summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSreeram Ramachandran2014-09-08 18:05:09 -0500
committerSreeram Ramachandran2014-09-09 01:35:52 -0500
commit17622d09d5ba54ae3c8b11644c6d7556bdc6644c (patch)
treec3fac859878ec4a57e1e7018f8837b09feba10ee /libnetutils
parent97b536f1fbfd1fa711833b7dc92aed902dea4bdf (diff)
downloadplatform-system-core-17622d09d5ba54ae3c8b11644c6d7556bdc6644c.tar.gz
platform-system-core-17622d09d5ba54ae3c8b11644c6d7556bdc6644c.tar.xz
platform-system-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.c6
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)
599{ 599{
600#ifdef HAVE_ANDROID_OS 600#ifdef HAVE_ANDROID_OS
601 int result, success; 601 int result, success;
602 in_addr_t myaddr; 602 in_addr_t myaddr = 0;
603 struct ifreq ifr; 603 struct ifreq ifr;
604 struct in6_ifreq ifr6; 604 struct in6_ifreq ifr6;
605 605
606 if (reset_mask & RESET_IPV4_ADDRESSES) { 606 if (reset_mask & RESET_IPV4_ADDRESSES) {
607 /* IPv4. Clear connections on the IP address. */ 607 /* IPv4. Clear connections on the IP address. */
608 ifc_init(); 608 ifc_init();
609 ifc_get_info(ifname, &myaddr, NULL, NULL); 609 if (!(reset_mask & RESET_IGNORE_INTERFACE_ADDRESS)) {
610 ifc_get_info(ifname, &myaddr, NULL, NULL);
611 }
610 ifc_init_ifr(ifname, &ifr); 612 ifc_init_ifr(ifname, &ifr);
611 init_sockaddr_in(&ifr.ifr_addr, myaddr); 613 init_sockaddr_in(&ifr.ifr_addr, myaddr);
612 result = ioctl(ifc_ctl_sock, SIOCKILLADDR, &ifr); 614 result = ioctl(ifc_ctl_sock, SIOCKILLADDR, &ifr);