Page MenuHomeFreeBSD

Fix `arp -d` / `ndp -d`.

Authored by melifaro on Feb 19 2021, 7:52 PM.



Recent changes ( 2fe5a79425c7 ) pushed RTA_DST masking from route control code to the rtsock code.

It broke arp/ndp deletion.
It turns out, arp/ndp perform RTM_GET request first to gen an interface index, then simply stamp it with RTF_LLDATA and update the command to be RTM_DELETE.

As the kernel has always ignored pretty much everything except RTA_DST, RTA_GATEWAY and RTF_ANNOUNCE, it worked.

Fix this by removing RTA_NETMASK for RTF_LLINFO messages in the early phase.

While here, cleanup some unused code from arp/ndp (proper fix to handle RTM_DELETE will be done separately).

Diff Detail

R10 FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

melifaro added reviewers: kp, network.

Is this a problem of the kernel or the laziness of the arp code?

gnn added a subscriber: gnn.

Couple of nits but otherwise LGTM.


Remove spare blank line please.


Also this one.

This revision is now accepted and ready to land.Feb 19 2021, 8:59 PM

Is this a problem of the kernel or the laziness of the arp code?

I'd say it's the problem of both due to the undefined contract.

Technically speaking, the kernel doesn't need RTA_NETMASK at all, as we always operate on a single entry.
arp(8) was indeed lazy and, so simply worked until the recent times where I added a bit more input normalisation stuff.

melifaro added inline comments.

oh wow!
I missed this style(9). Awesome we don't need to do it now.