From: Patrik Flykt <[email protected]>

The interface was not properly set down and thus the services
were not removed.

Fixes BMC#25659
---
 src/inet.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/inet.c b/src/inet.c
index 75efc26..1f9bd0d 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -311,7 +311,7 @@ done:
 
 int connman_inet_ifdown(int index)
 {
-       struct ifreq ifr;
+       struct ifreq ifr, addr_ifr;
        struct sockaddr_in *addr;
        int sk, err;
 
@@ -332,9 +332,11 @@ int connman_inet_ifdown(int index)
                goto done;
        }
 
-       addr = (struct sockaddr_in *)&ifr.ifr_addr;
+       memset(&addr_ifr, 0, sizeof(addr_ifr));
+       memcpy(&addr_ifr.ifr_name, &ifr.ifr_name, sizeof(ifr.ifr_name));
+       addr = (struct sockaddr_in *)&addr_ifr.ifr_addr;
        addr->sin_family = AF_INET;
-       if (ioctl(sk, SIOCSIFADDR, &ifr) < 0)
+       if (ioctl(sk, SIOCSIFADDR, &addr_ifr) < 0)
                connman_warn("Could not clear IPv4 address index %d", index);
 
        if (!(ifr.ifr_flags & IFF_UP)) {
-- 
1.7.10.4

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to