Merge "[ipsec-doze] Add fchown to IpSecService to support doze" am: 4edb4c8ec4 am: 5949912523

am: ad2180c3ba

Change-Id: Id6a5ff71ead4566b9a91b9e9b6c78d81f1ac0f54
This commit is contained in:
Benedict Wong
2017-12-20 18:58:30 +00:00
committed by android-build-merger

View File

@@ -988,12 +988,6 @@ public class IpSecService extends IIpSecService.Stub {
sockFd = Os.socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); sockFd = Os.socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
mUidFdTagger.tag(sockFd, callingUid); mUidFdTagger.tag(sockFd, callingUid);
if (port != 0) {
Log.v(TAG, "Binding to port " + port);
Os.bind(sockFd, INADDR_ANY, port);
} else {
port = bindToRandomPort(sockFd);
}
// This code is common to both the unspecified and specified port cases // This code is common to both the unspecified and specified port cases
Os.setsockoptInt( Os.setsockoptInt(
sockFd, sockFd,
@@ -1001,6 +995,14 @@ public class IpSecService extends IIpSecService.Stub {
OsConstants.UDP_ENCAP, OsConstants.UDP_ENCAP,
OsConstants.UDP_ENCAP_ESPINUDP); OsConstants.UDP_ENCAP_ESPINUDP);
mSrvConfig.getNetdInstance().ipSecSetEncapSocketOwner(sockFd, callingUid);
if (port != 0) {
Log.v(TAG, "Binding to port " + port);
Os.bind(sockFd, INADDR_ANY, port);
} else {
port = bindToRandomPort(sockFd);
}
userRecord.mEncapSocketRecords.put( userRecord.mEncapSocketRecords.put(
resourceId, resourceId,
new RefcountedResource<EncapSocketRecord>( new RefcountedResource<EncapSocketRecord>(