[Bug 1809994] Re: netplan reparses wifi when bridge member is listed before definition

Launchpad Bug Tracker 1809994 at bugs.launchpad.net
Wed Nov 22 14:32:45 UTC 2023


This bug was fixed in the package netplan.io - 0.107-5ubuntu2

---------------
netplan.io (0.107-5ubuntu2) noble; urgency=medium

  * d/p/lp1809994/0010-parse-improve-the-parsing-of-access-points-LP-180999.patch.
    Improve access-points parsing. Properly handle access-points if a second
    pass if required in the parser and not report them as duplicates. (LP: #1809994)
  * d/p/lp1809994/0011-wifi-replace-the-previously-defined-AP-with-the-new-.patch.
    Overwrite the access-point object if another access-point with the same
    name is found instead of ignoring the new one. This behavior is closer
    to the merging process Netplan does.

 -- Danilo Egea Gondolfo <danilo.egea.gondolfo at canonical.com>  Tue, 14
Nov 2023 14:13:31 +0000

** Changed in: netplan.io (Ubuntu Noble)
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to netplan.io in Ubuntu.
Matching subscriptions: foundations-bugs
https://bugs.launchpad.net/bugs/1809994

Title:
  netplan reparses wifi when bridge member is listed before definition

Status in netplan.io package in Ubuntu:
  Fix Released
Status in netplan.io source package in Mantic:
  Fix Committed
Status in netplan.io source package in Noble:
  Fix Released

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://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1412

  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/10-config.yaml <<EOF
  network:
    bridges:
      mybridge:
        interfaces: [enp5s0]
    ethernets:
      enp5s0: {}
    wifis:
      wlp6s0:
        access-points:
          "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/10-config.yaml

  cat > /etc/netplan/10-config.yaml <<EOF
  network:
    wifis:
      wlp6s0:
        access-points:
          "mywifi":
            password: "mypassword"
  EOF

  cat > /etc/netplan/20-second-config.yaml <<EOF
  network:
    wifis:
      wlp6s0:
        access-points:
          "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://launchpad.net/~danilogondolfo/+archive/ubuntu/netplan
  and try the steps above again. Both the scenarios should work fine.

  add-apt-repository ppa:danilogondolfo/netplan
  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://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
   *** 0.36.3 100
          100 /var/lib/dpkg/status
       0.36.1 500
          500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages

  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/netplan/generate']
  ** (generate:5321): DEBUG: 20:44:08.972: Processing input file //etc/netplan/50-cloud-init.yaml..
  ** (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/50-cloud-init.yaml line 18 column 16: wlp6s0: Duplicate access point SSID 'palisades-guest'

  % cat /etc/netplan/50-cloud-init.yaml
  # 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/cloud.cfg.d/99-disable-network-config.cfg with the following:
  # network: {config: disabled}
  network:
      bridges:
          mybridge:
              interfaces: [enp5s0]
              dhcp4: true
      ethernets:
          enp5s0:
              dhcp4: no
      wifis:
          wlp6s0:
              dhcp4: true
              optional: true
              access-points:
                  "mywifi":
                      password: "mypass"
      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:add_missing_node() which tags it
  is missing a definition and then reparses.  This then attempts to
  parse wifis a second time and runs into a condition check that's meant
  to prevent duplicate SSIDs.

  ProblemType: Bug
  DistroRelease: Ubuntu 18.04
  Package: netplan.io 0.36.3
  ProcVersionSignature: Ubuntu 4.15.0-36.39-generic 4.15.18
  Uname: Linux 4.15.0-36-generic x86_64
  NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair
  ApportVersion: 2.20.9-0ubuntu7.4
  Architecture: amd64
  Date: Fri Dec 28 20:40:57 2018
  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: netplan.io
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/1809994/+subscriptions




More information about the foundations-bugs mailing list