Merge "ueventd: track platform device uevents to parse block device names"
diff --git a/init/property_service.c b/init/property_service.c
index be56a19..7fc4f65 100644
--- a/init/property_service.c
+++ b/init/property_service.c
@@ -189,15 +189,6 @@
__futex_wake(&pi->serial, INT32_MAX);
}
-static int property_write(prop_info *pi, const char *value)
-{
- int valuelen = strlen(value);
- if(valuelen >= PROP_VALUE_MAX) return -1;
- update_prop_info(pi, value, valuelen);
- return 0;
-}
-
-
/*
* Checks permissions for starting/stoping system services.
* AID_SYSTEM and AID_ROOT are always allowed.
@@ -384,8 +375,8 @@
}
r = recv(s, &msg, sizeof(msg), 0);
- close(s);
if(r != sizeof(prop_msg)) {
+ close(s);
ERROR("sys_prop: mis-match msg size recieved: %d expected: %d\n",
r, sizeof(prop_msg));
return;
@@ -416,6 +407,11 @@
default:
break;
}
+
+ // Note: bionic's property client code assumes that the property
+ // server will not close the socket until *AFTER* the property is
+ // written to memory.
+ close(s);
}
void get_property_workspace(int *fd, int *sz)
diff --git a/libnetutils/ifc_utils.c b/libnetutils/ifc_utils.c
index e5c58b9..946c39d 100644
--- a/libnetutils/ifc_utils.c
+++ b/libnetutils/ifc_utils.c
@@ -366,10 +366,12 @@
int ifc_reset_connections(const char *ifname)
{
#ifdef HAVE_ANDROID_OS
- int result;
+ int result, success;
in_addr_t myaddr;
struct ifreq ifr;
+ struct in6_ifreq ifr6;
+ /* IPv4. Clear connections on the IP address. */
ifc_init();
ifc_get_info(ifname, &myaddr, NULL, NULL);
ifc_init_ifr(ifname, &ifr);
@@ -377,6 +379,21 @@
result = ioctl(ifc_ctl_sock, SIOCKILLADDR, &ifr);
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;
#else
return 0;