Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69052994 authored by Sreeram Ramachandran's avatar Sreeram Ramachandran Committed by Android (Google) Code Review
Browse files

Merge "Support resetting connections tied to any nonexistent address." into lmp-dev

parents 228f8261 17622d09
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -36,6 +36,7 @@ extern int ifc_disable(const char *ifname);


#define RESET_IPV4_ADDRESSES 0x01
#define RESET_IPV4_ADDRESSES 0x01
#define RESET_IPV6_ADDRESSES 0x02
#define RESET_IPV6_ADDRESSES 0x02
#define RESET_IGNORE_INTERFACE_ADDRESS 0x04
#define RESET_ALL_ADDRESSES  (RESET_IPV4_ADDRESSES | RESET_IPV6_ADDRESSES)
#define RESET_ALL_ADDRESSES  (RESET_IPV4_ADDRESSES | RESET_IPV6_ADDRESSES)
extern int ifc_reset_connections(const char *ifname, const int reset_mask);
extern int ifc_reset_connections(const char *ifname, const int reset_mask);


+4 −2
Original line number Original line Diff line number Diff line
@@ -599,14 +599,16 @@ int ifc_reset_connections(const char *ifname, const int reset_mask)
{
{
#ifdef HAVE_ANDROID_OS
#ifdef HAVE_ANDROID_OS
    int result, success;
    int result, success;
    in_addr_t myaddr;
    in_addr_t myaddr = 0;
    struct ifreq ifr;
    struct ifreq ifr;
    struct in6_ifreq ifr6;
    struct in6_ifreq ifr6;


    if (reset_mask & RESET_IPV4_ADDRESSES) {
    if (reset_mask & RESET_IPV4_ADDRESSES) {
        /* IPv4. Clear connections on the IP address. */
        /* IPv4. Clear connections on the IP address. */
        ifc_init();
        ifc_init();
        if (!(reset_mask & RESET_IGNORE_INTERFACE_ADDRESS)) {
            ifc_get_info(ifname, &myaddr, NULL, NULL);
            ifc_get_info(ifname, &myaddr, NULL, NULL);
        }
        ifc_init_ifr(ifname, &ifr);
        ifc_init_ifr(ifname, &ifr);
        init_sockaddr_in(&ifr.ifr_addr, myaddr);
        init_sockaddr_in(&ifr.ifr_addr, myaddr);
        result = ioctl(ifc_ctl_sock, SIOCKILLADDR,  &ifr);
        result = ioctl(ifc_ctl_sock, SIOCKILLADDR,  &ifr);