Incomplete network info showing in both web and API :: landscape-server 23.03
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|
2: enp0s31f6: <BROADCAST,
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,
link/ether 80:3f:5d:09:18:d6 brd ff:ff:ff:ff:ff:ff
4: wlp0s20f3: <BROADCAST,
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,
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_
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) |
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) |
Changed in landscape-client (Ubuntu Oracular): | |
status: | Fix Released → Fix Committed |
Hi Mark, I opened an upstream PR. It can be tracked here: https:/ /github. com/canonical/ landscape- client/ pull/241