Merge "Revert^3 "Soft-enables new MAC address restrictions.""

This commit is contained in:
Elliott Hughes 2020-12-01 18:30:28 +00:00 committed by Gerrit Code Review
commit 4984bda13e

View file

@ -306,9 +306,12 @@ int getifaddrs(ifaddrs** out) {
// Open the netlink socket and ask for all the links and addresses.
NetlinkConnection nc;
// SELinux policy only allows RTM_GETLINK messages to be sent by system apps.
// SELinux policy only allows RTM_GETLINK messages to be sent by:
// - System apps
// - Apps with a target SDK version lower than R
bool getlink_success = false;
if (getuid() < FIRST_APPLICATION_UID) {
if (getuid() < FIRST_APPLICATION_UID ||
android_get_application_target_sdk_version() < __ANDROID_API_R__) {
getlink_success = nc.SendRequest(RTM_GETLINK) && nc.ReadResponses(__getifaddrs_callback, out);
}
bool getaddr_success =