mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-20 06:00:49 +02:00
core: also export 0.0.0.0 as gateway in IP configuration
The IP configuration exported over D-Bus for a device has a "gateway" property. If the device has a default route without a gateway, before the L3 rework the gateway used to be exported as "0.0.0.0". That seems useful to indicate that the device has a default route, but without a next hop. Restore that behavior. Fixes-test: @preserve_route_to_generic_device
This commit is contained in:
parent
c4238620d3
commit
8f8e912e3b
2 changed files with 16 additions and 10 deletions
|
|
@ -100,12 +100,14 @@ get_property_ip(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec
|
|||
g_value_set_variant(value, priv->v_address_data);
|
||||
break;
|
||||
case PROP_IP_GATEWAY:
|
||||
g_value_set_variant(
|
||||
value,
|
||||
nm_ip_addr_is_null(addr_family, &priv->v_gateway.addr)
|
||||
? nm_g_variant_singleton_s_empty()
|
||||
: g_variant_new_string(
|
||||
nm_utils_inet_ntop(addr_family, &priv->v_gateway.addr, sbuf_addr)));
|
||||
if (priv->v_gateway.addr) {
|
||||
g_value_set_variant(
|
||||
value,
|
||||
g_variant_new_string(
|
||||
nm_utils_inet_ntop(addr_family, priv->v_gateway.addr, sbuf_addr)));
|
||||
} else {
|
||||
g_value_set_variant(value, nm_g_variant_singleton_s_empty());
|
||||
}
|
||||
break;
|
||||
case PROP_IP_ROUTE_DATA:
|
||||
g_value_set_variant(value, priv->v_route_data);
|
||||
|
|
@ -210,6 +212,7 @@ finalize(GObject *object)
|
|||
nm_g_variant_unref(priv->v_route_data);
|
||||
nm_g_variant_unref(priv->v_routes);
|
||||
|
||||
g_free(priv->v_gateway.addr);
|
||||
nmp_object_unref(priv->v_gateway.best_default_route);
|
||||
|
||||
nm_l3_config_data_unref(priv->l3cd);
|
||||
|
|
@ -767,9 +770,12 @@ _handle_platform_change(NMIPConfig *self, guint32 obj_type_flags, gboolean is_in
|
|||
? nm_platform_ip_route_get_gateway(
|
||||
addr_family,
|
||||
NMP_OBJECT_CAST_IP_ROUTE(priv->v_gateway.best_default_route))
|
||||
: &nm_ip_addr_zero;
|
||||
if (!nm_ip_addr_equal(addr_family, &priv->v_gateway.addr, gateway_next_hop)) {
|
||||
nm_ip_addr_set(addr_family, &priv->v_gateway.addr, gateway_next_hop);
|
||||
: NULL;
|
||||
|
||||
if (!nm_ip_addr_equal(addr_family, priv->v_gateway.addr, gateway_next_hop)) {
|
||||
g_free(priv->v_gateway.addr);
|
||||
priv->v_gateway.addr =
|
||||
g_memdup(gateway_next_hop, nm_utils_addr_family_to_size(addr_family));
|
||||
best_default_route_changed = TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ struct _NMIPConfigPrivate {
|
|||
GVariant * v_routes;
|
||||
struct {
|
||||
const NMPObject *best_default_route;
|
||||
NMIPAddr addr;
|
||||
NMIPAddr * addr;
|
||||
} v_gateway;
|
||||
gulong l3cfg_notify_id;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue