diff options
author | Thomas Haller <thaller@redhat.com> | 2019-04-17 11:04:10 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-04-17 20:21:25 +0200 |
commit | 619bb6b9dccf6ca57448c6c7f317bea6cdc700cc (patch) | |
tree | c42b4c16da61e7198ee1673c9871286eec5641a3 | |
parent | 83732dd32c0f9b577c524b843ab7694706fb4418 (diff) | |
download | NetworkManager-th/platform-routing-rules-compare.tar.gz |
platform: compare routing rules according to kernel support for FRA_L3MDEVth/platform-routing-rules-compare
Also, in nm_platform_routing_rule_cmp() always compare the routing
table field, also if l3mdev is set. For kernel, we cannot set table and
l3mdev together, hence such rules don't really exist (or if we try to
configure it, it will be rejected by kernel). But as far as
nm_platform_routing_rule_cmp() is concerned, if the table is set,
always compare it.
-rw-r--r-- | src/platform/nm-platform.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index daadced6b9..852da05f4c 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -7459,9 +7459,12 @@ nm_platform_routing_rule_hash_update (const NMPlatformRoutingRule *obj, : FALSE)), obj->suppress_prefixlen_inverse, obj->suppress_ifgroup_inverse, - ( cmp_full - ? obj->l3mdev - : (guint8) !!obj->l3mdev), + ( _routing_rule_compare (cmp_type, + NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_L3MDEV) + ? ( cmp_full + ? (guint16) obj->l3mdev + : (guint16) !!obj->l3mdev) + : G_MAXUINT16), obj->action, obj->tos, obj->src_len, @@ -7536,13 +7539,15 @@ nm_platform_routing_rule_cmp (const NMPlatformRoutingRule *a, NM_CMP_FIELD (a, b, priority); NM_CMP_FIELD (a, b, tun_id); - if (cmp_full) - NM_CMP_FIELD (a, b, l3mdev); - else - NM_CMP_FIELD_BOOL (a, b, l3mdev); + if (_routing_rule_compare (cmp_type, + NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_L3MDEV)) { + if (cmp_full) + NM_CMP_FIELD (a, b, l3mdev); + else + NM_CMP_FIELD_BOOL (a, b, l3mdev); + } - if (cmp_full || !a->l3mdev) - NM_CMP_FIELD (a, b, table); + NM_CMP_FIELD (a, b, table); NM_CMP_DIRECT (a->flags & flags_mask, b->flags & flags_mask); |