diff options
| author | Sreeram Ramachandran <sreeram@google.com> | 2014-09-08 16:05:09 -0700 |
|---|---|---|
| committer | Sreeram Ramachandran <sreeram@google.com> | 2014-09-08 23:35:52 -0700 |
| commit | 17622d09d5ba54ae3c8b11644c6d7556bdc6644c (patch) | |
| tree | c3fac859878ec4a57e1e7018f8837b09feba10ee /libnetutils | |
| parent | 97b536f1fbfd1fa711833b7dc92aed902dea4bdf (diff) | |
| download | core-17622d09d5ba54ae3c8b11644c6d7556bdc6644c.tar.gz core-17622d09d5ba54ae3c8b11644c6d7556bdc6644c.tar.bz2 core-17622d09d5ba54ae3c8b11644c6d7556bdc6644c.zip | |
Support resetting connections tied to any nonexistent address.
Bug: 15414453
Change-Id: Ibf1f052e12b88838a328148e25817a96f10d50f5
Diffstat (limited to 'libnetutils')
| -rw-r--r-- | libnetutils/ifc_utils.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libnetutils/ifc_utils.c b/libnetutils/ifc_utils.c index 3f6c6b56c..913f51e81 100644 --- a/libnetutils/ifc_utils.c +++ b/libnetutils/ifc_utils.c @@ -599,14 +599,16 @@ int ifc_reset_connections(const char *ifname, const int reset_mask) { #ifdef HAVE_ANDROID_OS int result, success; - in_addr_t myaddr; + in_addr_t myaddr = 0; struct ifreq ifr; struct in6_ifreq ifr6; if (reset_mask & RESET_IPV4_ADDRESSES) { /* IPv4. Clear connections on the IP address. */ ifc_init(); - ifc_get_info(ifname, &myaddr, NULL, NULL); + if (!(reset_mask & RESET_IGNORE_INTERFACE_ADDRESS)) { + ifc_get_info(ifname, &myaddr, NULL, NULL); + } ifc_init_ifr(ifname, &ifr); init_sockaddr_in(&ifr.ifr_addr, myaddr); result = ioctl(ifc_ctl_sock, SIOCKILLADDR, &ifr); |
