Skip to contentSkip to conversation

Question on Netlink IPv6 routing table lookup

DISCUSSION Fernando Gont 2 participants 4 messages Sep 23, 2013 – Sep 27, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Folks,

I'm performing IPv6 routing table lookups with a netlink socket, and it seems that specifying the Source Address with the RTA_SRC element does not have any effect on the result of the look-up.

In my network setup, I have two interfaces, as follows:

NET1 (fc00:1::/64) <------> MY_NODE <------> NET2 (fc00:2::/64)

For simplicity sake, let's say that my nodes' address on NET1 is fc00:1::1, and my node's address on NET2 is fc00:2::1. And my node has two default routes (one in NET1, and another in NET2).

I'd expect that if I set RTA_SRC to fc00:1::1, the default route on NET1 is selected, but if I set RTA_SRC to fc00:2::1, it is the default route on NET2 that is selected.

However, the result of the routing tale look-up is always the same, regardless of RTA_SRC.

I looked at /proc/net/ipv6_route, and it seems that, for all routes, the "source network" is always set to :: (all zeroes), thus probably explaining the above behavior.

Is there any way to influence the routing-table look-up based on the IPv6 source address?

If that's not (currently) possible, should I expect RTA_SRC to work as described above at some point in the future?

Signature · 3 lines
Fernando Gont
e-mail: [email protected] || [email protected]
PGP Fingerprint: 7809 84F5 322E 45C7 F1C9 3945 96EE A9EF D076 FFF1
#1 lore raw
Quoted 2 lines · Fernando Gont

If that's not (currently) possible, should I expect RTA_SRC to work as described above at some point in the future?

The RTA_SRC attriute matches on sutrees in the ipv6 routing table:

ip -6 r a default via fe80::1 dev eth0 from 2000::/64 ip -6 r a default via fe80::2 dev eth0 from 2000:1:/64

ip -6 r g :: from 2000::
ip -6 r g :: from 2000:1::

...should return different routes. The from parameter is the RTA_SRC attribute.

Greetings,

Hannes

#2 lore raw

Hi, Hannes,

Quoted 6 lines · Hannes Frederic Sowa
Quoted 2 lines · Fernando Gont

If that's not (currently) possible, should I expect RTA_SRC to work as described above at some point in the future?

The RTA_SRC attriute matches on sutrees in the ipv6 routing table:

Quoted 8 lines

ip -6 r a default via fe80::1 dev eth0 from 2000::/64 ip -6 r a default via fe80::2 dev eth0 from 2000:1:/64

ip -6 r g :: from 2000::
ip -6 r g :: from 2000:1::

...should return different routes. The from parameter is the RTA_SRC attribute.

Isn't the "from" the "source network" in /proc/net/ipv6_route? (as described in <http://www.tldp.org/HOWTO/Linux+IPv6-HOWTO/proc-net.html>)

I have a node with multiple Ethernet interfaces, each of which connected to a different network where IPv6 Router Advertisements are received... and the "source network" is set to all-zeros in all cases.

Thanks!

Best regards,

Signature · 3 lines
Fernando Gont
e-mail: [email protected] || [email protected]
PGP Fingerprint: 7809 84F5 322E 45C7 F1C9 3945 96EE A9EF D076 FFF1
#3 lore raw
Quoted 12 lines · Fernando Gont

Hi, Hannes,

Quoted 9 lines · Hannes Frederic Sowa
Quoted 2 lines · Fernando Gont

If that's not (currently) possible, should I expect RTA_SRC to work as described above at some point in the future?

The RTA_SRC attriute matches on sutrees in the ipv6 routing table:

ip -6 r a default via fe80::1 dev eth0 from 2000::/64 ip -6 r a default via fe80::2 dev eth0 from 2000:1:/64

Quoted 8 lines
Quoted 5 lines

ip -6 r g :: from 2000::
ip -6 r g :: from 2000:1::

...should return different routes. The from parameter is the RTA_SRC attribute.

Isn't the "from" the "source network" in /proc/net/ipv6_route? (as described in <http://www.tldp.org/HOWTO/Linux+IPv6-HOWTO/proc-net.html>)

Correct.

Quoted 3 lines

I have a node with multiple Ethernet interfaces, each of which connected to a different network where IPv6 Router Advertisements are received... and the "source network" is set to all-zeros in all cases.

As soon as you add a route with RTA_SRC you will see those two fields != 0. Subtrees don't get used by router advertisments. Only way to set these fields is by using the RTA_SRC from user-land.

Greetings,

Hannes