Santosh Kumar
|
Re: Receiving RSVP Packets and IP Header problem
|
Santosh Kumar
11/01/2008 9:21 AM
post15826
|
Re: Receiving RSVP Packets and IP Header problem
Hi Sean,
Thanks for the information. I did some digging too and did find this....for anyone who's new to BSD flavored stacks.
raw socket with IP_HDRINCL uses different network byteorder for some
of the IP header fields (ip_off and ip_len). i think the behavior
is confusing, and the culprit is 4.[34]BSD. (4.[34]BSD should have
cleaned it up before supplying this API to users)
- openbsd:
rip_input: host byteorder, ip_len is payload length
rip_output: network byteorder, ip_len is for the whole packet
- netbsd:
rip_input: host byteorder, ip_len is payload length
rip_output: host byteorder, ip_len is for the whole packet
(same as 4.4BSD, but internally we use network byteorder all
the way throughout the IPv4 code)
- freebsd:
rip_input: host byteorder, ip_len is payload length
rip_output: host byteorder, ip_len is for the whole packet
(same as 4.4BSD)
i think both case should be network byteorder, and ip_len field
should reflect the length of the whole packet instead of the payload
length.
-Santosh
> On Sat, Nov 01, 2008 at 08:05:11AM -0400, Santosh Kumar wrote:
> > Hi,
> >
> > I am looking at a strange problem while receiving RSVP packets. In our
> system, we send and receive RSVP packets using RAW sockets. The problem we are
> seeing is this:
> >
> > Packets are sent properly from the source node and the packets reach the
> destination. Correctly. We verified that the packet received in our example
> had totlen field on IP header as 264. However, when we receive the packets
> through recvfrom interface along with the IP header, the totlen field is now
> 244 instead of 264. Rest of the header looks good.
> >
> > The only layer between the point where tcp dump sniffs packet and the
> application is the iopkt layer. Can someone shed some light on what might be
> happening here?
> >
> > Thanks,
> > Santosh
> >
>
> See this section of code in rip_input().
>
> -seanb
>
>
>
>
> /*
> * XXX Compatibility: programs using raw IP expect ip_len
> * XXX to have the header length subtracted, and in host order.
> * XXX ip_off is also expected to be host order.
> */
> ip->ip_len = ntohs(ip->ip_len) - (ip->ip_hl << 2);
> NTOHS(ip->ip_off);
>
>
|
|
|