Incomplete network info showing in both web and API :: landscape-server 23.03

Bug #2052834 reported by Mark Cunningham
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Landscape Client
In Progress
Undecided
Ghadi Rahme
Landscape Server
Fix Committed
Undecided
Rowen Francis Ico Lirio
landscape-client (Ubuntu)
Status tracked in Oracular
Focal
New
Undecided
Ghadi Rahme
Jammy
New
Undecided
Ghadi Rahme
Mantic
New
Undecided
Ghadi Rahme
Noble
New
Undecided
Ghadi Rahme
Oracular
Fix Committed
Undecided
Ghadi Rahme

Bug Description

Thank you @mdscunningham for opening the bug report.

[Impact]

Current versions of landscape client omit some network interfaces in their API response. While some interfaces should not be included such as loops and tap interfaces, others such as disconnected interfaces (no IP address or in the down state) should still be included as long as they have a valid MAC address.
This patch makes sure that interfaces are not omitted from the API response based on their IP address or their current state.

[Test Plan]

1- launch a ubuntu instance (lxc container, VM, bare metal) and make sure that the machine has access to at least two network interfaces.
2- Make sure one of the interfaces is connected and has a valid IP.
3- Also make sure at least one interface is not connected and has a valid MAC address. The interface can be in the down state or simply not configured with an IP. One easy way to achieve this is by running the following command:

$ ip link set dev <interface> down

4- Install landscape-client on the machine and enroll it into the landscape server.
5- Wait a few minutes for the machine to enroll and for all information to be exchanged between the server and the client
6- Query the server with lanscape-api to fetch information about the currently connected clients:

 $ landscape-api get-computers --with-network --json

7- Prior to this patch, the interfaces in the down state or with no IP addresses will not show up in the API response. However after this patch these interfaces will show up with an IP address, broadcast address and netmask of 0.0.0.0.

[Where problems could occur]

* Some interfaces might still fail to show up.
* Some interfaces that are not meant to show up might show up.

[Original Description]

Customer has opened a case (00378390) indicating that when they use the lansdcape-api to get network info for client machines they do not get all interfaces returned by the API.

For their specific use case they need to get all MAC addresses from the machine to add those to their VPN for access. They indicate that their wifi interface shows up in the web UI, but not in the API output.

I was able to replicate this in 23.03+18 with my own laptop. Here are my results.

Actual interfaces on machine, there are four, which should all be visible in Landscape.

ip a | grep -E 'BROADCAST|ether|inet '

2: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 38:f3:ab:41:dd:0d brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.176/24 brd 192.168.1.255 scope global dynamic noprefixroute enp0s31f6

3: enx803f5d0918d6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 80:3f:5d:09:18:d6 brd ff:ff:ff:ff:ff:ff

4: wlp0s20f3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether e0:2b:e9:bb:0f:6c brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.143/24 brd 192.168.1.255 scope global dynamic noprefixroute wlp0s20f3

5: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 52:54:00:e3:af:9a brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0

From Web UI, I see three of four:

Network:
Model: Not available
MAC: 80:3f:5d:09:18:d6
IP: Not available

Model: Comet Lake PCH CNVi WiFi
MAC: e0:2b:e9:bb:0f:6c
IP: 192.168.1.143

Model: Ethernet Connection (11) I219-LM
MAC: 38:f3:ab:41:dd:0d
IP: 192.168.1.176

From API, I see a different three of four:

landscape-api get-computers --with-network --query <hostname>

  'network_devices': [{'broadcast_address': '192.168.1.255',
                       'duplex': True,
                       'interface': 'enp0s31f6',
                       'ip_address': '192.168.1.176',
                       'mac_address': '38:f3:ab:41:dd:0d',
                       'netmask': '255.255.255.0',
                       'speed': 1000},
                      {'broadcast_address': '192.168.122.255',
                       'duplex': False,
                       'interface': 'virbr0',
                       'ip_address': '192.168.122.1',
                       'mac_address': '52:54:00:e3:af:9a',
                       'netmask': '255.255.255.0',
                       'speed': 10000},
                      {'broadcast_address': '192.168.1.255',
                       'duplex': False,
                       'interface': 'wlp0s20f3',
                       'ip_address': '192.168.1.143',
                       'mac_address': 'e0:2b:e9:bb:0f:6c',
                       'netmask': '255.255.255.0',
                       'speed': -1}],

I would expect all four interfaces to be visible, and clearly Landscape is aware of all four because if we combine the outputs above you can see all four, but each view Web / API only returns a different three of the four.

information type: Proprietary → Public
Changed in landscape:
assignee: nobody → Rowen Francis Ico Lirio (rflirio12)
Revision history for this message
Ghadi Rahme (ghadi-rahme) wrote :

Hi Mark, I opened an upstream PR. It can be tracked here: https://github.com/canonical/landscape-client/pull/241

Revision history for this message
Spencer Runde (spencerrunde) wrote :

Ghadi's PR has been merged into main: https://github.com/canonical/landscape-client/pull/241

Changed in landscape:
status: New → Fix Committed
Changed in landscape-client:
assignee: nobody → Ghadi Rahme (ghadi-rahme)
status: New → In Progress
Changed in landscape-client (Ubuntu):
status: New → In Progress
Changed in landscape-client (Ubuntu Oracular):
assignee: nobody → Ghadi Rahme (ghadi-rahme)
Changed in landscape-client (Ubuntu Noble):
assignee: nobody → Ghadi Rahme (ghadi-rahme)
Changed in landscape-client (Ubuntu Mantic):
assignee: nobody → Ghadi Rahme (ghadi-rahme)
Changed in landscape-client (Ubuntu Jammy):
assignee: nobody → Ghadi Rahme (ghadi-rahme)
Changed in landscape-client (Ubuntu Focal):
assignee: nobody → Ghadi Rahme (ghadi-rahme)
Revision history for this message
Ghadi Rahme (ghadi-rahme) wrote :

Hello,

Attached is the oracular debdiff, I will post the other debdiffs once oracular is accepted.

description: updated
Revision history for this message
Simon Quigley (tsimonq2) wrote :

Sponsored, thanks!

In the future, please use DEP-3 headers: https://dep-team.pages.debian.net/deps/dep3/

Changed in landscape-client (Ubuntu Oracular):
status: In Progress → Fix Committed
Revision history for this message
Ghadi Rahme (ghadi-rahme) wrote :

Hello @tsimonq2,

Thank you sponsoring the patch. I wanted to clarify the build failures that are occurring for oracular, these failures are not related to my patch and are a separate issue affecting oracular. The issue is being tracked in a separate LP bug: https://bugs.launchpad.net/landscape-client/+bug/2068050

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package landscape-client - 24.02-0ubuntu8

---------------
landscape-client (24.02-0ubuntu8) oracular; urgency=medium

  * d/p/2068050-fix-pycurl-error-string-test: Fix difference in pycurl error
    string upon certificate validation failured (LP: #2068050)

 -- Mitch Burton <email address hidden> Wed, 12 Jun 2024 14:51:00 -0700

Changed in landscape-client (Ubuntu Oracular):
status: Fix Committed → Fix Released
Changed in landscape-client (Ubuntu Oracular):
status: Fix Released → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.