netplan reparses wifi when bridge member is listed before definition
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
netplan.io (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
Mantic |
Fix Released
|
Undecided
|
Unassigned | ||
Noble |
Fix Released
|
High
|
Unassigned |
Bug Description
[ Impact ]
Netplan will fail to generate network configuration if it finds the same access-point SSID
more than once in the configuration. This situation will happen if the user defined the
access-point more than once for the same interface in the same or different files and, worse,
if the parser required a second pass through the configuration.
The second scenario is particularly bad as it's hard to identify the problem without understanding
how the parser works.
Multiple definition of resources is common in Netplan and shouldn't lead to failures.
It's important to have this fixes backported to Mantic due to the Netplan + NetworkManager integration.
If the user ends up in this situation, they will not be able to use Network Manager as it will
always fail parse the Netplan configuration.
See https:/
This patch fixes the issue by gracefully handling access-point duplication. If the parser ever finds
the same access-point for the same interface, the old one will be discarded and replaced by the new
definition.
[ Test Plan ]
How to reproduce the issue:
1) Launch a LXD VM with Mantic
$ lxc launch ubuntu:mantic mantic --vm
$ lxc shell mantic
Problem one: multipass parsing will process interfaces twice
Create the following configuration
cat > /etc/netplan/
network:
bridges:
mybridge:
interfaces: [enp5s0]
ethernets:
enp5s0: {}
wifis:
wlp6s0:
access-
"mywifi":
password: "mypassword"
EOF
Run "netplan generate". You will get the error below:
Error in network definition: wlp6s0: Duplicate access point SSID 'mywifi'
This scenario is particularly bad because the access-point is clearly not
defined twice. Although, because the parser will walk through the configuration
twice, it will process it again.
Problem two: similar to problem one but with real duplication
Delete the previous file and create the configuration below:
rm /etc/netplan/
cat > /etc/netplan/
network:
wifis:
wlp6s0:
access-
"mywifi":
password: "mypassword"
EOF
cat > /etc/netplan/
network:
wifis:
wlp6s0:
access-
"mywifi":
password: "mypassword"
EOF
Run "netplan generate". You will get the same error:
Error in network definition: wlp6s0: Duplicate access point SSID 'mywifi'
The configuration is duplicated, but this shouldn't be a problem to Netplan.
Now update Netplan using the PPA https:/
and try the steps above again. Both the scenarios should work fine.
add-apt-repository ppa:danilogondo
apt update && apt -y upgrade
[ Where problems could occur ]
These changes affect how the parser handles access-points only so any issues
that it might introduce will manifest while parsing wifi interfaces.
Although, all the unit and integration tests are passing so we don't expect any
changes in behavior on scenarios that were working fine in Netplan. All NetworkManager's
autopkgtests are also passing (and they contain several tests related to Wifi).
[ Other Info ]
Note the this issue was reported back in 2018 and is still present in Netplan.
While it wasn't a priority, with the integration between Netplan and Network Manager
in Mantic, it became urgent.
---- Original bug description ----
1) # lsb_release -rd
Description: Ubuntu 18.04.1 LTS
Release: 18.04
2) # apt-cache policy netplan.io
netplan.io:
Installed: 0.36.3
Candidate: 0.40.1~18.04.3
Version table:
0.40.1~18.04.3 500
500 http://
*** 0.36.3 100
100 /var/lib/
0.36.1 500
500 http://
3) netplan generate creates configuration for a bridge with single member and wifi accesspoint
4) netplan generate returns error, "Duplicate access point SSID"
# netplan --debug generate
DEBUG:command generate: running ['/lib/
** (generate:5321): DEBUG: 20:44:08.972: Processing input file //etc/netplan/
** (generate:5321): DEBUG: 20:44:08.972: starting new processing pass
** (generate:5321): DEBUG: 20:44:08.972: recording missing yaml_node_t enp5s0
** (generate:5321): DEBUG: 20:44:08.973: wlp6s0: adding wifi AP 'palisades-guest'
** (generate:5321): DEBUG: 20:44:08.973: starting new processing pass
** (generate:5321): DEBUG: 20:44:08.973: wlp6s0: adding wifi AP 'palisades-guest'
Error in network definition //etc/netplan/
% cat /etc/netplan/
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/
# network: {config: disabled}
network:
bridges:
mybridge:
dhcp4: true
ethernets:
enp5s0:
dhcp4: no
wifis:
wlp6s0:
dhcp4: true
version: 2
Note, if I move the ethernet definition of enp5s0 before the bridge, netplan can parse it.
This appears to be related to parse.c:
ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: netplan.io 0.36.3
ProcVersionSign
Uname: Linux 4.15.0-36-generic x86_64
NonfreeKernelMo
ApportVersion: 2.20.9-0ubuntu7.4
Architecture: amd64
Date: Fri Dec 28 20:40:57 2018
ProcEnviron:
TERM=xterm-
PATH=(custom, no user)
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: netplan.io
UpgradeStatus: No upgrade log present (probably fresh install)
Related branches
- Lukas Märdian: Approve
-
Diff: 319 lines (+291/-0)4 files modifieddebian/changelog (+13/-0)
debian/patches/lp1809994/0010-parse-improve-the-parsing-of-access-points-LP-180999.patch (+197/-0)
debian/patches/lp1809994/0011-wifi-replace-the-previously-defined-AP-with-the-new-.patch (+79/-0)
debian/patches/series (+2/-0)
- Lukas Märdian: Approve
- Ubuntu Core Development Team: Pending requested
-
Diff: 318 lines (+290/-0)4 files modifieddebian/changelog (+12/-0)
debian/patches/lp1809994/0010-parse-improve-the-parsing-of-access-points-LP-180999.patch (+197/-0)
debian/patches/lp1809994/0011-wifi-replace-the-previously-defined-AP-with-the-new-.patch (+79/-0)
debian/patches/series (+2/-0)
Changed in netplan.io (Ubuntu): | |
status: | New → Triaged |
importance: | Undecided → High |
assignee: | nobody → Mathieu Trudel-Lapierre (cyphermox) |
tags: | added: fr-3791 |
tags: | removed: foundations-todo |
Changed in netplan.io (Ubuntu): | |
status: | Triaged → Fix Committed |
Changed in netplan.io (Ubuntu Noble): | |
assignee: | Mathieu Trudel-Lapierre (cyphermox) → nobody |
description: | updated |
Changed in netplan.io (Ubuntu Mantic): | |
status: | New → In Progress |
This impacts bonded interfaces on a fresh install of Ubuntu 18.04.3 LTS
# cat /etc/netplan/ 50-cloud- init.yaml
wlx00XXXXXXXXX XXX:
access- points:
"guest" :
mode: ap
password: "lol netplan"
addresses: [192.168.42.0/24]
optional: true
macaddress: xx:xx:xx:xx:xx:xx
addresses: [192.168.0.2/24]
nameserver s:
addresses: [8.8.8.8, 1.1.1.1]
interfaces :
parameters :
mode: broadcast
network:
wifis:
match:
bonds:
bond0:
dhcp4: false
dhcp6: false
# search: [lab, home]
- enp3s0
- enp5s0
ethernets:
enp3s0: {}
enp5s0: {}
version: 2
# netplan --debug generate netplan/ generate' ] 50-cloud- init.yaml. . 50-cloud- init.yaml: 12:16: Error in network definition: wlx00XXXXXXXXXXXX: Duplicate access point SSID 'guest'
"guest" :
DEBUG:command generate: running ['/lib/
** (generate:1388): DEBUG: 17:40:48.166: Processing input file /etc/netplan/
** (generate:1388): DEBUG: 17:40:48.166: starting new processing pass
** (generate:1388): DEBUG: 17:40:48.166: wlx00XXXXXXXXXXXX: adding wifi AP 'guest'
** (generate:1388): DEBUG: 17:40:48.166: recording missing yaml_node_t enp3s0
** (generate:1388): DEBUG: 17:40:48.166: recording missing yaml_node_t enp5s0
** (generate:1388): DEBUG: 17:40:48.166: starting new processing pass
** (generate:1388): DEBUG: 17:40:48.166: wlx00XXXXXXXXXXXX: adding wifi AP 'guest'
/etc/netplan/
^