3729 getifaddrs must learn to stop worrying and love the other address families

Review Request #318 - Created Jan. 4, 2017 and updated

Information
Sebastian Wiedenroth
illumos-gate
Reviewers
general

Presently getifaddrs enumerates network interface addresses only from AF_INET and AF_INET6.
This is contrary to the expectations of a small set of software (e.g. dhcpcd, olsrd) which expects this function to deal also in AF_LINK.

With this change getifaddrs() also returns AF_LINK entries, supplying the MAC address in 'ifa_addr' and a reasonably filled 'if_data_t' in 'ifa_data'.
This should be sufficient for most applications that are interested in things like the MAC address or the MTU.

Booted OI with this change, ran a small tool that prints the getifaddrs() details.
Ran the test tool with and without the environment variable GETIFADDRS_MAY_RETURN_AF_LINK=1 set.
Rebuild the test tool and retried.

Ran with libumem and ::findleaks on the test tool (that also calls freeifaddrs()) in all four combinations.

Issues

  • 0
  • 23
  • 6
  • 29
Description From Last Updated
Dan McDonald
Sebastian Wiedenroth
Yuri Pankov
Yuri Pankov
Robert Mustacchi
Robert Mustacchi
Robert Mustacchi
Dan McDonald
Dan McDonald
Sebastian Wiedenroth
Sebastian Wiedenroth
Sebastian Wiedenroth
Jason King
Jason King
Ship It!
Dan McDonald

   
usr/src/lib/libsocket/inet/getifaddrs.c (Diff revisions 5 - 7)
 
 

Why remove this line?

  1. This was a leftover that was missed from an even earlier version which used ioctls and ip instead of doors and datalinks.
    For links those ip flags don't make much sense (they are per ip address, not per link), so they should be zero.

Dan McDonald
Ship It!
Loading...