Skip to content

Conversation

@ssahani
Copy link
Contributor

@ssahani ssahani commented Nov 21, 2019

closes #2527

@ssahani ssahani force-pushed the acd-duplicate-ip branch 4 times, most recently from 0d5f385 to 80b9e0d Compare November 22, 2019 03:12
@ssahani ssahani changed the title network: introduce DAD for static address network: introduce DAD for static IPV4 address Nov 22, 2019
@yuwata yuwata added the network label Nov 22, 2019
@yuwata
Copy link
Member

yuwata commented Nov 24, 2019

@ssahani LGTM. I have adjusted log level and log message, and also fixed an memory use-after-free. Change can see from here. PTAL.

@yuwata yuwata added this to the v245 milestone Nov 24, 2019
@yuwata
Copy link
Member

yuwata commented Nov 24, 2019

(v244-rc1 was released. Let's merge this after v244 release.)

@ssahani
Copy link
Contributor Author

ssahani commented Nov 24, 2019

Thank you. LGTM

@yuwata yuwata force-pushed the acd-duplicate-ip branch 2 times, most recently from 49ba008 to 78ab099 Compare November 26, 2019 15:56
@yuwata
Copy link
Member

yuwata commented Nov 26, 2019

A test case is also added.

</listitem>
</varlistentry>
<varlistentry>
<term><varname>IPv4DuplicateAddressDetection=</varname></term>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is yet another option really needed? we already have DuplicateAddressDetection=, currently only used for IPv6. It could be generalized to apply to both address families: use IPv4 ACD if the address is v4, use IPv6 DAD if the address is v6.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds nice. Thanks. I'd like to update so. @ssahani Do you agree with that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that DuplicateAddressDetection= is controversial. If set to yes, then NODAD flag is set. Maybe, we should deprecate the setting, and introduce IPv6DuplicateAddressDetection=.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes . It works for IPv6. We set this and kernel does the DAD. Mixing up will not work. Renaming indeed is nice.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I didn't realize DuplicateAddressDetection= logic was inverted. Definitely surprising and user-unfriendly.

Unfortunately, there is already a IPv6DuplicateAddressDetection= option in the [Network] section. Could it be a source of confusion to have the same option name in different sections with different semantics?

@yuwata
Copy link
Member

yuwata commented Dec 4, 2019

@ssahani and @Pesa PTAL the last commit.

@yuwata
Copy link
Member

yuwata commented Dec 4, 2019

Hmm... I noticed that PrefixRoute= is also inverted... But let's fix that in another PR.

@yuwata
Copy link
Member

yuwata commented Dec 4, 2019

@ssahani I added one more commit. PTAL.

@ssahani
Copy link
Contributor Author

ssahani commented Dec 4, 2019

LGTM

address->section->filename, address->section->line);
}

if (address->family != AF_INET && address->ipv4_duplicate_address_detection) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should there be a similar check for ipv6 DAD on non-ipv6 addresses?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NODAD flag for IPv4 address should be silently ignored by kernel. So, I think it is not necessary.

@yuwata
Copy link
Member

yuwata commented Dec 5, 2019

@keszybz Could you take a final look?

<term><varname>IPv4DuplicateAddressDetection=</varname></term>
<listitem>
<para>Takes a boolean. When true performs IPv4 Duplicate Address Detection. See
<ulink url="https://tools.ietf.org/html/rfc5227">RFC 5224</ulink>. Defaults to false.</para>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, let's not add yet another option. If users wants DAD, then most likely they want both ipv4 and ipv6, and don't care about internal implementation details, i.e. whether this is the kernel that is doing this or the user space.

Let's do the following: make DuplicateAddressDetection take: yes|no, "both", "ipv4", "ipv6". If yes|no, then warn about the inverted meaning and set according to current semantics. If "ipv4", enable for IPv4, if "ipv6", enable for IPv6, if "both" enable for both.

This is easier for the users, and will give us more flexibility to add new variants of this setting in the future.

switch (event) {

case SD_IPV4ACD_EVENT_STOP:
log_link_debug(link, "Stopping ACD client ...");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No space before the ellipsis. (Right now it looks like the ellipsis is a placeholder for a client name.)

return;

case SD_IPV4ACD_EVENT_BIND:
log_link_debug(link, "Successfully claimed address '%s'", strna(pretty));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No quotes around the address.

@yuwata yuwata added the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Dec 5, 2019
@yuwata yuwata removed the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Dec 6, 2019
@yuwata
Copy link
Member

yuwata commented Dec 6, 2019

@keszybz Thank you for the comments. Updated. PTAL.

Copy link
Member

@keszybz keszybz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good, except for the backwards compat part (which I may be misunderstanding, so please be patient).

@keszybz keszybz added the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Dec 6, 2019
@yuwata yuwata removed the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Dec 6, 2019
@yuwata
Copy link
Member

yuwata commented Dec 6, 2019

@keszybz Updated. Please take another look. Thank you.

Copy link
Member

@keszybz keszybz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there.

r = parse_boolean(rvalue);
if (r >= 0) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"For historical reason, %s=%s means %s=%s. "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"reasons"

@yuwata yuwata added good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed and removed good-to-merge/with-minor-suggestions labels Dec 6, 2019
@yuwata
Copy link
Member

yuwata commented Dec 6, 2019

@keszybz Thank you for the review. The two comments are addressed now. I've updated the green label.

@yuwata yuwata merged commit 43a2005 into systemd:master Dec 7, 2019
@ssahani ssahani deleted the acd-duplicate-ip branch March 27, 2020 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed network new-feature

Development

Successfully merging this pull request may close these issues.

systemd-networkd IP stealing

4 participants