core: set the route table for the ipv6 link-local method

Previously the prefix route fe80::/64 was always added to the main
table.

Fixes-test: @ipv6_route_set_route_with_tables
This commit is contained in:
Beniamino Galvani 2021-10-18 17:45:52 +02:00
parent e732cb9a70
commit 23d61367b3
5 changed files with 27 additions and 9 deletions

View file

@ -10563,13 +10563,15 @@ _dev_ipll6_start(NMDevice *self)
const char * stable_id; const char * stable_id;
stable_id = _prop_get_connection_stable_id(self, connection, &stable_type); stable_id = _prop_get_connection_stable_id(self, connection, &stable_type);
priv->ipll_data_6.v6.ipv6ll = nm_l3_ipv6ll_new_stable_privacy(priv->l3cfg, priv->ipll_data_6.v6.ipv6ll =
assume, nm_l3_ipv6ll_new_stable_privacy(priv->l3cfg,
stable_type, assume,
ifname, stable_type,
stable_id, ifname,
_dev_ipll6_state_change_cb, stable_id,
self); nm_device_get_route_table(self, AF_INET6),
_dev_ipll6_state_change_cb,
self);
} else { } else {
NMUtilsIPv6IfaceId iid; NMUtilsIPv6IfaceId iid;
@ -10579,7 +10581,12 @@ _dev_ipll6_start(NMDevice *self)
} }
priv->ipll_data_6.v6.ipv6ll = priv->ipll_data_6.v6.ipv6ll =
nm_l3_ipv6ll_new_token(priv->l3cfg, assume, &iid, _dev_ipll6_state_change_cb, self); nm_l3_ipv6ll_new_token(priv->l3cfg,
assume,
&iid,
nm_device_get_route_table(self, AF_INET6),
_dev_ipll6_state_change_cb,
self);
} }
llstate = nm_l3_ipv6ll_get_state(priv->ipll_data_6.v6.ipv6ll, &lladdr); llstate = nm_l3_ipv6ll_get_state(priv->ipll_data_6.v6.ipv6ll, &lladdr);

View file

@ -2489,6 +2489,7 @@ nm_l3_config_data_add_dependent_device_routes(NML3ConfigData * self,
.network = *a6, .network = *a6,
.plen = plen, .plen = plen,
}; };
nm_platform_ip_route_normalize(addr_family, &rx.rx); nm_platform_ip_route_normalize(addr_family, &rx.rx);
nm_l3_config_data_add_route(self, addr_family, NULL, &rx.rx); nm_l3_config_data_add_route(self, addr_family, NULL, &rx.rx);
} }

View file

@ -51,6 +51,8 @@ struct _NML3IPv6LL {
* with the configuration. */ * with the configuration. */
const NML3ConfigData *l3cd; const NML3ConfigData *l3cd;
guint32 route_table;
/* "assume" means that we first look whether there is any suitable /* "assume" means that we first look whether there is any suitable
* IPv6 address on the device, and in that case, try to use that * IPv6 address on the device, and in that case, try to use that
* instead of generating a new one. Otherwise, we always try to * instead of generating a new one. Otherwise, we always try to
@ -410,7 +412,7 @@ _lladdr_handle_changed(NML3IPv6LL *self)
l3cd, l3cd,
NM_L3CFG_CONFIG_PRIORITY_IPV6LL, NM_L3CFG_CONFIG_PRIORITY_IPV6LL,
0, 0,
0, self->route_table,
NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP4, NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP4,
NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP6, NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP6,
0, 0,
@ -624,6 +626,7 @@ _nm_l3_ipv6ll_new(NML3Cfg * l3cfg,
const char * ifname, const char * ifname,
const char * network_id, const char * network_id,
const NMUtilsIPv6IfaceId *token_iid, const NMUtilsIPv6IfaceId *token_iid,
guint32 route_table,
NML3IPv6LLNotifyFcn notify_fcn, NML3IPv6LLNotifyFcn notify_fcn,
gpointer user_data) gpointer user_data)
{ {
@ -647,6 +650,7 @@ _nm_l3_ipv6ll_new(NML3Cfg * l3cfg,
.cur_lladdr_obj = NULL, .cur_lladdr_obj = NULL,
.cur_lladdr = IN6ADDR_ANY_INIT, .cur_lladdr = IN6ADDR_ANY_INIT,
.assume = assume, .assume = assume,
.route_table = route_table,
.addrgen = .addrgen =
{ {
.stable_type = stable_type, .stable_type = stable_type,

View file

@ -48,6 +48,7 @@ NML3IPv6LL *_nm_l3_ipv6ll_new(NML3Cfg * l3cfg,
const char * ifname, const char * ifname,
const char * network_id, const char * network_id,
const NMUtilsIPv6IfaceId *token_iid, const NMUtilsIPv6IfaceId *token_iid,
guint32 route_table,
NML3IPv6LLNotifyFcn notify_fcn, NML3IPv6LLNotifyFcn notify_fcn,
gpointer user_data); gpointer user_data);
@ -57,6 +58,7 @@ nm_l3_ipv6ll_new_stable_privacy(NML3Cfg * l3cfg,
NMUtilsStableType stable_type, NMUtilsStableType stable_type,
const char * ifname, const char * ifname,
const char * network_id, const char * network_id,
guint32 route_table,
NML3IPv6LLNotifyFcn notify_fcn, NML3IPv6LLNotifyFcn notify_fcn,
gpointer user_data) gpointer user_data)
{ {
@ -67,6 +69,7 @@ nm_l3_ipv6ll_new_stable_privacy(NML3Cfg * l3cfg,
ifname, ifname,
network_id, network_id,
NULL, NULL,
route_table,
notify_fcn, notify_fcn,
user_data); user_data);
} }
@ -75,6 +78,7 @@ static inline NML3IPv6LL *
nm_l3_ipv6ll_new_token(NML3Cfg * l3cfg, nm_l3_ipv6ll_new_token(NML3Cfg * l3cfg,
gboolean assume, gboolean assume,
const NMUtilsIPv6IfaceId *token_iid, const NMUtilsIPv6IfaceId *token_iid,
guint32 route_table,
NML3IPv6LLNotifyFcn notify_fcn, NML3IPv6LLNotifyFcn notify_fcn,
gpointer user_data) gpointer user_data)
{ {
@ -84,6 +88,7 @@ nm_l3_ipv6ll_new_token(NML3Cfg * l3cfg,
NULL, NULL,
NULL, NULL,
token_iid, token_iid,
route_table,
notify_fcn, notify_fcn,
user_data); user_data);
} }

View file

@ -1025,6 +1025,7 @@ test_l3_ipv6ll(gconstpointer test_data)
NM_UTILS_STABLE_TYPE_UUID, NM_UTILS_STABLE_TYPE_UUID,
tdata->f->ifname0, tdata->f->ifname0,
"b6a5b934-c649-43dc-a524-3dfdb74f9419", "b6a5b934-c649-43dc-a524-3dfdb74f9419",
0,
_test_l3_ipv6ll_callback_changed, _test_l3_ipv6ll_callback_changed,
tdata); tdata);