-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dhcpcd: Add support for arp persist defence #273
dhcpcd: Add support for arp persist defence #273
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update dhcpcd.conf.5.in with the new option, next to the arp option and bump the date of it as well please.
src/arp.c
Outdated
logwarnx("%s: %d second defence failed for %s", | ||
ifp->name, DEFEND_INTERVAL, inet_ntoa(astate->addr)); | ||
eloop_timespec_diff(&now, &astate->defend, NULL) < | ||
DEFEND_INTERVAL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline before the opening curly brace please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/arp.c
Outdated
DEFEND_INTERVAL) { | ||
if ((ifp->options->options & | ||
DHCPCD_ARP_PERSISTDEFENCE) == | ||
DHCPCD_ARP_PERSISTDEFENCE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for == here - (a & b) will produce a truthy value.
Also, new line before the opening curly brace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/arp.c
Outdated
if ((ifp->options->options & | ||
DHCPCD_ARP_PERSISTDEFENCE) == | ||
DHCPCD_ARP_PERSISTDEFENCE) { | ||
logerrx("%s: %d second defence ignored as " \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scrap this diagnostic.
Just keep the existing diagnostic and early return if DHCPCD_ARP_PERSISTDEFENCE.
We can tell if it's set or not as the address will be kept or dropped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/dhcpcd.conf.5.in
Outdated
@@ -510,6 +510,8 @@ adding a new IPv4 address. | |||
.It Ic noarp | |||
Don't send any ARP requests. | |||
This also disables IPv4LL. | |||
.It Ic arp_persistdefence | |||
Keep the IP address even if defense fails upon IP Address conflict. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
British spelling of defence please :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good now, just one spelling issue to address and I'll merge it.
Oh yeah, add |
RFC 5227 recommends 3 ways to deal with address conflict detection. a) Stop everything. b) Defend and then stop on fail - this is what dhcpcd currently does. c) Notify and carry on. The current change implements the option c. A new option arp_persistdefence has been added and when this is enabled, the a defence is attempted upon a conflict and when that fails, an error is logged on every other conflict within the DEFEND_INTERVAL and the current IP address is retained. Fixes #272
Thanks for the patch! |
RFC 5227 recommends 3 ways to deal with address conflict detection.
a) Stop everything.
b) Defend and then stop on fail - this is what dhcpcd currently does.
c) Notify and carry on.
The current change implements the option c. A new option arp_persistdefence has been added and when this is enabled, the a defence is attempted upon a conflict and when that fails, an error is logged on every other conflict within the DEFEND_INTERVAL and the current IP address is retained.