am 69052994: Merge "Support resetting connections tied to any nonexistent address." into lmp-dev
* commit '69052994fd21f2b594295f62e2f867e911e8468d':
Support resetting connections tied to any nonexistent address.
diff --git a/include/netutils/ifc.h b/include/netutils/ifc.h
index 9a8b282..3b27234 100644
--- a/include/netutils/ifc.h
+++ b/include/netutils/ifc.h
@@ -36,6 +36,7 @@
#define RESET_IPV4_ADDRESSES 0x01
#define RESET_IPV6_ADDRESSES 0x02
+#define RESET_IGNORE_INTERFACE_ADDRESS 0x04
#define RESET_ALL_ADDRESSES (RESET_IPV4_ADDRESSES | RESET_IPV6_ADDRESSES)
extern int ifc_reset_connections(const char *ifname, const int reset_mask);
diff --git a/libnetutils/ifc_utils.c b/libnetutils/ifc_utils.c
index 3f6c6b5..913f51e 100644
--- a/libnetutils/ifc_utils.c
+++ b/libnetutils/ifc_utils.c
@@ -599,14 +599,16 @@
{
#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);