Skip to content

Commit 14772f9

Browse files
committed
Merge branch 'main' of https://github.com/davidekete/netplan into Fix-docs-directory-structure-to-reflect-Diátaxis
2 parents 6e95365 + 52ea6f3 commit 14772f9

File tree

22 files changed

+520
-87
lines changed

22 files changed

+520
-87
lines changed

.github/workflows/autopkgtest.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
cp -r netplan.io-*/debian .
4949
rm -r debian/patches/ # clear any distro patches
5050
sed -i 's|iproute2,|iproute2, ethtool,|' debian/control # add ethtool as a dependency of netplan.io temporarily
51+
sed -i 's|systemd (>= 257.2-3ubuntu1~),|systemd (>= 248~),|g' debian/control # see https://github.com/canonical/netplan/pull/535
5152
TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) # find latest (stable) tag
5253
REV=$(git rev-parse --short HEAD) # get current git revision
5354
VER="$TAG+git~$REV"
@@ -57,4 +58,5 @@ jobs:
5758
autopkgtest . -U \
5859
--env=DPKG_GENSYMBOLS_CHECK_LEVEL=0 \
5960
--env=NETPLAN_PARSER_IGNORE_ERRORS=1 \
60-
-- lxd autopkgtest/ubuntu/noble/amd64
61+
-- lxd autopkgtest/ubuntu/noble/amd64 \
62+
|| test $? -eq 2 # allow wifi test to be skipped (exit code = 2)

.github/workflows/network-manager.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
pull-lp-source netplan.io
4242
cp -r netplan.io-*/debian .
4343
rm -r debian/patches/ # clear any distro patches
44+
sed -i 's|systemd (>= 257.2-3ubuntu1~),|systemd (>= 248~),|g' debian/control # see https://github.com/canonical/netplan/pull/535
4445
echo "3.0 (native)" > debian/source/format # force native build
4546
TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) # find latest (stable) tag
4647
REV=$(git rev-parse --short HEAD) # get current git revision

.github/workflows/rpmbuild.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ jobs:
3434
dnf -y builddep rpm/netplan.spec
3535
adduser test
3636
chown -R test:test .
37-
su test -c 'rpmbuild -bi --build-in-place rpm/netplan.spec'
37+
su test -c 'rpmbuild -bi -D "debug_package %{nil}" --build-in-place rpm/netplan.spec'

.github/workflows/spread.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ jobs:
1818
- uses: actions/checkout@v3
1919
- name: Install spread
2020
run: |
21-
# TODO: Once Spread PR #179 is merged, go back to:
22-
# go install github.com/snapcore/spread/cmd/spread@latest
23-
git clone --depth 1 --branch thp https://github.com/thp-canonical/spread spread-fork
24-
cd spread-fork && go install ./cmd/spread
25-
cd .. && rm -r spread-fork
21+
go install github.com/snapcore/spread/cmd/spread@latest
2622
- name: Run the spread test inside LXD
2723
run: |
2824
~/go/bin/spread -v lxd:

doc/reference/netplan-yaml.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ Match devices by MAC when setting options like: `wakeonlan` or `*-offload`.
462462

463463
- **`gateway4`**, **`gateway6`** (scalar)
464464

