Date: Sat, 09 Aug 2014 01:52:29 -0400 From: Fernando Gont <fernando@gont.com.ar> To: Hiroki Sato <hrs@FreeBSD.org> Cc: freebsd-net@freebsd.org Subject: Re: Routing IPv6 packets towards oneself with routing sockets? Message-ID: <53E5B71D.2030500@gont.com.ar> In-Reply-To: <20140808.053757.1725805140861121363.hrs@allbsd.org> References: <53E2B586.3080700@gont.com.ar> <20140807.192403.845244220459089560.hrs@allbsd.org> <53E35DA7.4020800@gont.com.ar> <20140808.053757.1725805140861121363.hrs@allbsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, Hiroki, On 08/07/2014 04:37 PM, Hiroki Sato wrote: > > fe> However, whenever I lookup an entry for fc00:1::1 with routing sockets, > fe> the only entry I obtain is fc00:1::/64 (a network route) rather than > fe> fc00:1::1/128 (a host route). > > Does this mean you got RTA_DST with fc00:1::/64 when > "bsd-lookup-simple -v fc00:1::1"? If so, it is very strange. Nope, you're right. I get fc00:1::1... the only "problem" was that the outgoing interface was incorrect... but as you noted, that had to do with me not setting RTA_IFP. (FWIW, my guide for using routing sockets was Stevens' UNPv1... but IIRC he never mentioned that of setting RTA_IFP, but rather suggested that RTA_GATEWAY could return AF_INET or AF_LINK (in his discussion about IPv4, since there was no discussion about IPv6). > Although your code assumes RTA_GATEWAY eventually returns the > outgoing interface, it is not always true. RTA_IFP should be used if > you want to look up it instead of looking up gateways until AF_LINK > is obtained. Certainly RTA_GATEWAY returns AF_LINK and you can check > sdl_index in it, but the index number is not always the same as the > actual outgoing interface (one of the examples is a host route). Just curious: what's the meaning of the AF_LINK I was reading? > A revised source file is attached. Some nits are also fixed: 1) > SA_SIZE() on MacOSX is not aligned with sizeof(long) and 2) > IFACE_LENGTH should be IFNAMSIZ. Thanks so much! -- I'll incorporate these into the ipv6toolkit (that's the reason for which I was playing with this in the first place). Thanks again! Best regards, -- Fernando Gont e-mail: fernando@gont.com.ar || fgont@si6networks.com PGP Fingerprint: 7809 84F5 322E 45C7 F1C9 3945 96EE A9EF D076 FFF1
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53E5B71D.2030500>