diff options
Diffstat (limited to 'src/nm-ip4-config.c')
-rw-r--r-- | src/nm-ip4-config.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c index 4b27edf74b..78c3f94f4f 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -486,7 +486,12 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIPConfig *setting, gu memset (&route, 0, sizeof (route)); nm_ip_route_get_dest_binary (s_route, &route.network); + route.plen = nm_ip_route_get_prefix (s_route); + nm_assert (route.plen <= 32); + if (route.plen == 0) + continue; + nm_ip_route_get_next_hop_binary (s_route, &route.gateway); if (nm_ip_route_get_metric (s_route) == -1) route.metric = default_route_metric; @@ -494,8 +499,6 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIPConfig *setting, gu route.metric = nm_ip_route_get_metric (s_route); route.source = NM_IP_CONFIG_SOURCE_USER; - g_assert (route.plen > 0); - nm_ip4_config_add_route (config, &route); } @@ -1328,7 +1331,7 @@ nm_ip4_config_dump (const NMIP4Config *config, const char *detail) } gboolean -nm_ip4_config_destination_is_direct (const NMIP4Config *config, guint32 network, int plen) +nm_ip4_config_destination_is_direct (const NMIP4Config *config, guint32 network, guint8 plen) { guint naddresses = nm_ip4_config_get_num_addresses (config); int i; @@ -1567,7 +1570,7 @@ nm_ip4_config_add_route (NMIP4Config *config, const NMPlatformIP4Route *new) int i; g_return_if_fail (new != NULL); - g_return_if_fail (new->plen > 0); + g_return_if_fail (new->plen > 0 && new->plen <= 32); g_assert (priv->ifindex); for (i = 0; i < priv->routes->len; i++ ) { |