Skip to content
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

network: IPv4LL and ACD fixes #19980

Merged
merged 30 commits into from
Jun 30, 2021
Merged

Conversation

yuwata
Copy link
Member

@yuwata yuwata commented Jun 20, 2021

Fixes #12145.
Fixes #17235.

@yuwata yuwata force-pushed the sd-ipv4acd-filter-all-hwaddr branch 3 times, most recently from 3fd3b72 to 2533069 Compare June 22, 2021 07:45
@yuwata yuwata changed the title [WIP] network: IPv4LL and ACD fixes network: IPv4LL and ACD fixes Jun 22, 2021
@yuwata yuwata added this to the v249 milestone Jun 22, 2021
@yuwata
Copy link
Member Author

yuwata commented Jun 22, 2021

I added this to v249 milestone. If this is too late to be included in v249, feel free to drop it. But this is slightly large, and maybe hard to backport this after v249.

@yuwata yuwata force-pushed the sd-ipv4acd-filter-all-hwaddr branch 2 times, most recently from 12eaca2 to 0d5df6b Compare June 22, 2021 15:21
@poettering poettering added reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks and removed needs-review labels Jun 24, 2021
@yuwata yuwata force-pushed the sd-ipv4acd-filter-all-hwaddr branch from 0d5df6b to 4f6cf24 Compare June 25, 2021 14:54
@yuwata yuwata added needs-review and removed reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks labels Jun 25, 2021
@yuwata yuwata force-pushed the sd-ipv4acd-filter-all-hwaddr branch from 4f6cf24 to d2158fa Compare June 25, 2021 14:58
@yuwata
Copy link
Member Author

yuwata commented Jun 25, 2021

@poettering Thank you for your review. Now, the callback mechanisms which checks the sender hardware address is introduced to sd-ipv4acd and sd-ipv4ll. PTAL.

@yuwata yuwata force-pushed the sd-ipv4acd-filter-all-hwaddr branch 5 times, most recently from 9fc741a to a535d93 Compare June 25, 2021 23:04
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.

LGTM. I'd be inclined to merge this for 249.

src/network/networkd-link.c Show resolved Hide resolved
src/network/networkd-ipv4ll.c Show resolved Hide resolved
src/network/networkd-address.c Show resolved Hide resolved
Comment on lines 32 to 101
r = address_remove(address, link);
if (r < 0) {
log_link_warning_errno(link, r, "Failed to remove address "IPV4_ADDRESS_FMT_STR": %m",
IPV4_ADDRESS_FMT_VAL(address->in_addr.in));
link_enter_failed(link);
}
break;
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, so we remove the address if the acd client is stopped… Or in other words, we effectively add an address by creating the acd client for it, and remove it by stopping the acd client… I wonder if we should then rename things, to emphasize the "address" part and de-emphesize the "conflict detection" part. But I don't have any good suggestions.

Copy link
Member Author

Choose a reason for hiding this comment

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

You mean about the log messages? The messages in the callback function is updated. PTAL.

yuwata added 18 commits July 1, 2021 00:49
See RFC 5227 section 2.1.1.

This introduces a callback which intend to a library user, e.g.
networkd, checks whether the sender hardware address is a MAC address of
the host's intrerface or not.
This also renames link_get() -> link_get_by_index().
…e the length of the hardware address is not ETH_ALEN

Currently, sd-ipv4acd assumes hardware address is ETH_ALEN.
Currently, networkd does not set tentative flag on create, and kernel
ignore the flag on remove. So, this commit does not change any current
behaviour. This is just a preparation for later commits.
Previously, if IPv4 ACD is enabled on an address, then we first
assign the address, and start sd-ipv4acd daemon for the address.
This is not only RFC incompliant, but also the address is always
dropped, as the daemon always considers the address is conflicted.

This commit makes networkd first starts sd-ipv4acd daemon to probe
the address, and then the address is configured if no conflict is
detected.

Fixes systemd#17235.
@yuwata yuwata force-pushed the sd-ipv4acd-filter-all-hwaddr branch from a535d93 to 4492443 Compare June 30, 2021 15:50
@yuwata
Copy link
Member Author

yuwata commented Jun 30, 2021

@keszybz Thank you for your review. Force-pushed a revised version. In addition to the above points you commented, the following changes are applied.

  • in dhcp_lease_lost(), now the pending request is also dropped.
  • in on_acd(), DHCPv4 address is not removed in the function, but dhcp_lease_lost() drop it.
  • split on_acd() into several small functions.

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.

s390x: "boot-and-services": test_service (__main__.NspawnTest) ... Failed to dump process list for 'systemd-nspawn@c1.service', ignoring: Unit systemd-nspawn@c1.service not loaded.
Looks unrelated.

LGTM, let's get this merged.

/* Unlikely, but during probing the address, the lease may be lost. */
return 0;

log_link_warning(link, "Dropping DHCPv4 lease, as an address conflict is detected.");
Copy link
Member

Choose a reason for hiding this comment

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

"is" → "was"

@keszybz keszybz merged commit 807aa0b into systemd:main Jun 30, 2021
@yuwata yuwata deleted the sd-ipv4acd-filter-all-hwaddr branch June 30, 2021 20:54
yuwata added a commit to yuwata/systemd that referenced this pull request Jun 30, 2021
yuwata added a commit to yuwata/systemd that referenced this pull request Jul 1, 2021
mrc0mmand pushed a commit to mrc0mmand/rhel-9 that referenced this pull request Jul 2, 2021
mrc0mmand pushed a commit to mrc0mmand/rhel-9 that referenced this pull request Jul 2, 2021
jamacku pushed a commit to redhat-plumbers/systemd-rhel9 that referenced this pull request Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants