Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 06 Aug 2014 19:08:54 -0400
From:      Fernando Gont <fernando@gont.com.ar>
To:        FreeBSD Net <freebsd-net@freebsd.org>
Subject:   Routing IPv6 packets towards oneself with routing sockets?
Message-ID:  <53E2B586.3080700@gont.com.ar>

next in thread | raw e-mail | index | archive | help
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@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?53E2B586.3080700>