platform: add mss attribute to NMPlatformIP*Route
This commit is contained in:
@@ -661,6 +661,7 @@ ip4_route_add (NMPlatform *platform, int ifindex, in_addr_t network, int plen,
|
|||||||
route.plen = plen;
|
route.plen = plen;
|
||||||
route.gateway = gateway;
|
route.gateway = gateway;
|
||||||
route.metric = metric;
|
route.metric = metric;
|
||||||
|
route.mss = mss;
|
||||||
|
|
||||||
g_array_append_val (priv->ip4_routes, route);
|
g_array_append_val (priv->ip4_routes, route);
|
||||||
|
|
||||||
@@ -682,6 +683,7 @@ ip6_route_add (NMPlatform *platform, int ifindex, struct in6_addr network, int p
|
|||||||
route.plen = plen;
|
route.plen = plen;
|
||||||
route.gateway = gateway;
|
route.gateway = gateway;
|
||||||
route.metric = metric;
|
route.metric = metric;
|
||||||
|
route.mss = mss;
|
||||||
|
|
||||||
g_array_append_val (priv->ip6_routes, route);
|
g_array_append_val (priv->ip6_routes, route);
|
||||||
|
|
||||||
|
@@ -418,6 +418,7 @@ init_ip4_route (NMPlatformIP4Route *route, struct rtnl_route *rtnlroute)
|
|||||||
if (gw)
|
if (gw)
|
||||||
memcpy (&route->gateway, nl_addr_get_binary_addr (gw), sizeof (route->gateway));
|
memcpy (&route->gateway, nl_addr_get_binary_addr (gw), sizeof (route->gateway));
|
||||||
route->metric = rtnl_route_get_priority (rtnlroute);
|
route->metric = rtnl_route_get_priority (rtnlroute);
|
||||||
|
rtnl_route_get_metric (rtnlroute, RTAX_ADVMSS, &route->mss);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -438,6 +439,7 @@ init_ip6_route (NMPlatformIP6Route *route, struct rtnl_route *rtnlroute)
|
|||||||
if (gw)
|
if (gw)
|
||||||
memcpy (&route->gateway, nl_addr_get_binary_addr (gw), sizeof (route->gateway));
|
memcpy (&route->gateway, nl_addr_get_binary_addr (gw), sizeof (route->gateway));
|
||||||
route->metric = rtnl_route_get_priority (rtnlroute);
|
route->metric = rtnl_route_get_priority (rtnlroute);
|
||||||
|
rtnl_route_get_metric (rtnlroute, RTAX_ADVMSS, &route->mss);
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
@@ -84,7 +84,8 @@ typedef struct {
|
|||||||
in_addr_t network;
|
in_addr_t network;
|
||||||
int plen;
|
int plen;
|
||||||
in_addr_t gateway;
|
in_addr_t gateway;
|
||||||
int metric;
|
guint metric;
|
||||||
|
guint mss;
|
||||||
} NMPlatformIP4Route;
|
} NMPlatformIP4Route;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -92,7 +93,8 @@ typedef struct {
|
|||||||
struct in6_addr network;
|
struct in6_addr network;
|
||||||
int plen;
|
int plen;
|
||||||
struct in6_addr gateway;
|
struct in6_addr gateway;
|
||||||
int metric;
|
guint metric;
|
||||||
|
guint mss;
|
||||||
} NMPlatformIP6Route;
|
} NMPlatformIP6Route;
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
@@ -56,7 +56,7 @@ test_ip4_route ()
|
|||||||
inet_pton (AF_INET, "198.51.100.0", &gateway);
|
inet_pton (AF_INET, "198.51.100.0", &gateway);
|
||||||
|
|
||||||
/* Add route to gateway */
|
/* Add route to gateway */
|
||||||
g_assert (nm_platform_ip4_route_add (ifindex, gateway, 32, INADDR_ANY, metric, 0)); no_error ();
|
g_assert (nm_platform_ip4_route_add (ifindex, gateway, 32, INADDR_ANY, metric, mss)); no_error ();
|
||||||
accept_signal (route_added);
|
accept_signal (route_added);
|
||||||
|
|
||||||
/* Add route */
|
/* Add route */
|
||||||
@@ -77,11 +77,13 @@ test_ip4_route ()
|
|||||||
rts[0].ifindex = ifindex;
|
rts[0].ifindex = ifindex;
|
||||||
rts[0].gateway = INADDR_ANY;
|
rts[0].gateway = INADDR_ANY;
|
||||||
rts[0].metric = metric;
|
rts[0].metric = metric;
|
||||||
|
rts[0].mss = mss;
|
||||||
rts[1].network = network;
|
rts[1].network = network;
|
||||||
rts[1].plen = plen;
|
rts[1].plen = plen;
|
||||||
rts[1].ifindex = ifindex;
|
rts[1].ifindex = ifindex;
|
||||||
rts[1].gateway = gateway;
|
rts[1].gateway = gateway;
|
||||||
rts[1].metric = metric;
|
rts[1].metric = metric;
|
||||||
|
rts[1].mss = mss;
|
||||||
g_assert_cmpint (routes->len, ==, 2);
|
g_assert_cmpint (routes->len, ==, 2);
|
||||||
g_assert (!memcmp (routes->data, rts, sizeof (rts)));
|
g_assert (!memcmp (routes->data, rts, sizeof (rts)));
|
||||||
g_array_unref (routes);
|
g_array_unref (routes);
|
||||||
@@ -116,8 +118,8 @@ test_ip6_route ()
|
|||||||
inet_pton (AF_INET6, "2001:db8:a:b:0:0:0:0", &network);
|
inet_pton (AF_INET6, "2001:db8:a:b:0:0:0:0", &network);
|
||||||
inet_pton (AF_INET6, "2001:db8:c:d:1:2:3:4", &gateway);
|
inet_pton (AF_INET6, "2001:db8:c:d:1:2:3:4", &gateway);
|
||||||
|
|
||||||
/* Add gateway address */
|
/* Add route to gateway */
|
||||||
g_assert (nm_platform_ip6_route_add (ifindex, gateway, 128, in6addr_any, metric, 0)); no_error ();
|
g_assert (nm_platform_ip6_route_add (ifindex, gateway, 128, in6addr_any, metric, mss)); no_error ();
|
||||||
accept_signal (route_added);
|
accept_signal (route_added);
|
||||||
|
|
||||||
/* Add route */
|
/* Add route */
|
||||||
@@ -138,11 +140,13 @@ test_ip6_route ()
|
|||||||
rts[0].ifindex = ifindex;
|
rts[0].ifindex = ifindex;
|
||||||
rts[0].gateway = in6addr_any;
|
rts[0].gateway = in6addr_any;
|
||||||
rts[0].metric = metric;
|
rts[0].metric = metric;
|
||||||
|
rts[0].mss = mss;
|
||||||
rts[1].network = network;
|
rts[1].network = network;
|
||||||
rts[1].plen = plen;
|
rts[1].plen = plen;
|
||||||
rts[1].ifindex = ifindex;
|
rts[1].ifindex = ifindex;
|
||||||
rts[1].gateway = gateway;
|
rts[1].gateway = gateway;
|
||||||
rts[1].metric = metric;
|
rts[1].metric = metric;
|
||||||
|
rts[1].mss = mss;
|
||||||
g_assert_cmpint (routes->len, ==, 2);
|
g_assert_cmpint (routes->len, ==, 2);
|
||||||
g_assert (!memcmp (routes->data, rts, sizeof (rts)));
|
g_assert (!memcmp (routes->data, rts, sizeof (rts)));
|
||||||
g_array_unref (routes);
|
g_array_unref (routes);
|
||||||
|
Reference in New Issue
Block a user