mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 11:08:03 +02:00
platform: cleanup handling metric paramters for non-exclusive routes
This commit is contained in:
parent
93fd03277f
commit
7141a3b87a
3 changed files with 33 additions and 32 deletions
|
|
@ -2430,11 +2430,7 @@ ip_route_get_lock_flag (const NMPlatformIPRoute *route)
|
|||
static struct nl_msg *
|
||||
_nl_msg_new_route (int nlmsg_type,
|
||||
int nlmsg_flags,
|
||||
const NMPObject *obj,
|
||||
guint32 cwnd,
|
||||
guint32 initcwnd,
|
||||
guint32 initrwnd,
|
||||
guint32 mtu)
|
||||
const NMPObject *obj)
|
||||
{
|
||||
struct nl_msg *msg;
|
||||
const NMPClass *klass = NMP_OBJECT_GET_CLASS (obj);
|
||||
|
|
@ -2494,10 +2490,10 @@ _nl_msg_new_route (int nlmsg_type,
|
|||
|
||||
if ( obj->ip_route.mss
|
||||
|| obj->ip_route.window
|
||||
|| cwnd
|
||||
|| initcwnd
|
||||
|| initrwnd
|
||||
|| mtu
|
||||
|| obj->ip_route.cwnd
|
||||
|| obj->ip_route.initcwnd
|
||||
|| obj->ip_route.initrwnd
|
||||
|| obj->ip_route.mtu
|
||||
|| lock) {
|
||||
struct nlattr *metrics;
|
||||
|
||||
|
|
@ -2509,14 +2505,14 @@ _nl_msg_new_route (int nlmsg_type,
|
|||
NLA_PUT_U32 (msg, RTAX_ADVMSS, obj->ip_route.mss);
|
||||
if (obj->ip_route.window)
|
||||
NLA_PUT_U32 (msg, RTAX_WINDOW, obj->ip_route.window);
|
||||
if (cwnd)
|
||||
NLA_PUT_U32 (msg, RTAX_CWND, cwnd);
|
||||
if (initcwnd)
|
||||
NLA_PUT_U32 (msg, RTAX_INITCWND, initcwnd);
|
||||
if (initrwnd)
|
||||
NLA_PUT_U32 (msg, RTAX_INITRWND, initrwnd);
|
||||
if (mtu)
|
||||
NLA_PUT_U32 (msg, RTAX_MTU, mtu);
|
||||
if (obj->ip_route.cwnd)
|
||||
NLA_PUT_U32 (msg, RTAX_CWND, obj->ip_route.cwnd);
|
||||
if (obj->ip_route.initcwnd)
|
||||
NLA_PUT_U32 (msg, RTAX_INITCWND, obj->ip_route.initcwnd);
|
||||
if (obj->ip_route.initrwnd)
|
||||
NLA_PUT_U32 (msg, RTAX_INITRWND, obj->ip_route.initrwnd);
|
||||
if (obj->ip_route.mtu)
|
||||
NLA_PUT_U32 (msg, RTAX_MTU, obj->ip_route.mtu);
|
||||
if (lock)
|
||||
NLA_PUT_U32 (msg, RTAX_LOCK, lock);
|
||||
|
||||
|
|
@ -5715,11 +5711,7 @@ ip4_route_add (NMPlatform *platform, const NMPlatformIP4Route *route)
|
|||
|
||||
nlmsg = _nl_msg_new_route (RTM_NEWROUTE,
|
||||
NLM_F_CREATE | NLM_F_REPLACE,
|
||||
&obj,
|
||||
route->cwnd,
|
||||
route->initcwnd,
|
||||
route->initrwnd,
|
||||
route->mtu);
|
||||
&obj);
|
||||
return do_add_addrroute (platform, &obj, nlmsg);
|
||||
}
|
||||
|
||||
|
|
@ -5738,11 +5730,7 @@ ip6_route_add (NMPlatform *platform, const NMPlatformIP6Route *route)
|
|||
|
||||
nlmsg = _nl_msg_new_route (RTM_NEWROUTE,
|
||||
NLM_F_CREATE | NLM_F_REPLACE,
|
||||
&obj,
|
||||
route->cwnd,
|
||||
route->initcwnd,
|
||||
route->initrwnd,
|
||||
route->mtu);
|
||||
&obj);
|
||||
return do_add_addrroute (platform, &obj, nlmsg);
|
||||
}
|
||||
|
||||
|
|
@ -5792,11 +5780,7 @@ ip_route_delete (NMPlatform *platform,
|
|||
|
||||
nlmsg = _nl_msg_new_route (RTM_DELROUTE,
|
||||
0,
|
||||
obj,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
obj);
|
||||
if (!nlmsg)
|
||||
return FALSE;
|
||||
return do_delete_object (platform, obj, nlmsg);
|
||||
|
|
|
|||
|
|
@ -4737,6 +4737,10 @@ nm_platform_ip4_route_hash (const NMPlatformIP4Route *obj, NMPlatformIPRouteCmpT
|
|||
h = NM_HASH_COMBINE (h, obj->mss);
|
||||
h = NM_HASH_COMBINE (h, obj->pref_src);
|
||||
h = NM_HASH_COMBINE (h, obj->window);
|
||||
h = NM_HASH_COMBINE (h, obj->cwnd);
|
||||
h = NM_HASH_COMBINE (h, obj->initcwnd);
|
||||
h = NM_HASH_COMBINE (h, obj->initrwnd);
|
||||
h = NM_HASH_COMBINE (h, obj->mtu);
|
||||
h = NM_HASH_COMBINE (h, obj->lock_window);
|
||||
h = NM_HASH_COMBINE (h, obj->lock_cwnd);
|
||||
h = NM_HASH_COMBINE (h, obj->lock_initcwnd);
|
||||
|
|
@ -4800,6 +4804,10 @@ nm_platform_ip4_route_cmp (const NMPlatformIP4Route *a, const NMPlatformIP4Route
|
|||
NM_CMP_FIELD (a, b, mss);
|
||||
NM_CMP_FIELD (a, b, pref_src);
|
||||
NM_CMP_FIELD (a, b, window);
|
||||
NM_CMP_FIELD (a, b, cwnd);
|
||||
NM_CMP_FIELD (a, b, initcwnd);
|
||||
NM_CMP_FIELD (a, b, initrwnd);
|
||||
NM_CMP_FIELD (a, b, mtu);
|
||||
NM_CMP_FIELD_UNSAFE (a, b, lock_window);
|
||||
NM_CMP_FIELD_UNSAFE (a, b, lock_cwnd);
|
||||
NM_CMP_FIELD_UNSAFE (a, b, lock_initcwnd);
|
||||
|
|
|
|||
|
|
@ -374,10 +374,19 @@ typedef union {
|
|||
/* RTA_METRICS.RTAX_WINDOW (iproute2: window) */ \
|
||||
guint32 window; \
|
||||
\
|
||||
/* RTA_METRICS.RTAX_CWND (iproute2: cwnd) */ \
|
||||
guint32 cwnd; \
|
||||
\
|
||||
/* RTA_METRICS.RTAX_INITCWND (iproute2: initcwnd) */ \
|
||||
guint32 initcwnd; \
|
||||
\
|
||||
/* RTA_METRICS.RTAX_INITRWND (iproute2: initrwnd) */ \
|
||||
guint32 initrwnd; \
|
||||
\
|
||||
/* RTA_METRICS.RTAX_MTU (iproute2: mtu) */ \
|
||||
guint32 mtu; \
|
||||
\
|
||||
\
|
||||
guint32 metric; \
|
||||
guint32 tos; \
|
||||
\
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue