(usagi-users 03692) Re: Router Alert Query
Remi Denis-Courmont <[email protected]>
| Newsgroups | gmane.linux.ipv6.usagi.users |
|---|---|
| Message-ID | <[email protected]> |
Selon Gayatri Bulla <[email protected]>: > I have a query related to Router Alert Option. > In ip6_ra_control() function in ipv6_sockglue.c file, you are checking > this: > > if (sk->type != SOCK_RAW || sk->num != IPPROTO_RAW) > return -EINVAL; > > I dint get the importance of sk->num != IPPROTO_RAW check..... > Why are you checking the local port to be IPPROTO_RAW, what i feel is it > should parse and handle all raw packets and not just IPPROTO_RAW packets. It's not the port number, it's the socket protocol. If the protocol is not raw, the application expects the layer 4 header (and upper layer payloads), so there is no way it could receive a router alert option (which lies between the IPv6 header and the actual layer 4 header) within the received data... If you want to see Router Alert on non-IPPROTO_RAW sockets, I guess the correct way consists of enabling the HOPOPTS socket option and use recvmsg(), but then, you will receive all packets, not just the ones with Router Alert. -- Remi Denis-Courmont http://www.simphalempin.com/home/