Page MenuHomeFreeBSD

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

Authored by melifaro on Feb 19 2021, 7:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 5, 2:28 PM
Unknown Object (File)
Fri, Nov 1, 5:40 PM
Unknown Object (File)
Fri, Oct 18, 11:24 AM
Unknown Object (File)
Fri, Oct 18, 1:51 AM
Unknown Object (File)
Wed, Oct 16, 3:05 AM
Unknown Object (File)
Tue, Oct 15, 10:17 AM
Unknown Object (File)
Mon, Oct 14, 10:20 AM
Unknown Object (File)
Fri, Oct 11, 9:24 PM

Details

Summary

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

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
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.

sys/net/rtsock.c
1382

Remove spare blank line please.

1473

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.
sys/net/rtsock.c
1382

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