mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-12 08:50:34 +01:00
platform: require RTA_PREF support in kernel
The preference for IPv6 routes was added in kernel v4.1, 22 June 2015. It is even in latest RHEL7 kernels. Drop trying to be compatible with such old kernels.
This commit is contained in:
parent
eb1c266280
commit
bcd2c99aab
7 changed files with 23 additions and 53 deletions
|
|
@ -10856,25 +10856,21 @@ ndisc_config_changed(NMNDisc *ndisc, const NMNDiscData *rdata, guint changed_int
|
|||
}
|
||||
|
||||
if (NM_FLAGS_ANY(changed, NM_NDISC_CONFIG_ROUTES | NM_NDISC_CONFIG_GATEWAYS)) {
|
||||
nm_ip6_config_reset_routes_ndisc(
|
||||
(NMIP6Config *) priv->ac_ip6_config.orig,
|
||||
rdata->gateways,
|
||||
rdata->gateways_n,
|
||||
rdata->routes,
|
||||
rdata->routes_n,
|
||||
nm_device_get_route_table(self, AF_INET6),
|
||||
nm_device_get_route_metric(self, AF_INET6),
|
||||
nm_platform_kernel_support_get(NM_PLATFORM_KERNEL_SUPPORT_TYPE_RTA_PREF));
|
||||
nm_ip6_config_reset_routes_ndisc((NMIP6Config *) priv->ac_ip6_config.orig,
|
||||
rdata->gateways,
|
||||
rdata->gateways_n,
|
||||
rdata->routes,
|
||||
rdata->routes_n,
|
||||
nm_device_get_route_table(self, AF_INET6),
|
||||
nm_device_get_route_metric(self, AF_INET6));
|
||||
if (priv->ac_ip6_config.current) {
|
||||
nm_ip6_config_reset_routes_ndisc(
|
||||
(NMIP6Config *) priv->ac_ip6_config.current,
|
||||
rdata->gateways,
|
||||
rdata->gateways_n,
|
||||
rdata->routes,
|
||||
rdata->routes_n,
|
||||
nm_device_get_route_table(self, AF_INET6),
|
||||
nm_device_get_route_metric(self, AF_INET6),
|
||||
nm_platform_kernel_support_get(NM_PLATFORM_KERNEL_SUPPORT_TYPE_RTA_PREF));
|
||||
nm_ip6_config_reset_routes_ndisc((NMIP6Config *) priv->ac_ip6_config.current,
|
||||
rdata->gateways,
|
||||
rdata->gateways_n,
|
||||
rdata->routes,
|
||||
rdata->routes_n,
|
||||
nm_device_get_route_table(self, AF_INET6),
|
||||
nm_device_get_route_metric(self, AF_INET6));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -201,15 +201,13 @@ ndisc_config_changed(NMNDisc * ndisc,
|
|||
}
|
||||
|
||||
if (NM_FLAGS_ANY(changed, NM_NDISC_CONFIG_ROUTES | NM_NDISC_CONFIG_GATEWAYS)) {
|
||||
nm_ip6_config_reset_routes_ndisc(
|
||||
ndisc_config,
|
||||
rdata->gateways,
|
||||
rdata->gateways_n,
|
||||
rdata->routes,
|
||||
rdata->routes_n,
|
||||
RT_TABLE_MAIN,
|
||||
global_opt.priority_v6,
|
||||
nm_platform_kernel_support_get(NM_PLATFORM_KERNEL_SUPPORT_TYPE_RTA_PREF));
|
||||
nm_ip6_config_reset_routes_ndisc(ndisc_config,
|
||||
rdata->gateways,
|
||||
rdata->gateways_n,
|
||||
rdata->routes,
|
||||
rdata->routes_n,
|
||||
RT_TABLE_MAIN,
|
||||
global_opt.priority_v6);
|
||||
}
|
||||
|
||||
if (changed & NM_NDISC_CONFIG_DHCP_LEVEL) {
|
||||
|
|
|
|||
|
|
@ -1678,8 +1678,7 @@ nm_ip6_config_reset_routes_ndisc(NMIP6Config * self,
|
|||
const NMNDiscRoute * routes,
|
||||
guint routes_n,
|
||||
guint32 route_table,
|
||||
guint32 route_metric,
|
||||
gboolean kernel_support_rta_pref)
|
||||
guint32 route_metric)
|
||||
{
|
||||
NMIP6ConfigPrivate *priv;
|
||||
guint i;
|
||||
|
|
@ -1735,7 +1734,6 @@ nm_ip6_config_reset_routes_ndisc(NMIP6Config * self,
|
|||
.table_coerced = nm_platform_route_table_coerce(route_table),
|
||||
.metric = route_metric,
|
||||
};
|
||||
const NMIcmpv6RouterPref first_pref = gateways[0].preference;
|
||||
|
||||
for (i = 0; i < gateways_n; i++) {
|
||||
r.gateway = gateways[i].address;
|
||||
|
|
@ -1753,13 +1751,6 @@ nm_ip6_config_reset_routes_ndisc(NMIP6Config * self,
|
|||
changed = TRUE;
|
||||
new_best_default_route =
|
||||
_nm_ip_config_best_default_route_find_better(new_best_default_route, obj_new);
|
||||
|
||||
if (first_pref != gateways[i].preference && !kernel_support_rta_pref) {
|
||||
/* We are unable to configure a router preference. Hence, we skip all gateways
|
||||
* with a different preference from the first gateway. Note, that the gateways
|
||||
* are sorted in order of highest to lowest preference. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -198,8 +198,7 @@ void nm_ip6_config_reset_routes_ndisc(NMIP6Config * self,
|
|||
const struct _NMNDiscRoute * routes,
|
||||
guint routes_n,
|
||||
guint32 route_table,
|
||||
guint32 route_metric,
|
||||
gboolean kernel_support_rta_pref);
|
||||
guint32 route_metric);
|
||||
|
||||
void nm_ip6_config_update_routes_metric(NMIP6Config *self, gint64 metric);
|
||||
|
||||
|
|
|
|||
|
|
@ -3583,13 +3583,6 @@ rta_multipath_done:;
|
|||
obj->ip_route.lock_mtu = NM_FLAGS_HAS(lock, 1 << RTAX_MTU);
|
||||
|
||||
if (!is_v4) {
|
||||
if (!_nm_platform_kernel_support_detected(NM_PLATFORM_KERNEL_SUPPORT_TYPE_RTA_PREF)) {
|
||||
/* Detect support for RTA_PREF by inspecting the netlink message.
|
||||
* RTA_PREF was added in kernel 4.1, dated 21 June, 2015. */
|
||||
_nm_platform_kernel_support_init(NM_PLATFORM_KERNEL_SUPPORT_TYPE_RTA_PREF,
|
||||
tb[RTA_PREF] ? 1 : -1);
|
||||
}
|
||||
|
||||
if (tb[RTA_PREF])
|
||||
obj->ip6_route.rt_pref = nla_get_u8(tb[RTA_PREF]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -300,12 +300,6 @@ static const struct {
|
|||
const char *name;
|
||||
const char *desc;
|
||||
} _nm_platform_kernel_support_info[_NM_PLATFORM_KERNEL_SUPPORT_NUM] = {
|
||||
[NM_PLATFORM_KERNEL_SUPPORT_TYPE_RTA_PREF] =
|
||||
{
|
||||
.compile_time_default = (RTA_MAX >= 20 /* RTA_PREF */),
|
||||
.name = "RTA_PREF",
|
||||
.desc = "ability to set router preference for IPv6 routes",
|
||||
},
|
||||
[NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_L3MDEV] =
|
||||
{
|
||||
.compile_time_default = (FRA_MAX >= 19 /* FRA_L3MDEV */),
|
||||
|
|
|
|||
|
|
@ -1015,7 +1015,6 @@ typedef void (*NMPlatformAsyncCallback)(GError *error, gpointer user_data);
|
|||
/*****************************************************************************/
|
||||
|
||||
typedef enum {
|
||||
NM_PLATFORM_KERNEL_SUPPORT_TYPE_RTA_PREF,
|
||||
NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_L3MDEV,
|
||||
NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_UID_RANGE,
|
||||
NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_PROTOCOL,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue