From d910c94beb477837b458de706caad133fc4fd0a9 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Mon, 7 Sep 2015 12:06:27 +0200 Subject: [PATCH] policy: update device's metered property when connection changes If the metered property of a connection is changed, an activated device associated to the connection must be updated immediately with the new metered value. https://bugzilla.gnome.org/show_bug.cgi?id=754409 --- src/devices/nm-device.c | 3 +-- src/devices/nm-device.h | 1 + src/nm-policy.c | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 22a235d40e..83e7c4cbf8 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -68,7 +68,6 @@ _LOG_DECLARE_SELF (NMDevice); #include "nmdbus-device.h" -static void nm_device_update_metered (NMDevice *self); static void ip_check_ping_watch_cb (GPid pid, gint status, gpointer user_data); static gboolean ip_config_valid (NMDeviceState state); static NMActStageReturn dhcp4_start (NMDevice *self, NMConnection *connection, NMDeviceStateReason *reason); @@ -7841,7 +7840,7 @@ nm_device_set_dhcp_anycast_address (NMDevice *self, const char *addr) priv->dhcp_anycast_address = g_strdup (addr); } -static void +void nm_device_update_metered (NMDevice *self) { #define NM_METERED_INVALID ((NMMetered) -1) diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index 00ea568e52..50ac8b0d38 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -498,6 +498,7 @@ const NMPlatformIP4Route *nm_device_get_ip4_default_route (NMDevice *self, gbool const NMPlatformIP6Route *nm_device_get_ip6_default_route (NMDevice *self, gboolean *out_is_assumed); void nm_device_spawn_iface_helper (NMDevice *self); +void nm_device_update_metered (NMDevice *self); G_END_DECLS diff --git a/src/nm-policy.c b/src/nm-policy.c index b22608b530..78dd865ebe 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -1663,8 +1663,10 @@ connection_updated (NMSettings *settings, } } - if (device) + if (device) { firewall_update_zone (policy, connection, device); + nm_device_update_metered (device); + } schedule_activate_all (policy); }