mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 07:40:28 +01:00
platform: use route pref_src when deleting IP route
This commit is contained in:
parent
8e4c5b173f
commit
415e00d086
3 changed files with 20 additions and 8 deletions
|
|
@ -2419,7 +2419,6 @@ static struct nl_msg *
|
|||
_nl_msg_new_route (int nlmsg_type,
|
||||
int nlmsg_flags,
|
||||
const NMPObject *obj,
|
||||
gconstpointer pref_src,
|
||||
gconstpointer src,
|
||||
guint8 src_plen,
|
||||
guint32 window,
|
||||
|
|
@ -2472,8 +2471,13 @@ _nl_msg_new_route (int nlmsg_type,
|
|||
|
||||
NLA_PUT_U32 (msg, RTA_PRIORITY, obj->ip_route.metric);
|
||||
|
||||
if (pref_src)
|
||||
NLA_PUT (msg, RTA_PREFSRC, addr_len, pref_src);
|
||||
if (is_v4) {
|
||||
if (NMP_OBJECT_CAST_IP4_ROUTE (obj)->pref_src)
|
||||
NLA_PUT (msg, RTA_PREFSRC, addr_len, &obj->ip4_route.pref_src);
|
||||
} else {
|
||||
if (!IN6_IS_ADDR_UNSPECIFIED (&NMP_OBJECT_CAST_IP6_ROUTE (obj)->pref_src))
|
||||
NLA_PUT (msg, RTA_PREFSRC, addr_len, &obj->ip6_route.pref_src);
|
||||
}
|
||||
|
||||
if ( obj->ip_route.mss
|
||||
|| window || cwnd || initcwnd || initrwnd || mtu || lock) {
|
||||
|
|
@ -5704,7 +5708,6 @@ ip4_route_add (NMPlatform *platform, const NMPlatformIP4Route *route)
|
|||
nlmsg = _nl_msg_new_route (RTM_NEWROUTE,
|
||||
NLM_F_CREATE | NLM_F_REPLACE,
|
||||
&obj,
|
||||
route->pref_src ? &route->pref_src : NULL,
|
||||
NULL,
|
||||
0,
|
||||
route->window,
|
||||
|
|
@ -5731,7 +5734,6 @@ ip6_route_add (NMPlatform *platform, const NMPlatformIP6Route *route)
|
|||
nlmsg = _nl_msg_new_route (RTM_NEWROUTE,
|
||||
NLM_F_CREATE | NLM_F_REPLACE,
|
||||
&obj,
|
||||
!IN6_IS_ADDR_UNSPECIFIED (&route->pref_src) ? &route->pref_src : NULL,
|
||||
!IN6_IS_ADDR_UNSPECIFIED (&route->src) ? &route->src : NULL,
|
||||
route->src_plen,
|
||||
route->window,
|
||||
|
|
@ -5791,7 +5793,6 @@ ip_route_delete (NMPlatform *platform,
|
|||
0,
|
||||
obj,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
|
|
|||
|
|
@ -4755,6 +4755,7 @@ nm_platform_ip4_route_hash (const NMPlatformIP4Route *obj, NMPlatformIPRouteCmpT
|
|||
h = NM_HASH_COMBINE (h, obj->scope_inv);
|
||||
h = NM_HASH_COMBINE (h, obj->gateway);
|
||||
h = NM_HASH_COMBINE (h, obj->mss);
|
||||
h = NM_HASH_COMBINE (h, obj->pref_src);
|
||||
}
|
||||
break;
|
||||
case NM_PLATFORM_IP_ROUTE_CMP_TYPE_SEMANTICALLY:
|
||||
|
|
@ -4811,6 +4812,7 @@ nm_platform_ip4_route_cmp (const NMPlatformIP4Route *a, const NMPlatformIP4Route
|
|||
NM_CMP_FIELD (a, b, scope_inv);
|
||||
NM_CMP_FIELD (a, b, gateway);
|
||||
NM_CMP_FIELD (a, b, mss);
|
||||
NM_CMP_FIELD (a, b, pref_src);
|
||||
}
|
||||
break;
|
||||
case NM_PLATFORM_IP_ROUTE_CMP_TYPE_SEMANTICALLY:
|
||||
|
|
|
|||
|
|
@ -391,8 +391,10 @@ struct _NMPlatformIP4Route {
|
|||
/* RTA_GATEWAY. The gateway is part of the primary key for a route */
|
||||
in_addr_t gateway;
|
||||
|
||||
/* RTA_PREFSRC/rtnl_route_get_pref_src(). A value of zero means that
|
||||
* no pref-src is set. */
|
||||
/* RTA_PREFSRC (called "src" by iproute2).
|
||||
*
|
||||
* pref_src is part of the ID of an IPv4 route. When deleting a route,
|
||||
* pref_src must match, unless set to 0.0.0.0 to match any. */
|
||||
in_addr_t pref_src;
|
||||
|
||||
/* The bitwise inverse of the route scope rtm_scope. It is inverted so that the
|
||||
|
|
@ -416,7 +418,14 @@ struct _NMPlatformIP6Route {
|
|||
/* RTA_GATEWAY. The gateway is part of the primary key for a route */
|
||||
struct in6_addr gateway;
|
||||
|
||||
/* RTA_PREFSRC (called "src" by iproute2).
|
||||
*
|
||||
* pref_src is not part of the ID for an IPv6 route. You cannot add two
|
||||
* routes that only differ by pref_src.
|
||||
*
|
||||
* When deleting a route, pref_src is ignored by kernel. */
|
||||
struct in6_addr pref_src;
|
||||
|
||||
struct in6_addr src;
|
||||
guint8 src_plen;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue