[Toybox] IFCONFIG doubt

Ashwini Sharma ak.ashwini1981 at gmail.com
Tue Jun 28 22:12:16 PDT 2016


Hello Elliott,

I am writing my own native app (C) on Android where i need to get the MAC
addr of my device.

Thats why i wanted to have the IOCTL.

Regards,
Ashwini
On 28 Jun 2016 21:17, "enh" <enh at google.com> wrote:

> On Tue, Jun 28, 2016 at 1:45 AM, Ashwini Sharma
> <ak.ashwini1981 at gmail.com> wrote:
> > Hello enh,
> >
> > Android's original ifconfig was only showing the ip address for interface
> > and flags.
> >
> > Otherwise ifconfig on other platforms gives out lot of other details.
> Does
> > it do so on Android?
>
> since we switched to toybox ifconfig, it behaves the same as toybox
> ifconfig everywhere else:
>
> $ adb shell ifconfig
> dummy0    Link encap:Ethernet  HWaddr ae:7c:06:df:aa:06
>           inet6 addr: fe80::ac7c:6ff:fedf:aa06/64 Scope: Link
>           UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
>           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:0
>           RX bytes:0 TX bytes:210
>
> lo        Link encap:Local Loopback
>           inet addr:127.0.0.1  Mask:255.0.0.0
>           inet6 addr: ::1/128 Scope: Host
>           UP LOOPBACK RUNNING  MTU:65536  Metric:1
>           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:0
>           RX bytes:0 TX bytes:0
>
>
> > I  interested in how to get the MAC address at the ndk level. As earlier
> i
> > saw that SIOCGIFHWADDR is not supported.
>
> if you're in the untrustde_app SELinux domain, you won't be able to
> make that ioctl on Android. in other places it'll show up as
> all-zeros.
>
> > Is there a way to get the mac address.
> >
> > Thanks,
> > Ashwini
> >
> > On 27 Jun 2016 20:58, "enh" <enh at google.com> wrote:
> >
> > ---
> >  toys/android/start.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > _______________________________________________
> > Toybox mailing list
> > Toybox at lists.landley.net
> > http://lists.landley.net/listinfo.cgi/toybox-landley.net
> >
>
>
>
> --
> Elliott Hughes - http://who/enh - http://jessies.org/~enh/
> Android native code/tools questions? Mail me/drop by/add me as a reviewer.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20160629/afa665b5/attachment.htm>


More information about the Toybox mailing list