Page MenuHomeFreeBSD

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

Authored by melifaro on Feb 19 2021, 7:52 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
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 37201
Build 34090: arc lint + arc unit

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.

1474

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.