diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2012-09-11 15:01:16 +0300 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-09-13 13:41:43 +0300 |
commit | 98919ac6cbc7535309d308363a249a0cdfe0af22 (patch) | |
tree | 827d9c53b4d22ff0cac69924f2f7f63ec03cd3cc /src/ipconfig.c | |
parent | f9241eaa486e3012af9fbf3f8e883e250c6f7ce2 (diff) | |
download | connman-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.
Diffstat (limited to 'src/ipconfig.c')
-rw-r--r-- | src/ipconfig.c | 13 |
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) |