platform: cleanup handling "window" for non-exclusive routes

This commit is contained in:
Thomas Haller
2017-07-27 06:47:11 +02:00
parent 8fc669c02a
commit bf348cde69
3 changed files with 27 additions and 15 deletions

View File

@@ -2421,7 +2421,6 @@ static struct nl_msg *
_nl_msg_new_route (int nlmsg_type,
int nlmsg_flags,
const NMPObject *obj,
guint32 window,
guint32 cwnd,
guint32 initcwnd,
guint32 initrwnd,
@@ -2484,7 +2483,12 @@ _nl_msg_new_route (int nlmsg_type,
}
if ( obj->ip_route.mss
|| window || cwnd || initcwnd || initrwnd || mtu || lock) {
|| obj->ip_route.window
|| cwnd
|| initcwnd
|| initrwnd
|| mtu
|| lock) {
struct nlattr *metrics;
metrics = nla_nest_start (msg, RTA_METRICS);
@@ -2493,8 +2497,8 @@ _nl_msg_new_route (int nlmsg_type,
if (obj->ip_route.mss)
NLA_PUT_U32 (msg, RTAX_ADVMSS, obj->ip_route.mss);
if (window)
NLA_PUT_U32 (msg, RTAX_WINDOW, window);
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)
@@ -5712,7 +5716,6 @@ ip4_route_add (NMPlatform *platform, const NMPlatformIP4Route *route)
nlmsg = _nl_msg_new_route (RTM_NEWROUTE,
NLM_F_CREATE | NLM_F_REPLACE,
&obj,
route->window,
route->cwnd,
route->initcwnd,
route->initrwnd,
@@ -5737,7 +5740,6 @@ ip6_route_add (NMPlatform *platform, const NMPlatformIP6Route *route)
nlmsg = _nl_msg_new_route (RTM_NEWROUTE,
NLM_F_CREATE | NLM_F_REPLACE,
&obj,
route->window,
route->cwnd,
route->initcwnd,
route->initrwnd,
@@ -5797,7 +5799,6 @@ ip_route_delete (NMPlatform *platform,
0,
0,
0,
0,
0);
if (!nlmsg)
return FALSE;

View File

@@ -4756,6 +4756,7 @@ nm_platform_ip4_route_hash (const NMPlatformIP4Route *obj, NMPlatformIPRouteCmpT
h = NM_HASH_COMBINE (h, obj->gateway);
h = NM_HASH_COMBINE (h, obj->mss);
h = NM_HASH_COMBINE (h, obj->pref_src);
h = NM_HASH_COMBINE (h, obj->window);
}
break;
case NM_PLATFORM_IP_ROUTE_CMP_TYPE_SEMANTICALLY:
@@ -4813,6 +4814,7 @@ nm_platform_ip4_route_cmp (const NMPlatformIP4Route *a, const NMPlatformIP4Route
NM_CMP_FIELD (a, b, gateway);
NM_CMP_FIELD (a, b, mss);
NM_CMP_FIELD (a, b, pref_src);
NM_CMP_FIELD (a, b, window);
}
break;
case NM_PLATFORM_IP_ROUTE_CMP_TYPE_SEMANTICALLY:

View File

@@ -355,18 +355,27 @@ typedef union {
\
guint32 metric; \
\
/* RTA_METRICS.RTAX_ADVMSS. For IPv4 routes, this is part of their
* ID (meaning: you can add otherwise idential IPv4 routes that
* only differ by mss). On the other hand, for IPv6 you cannot add two
* IPv6 routes that only differ by mss.
guint32 tos; \
\
\
/* RTA_METRICS:
*
* When deleting a route, kernel seems to ignore RTA_METRICS.RTAX_ADVMSS.
* Which is a problem for IPv4 because you cannot explicitly select which
* route to delete. Kernel just picks the first. */ \
* For IPv4 routes, these properties are part of their
* ID (meaning: you can add otherwise idential IPv4 routes that
* only differ by the metric property).
* On the other hand, for IPv6 you cannot add two IPv6 routes that only differ
* by an RTA_METRICS property.
*
* When deleting a route, kernel seems to ignore the RTA_METRICS propeties.
* That is a problem/bug for IPv4 because you cannot explicitly select which
* route to delete. Kernel just picks the first. See rh#1475642. */ \
\
/* RTA_METRICS.RTAX_ADVMSS (iproute2: advmss) */ \
guint32 mss; \
\
guint32 tos; \
/* RTA_METRICS.RTAX_WINDOW (iproute2: window) */ \
guint32 window; \
\
guint32 cwnd; \
guint32 initcwnd; \
guint32 initrwnd; \