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
---
 toys/net/ifconfig.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
From 79c6a78838b820f89488ae8da6fa38f6112e6841 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <[email protected]>
Date: Wed, 17 Jul 2019 13:22:39 -0700
Subject: [PATCH] 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
---
 toys/net/ifconfig.c | 5 +++--
 1 file 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]);
-- 
2.22.0.657.g960e92d24f-goog

_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to