On Wed, Sep 24, 2025 at 12:47:22PM +1000, David Gibson wrote:
On Tue, Sep 23, 2025 at 09:13:22PM -0400, Jon Maloy wrote: [snip]
+ for (; RTA_OK(rta, na); rta = RTA_NEXT(rta, na)) { + switch (rta->rta_type) { + case NDA_DST: + dst = RTA_DATA(rta); + dstlen = RTA_PAYLOAD(rta); + break; + case NDA_LLADDR: + lladdr = RTA_DATA(rta); + lladdr_len = RTA_PAYLOAD(rta); + break; + default: + break; + } + }
It seems like somewhere there ought to be something specifying the address type of both DST and LLADDR, but I'm not sure exactly where. We should check those, just in case some weirdo runs us on a host with IPX over Token Ring.
Looked into this a bit more. The LLADDR type is a property of the link. I don't know if we get an RTM_NEWLINK before RTM_NEWNEIGH on the subscription channel. If so, we can check that and give up if it's not ARPHRD_ETHER. If not, we should probably probe the LLADDR type via our normal netlink socket and only subscribe if it is ARPHRD_ETHER. For the protocol address type, it looks to be in ndm->ndm_family, though rtnetlink(7) doesn't make that very clear. We should check that, not just the address length. -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson