summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2012-08-28 07:51:30 (GMT)
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-08-29 07:57:15 (GMT)
commit4e24ba00aca6a3159e9ccb017f202321947967b8 (patch)
treeb2c91e1c2009de2149e44c1308fd9cd3115c8a27
parentd40a1df675ff776b869c6e222d10219f5ebbe01d (diff)
downloadconnman-4e24ba00aca6a3159e9ccb017f202321947967b8.zip
connman-4e24ba00aca6a3159e9ccb017f202321947967b8.tar.gz
connman-4e24ba00aca6a3159e9ccb017f202321947967b8.tar.bz2
inet: Properly remove IPv4 address and set interface down
The interface was not properly set down and thus the services were not removed. Fixes BMC#25659
-rw-r--r--src/inet.c8
1 files 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)) {