am 0dd572a5: Merge "Kill IPv6 sockets as well as IPv4 sockets." into honeycomb-LTE
* commit '0dd572a5196f7887de56912b6f2a22f053f1ca34': Kill IPv6 sockets as well as IPv4 sockets.
This commit is contained in:
commit
e9fa47ca66
1 changed files with 18 additions and 1 deletions
|
|
@ -366,10 +366,12 @@ int ifc_disable(const char *ifname)
|
||||||
int ifc_reset_connections(const char *ifname)
|
int ifc_reset_connections(const char *ifname)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_ANDROID_OS
|
#ifdef HAVE_ANDROID_OS
|
||||||
int result;
|
int result, success;
|
||||||
in_addr_t myaddr;
|
in_addr_t myaddr;
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
|
struct in6_ifreq ifr6;
|
||||||
|
|
||||||
|
/* IPv4. Clear connections on the IP address. */
|
||||||
ifc_init();
|
ifc_init();
|
||||||
ifc_get_info(ifname, &myaddr, NULL, NULL);
|
ifc_get_info(ifname, &myaddr, NULL, NULL);
|
||||||
ifc_init_ifr(ifname, &ifr);
|
ifc_init_ifr(ifname, &ifr);
|
||||||
|
|
@ -377,6 +379,21 @@ int ifc_reset_connections(const char *ifname)
|
||||||
result = ioctl(ifc_ctl_sock, SIOCKILLADDR, &ifr);
|
result = ioctl(ifc_ctl_sock, SIOCKILLADDR, &ifr);
|
||||||
ifc_close();
|
ifc_close();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IPv6. On Linux, when an interface goes down it loses all its IPv6
|
||||||
|
* addresses, so we don't know which connections belonged to that interface
|
||||||
|
* So we clear all unused IPv6 connections on the device by specifying an
|
||||||
|
* empty IPv6 address.
|
||||||
|
*/
|
||||||
|
ifc_init6();
|
||||||
|
// This implicitly specifies an address of ::, i.e., kill all IPv6 sockets.
|
||||||
|
memset(&ifr6, 0, sizeof(ifr6));
|
||||||
|
success = ioctl(ifc_ctl_sock6, SIOCKILLADDR, &ifr6);
|
||||||
|
if (result == 0) {
|
||||||
|
result = success;
|
||||||
|
}
|
||||||
|
ifc_close6();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue