aboutsummaryrefslogtreecommitdiff
path: root/toys/net
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-07-17 13:22:39 -0700
committerRob Landley <rob@landley.net>2019-07-17 22:57:17 -0500
commitc86c275068d89c5e106a3b474eff750d2367017c (patch)
tree906372fe1fd4c431696d61baf0a70f6e38478612 /toys/net
parent25bfbb69be6cb5577285cb58d14b1b0c2a09e7d1 (diff)
downloadtoybox-c86c275068d89c5e106a3b474eff750d2367017c.tar.gz
ifconfig: fix for non-root on Android.
The change from ioctl to xioctl in 844f0d1aae28c54bbb672f53ba2cda182c572129 broke ifconfig for non-root on Android. SIOCGIFHWADDR has been protected to prevent device tracking since Nougat. Bug: https://issuetracker.google.com/137671590
Diffstat (limited to 'toys/net')
-rw-r--r--toys/net/ifconfig.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/toys/net/ifconfig.c b/toys/net/ifconfig.c
index dbe66d39..f8f1277e 100644
--- a/toys/net/ifconfig.c
+++ b/toys/net/ifconfig.c
@@ -133,8 +133,9 @@ static void display_ifconfig(char *name, int always, unsigned long long val[])
printf("%*c", 29-len, ' ');
}
- // query hardware type and hardware address
- xioctl(TT.sockfd, SIOCGIFHWADDR, &ifre);
+ // Query hardware type and hardware address.
+ // Not xioctl because you don't have permission for this on Android.
+ ioctl(TT.sockfd, SIOCGIFHWADDR, &ifre);
if (toys.optflags&FLAG_S)
for (i=0; i<6; i++) printf(":%02x"+!i, ifre.ifr_hwaddr.sa_data[i]);