dhcpcd-discuss

Re: AW: WG: linux routing table for default route

Roy Marples

Fri Dec 13 12:58:45 2019

On 13/12/2019 07:27, andrey@xxxxxxxxxxxx wrote:
Hi Ron,

> without thinking how to integrate it with dhcpcd. I mean, start by writing the commands > assuming it has all the information it needs. You might use pseudo values like

 > ip route I_WILL_SOMEHOW_FIND_THE_IP_LATER
that’s not the point, it’s obvious:

/usr/bin/ip -6 route add default via GATEWAY dev WAN table main mtu MTU expires EXPIRATION

But, ipv6-route added this way needs all those parameters. For example: routes communicated by ROUTERADVERTISMENT message (IPv6 NDP) have explicitely defiled lifetime, typically 1800 sec. How to get the lifetime from RA? Are routes communicated by DHCPv6 response also expiring? How to bring those two sources of routing information together? DHCPCD is already managing it in code properly (hopefully), why to reconstruct this logic in the shell script?

dhcpcd -dB6T

xennet0: Router Advertisement from fe80::1
xennet0: executing `/libexec/dhcpcd-run-hooks' TEST
interface=xennet0
pid=2563
protocol=ra
reason=TEST
ifcarrier=up
ifflags=4294936643
ifmtu=1500
ifwireless=0
nd1_acquired=1179202
nd1_dnssl1_lifetime=900
nd1_dnssl1_search=marples.name
nd1_from=fe80::1
nd1_mtu=1480
nd1_now=1179202
nd1_prefix_information1_flags=LA
nd1_prefix_information1_length=64
nd1_prefix_information1_pltime=0
nd1_prefix_information1_prefix=fd73:7808:1015::
nd1_prefix_information1_vltime=0
nd1_prefix_information2_flags=L
nd1_prefix_information2_length=64
nd1_prefix_information2_pltime=1200
nd1_prefix_information2_prefix=2001:470:690c:1::
nd1_prefix_information2_vltime=1800
nd1_prefix_information3_flags=L
nd1_prefix_information3_length=64
nd1_prefix_information3_pltime=1200
nd1_prefix_information3_prefix=2001:470:690c:2::
nd1_prefix_information3_vltime=1800
nd1_prefix_information4_flags=L
nd1_prefix_information4_length=64
nd1_prefix_information4_pltime=1200
nd1_prefix_information4_prefix=2001:470:690c:3::
nd1_prefix_information4_vltime=1800
nd1_rdnss1_lifetime=900
nd1_rdnss1_servers='fe80::1%xennet0'
nd1_source_address=f20ba43f5ef7

Basically the whole RA is converted to env vars.

Indeed, I’m software developer so I know how to create a script. I’d surely manage it finaly but it would take plety of iterations to fugure out all undocumented details (or to find it in DHCPCD source code).

The man pages should be document enough.
For detailed env vars you get, look at dhcpcd-definitions.conf.
It's pretty easy to convert any messages once you look at this file :)

Roy

References:
Re: linux routing table for default routeRoy Marples
WG: linux routing table for default routeandrey
Re: WG: linux routing table for default routeRon Varburg
AW: WG: linux routing table for default routeandrey
Archive administrator: postmaster@marples.name