summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-04-09 12:55:32 +0200
committerThomas Haller <thaller@redhat.com>2019-04-09 20:43:09 +0200
commite8a0a47c668d75e74d3dc1e69b467e4fa86e6927 (patch)
tree215235fd74a5877a989143ea3bfaf8afc92d5a08
parent3a2e002a2ebed799d4caa3b1b2d913d3684c47e5 (diff)
downloadNetworkManager-th/ipv6-route-onlink.tar.gz
libnm,core: enable "onlink" flags also for IPv6 routesth/ipv6-route-onlink
Previously, onlink (RTNH_F_ONLINK) did not work for IPv6. In the meantime, this works in kernel ([1], [2]). Enable it also in NetworkManager. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc1e64e1092f62290d59151d16f9de0210e303c8 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=68e2ffdeb5dbf54bc3a0684aa4e73c6db8675eed
-rw-r--r--libnm-core/nm-setting-ip-config.c2
-rw-r--r--src/nm-ip4-config.c11
-rw-r--r--src/platform/nm-linux-platform.c4
-rw-r--r--src/platform/nm-platform.h2
4 files changed, 7 insertions, 12 deletions
diff --git a/libnm-core/nm-setting-ip-config.c b/libnm-core/nm-setting-ip-config.c
index 53d55c57cd..ea099b9a8d 100644
--- a/libnm-core/nm-setting-ip-config.c
+++ b/libnm-core/nm-setting-ip-config.c
@@ -1218,7 +1218,7 @@ static const NMVariantAttributeSpec * const ip_route_attribute_spec[] = {
ATTR_SPEC_PTR (NM_IP_ROUTE_ATTRIBUTE_SRC, G_VARIANT_TYPE_STRING, TRUE, TRUE, 'a'),
ATTR_SPEC_PTR (NM_IP_ROUTE_ATTRIBUTE_FROM, G_VARIANT_TYPE_STRING, FALSE, TRUE, 'p'),
ATTR_SPEC_PTR (NM_IP_ROUTE_ATTRIBUTE_TOS, G_VARIANT_TYPE_BYTE, TRUE, FALSE, 0 ),
- ATTR_SPEC_PTR (NM_IP_ROUTE_ATTRIBUTE_ONLINK, G_VARIANT_TYPE_BOOLEAN, TRUE, FALSE, 0 ),
+ ATTR_SPEC_PTR (NM_IP_ROUTE_ATTRIBUTE_ONLINK, G_VARIANT_TYPE_BOOLEAN, TRUE, TRUE, 0 ),
ATTR_SPEC_PTR (NM_IP_ROUTE_ATTRIBUTE_WINDOW, G_VARIANT_TYPE_UINT32, TRUE, TRUE, 0 ),
ATTR_SPEC_PTR (NM_IP_ROUTE_ATTRIBUTE_CWND, G_VARIANT_TYPE_UINT32, TRUE, TRUE, 0 ),
ATTR_SPEC_PTR (NM_IP_ROUTE_ATTRIBUTE_INITCWND, G_VARIANT_TYPE_UINT32, TRUE, TRUE, 0 ),
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index 2f9db03b66..4821ec6b17 100644
--- a/src/nm-ip4-config.c
+++ b/src/nm-ip4-config.c
@@ -859,15 +859,12 @@ _nm_ip_config_merge_route_attributes (int addr_family,
GET_ATTR (NM_IP_ROUTE_ATTRIBUTE_TABLE, table, UINT32, uint32, 0);
r->table_coerced = nm_platform_route_table_coerce (table ?: (route_table ?: RT_TABLE_MAIN));
- if (addr_family == AF_INET) {
+ if (addr_family == AF_INET)
GET_ATTR (NM_IP_ROUTE_ATTRIBUTE_TOS, r4->tos, BYTE, byte, 0);
- GET_ATTR (NM_IP_ROUTE_ATTRIBUTE_ONLINK, onlink, BOOLEAN, boolean, FALSE);
- } else
- onlink = FALSE;
- r->r_rtm_flags = 0;
- if (onlink)
- r->r_rtm_flags = RTNH_F_ONLINK;
+ GET_ATTR (NM_IP_ROUTE_ATTRIBUTE_ONLINK, onlink, BOOLEAN, boolean, FALSE);
+
+ r->r_rtm_flags = ((onlink) ? (unsigned) RTNH_F_ONLINK : 0u);
GET_ATTR (NM_IP_ROUTE_ATTRIBUTE_WINDOW, r->window, UINT32, uint32, 0);
GET_ATTR (NM_IP_ROUTE_ATTRIBUTE_CWND, r->cwnd, UINT32, uint32, 0);
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index e2f138e8aa..4abb45960f 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -4016,9 +4016,7 @@ _nl_msg_new_route (int nlmsg_type,
? nm_platform_route_scope_inv (obj->ip4_route.scope_inv)
: RT_SCOPE_NOWHERE,
.rtm_type = RTN_UNICAST,
- .rtm_flags = obj->ip_route.r_rtm_flags & (is_v4
- ? (unsigned) (RTNH_F_ONLINK)
- : (unsigned) 0),
+ .rtm_flags = obj->ip_route.r_rtm_flags & ((unsigned) (RTNH_F_ONLINK)),
.rtm_dst_len = obj->ip_route.plen,
.rtm_src_len = is_v4
? 0
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index 2e30f8b9ce..42f6c96136 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -429,7 +429,7 @@ typedef union {
* Such a route is not alive, according to nmp_object_is_alive().
*
* NOTE: currently we ignore all flags except RTM_F_CLONED
- * and RTNH_F_ONLINK for IPv4.
+ * and RTNH_F_ONLINK.
* We also may not properly consider the flags as part of the ID
* in route-cmp. */ \
unsigned r_rtm_flags; \