On Mon, Apr 13, 2020 at 02:00:22PM -0500, Ian Pilcher wrote: > First off, please let me know if this list isn't an appropriate place > for these sorts of questions. > > With that out of the way, I'm trying to understand the sample program > at: > > http://git.netfilter.org/libmnl/tree/examples/rtnl/rtnl-link-dump.c > > I've been able to puzzle most of it out, but I'm confused by the > use of the struct rtgenmsg (declared on line 88 and used on lines > 95-96). > > * Based on rtnetlink(7), shouldn't this more properly be a struct > ifinfomsg (even though only rtgen_family/ifi_family is set)? RTM_GETLINK expects ifinfomsg, yes. > * More importantly, why is setting this to AF_PACKET required at all? > Testing the program without setting it reveals that it definitely is > required, but I haven't been able to find anything that explains *why* > that is the case. Probably AF_UNSPEC is more appropriate there?