summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2012-09-11 15:01:16 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-09-13 13:41:43 +0300
commit98919ac6cbc7535309d308363a249a0cdfe0af22 (patch)
tree827d9c53b4d22ff0cac69924f2f7f63ec03cd3cc
parentf9241eaa486e3012af9fbf3f8e883e250c6f7ce2 (diff)
downloadconnman-98919ac6cbc7535309d308363a249a0cdfe0af22.tar.gz
connman-98919ac6cbc7535309d308363a249a0cdfe0af22.tar.bz2
connman-98919ac6cbc7535309d308363a249a0cdfe0af22.zip
ipconfig: Catch interface name changes
Update the ipdevice interface name if it is changed by udev.
-rw-r--r--src/ipconfig.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ipconfig.c b/src/ipconfig.c
index e2b6576b..4d8c569e 100644
--- a/src/ipconfig.c
+++ b/src/ipconfig.c
@@ -632,8 +632,19 @@ void __connman_ipconfig_newlink(int index, unsigned short type,
return;
ipdevice = g_hash_table_lookup(ipdevice_hash, GINT_TO_POINTER(index));
- if (ipdevice != NULL)
+ if (ipdevice != NULL) {
+ char *ifname = connman_inet_ifname(index);
+ if (g_strcmp0(ipdevice->ifname, ifname) != 0) {
+ DBG("interface name changed %s -> %s",
+ ipdevice->ifname, ifname);
+
+ g_free(ipdevice->ifname);
+ ipdevice->ifname = ifname;
+ } else
+ g_free(ifname);
+
goto update;
+ }
ipdevice = g_try_new0(struct connman_ipdevice, 1);
if (ipdevice == NULL)