-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu 19 Jun 2014 04:59:10 AM UTC, Robert Mustacchi wrote: > On 6/18/14 21:07 , Alain O'Dea via smartos-discuss wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> When I run some C code to get the MAC address of a VNIC >> sockaddr_ll->sll_addr is all zeroes. >> >> Here is the code in question with the particular line highlighted: >> https://github.com/AlainODea-haskell/network-info/blob/NetworkUnixIllumosHurd/cbits/network-unix.c#L36 >> >> Is that a bad way to get the MAC address of a VNIC? >> >> The other aspects of that code seem to have no trouble getting the >> IPv4 and IPv6 addresses, but the MAC address is being elusive. >> >> This is part of the network-info Haskell library which is a dependency >> of git-annex which I am trying to make usable on SmartOS. > > So, it looks like our implementation of getifaddrs() does not return > anything about AF_PACKET by default. I wrote a simple little C program > and ran it in my zone, and it only fired for IPv4/IPv6 addresses. > Instead, it appears that what's happened is that because you memset the > mac address, that's why we got all zeros. > > As for a better way to do this, I'm not 100% sure off hand, but I'll try > and get an answer for you. > > Here's that C program for reference, when building don't forget to link > -lnsl and -lsocket: > > /* > * Test getifaddrs behavior. > */ > > #include <sys/types.h> > #include <sys/socket.h> > #include <ifaddrs.h> > #include <stdio.h> > > int > main(int argc, const char *argv[]) > { > struct ifaddrs *ifa, *oif; > > if (getifaddrs(&ifa) != 0) { > perror("getifaddrs"); > return (1); > } > > oif = ifa; > while (ifa != NULL) { > printf("%s: [%d]\n", ifa->ifa_name, > ifa->ifa_addr->sa_family); > ifa = ifa->ifa_next; > } > > freeifaddrs(oif); > > return (0); > } > > > Robert
Thank you Robert. Is this is a bug in getifaddrs(3SOCKET)? This has no effect on git-annex since it uses V5 UUIDs already so it's not critical. Regrettably, the thing I am fixing is network-info which is just a utility library for getting IPv4, IPv6, and MAC addresses. Hopefully the maintainer will accept a partial implementation since it at least fixes the build. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJTouNvAAoJEP0rIXJNjNSActoIALA+GYavM7/S3xl2ujWA1IhA v8x979PswDc5xf8Tp0uAL45sNXHjD1rtKKOO55aw8/l2/qwwntpxMIv4RDPtFMKZ Na+eTba5mjH5bAnq0Pi+nV3g+2HzVUDd8n0+OJZpAQkdkCxlawyPB33ajGoijvtG P2NgkzHxy0qKft/EKoBqHq7J5YPHC1829nxCFbfCyB/6E6gwfxePuU9ojVCw37g0 zJKJUIT8yXUG5M6nHeEhZk9gdhyAuTymqf9Iw0IdrXrIpaCVcHFP7Eg9BDGAmJPw QGxGyCh8ToeNWZNAnvEtX665qcRJtXIQL5C95WZ7+DR3OdzTH/ZUUVuJ+Th+R8s= =hn9o -----END PGP SIGNATURE----- ------------------------------------------- smartos-discuss Archives: https://www.listbox.com/member/archive/184463/=now RSS Feed: https://www.listbox.com/member/archive/rss/184463/25769125-55cfbc00 Modify Your Subscription: https://www.listbox.com/member/?member_id=25769125&id_secret=25769125-7688e9fb Powered by Listbox: http://www.listbox.com
