Open mcr opened 3 years ago
to move the actual socket creation/manipulation/sendto/recvfrom() code into new .c files, so that a radvd-testing executable can be created that has mock functions. (A "link seam").
To me that is a reasonable path forward.
I can't promise that I'll get this organized before the end of April, so I suggest not blocking #127.
@mcr: What is the situation in 2024? Have you tested the 2.20-rc1 (2023-11-17)?
I have thought a bunch about how to test netlink dependant things. I looked at trying to put capture/replay code into libnl, but I gotta say that I found libnl not that helpful, and I had other things to do. radvd doesn't use libnl, and the netlink.c code is pretty sweet. It's not just netlink.c but also recv.c and send.c (really_send()) that need to have a seam inserted. The easiest in my opinion is to move the actual socket creation/manipulation/sendto/recvfrom() code into new .c files, so that a radvd-testing executable can be created that has mock functions. (A "link seam"). I have code that replaces send/recv with calls to pcap(3) functions. netlink sockets can now be captured, I think, with tcpdump, so we'd have a pcap file of RS,NS, etc.. and a pcap file of netlink messages. (Better would be a single pcap-ng file that had both, mixed in the order we need). And a pcap{,-ng} file for output that would capture RAs, NA/ND, etc. [I don't recall if we ever send NAs]