465-
> Deprecated, see `Default routes`.
465+
> Deprecated, see [Default routes](#default-routes).
466466
> Set default gateway for IPv4/6, for manual address configuration. This
467467
> requires setting `addresses` too. Gateway IP addresses must be in a form
468468
> recognised by **`inet_pton`**(3). There should only be a single gateway
@@ -879,6 +879,9 @@ network:
879879
> Specify a priority for the routing policy rule, to influence the order
880880
> in which routing rules are processed. A higher number means lower
881881
> priority: rules are processed in order by increasing priority number.
882+
> Specifying an explicit, unique, priority for each routing policy rule
883+
> is strongly recommended and is mandatory on the `NetworkManager`
884+
> back-end.
882885

883886
- **`mark`** (scalar)
884887

@@ -907,7 +910,8 @@ interfaces, as well as individual Wi-Fi networks, by means of the `auth` block.
907910
- **`key-management`** (scalar)
908911

909912
> The supported key management modes are `none` (no key management);
910-
> `psk` (WPA with pre-shared key, common for home Wi-Fi); `eap` (WPA
913+
> `psk` (WPA with pre-shared key, common for home Wi-Fi); `psk-sha256`
914+
> (WPA2 with pre-shared key, common for home Wi-Fi); `eap` (WPA
911915
> with EAP, common for enterprise Wi-Fi); `eap-sha256` (used with WPA3-Enterprise);
912916
> `eap-suite-b-192` (used with WPA3-Enterprise); `sae` (used by WPA3);
913917
> and `802.1x` (used primarily for wired Ethernet connections).

netplan_cli/cli/commands/apply.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,13 @@ def command_apply(self, run_generate=True, sync=False, exit_on_error=True, state
252252
stderr=subprocess.DEVNULL)
253253

254254
subprocess.check_call(['udevadm', 'control', '--reload'])
255-
subprocess.check_call(['udevadm', 'trigger', '--action=move', '--subsystem-match=net', '--settle'])
255+
256+
try:
257+
subprocess.check_call(['udevadm', 'trigger', '--action=move', '--subsystem-match=net', '--settle'])
258+
except subprocess.CalledProcessError as e:
259+
# udevadm trigger returns 1 if it cannot trigger devices since
260+
# systemd v248, e.g. in containers (LP: #2095203)
261+
logging.warning('Ignoring device trigger error: {}'.format(e))
256262

257263
# apply any SR-IOV related changes, if applicable
258264
NetplanApply.process_sriov_config(config_manager, exit_on_error)

src/abi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ typedef enum {
145145
NETPLAN_AUTH_KEY_MANAGEMENT_WPA_EAPSUITE_B_192,
146146
NETPLAN_AUTH_KEY_MANAGEMENT_8021X,
147147
NETPLAN_AUTH_KEY_MANAGEMENT_WPA_SAE,
148+
NETPLAN_AUTH_KEY_MANAGEMENT_WPA_PSKSHA256,
148149
NETPLAN_AUTH_KEY_MANAGEMENT_MAX,
149150
} NetplanAuthKeyManagementType;
150151

src/names.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ static const char* const
5959
netplan_auth_key_management_type_to_str[NETPLAN_AUTH_KEY_MANAGEMENT_MAX] = {
6060
[NETPLAN_AUTH_KEY_MANAGEMENT_NONE] = "none",
6161
[NETPLAN_AUTH_KEY_MANAGEMENT_WPA_PSK] = "psk",
62+
[NETPLAN_AUTH_KEY_MANAGEMENT_WPA_PSKSHA256] = "psk-sha256",
6263
[NETPLAN_AUTH_KEY_MANAGEMENT_WPA_EAP] = "eap",
6364
[NETPLAN_AUTH_KEY_MANAGEMENT_WPA_EAPSHA256] = "eap-sha256",
6465
[NETPLAN_AUTH_KEY_MANAGEMENT_WPA_EAPSUITE_B_192] = "eap-suite-b-192",

src/networkd.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,10 @@ append_wpa_auth_conf(GString* s, const NetplanAuthenticationSettings* auth, cons
11881188
g_string_append(s, " key_mgmt=WPA-PSK\n");
11891189
break;
11901190

1191+
case NETPLAN_AUTH_KEY_MANAGEMENT_WPA_PSKSHA256:
1192+
g_string_append(s, " key_mgmt=WPA-PSK WPA-PSK-SHA256\n");
1193+
break;
1194+
11911195
case NETPLAN_AUTH_KEY_MANAGEMENT_WPA_EAP:
11921196
g_string_append(s, " key_mgmt=WPA-EAP\n");
11931197
break;

src/nm.c

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,64 @@ write_routes_nm(const NetplanNetDefinition* def, GKeyFile *kf, gint family, GErr
254254
j++;
255255
}
256256
}
257+
258+
return TRUE;
259+
}
260+
261+
STATIC gboolean
262+
write_ip_rules_nm(const NetplanNetDefinition* def, GKeyFile *kf, gint family, GError** error)
263+
{
264+
const gchar* group = NULL;
265+
gchar* tmp_key = NULL;
266+
GString* tmp_val = NULL;
267+
268+
if (family == AF_INET)
269+
group = "ipv4";
270+
else if (family == AF_INET6)
271+
group = "ipv6";
272+
g_assert(group != NULL);
273+
274+
if (def->ip_rules != NULL) {
275+
for (unsigned i = 0, j = 1; i < def->ip_rules->len; ++i) {
276+
const NetplanIPRule *cur_rule = g_array_index(def->ip_rules, NetplanIPRule*, i);
277+
278+
if (cur_rule->family != family)
279+
continue;
280+
281+
/* NetworkManager requires that priority be specified. This is
282+
* also in-line with the iproute2 guidance that "Each rule should
283+
* have an explicitly set unique priority value"[1].
284+
* [1]http://www.policyrouting.org/iproute2.doc.html#ss9.6.1 */
285+
if (cur_rule->priority == NETPLAN_IP_RULE_PRIO_UNSPEC) {
286+
g_set_error(error, NETPLAN_BACKEND_ERROR, NETPLAN_ERROR_UNSUPPORTED,
287+
"ERROR: %s: The priority setting is mandatory for NetworkManager routing-policy\n", def->id);
288+
return FALSE;
289+
}
290+
291+
tmp_key = g_strdup_printf("routing-rule%u", j);
292+
tmp_val = g_string_sized_new(200);
293+
294+
g_string_printf(tmp_val, "priority %u", cur_rule->priority);
295+
296+
if (cur_rule->from)
297+
g_string_append_printf(tmp_val, " from %s", cur_rule->from);
298+
if (cur_rule->to)
299+
g_string_append_printf(tmp_val, " to %s", cur_rule->to);
300+
if (cur_rule->tos != NETPLAN_IP_RULE_TOS_UNSPEC)
301+
g_string_append_printf(tmp_val, " tos %u", cur_rule->tos);
302+
if (cur_rule->fwmark != NETPLAN_IP_RULE_FW_MARK_UNSPEC)
303+
g_string_append_printf(tmp_val, " fwmark %u", cur_rule->fwmark);
304+
if (cur_rule->table != NETPLAN_ROUTE_TABLE_UNSPEC)
305+
g_string_append_printf(tmp_val, " table %u", cur_rule->table);
306+
307+
g_key_file_set_string(kf, group, tmp_key, tmp_val->str);
308+
g_free(tmp_key);
309+
g_string_free(tmp_val, TRUE);
310+
311+
j++;
312+
}
313+
}
314+
257315
return TRUE;
258316
}
259317

@@ -457,6 +515,7 @@ write_wifi_auth_parameters(const NetplanAuthenticationSettings* auth, GKeyFile *
457515
case NETPLAN_AUTH_KEY_MANAGEMENT_NONE:
458516
break;
459517
case NETPLAN_AUTH_KEY_MANAGEMENT_WPA_PSK:
518+
case NETPLAN_AUTH_KEY_MANAGEMENT_WPA_PSKSHA256:
460519
g_key_file_set_string(kf, "wifi-security", "key-mgmt", "wpa-psk");
461520
break;
462521
case NETPLAN_AUTH_KEY_MANAGEMENT_WPA_EAP:
@@ -716,6 +775,8 @@ write_nm_conf_access_point(const NetplanNetDefinition* def, const char* rootdir,
716775
g_key_file_set_uint64(kf, "vrf", "table", def->vrf_table);
717776
if (!write_routes_nm(def, kf, AF_INET, error) || !write_routes_nm(def, kf, AF_INET6, error))
718777
return FALSE;
778+
if (!write_ip_rules_nm(def, kf, AF_INET, error) || !write_ip_rules_nm(def, kf, AF_INET6, error))
779+
return FALSE;
719780
}
720781

721782
if (def->type == NETPLAN_DEF_TYPE_VETH && def->veth_peer_link) {
@@ -871,6 +932,8 @@ write_nm_conf_access_point(const NetplanNetDefinition* def, const char* rootdir,
871932
write_search_domains(def, "ipv4", kf);
872933
if (!write_routes_nm(def, kf, AF_INET, error))
873934
return FALSE;
935+
if (!write_ip_rules_nm(def, kf, AF_INET, error))
936+
return FALSE;
874937
}
875938

876939
if (!def->dhcp4_overrides.use_routes) {
@@ -917,6 +980,9 @@ write_nm_conf_access_point(const NetplanNetDefinition* def, const char* rootdir,
917980
if (!write_routes_nm(def, kf, AF_INET6, error))
918981
return FALSE;
919982

983+
if (!write_ip_rules_nm(def, kf, AF_INET6, error))
984+
return FALSE;
985+
920986
if (!def->dhcp6_overrides.use_routes) {
921987
g_key_file_set_boolean(kf, "ipv6", "ignore-auto-routes", TRUE);
922988
g_key_file_set_boolean(kf, "ipv6", "never-default", TRUE);

0 commit comments

Comments
 (0)