[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200925231159.945-1-qingtao.cao.au@gmail.com>
Date: Sat, 26 Sep 2020 09:11:58 +1000
From: Qingtao Cao <qingtao.cao.au@...il.com>
To: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
kuznet@....inr.ac.ru, yoshfuji@...ux-ipv6.org, corbet@....net
Subject: Support default route metric per interface
On a multihomed device there may be multiple default routes with different
priorities. For example by default the default route via the cable/WAN
interface has a higher priority (lower metric value) than the one via the
expensive cellular modem. However, when the userspace detects a network
connection issue on the cable/WAN interface, the userspace may change
metrics to prefer the celluar modem's default route until the one via the
cable/WAN is restored
When the kernel automatically creates routes such as IPv4 subnet routes
with newly bound addresses or IPv6 prefix routes with reception of RAs, the
kernel is expected to follow the same preference as decided by the userspace
To this end, per-interface's def_rt_metric sysfs attribute files are added,
so that:
. when userspace changes interfaces' priority, their metrics values could
also be saved into their def_rt_metric sysfs files
. whenever the kernel creates IPv4 or IPv6 routes, the value in def_rt_metric
for the relevant interface is read and applied when userspace has not
explicitly specified a metric value (for example, via the IFA_RT_PRIORITY
attribute in netlink messages)
If an interface's def_rt_metric is 0 then the kernel default metric value
will be fallen back on.
Powered by blists - more mailing lists