Routing IPv6 packets towards oneself with routing sockets?
Fernando Gont
fernando at gont.com.ar
Wed Aug 6 23:09:18 UTC 2014
Folks,
I've found a "tricky" scenario when consulting the IPv6 routing table
with routing sockets.
Short version of the question:
I'm currently consulting the IPv6 routing table with raw sockets.
My own host is assigned the address fc00:1::1, and it is directly
connected to fc00:1::/64 with em0. The corresponding entries from its
routing table are:
fc00:1::/64 link#1 U em0
fc00:1::1 link#1 UHS lo0
Essentially, packets sent to fc00:1::1 don't go through em0 but rather
go through the loopback interface (if you ping6 fc00:1::1, you'll see
the packets on lo0 rather than em0).
However, whenever I lookup an entry for fc00:1::1 with routing sockets,
the only entry I obtain is fc00:1::/64 (a network route) rather than
fc00:1::1/128 (a host route). As a result, I kind of have to figure out
that since fc00:1::1 is my own address, I must override whatever I
learned via routing sockets, and just send my packets to loopback.
I would assume that I must be doing something wrong, since I would
expect the host-specific route (i.e. longest-matching route) to be route
learned via routing sockets. And that I shouldn't be implementing this
"is the dst address my own address?" hack.
Any thoughts?
P.S.: I can provide a code snippet if that'd be of any help.
Thanks!
Best regards,
--
Fernando Gont
e-mail: fernando at gont.com.ar || fgont at si6networks.com
PGP Fingerprint: 7809 84F5 322E 45C7 F1C9 3945 96EE A9EF D076 FFF1
More information about the freebsd-net
mailing list