Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problems with raw socket application on router !!!!

2 views
Skip to first unread message

Uma

unread,
Sep 18, 2001, 9:25:42 AM9/18/01
to
Hello All,

I have my application running on linux (Red Hat 7.0) router C
. In my application , i have created a raw socket
which blocks to receive datagrams belonging to a
particular protocol id (my own protocol id -- 135).
I am sending a datagram belonging to protocol id
135 using raw socket from Application on Host A to
application running on Host B via the router C. The
datagram goes through my router and reaches the destination C , but my
raw socket is not given the datagram. I have tried setting the
router alert option also. The router application only
gets the datagram when the destination address of the
datagram is the router and not some other third host.
If anybody has tried this out before , can they give
me some hints. Please mail me if any more information
is needed.

Thanks,
Uma

Chris Friesen

unread,
Sep 18, 2001, 11:38:39 PM9/18/01
to
Uma wrote:

> i have created a raw socket
> which blocks to receive datagrams belonging to a
> particular protocol id (my own protocol id -- 135).
> I am sending a datagram belonging to protocol id
> 135 using raw socket from Application on Host A to
> application running on Host B via the router C. The
> datagram goes through my router and reaches the destination C , but my
> raw socket is not given the datagram. I have tried setting the
> router alert option also. The router application only
> gets the datagram when the destination address of the
> datagram is the router and not some other third host.

First of all, do you see the packets when using tcpdump? If so, then it will be
possible to get them.

Next, what options are you using on your socket? I assume that you're using the
PF_INET socket, with the SOCK_RAW type and a protocol of 135?

Those are my first suggestions. Check those and see if they're correct.

Chris

Uma

unread,
Sep 20, 2001, 6:41:25 AM9/20/01
to
Thanks for the reply.

Yes i have created the socket using socket(PF_INET, SOCK_RAW, 135);
Yes , i could see tcpdump running on the router, receiving my packet ,
decrementing the ttl and sending it out.

I have a few doubts,

1) do i have to set IP_HDRINCL option...i.e. do i have to build my own
ip header in this case.
2) do i have to change some setup in router for e.g are my firewall
settings wrong. ?
I have configured the machine as router by setting the value of
/proc/sys/net/ipv4/ip_forward to 1. That's the only thing i have done.
do i have to do anything else ?

regards,
uma


Chris Friesen <chris_...@sympatico.ca> wrote in message news:<3BA8133F...@sympatico.ca>...


> Uma wrote:
>
> > i have created a raw socket
> > which blocks to receive datagrams belonging to a
> > particular protocol id (my own protocol id -- 135).
> > I am sending a datagram belonging to protocol id
> > 135 using raw socket from Application on Host A to
> > application running on Host B via the router C. The

> > datagram goes through my router C and reaches the destination B , but my

Chris Friesen

unread,
Sep 20, 2001, 9:42:45 PM9/20/01
to
Uma wrote:
>
> Thanks for the reply.
>
> Yes i have created the socket using socket(PF_INET, SOCK_RAW, 135);
> Yes , i could see tcpdump running on the router, receiving my packet ,
> decrementing the ttl and sending it out.
>
> I have a few doubts,
>
> 1) do i have to set IP_HDRINCL option...i.e. do i have to build my own
> ip header in this case.
> 2) do i have to change some setup in router for e.g are my firewall
> settings wrong. ?
> I have configured the machine as router by setting the value of
> /proc/sys/net/ipv4/ip_forward to 1. That's the only thing i have done.
> do i have to do anything else ?


Okay, I must be misunderstanding something here. Do you have two machines or
three machines?

If it's three machines (hosts A and B, router C) then can you ping B from A?
Can you telnet from A to B? If so, then it should be transparent to your
application. The router doesn't know that it's a raw socket, so that should
make no difference. All the router sees is an incoming packet with a certain
source and a certain destination. Based on that information it handles the
packet.

When sending the packet from A to B, you should put B's IP address as the
destination. If your routes are configured properly, it will know that it has
to send the packet to the MAC address of the router.

Chris

0 new messages