platform: extend nm_platform_ipX_route_get_all() to return default-routes only
Add a new enum NMPlatformGetRouteMode. This extends the existing functions nm_platform_ip4_route_get_all() and nm_platform_ip6_route_get_all() to return default routes only. Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
@@ -194,7 +194,7 @@ nm_ip4_config_capture (int ifindex, gboolean capture_resolv_conf)
|
|||||||
g_array_unref (priv->routes);
|
g_array_unref (priv->routes);
|
||||||
|
|
||||||
priv->addresses = nm_platform_ip4_address_get_all (ifindex);
|
priv->addresses = nm_platform_ip4_address_get_all (ifindex);
|
||||||
priv->routes = nm_platform_ip4_route_get_all (ifindex, TRUE);
|
priv->routes = nm_platform_ip4_route_get_all (ifindex, NM_PLATFORM_GET_ROUTE_MODE_ALL);
|
||||||
|
|
||||||
/* Extract gateway from default route */
|
/* Extract gateway from default route */
|
||||||
old_gateway = priv->gateway;
|
old_gateway = priv->gateway;
|
||||||
|
@@ -306,7 +306,7 @@ nm_ip6_config_capture (int ifindex, gboolean capture_resolv_conf, NMSettingIP6Co
|
|||||||
g_array_unref (priv->routes);
|
g_array_unref (priv->routes);
|
||||||
|
|
||||||
priv->addresses = nm_platform_ip6_address_get_all (ifindex);
|
priv->addresses = nm_platform_ip6_address_get_all (ifindex);
|
||||||
priv->routes = nm_platform_ip6_route_get_all (ifindex, TRUE);
|
priv->routes = nm_platform_ip6_route_get_all (ifindex, NM_PLATFORM_GET_ROUTE_MODE_ALL);
|
||||||
|
|
||||||
/* Extract gateway from default route */
|
/* Extract gateway from default route */
|
||||||
old_gateway = priv->gateway;
|
old_gateway = priv->gateway;
|
||||||
|
@@ -983,13 +983,15 @@ ip6_address_exists (NMPlatform *platform, int ifindex, struct in6_addr addr, int
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
static GArray *
|
static GArray *
|
||||||
ip4_route_get_all (NMPlatform *platform, int ifindex, gboolean include_default)
|
ip4_route_get_all (NMPlatform *platform, int ifindex, NMPlatformGetRouteMode mode)
|
||||||
{
|
{
|
||||||
NMFakePlatformPrivate *priv = NM_FAKE_PLATFORM_GET_PRIVATE (platform);
|
NMFakePlatformPrivate *priv = NM_FAKE_PLATFORM_GET_PRIVATE (platform);
|
||||||
GArray *routes;
|
GArray *routes;
|
||||||
NMPlatformIP4Route *route;
|
NMPlatformIP4Route *route;
|
||||||
int count = 0, i;
|
int count = 0, i;
|
||||||
|
|
||||||
|
g_return_val_if_fail (NM_IN_SET (mode, NM_PLATFORM_GET_ROUTE_MODE_ALL, NM_PLATFORM_GET_ROUTE_MODE_NO_DEFAULT, NM_PLATFORM_GET_ROUTE_MODE_ONLY_DEFAULT), NULL);
|
||||||
|
|
||||||
/* Count routes */
|
/* Count routes */
|
||||||
for (i = 0; i < priv->ip4_routes->len; i++) {
|
for (i = 0; i < priv->ip4_routes->len; i++) {
|
||||||
route = &g_array_index (priv->ip4_routes, NMPlatformIP4Route, i);
|
route = &g_array_index (priv->ip4_routes, NMPlatformIP4Route, i);
|
||||||
@@ -1003,8 +1005,13 @@ ip4_route_get_all (NMPlatform *platform, int ifindex, gboolean include_default)
|
|||||||
for (i = 0; i < priv->ip4_routes->len; i++) {
|
for (i = 0; i < priv->ip4_routes->len; i++) {
|
||||||
route = &g_array_index (priv->ip4_routes, NMPlatformIP4Route, i);
|
route = &g_array_index (priv->ip4_routes, NMPlatformIP4Route, i);
|
||||||
if (route && route->ifindex == ifindex) {
|
if (route && route->ifindex == ifindex) {
|
||||||
if (route->plen != 0 || include_default)
|
if (NM_PLATFORM_IP_ROUTE_IS_DEFAULT (route)) {
|
||||||
g_array_append_val (routes, *route);
|
if (mode != NM_PLATFORM_GET_ROUTE_MODE_NO_DEFAULT)
|
||||||
|
g_array_append_val (routes, *route);
|
||||||
|
} else {
|
||||||
|
if (mode != NM_PLATFORM_GET_ROUTE_MODE_ONLY_DEFAULT)
|
||||||
|
g_array_append_val (routes, *route);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1012,13 +1019,15 @@ ip4_route_get_all (NMPlatform *platform, int ifindex, gboolean include_default)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GArray *
|
static GArray *
|
||||||
ip6_route_get_all (NMPlatform *platform, int ifindex, gboolean include_default)
|
ip6_route_get_all (NMPlatform *platform, int ifindex, NMPlatformGetRouteMode mode)
|
||||||
{
|
{
|
||||||
NMFakePlatformPrivate *priv = NM_FAKE_PLATFORM_GET_PRIVATE (platform);
|
NMFakePlatformPrivate *priv = NM_FAKE_PLATFORM_GET_PRIVATE (platform);
|
||||||
GArray *routes;
|
GArray *routes;
|
||||||
NMPlatformIP6Route *route;
|
NMPlatformIP6Route *route;
|
||||||
int count = 0, i;
|
int count = 0, i;
|
||||||
|
|
||||||
|
g_return_val_if_fail (NM_IN_SET (mode, NM_PLATFORM_GET_ROUTE_MODE_ALL, NM_PLATFORM_GET_ROUTE_MODE_NO_DEFAULT, NM_PLATFORM_GET_ROUTE_MODE_ONLY_DEFAULT), NULL);
|
||||||
|
|
||||||
/* Count routes */
|
/* Count routes */
|
||||||
for (i = 0; i < priv->ip6_routes->len; i++) {
|
for (i = 0; i < priv->ip6_routes->len; i++) {
|
||||||
route = &g_array_index (priv->ip6_routes, NMPlatformIP6Route, i);
|
route = &g_array_index (priv->ip6_routes, NMPlatformIP6Route, i);
|
||||||
@@ -1032,8 +1041,13 @@ ip6_route_get_all (NMPlatform *platform, int ifindex, gboolean include_default)
|
|||||||
for (i = 0; i < priv->ip6_routes->len; i++) {
|
for (i = 0; i < priv->ip6_routes->len; i++) {
|
||||||
route = &g_array_index (priv->ip6_routes, NMPlatformIP6Route, i);
|
route = &g_array_index (priv->ip6_routes, NMPlatformIP6Route, i);
|
||||||
if (route && route->ifindex == ifindex) {
|
if (route && route->ifindex == ifindex) {
|
||||||
if (route->plen != 0 || include_default)
|
if (NM_PLATFORM_IP_ROUTE_IS_DEFAULT (route)) {
|
||||||
g_array_append_val (routes, *route);
|
if (mode != NM_PLATFORM_GET_ROUTE_MODE_NO_DEFAULT)
|
||||||
|
g_array_append_val (routes, *route);
|
||||||
|
} else {
|
||||||
|
if (mode != NM_PLATFORM_GET_ROUTE_MODE_ONLY_DEFAULT)
|
||||||
|
g_array_append_val (routes, *route);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1297,6 +1297,16 @@ rtprot_to_source (guint rtprot)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
_rtnl_route_is_default (const struct rtnl_route *rtnlroute)
|
||||||
|
{
|
||||||
|
struct nl_addr *dst;
|
||||||
|
|
||||||
|
return rtnlroute
|
||||||
|
&& (dst = rtnl_route_get_dst ((struct rtnl_route *) rtnlroute))
|
||||||
|
&& nl_addr_get_prefixlen (dst) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
init_ip4_route (NMPlatformIP4Route *route, struct rtnl_route *rtnlroute)
|
init_ip4_route (NMPlatformIP4Route *route, struct rtnl_route *rtnlroute)
|
||||||
{
|
{
|
||||||
@@ -3647,21 +3657,28 @@ _route_match (struct rtnl_route *rtnlroute, int family, int ifindex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GArray *
|
static GArray *
|
||||||
ip4_route_get_all (NMPlatform *platform, int ifindex, gboolean include_default)
|
ip4_route_get_all (NMPlatform *platform, int ifindex, NMPlatformGetRouteMode mode)
|
||||||
{
|
{
|
||||||
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
|
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
|
||||||
GArray *routes;
|
GArray *routes;
|
||||||
NMPlatformIP4Route route;
|
NMPlatformIP4Route route;
|
||||||
struct nl_object *object;
|
struct nl_object *object;
|
||||||
|
|
||||||
|
g_return_val_if_fail (NM_IN_SET (mode, NM_PLATFORM_GET_ROUTE_MODE_ALL, NM_PLATFORM_GET_ROUTE_MODE_NO_DEFAULT, NM_PLATFORM_GET_ROUTE_MODE_ONLY_DEFAULT), NULL);
|
||||||
|
|
||||||
routes = g_array_new (FALSE, FALSE, sizeof (NMPlatformIP4Route));
|
routes = g_array_new (FALSE, FALSE, sizeof (NMPlatformIP4Route));
|
||||||
|
|
||||||
for (object = nl_cache_get_first (priv->route_cache); object; object = nl_cache_get_next (object)) {
|
for (object = nl_cache_get_first (priv->route_cache); object; object = nl_cache_get_next (object)) {
|
||||||
if (_route_match ((struct rtnl_route *) object, AF_INET, ifindex)) {
|
if (_route_match ((struct rtnl_route *) object, AF_INET, ifindex)) {
|
||||||
if (init_ip4_route (&route, (struct rtnl_route *) object)) {
|
if (_rtnl_route_is_default ((struct rtnl_route *) object)) {
|
||||||
if (!NM_PLATFORM_IP_ROUTE_IS_DEFAULT (&route) || include_default)
|
if (mode == NM_PLATFORM_GET_ROUTE_MODE_NO_DEFAULT)
|
||||||
g_array_append_val (routes, route);
|
continue;
|
||||||
|
} else {
|
||||||
|
if (mode == NM_PLATFORM_GET_ROUTE_MODE_ONLY_DEFAULT)
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
if (init_ip4_route (&route, (struct rtnl_route *) object))
|
||||||
|
g_array_append_val (routes, route);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3669,21 +3686,28 @@ ip4_route_get_all (NMPlatform *platform, int ifindex, gboolean include_default)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GArray *
|
static GArray *
|
||||||
ip6_route_get_all (NMPlatform *platform, int ifindex, gboolean include_default)
|
ip6_route_get_all (NMPlatform *platform, int ifindex, NMPlatformGetRouteMode mode)
|
||||||
{
|
{
|
||||||
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
|
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
|
||||||
GArray *routes;
|
GArray *routes;
|
||||||
NMPlatformIP6Route route;
|
NMPlatformIP6Route route;
|
||||||
struct nl_object *object;
|
struct nl_object *object;
|
||||||
|
|
||||||
|
g_return_val_if_fail (NM_IN_SET (mode, NM_PLATFORM_GET_ROUTE_MODE_ALL, NM_PLATFORM_GET_ROUTE_MODE_NO_DEFAULT, NM_PLATFORM_GET_ROUTE_MODE_ONLY_DEFAULT), NULL);
|
||||||
|
|
||||||
routes = g_array_new (FALSE, FALSE, sizeof (NMPlatformIP6Route));
|
routes = g_array_new (FALSE, FALSE, sizeof (NMPlatformIP6Route));
|
||||||
|
|
||||||
for (object = nl_cache_get_first (priv->route_cache); object; object = nl_cache_get_next (object)) {
|
for (object = nl_cache_get_first (priv->route_cache); object; object = nl_cache_get_next (object)) {
|
||||||
if (_route_match ((struct rtnl_route *) object, AF_INET6, ifindex)) {
|
if (_route_match ((struct rtnl_route *) object, AF_INET6, ifindex)) {
|
||||||
if (init_ip6_route (&route, (struct rtnl_route *) object)) {
|
if (_rtnl_route_is_default ((struct rtnl_route *) object)) {
|
||||||
if (!NM_PLATFORM_IP_ROUTE_IS_DEFAULT (&route) || include_default)
|
if (mode == NM_PLATFORM_GET_ROUTE_MODE_NO_DEFAULT)
|
||||||
g_array_append_val (routes, route);
|
continue;
|
||||||
|
} else {
|
||||||
|
if (mode == NM_PLATFORM_GET_ROUTE_MODE_ONLY_DEFAULT)
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
if (init_ip6_route (&route, (struct rtnl_route *) object))
|
||||||
|
g_array_append_val (routes, route);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1837,25 +1837,25 @@ nm_platform_address_flush (int ifindex)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
GArray *
|
GArray *
|
||||||
nm_platform_ip4_route_get_all (int ifindex, gboolean include_default)
|
nm_platform_ip4_route_get_all (int ifindex, NMPlatformGetRouteMode mode)
|
||||||
{
|
{
|
||||||
reset_error ();
|
reset_error ();
|
||||||
|
|
||||||
g_return_val_if_fail (ifindex > 0, NULL);
|
g_return_val_if_fail (ifindex > 0, NULL);
|
||||||
g_return_val_if_fail (klass->ip4_route_get_all, NULL);
|
g_return_val_if_fail (klass->ip4_route_get_all, NULL);
|
||||||
|
|
||||||
return klass->ip4_route_get_all (platform, ifindex, include_default);
|
return klass->ip4_route_get_all (platform, ifindex, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
GArray *
|
GArray *
|
||||||
nm_platform_ip6_route_get_all (int ifindex, gboolean include_default)
|
nm_platform_ip6_route_get_all (int ifindex, NMPlatformGetRouteMode mode)
|
||||||
{
|
{
|
||||||
reset_error ();
|
reset_error ();
|
||||||
|
|
||||||
g_return_val_if_fail (ifindex > 0, NULL);
|
g_return_val_if_fail (ifindex > 0, NULL);
|
||||||
g_return_val_if_fail (klass->ip6_route_get_all, NULL);
|
g_return_val_if_fail (klass->ip6_route_get_all, NULL);
|
||||||
|
|
||||||
return klass->ip6_route_get_all (platform, ifindex, include_default);
|
return klass->ip6_route_get_all (platform, ifindex, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@@ -2026,7 +2026,7 @@ nm_platform_ip4_route_sync (int ifindex, const GArray *known_routes)
|
|||||||
int i, i_type;
|
int i, i_type;
|
||||||
|
|
||||||
/* Delete unknown routes */
|
/* Delete unknown routes */
|
||||||
routes = nm_platform_ip4_route_get_all (ifindex, FALSE);
|
routes = nm_platform_ip4_route_get_all (ifindex, NM_PLATFORM_GET_ROUTE_MODE_NO_DEFAULT);
|
||||||
for (i = 0; i < routes->len; i++) {
|
for (i = 0; i < routes->len; i++) {
|
||||||
route = &g_array_index (routes, NMPlatformIP4Route, i);
|
route = &g_array_index (routes, NMPlatformIP4Route, i);
|
||||||
|
|
||||||
@@ -2099,7 +2099,7 @@ nm_platform_ip6_route_sync (int ifindex, const GArray *known_routes)
|
|||||||
int i, i_type;
|
int i, i_type;
|
||||||
|
|
||||||
/* Delete unknown routes */
|
/* Delete unknown routes */
|
||||||
routes = nm_platform_ip6_route_get_all (ifindex, FALSE);
|
routes = nm_platform_ip6_route_get_all (ifindex, NM_PLATFORM_GET_ROUTE_MODE_NO_DEFAULT);
|
||||||
for (i = 0; i < routes->len; i++) {
|
for (i = 0; i < routes->len; i++) {
|
||||||
route = &g_array_index (routes, NMPlatformIP6Route, i);
|
route = &g_array_index (routes, NMPlatformIP6Route, i);
|
||||||
route->ifindex = 0;
|
route->ifindex = 0;
|
||||||
|
@@ -99,6 +99,12 @@ typedef enum {
|
|||||||
|
|
||||||
#define NM_PLATFORM_LIFETIME_PERMANENT G_MAXUINT32
|
#define NM_PLATFORM_LIFETIME_PERMANENT G_MAXUINT32
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
NM_PLATFORM_GET_ROUTE_MODE_ALL,
|
||||||
|
NM_PLATFORM_GET_ROUTE_MODE_NO_DEFAULT,
|
||||||
|
NM_PLATFORM_GET_ROUTE_MODE_ONLY_DEFAULT,
|
||||||
|
} NMPlatformGetRouteMode;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
__NMPlatformObject_COMMON;
|
__NMPlatformObject_COMMON;
|
||||||
} NMPlatformObject;
|
} NMPlatformObject;
|
||||||
@@ -395,8 +401,8 @@ typedef struct {
|
|||||||
gboolean (*ip4_address_exists) (NMPlatform *, int ifindex, in_addr_t address, int plen);
|
gboolean (*ip4_address_exists) (NMPlatform *, int ifindex, in_addr_t address, int plen);
|
||||||
gboolean (*ip6_address_exists) (NMPlatform *, int ifindex, struct in6_addr address, int plen);
|
gboolean (*ip6_address_exists) (NMPlatform *, int ifindex, struct in6_addr address, int plen);
|
||||||
|
|
||||||
GArray * (*ip4_route_get_all) (NMPlatform *, int ifindex, gboolean include_default);
|
GArray * (*ip4_route_get_all) (NMPlatform *, int ifindex, NMPlatformGetRouteMode mode);
|
||||||
GArray * (*ip6_route_get_all) (NMPlatform *, int ifindex, gboolean include_default);
|
GArray * (*ip6_route_get_all) (NMPlatform *, int ifindex, NMPlatformGetRouteMode mode);
|
||||||
gboolean (*ip4_route_add) (NMPlatform *, int ifindex, NMIPConfigSource source,
|
gboolean (*ip4_route_add) (NMPlatform *, int ifindex, NMIPConfigSource source,
|
||||||
in_addr_t network, int plen, in_addr_t gateway,
|
in_addr_t network, int plen, in_addr_t gateway,
|
||||||
guint32 metric, guint32 mss);
|
guint32 metric, guint32 mss);
|
||||||
@@ -542,8 +548,8 @@ gboolean nm_platform_ip4_address_sync (int ifindex, const GArray *known_addresse
|
|||||||
gboolean nm_platform_ip6_address_sync (int ifindex, const GArray *known_addresses);
|
gboolean nm_platform_ip6_address_sync (int ifindex, const GArray *known_addresses);
|
||||||
gboolean nm_platform_address_flush (int ifindex);
|
gboolean nm_platform_address_flush (int ifindex);
|
||||||
|
|
||||||
GArray *nm_platform_ip4_route_get_all (int ifindex, gboolean include_default);
|
GArray *nm_platform_ip4_route_get_all (int ifindex, NMPlatformGetRouteMode mode);
|
||||||
GArray *nm_platform_ip6_route_get_all (int ifindex, gboolean include_default);
|
GArray *nm_platform_ip6_route_get_all (int ifindex, NMPlatformGetRouteMode mode);
|
||||||
gboolean nm_platform_ip4_route_add (int ifindex, NMIPConfigSource source,
|
gboolean nm_platform_ip4_route_add (int ifindex, NMIPConfigSource source,
|
||||||
in_addr_t network, int plen, in_addr_t gateway,
|
in_addr_t network, int plen, in_addr_t gateway,
|
||||||
guint32 metric, guint32 mss);
|
guint32 metric, guint32 mss);
|
||||||
|
@@ -83,8 +83,8 @@ dump_interface (NMPlatformLink *link)
|
|||||||
g_array_unref (ip4_addresses);
|
g_array_unref (ip4_addresses);
|
||||||
g_array_unref (ip6_addresses);
|
g_array_unref (ip6_addresses);
|
||||||
|
|
||||||
ip4_routes = nm_platform_ip4_route_get_all (link->ifindex, TRUE);
|
ip4_routes = nm_platform_ip4_route_get_all (link->ifindex, NM_PLATFORM_GET_ROUTE_MODE_ALL);
|
||||||
ip6_routes = nm_platform_ip6_route_get_all (link->ifindex, TRUE);
|
ip6_routes = nm_platform_ip6_route_get_all (link->ifindex, NM_PLATFORM_GET_ROUTE_MODE_ALL);
|
||||||
|
|
||||||
g_assert (ip4_routes);
|
g_assert (ip4_routes);
|
||||||
g_assert (ip6_routes);
|
g_assert (ip6_routes);
|
||||||
|
@@ -631,7 +631,7 @@ do_ip4_route_get_all (char **argv)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (ifindex) {
|
if (ifindex) {
|
||||||
routes = nm_platform_ip4_route_get_all (ifindex, TRUE);
|
routes = nm_platform_ip4_route_get_all (ifindex, NM_PLATFORM_GET_ROUTE_MODE_ALL);
|
||||||
for (i = 0; i < routes->len; i++) {
|
for (i = 0; i < routes->len; i++) {
|
||||||
route = &g_array_index (routes, NMPlatformIP4Route, i);
|
route = &g_array_index (routes, NMPlatformIP4Route, i);
|
||||||
inet_ntop (AF_INET, &route->network, networkstr, sizeof (networkstr));
|
inet_ntop (AF_INET, &route->network, networkstr, sizeof (networkstr));
|
||||||
@@ -655,7 +655,7 @@ do_ip6_route_get_all (char **argv)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (ifindex) {
|
if (ifindex) {
|
||||||
routes = nm_platform_ip6_route_get_all (ifindex, TRUE);
|
routes = nm_platform_ip6_route_get_all (ifindex, NM_PLATFORM_GET_ROUTE_MODE_ALL);
|
||||||
for (i = 0; i < routes->len; i++) {
|
for (i = 0; i < routes->len; i++) {
|
||||||
route = &g_array_index (routes, NMPlatformIP6Route, i);
|
route = &g_array_index (routes, NMPlatformIP6Route, i);
|
||||||
inet_ntop (AF_INET6, &route->network, networkstr, sizeof (networkstr));
|
inet_ntop (AF_INET6, &route->network, networkstr, sizeof (networkstr));
|
||||||
|
@@ -52,8 +52,8 @@ test_cleanup_internal (void)
|
|||||||
|
|
||||||
addresses4 = nm_platform_ip4_address_get_all (ifindex);
|
addresses4 = nm_platform_ip4_address_get_all (ifindex);
|
||||||
addresses6 = nm_platform_ip6_address_get_all (ifindex);
|
addresses6 = nm_platform_ip6_address_get_all (ifindex);
|
||||||
routes4 = nm_platform_ip4_route_get_all (ifindex, TRUE);
|
routes4 = nm_platform_ip4_route_get_all (ifindex, NM_PLATFORM_GET_ROUTE_MODE_ALL);
|
||||||
routes6 = nm_platform_ip6_route_get_all (ifindex, TRUE);
|
routes6 = nm_platform_ip6_route_get_all (ifindex, NM_PLATFORM_GET_ROUTE_MODE_ALL);
|
||||||
|
|
||||||
g_assert_cmpint (addresses4->len, ==, 1);
|
g_assert_cmpint (addresses4->len, ==, 1);
|
||||||
g_assert_cmpint (addresses6->len, ==, 1);
|
g_assert_cmpint (addresses6->len, ==, 1);
|
||||||
@@ -70,8 +70,8 @@ test_cleanup_internal (void)
|
|||||||
|
|
||||||
addresses4 = nm_platform_ip4_address_get_all (ifindex);
|
addresses4 = nm_platform_ip4_address_get_all (ifindex);
|
||||||
addresses6 = nm_platform_ip6_address_get_all (ifindex);
|
addresses6 = nm_platform_ip6_address_get_all (ifindex);
|
||||||
routes4 = nm_platform_ip4_route_get_all (ifindex, TRUE);
|
routes4 = nm_platform_ip4_route_get_all (ifindex, NM_PLATFORM_GET_ROUTE_MODE_ALL);
|
||||||
routes6 = nm_platform_ip6_route_get_all (ifindex, TRUE);
|
routes6 = nm_platform_ip6_route_get_all (ifindex, NM_PLATFORM_GET_ROUTE_MODE_ALL);
|
||||||
|
|
||||||
g_assert_cmpint (addresses4->len, ==, 0);
|
g_assert_cmpint (addresses4->len, ==, 0);
|
||||||
g_assert_cmpint (addresses6->len, ==, 0);
|
g_assert_cmpint (addresses6->len, ==, 0);
|
||||||
|
@@ -99,7 +99,7 @@ test_ip4_route (void)
|
|||||||
accept_signal (route_changed);
|
accept_signal (route_changed);
|
||||||
|
|
||||||
/* Test route listing */
|
/* Test route listing */
|
||||||
routes = nm_platform_ip4_route_get_all (ifindex, TRUE);
|
routes = nm_platform_ip4_route_get_all (ifindex, NM_PLATFORM_GET_ROUTE_MODE_ALL);
|
||||||
memset (rts, 0, sizeof (rts));
|
memset (rts, 0, sizeof (rts));
|
||||||
rts[0].source = NM_IP_CONFIG_SOURCE_USER;
|
rts[0].source = NM_IP_CONFIG_SOURCE_USER;
|
||||||
rts[0].network = gateway;
|
rts[0].network = gateway;
|
||||||
@@ -194,7 +194,7 @@ test_ip6_route (void)
|
|||||||
accept_signal (route_changed);
|
accept_signal (route_changed);
|
||||||
|
|
||||||
/* Test route listing */
|
/* Test route listing */
|
||||||
routes = nm_platform_ip6_route_get_all (ifindex, TRUE);
|
routes = nm_platform_ip6_route_get_all (ifindex, NM_PLATFORM_GET_ROUTE_MODE_ALL);
|
||||||
memset (rts, 0, sizeof (rts));
|
memset (rts, 0, sizeof (rts));
|
||||||
rts[0].source = NM_IP_CONFIG_SOURCE_USER;
|
rts[0].source = NM_IP_CONFIG_SOURCE_USER;
|
||||||
rts[0].network = gateway;
|
rts[0].network = gateway;
|
||||||
|
Reference in New Issue
Block a user