Merge ~schopin/ubuntu/+source/systemd/+git/systemd-1:focal/hipersocket-dhcp into ~ubuntu-core-dev/ubuntu/+source/systemd:ubuntu-focal

Proposed by Simon Chopin
Status: Merged
Merged at revision: 326ae43b7966d9e7c5f7124027185a79a07fa276
Proposed branch: ~schopin/ubuntu/+source/systemd/+git/systemd-1:focal/hipersocket-dhcp
Merge into: ~ubuntu-core-dev/ubuntu/+source/systemd:ubuntu-focal
Diff against target: 179 lines (+165/-0)
2 files modified
debian/patches/lp1914740-network-enable-DHCP-broadcast-flag-if-required-by-in.patch (+164/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Dan Streetman Approve
Simon Chopin Pending
Review via email: mp+405961@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Simon Chopin (schopin) wrote :

I've uploaded a version ~ppa1 for review on the following PPA: https://launchpad.net/~schopin/+archive/ubuntu/test-ppa/

I don't have the rights to automatically run the autopkgtests on it, though.

Revision history for this message
Dan Streetman (ddstreet) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/patches/lp1914740-network-enable-DHCP-broadcast-flag-if-required-by-in.patch b/debian/patches/lp1914740-network-enable-DHCP-broadcast-flag-if-required-by-in.patch
2new file mode 100644
3index 0000000..0bcdd75
4--- /dev/null
5+++ b/debian/patches/lp1914740-network-enable-DHCP-broadcast-flag-if-required-by-in.patch
6@@ -0,0 +1,164 @@
7+From e70eca9b48df906a3e2d9f36d3acd4b5cb9ae553 Mon Sep 17 00:00:00 2001
8+From: Viktor Mihajlovski <mihajlov@linux.ibm.com>
9+Date: Wed, 14 Apr 2021 13:01:35 +0200
10+Subject: [PATCH] network: enable DHCP broadcast flag if required by interface
11+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/1914740
12+Origin: upstream, https://github.com/systemd/systemd/commit/e70eca9b48df906a3e2d9f36d3acd4b5cb9ae553
13+
14+Some interfaces require that the DHCPOFFER message is sent via broadcast
15+if they can't receive unicast messages before they've been configured
16+with an IP address.
17+
18+E.g., s390 ccwgroup network interfaces operating in layer3 mode face
19+this limitation. This can prevent the interfaces from receiving an
20+IP address via DHCP, if the have been configured for layer3.
21+
22+To allow DHCP over such interfaces, we're introducing a new device
23+property ID_NET_DHCP_BROADCAST which can be set for those.
24+The networkd DHCP client will check whether this property is set
25+for an interface, and if so will set the broadcast flag, unless
26+the network configuration for the interface has an explicit
27+RequestBroadcast setting.
28+
29+Besides that, we're adding a udev rule to set this device property
30+for ccwgroup devices operating in layer3 mode, which is the case
31+if the ID_NET_DRIVER property is qeth_l3.
32+
33+Supercedes #18829
34+---
35+ rules.d/81-net-dhcp.rules | 14 ++++++++++++
36+ rules.d/meson.build | 1 +
37+ src/network/networkd-dhcp4.c | 27 ++++++++++++++++++++++--
38+ src/network/networkd-network-gperf.gperf | 4 ++--
39+ src/network/networkd-network.c | 1 +
40+ src/network/networkd-network.h | 2 +-
41+ 6 files changed, 44 insertions(+), 5 deletions(-)
42+ create mode 100644 rules.d/81-net-dhcp.rules
43+
44+diff --git a/rules.d/81-net-dhcp.rules b/rules.d/81-net-dhcp.rules
45+new file mode 100644
46+index 0000000000..2ef25ba060
47+--- /dev/null
48++++ b/rules.d/81-net-dhcp.rules
49+@@ -0,0 +1,14 @@
50++# do not edit this file, it will be overwritten on update
51++
52++ACTION=="remove", GOTO="net_dhcp_end"
53++SUBSYSTEM!="net", GOTO="net_dhcp_end"
54++
55++# Network interfaces requiring DHCPOFFER messages to be broadcast
56++# must set ID_NET_DHCP_BROADCAST to "1". This property will be
57++# checked by the networkd DHCP4 client to set the DHCP option
58++
59++# s390 ccwgroup interfaces in layer3 mode need broadcast DHCPOFFER
60++# using the link driver to detect this condition
61++ENV{ID_NET_DRIVER}=="qeth_l3", ENV{ID_NET_DHCP_BROADCAST}="1"
62++
63++LABEL="net_dhcp_end"
64+diff --git a/rules.d/meson.build b/rules.d/meson.build
65+index 13d1d330cf..9dfc42fb94 100644
66+--- a/rules.d/meson.build
67++++ b/rules.d/meson.build
68+@@ -23,6 +23,7 @@ rules = files('''
69+ 78-sound-card.rules
70+ 80-drivers.rules
71+ 80-net-setup-link.rules
72++ 81-net-dhcp.rules
73+ '''.split())
74+
75+ install_data(rules,
76+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
77+index 13e3e32f40..2a90d324f6 100644
78+--- a/src/network/networkd-dhcp4.c
79++++ b/src/network/networkd-dhcp4.c
80+@@ -1318,6 +1318,30 @@ int dhcp4_set_client_identifier(Link *link) {
81+ return 0;
82+ }
83+
84++static bool link_needs_dhcp_broadcast(Link *link) {
85++ const char *val;
86++ int r;
87++
88++ assert(link);
89++ assert(link->network);
90++
91++ /* Return the setting in DHCP[4].RequestBroadcast if specified. Otherwise return the device property
92++ * ID_NET_DHCP_BROADCAST setting, which may be set for interfaces requiring that the DHCPOFFER message
93++ * is being broadcast because they can't handle unicast messages while not fully configured.
94++ * If neither is set or a failure occurs, return false, which is the default for this flag.
95++ */
96++ r = link->network->dhcp_broadcast;
97++ if (r < 0 && link->sd_device && sd_device_get_property_value(link->sd_device, "ID_NET_DHCP_BROADCAST", &val) >= 0) {
98++ r = parse_boolean(val);
99++ if (r < 0)
100++ log_link_warning_errno(link, r, "DHCP4 CLIENT: Failed to parse ID_NET_DHCP_BROADCAST, ignoring: %m");
101++ else
102++ log_link_debug(link, "DHCP4 CLIENT: Detected ID_NET_DHCP_BROADCAST='%d'.", r);
103++
104++ }
105++ return r == true;
106++}
107++
108+ int dhcp4_configure(Link *link) {
109+ sd_dhcp_option *send_option;
110+ void *request_options;
111+@@ -1354,8 +1378,7 @@ int dhcp4_configure(Link *link) {
112+ if (r < 0)
113+ return log_link_error_errno(link, r, "DHCP4 CLIENT: Failed to set callback: %m");
114+
115+- r = sd_dhcp_client_set_request_broadcast(link->dhcp_client,
116+- link->network->dhcp_broadcast);
117++ r = sd_dhcp_client_set_request_broadcast(link->dhcp_client, link_needs_dhcp_broadcast(link));
118+ if (r < 0)
119+ return log_link_error_errno(link, r, "DHCP4 CLIENT: Failed to set request flag for broadcast: %m");
120+
121+diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
122+index fb726c8634..15230612f0 100644
123+--- a/src/network/networkd-network-gperf.gperf
124++++ b/src/network/networkd-network-gperf.gperf
125+@@ -166,7 +166,7 @@ DHCPv4.RequestOptions, config_parse_dhcp_request_options,
126+ DHCPv4.Anonymize, config_parse_bool, 0, offsetof(Network, dhcp_anonymize)
127+ DHCPv4.SendHostname, config_parse_bool, 0, offsetof(Network, dhcp_send_hostname)
128+ DHCPv4.Hostname, config_parse_hostname, 0, offsetof(Network, dhcp_hostname)
129+-DHCPv4.RequestBroadcast, config_parse_bool, 0, offsetof(Network, dhcp_broadcast)
130++DHCPv4.RequestBroadcast, config_parse_tristate, 0, offsetof(Network, dhcp_broadcast)
131+ DHCPv4.VendorClassIdentifier, config_parse_string, 0, offsetof(Network, dhcp_vendor_class_identifier)
132+ DHCPv4.MaxAttempts, config_parse_dhcp_max_attempts, 0, 0
133+ DHCPv4.UserClass, config_parse_dhcp_user_class, 0, offsetof(Network, dhcp_user_class)
134+@@ -316,7 +316,7 @@ DHCP.UseRoutes, config_parse_bool,
135+ DHCP.Anonymize, config_parse_bool, 0, offsetof(Network, dhcp_anonymize)
136+ DHCP.SendHostname, config_parse_bool, 0, offsetof(Network, dhcp_send_hostname)
137+ DHCP.Hostname, config_parse_hostname, 0, offsetof(Network, dhcp_hostname)
138+-DHCP.RequestBroadcast, config_parse_bool, 0, offsetof(Network, dhcp_broadcast)
139++DHCP.RequestBroadcast, config_parse_tristate, 0, offsetof(Network, dhcp_broadcast)
140+ DHCP.CriticalConnection, config_parse_tristate, 0, offsetof(Network, dhcp_critical)
141+ DHCP.VendorClassIdentifier, config_parse_string, 0, offsetof(Network, dhcp_vendor_class_identifier)
142+ DHCP.UserClass, config_parse_dhcp_user_class, 0, offsetof(Network, dhcp_user_class)
143+diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
144+index 2e716b291e..4408c2ab24 100644
145+--- a/src/network/networkd-network.c
146++++ b/src/network/networkd-network.c
147+@@ -397,6 +397,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
148+ .dhcp_use_mtu = false,
149+ /* NOTE: from man: UseTimezone=... Defaults to "no".*/
150+ .dhcp_use_timezone = false,
151++ .dhcp_broadcast = -1,
152+ .rapid_commit = true,
153+
154+ .dhcp6_use_ntp = true,
155+diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h
156+index 266e40cef5..064dbe63c3 100644
157+--- a/src/network/networkd-network.h
158++++ b/src/network/networkd-network.h
159+@@ -103,7 +103,7 @@ struct Network {
160+ int ip_service_type;
161+ bool dhcp_anonymize;
162+ bool dhcp_send_hostname;
163+- bool dhcp_broadcast;
164++ int dhcp_broadcast;
165+ bool dhcp_use_dns;
166+ bool dhcp_routes_to_dns;
167+ bool dhcp_use_ntp;
168+--
169+2.30.2
170+
171diff --git a/debian/patches/series b/debian/patches/series
172index 969fdce..5c75354 100644
173--- a/debian/patches/series
174+++ b/debian/patches/series
175@@ -144,3 +144,4 @@ lp1891215/0001-fs-util-add-conservative_rename-that-suppresses-unne.patch
176 lp1891215/0002-resolved-don-t-update-resolv.conf-snippets-unnecessa.patch
177 lp1891215/0003-fs-util-rename-conservative_rename-conservative_rena.patch
178 lp1891215/0004-fs-util-make-sure-conservative_renameat-properly-det.patch
179+lp1914740-network-enable-DHCP-broadcast-flag-if-required-by-in.patch

Subscribers

People subscribed via source and target branches