Skip to content

3385 Ignore detected wifi device from LAN detection when not currently active.#3390

Merged
holta merged 4 commits intoiiab:masterfrom
jvonau:3385
Oct 4, 2022
Merged

3385 Ignore detected wifi device from LAN detection when not currently active.#3390
holta merged 4 commits intoiiab:masterfrom
jvonau:3385

Conversation

@jvonau
Copy link
Copy Markdown
Contributor

@jvonau jvonau commented Oct 3, 2022

Related: #3324 #3328 #3334 #3335

@jvonau
Copy link
Copy Markdown
Contributor Author

jvonau commented Oct 3, 2022

wireless_list_1(wifi1) = not found-1
wireless_list_2(wifi2) = wlp0s20f3
num_wifi_interfaces = 1
discovered_wireless_iface = wlp0s20f3
discovered_wired_iface = eno1
exclude_devices = none
num_lan_interfaces = 2

2022-09-27 13:44:08,721 p=20120 u=root n=ansible | TASK [network : Wired enslaving - Assigns lan_list_results to br0 as wired slaves if present] ****************************************************************************
2022-09-27 13:44:09,064 p=20120 u=root n=ansible | changed: [127.0.0.1] => (item=eno1)
2022-09-27 13:44:09,369 p=20120 u=root n=ansible | changed: [127.0.0.1] => (item=wlp0s20f3)

The above is a potential bug, that is the unused wifi device, the parent of ap0, the systemd bridging code predates ap0 usage by a year or so.

Specific bug targeted:

-IIAB--------------------------------------------------------------------------
-rw-r--r-- 1 root root 116 Sep 27 13:44 /etc/systemd/network/IIAB-Slave-wlp0s20f3.network
                        ...ITS LAST 100 LINES FOLLOW...

# /etc/systemd/network/IIAB-Slave-eno1.network
[Match]
Name=eno1

[Link]
RequiredForOnline=no

[Network]
Bridge=br0

@jvonau jvonau changed the title 3385 3385 Ignore detected wifi device from LAN detection when not currently active. Oct 3, 2022
@holta holta added this to the 8.0 milestone Oct 3, 2022
@jvonau
Copy link
Copy Markdown
Contributor Author

jvonau commented Oct 3, 2022

87ea472 is the 'fix' for a single interface.
9f4b99e extends slave support for more than a single interface.
6b69696 provides clarity that only AP supported devices should be cloned.
d349f2f is #3379 included
hashes are valid until master changes that force a rebase to this PR

@holta
Copy link
Copy Markdown
Member

holta commented Oct 4, 2022

I'm thinking we should possibly skip PR #3389 (which feels like an optimization more than a significant functional change).
Let's instead focus directly on this one (PR #3390) if that's ok?

➡️ What smoke/functional testing does this PR #3390 most need ?

@jvonau
Copy link
Copy Markdown
Contributor Author

jvonau commented Oct 4, 2022

Testing on the install that I noticed the bug would be best to see If I truly addressed the situation but otherwise just a pull and run for the 'does no harm' to others quick test. Just getting back online, new cable modem just arrived, roommate installed it, (have IPv6 addresses and a different IPv4 network) of course now I can't connect to my test subjects.. I'll pull this one into a VM for a quick shakedown.

@jvonau
Copy link
Copy Markdown
Contributor Author

jvonau commented Oct 4, 2022

passes quick shakedown ubuntu-22.04 VM, RPi-4 stage2

@jvonau
Copy link
Copy Markdown
Contributor Author

jvonau commented Oct 4, 2022

Setup 0906-desktop to use NM before installing iiab ran install from install.log:

2022-10-04 02:23:51,873 p=32584 u=root n=ansible | changed: [127.0.0.1] => (item={'option': 'prior_gateway_device', 'value': 'unset'})
2022-10-04 02:23:52,494 p=32584 u=root n=ansible | changed: [127.0.0.1] => (item={'option': 'dhcpcd_result', 'value': 'disabled'})
2022-10-04 02:23:53,151 p=32584 u=root n=ansible | changed: [127.0.0.1] => (item={'option': 'network_manager_active', 'value': True})
2022-10-04 02:23:53,756 p=32584 u=root n=ansible | changed: [127.0.0.1] => (item={'option': 'systemd_networkd_active', 'value': False})
2022-10-04 02:23:54,360 p=32584 u=root n=ansible | changed: [127.0.0.1] => (item={'option': 'wan_in_interfaces', 'value': False})
2022-10-04 02:23:54,967 p=32584 u=root n=ansible | changed: [127.0.0.1] => (item={'option': 'wireless_list_1(wifi1)', 'value': 'not found-1'})
2022-10-04 02:23:55,572 p=32584 u=root n=ansible | changed: [127.0.0.1] => (item={'option': 'wireless_list_2(wifi2)', 'value': 'wlan0'})
2022-10-04 02:23:56,179 p=32584 u=root n=ansible | changed: [127.0.0.1] => (item={'option': 'num_wifi_interfaces', 'value': '1'})
2022-10-04 02:23:56,785 p=32584 u=root n=ansible | changed: [127.0.0.1] => (item={'option': 'discovered_wireless_iface', 'value': 'wlan0'})
2022-10-04 02:23:57,410 p=32584 u=root n=ansible | changed: [127.0.0.1] => (item={'option': 'discovered_wired_iface', 'value': 'eth1'})
2022-10-04 02:23:58,062 p=32584 u=root n=ansible | changed: [127.0.0.1] => (item={'option': 'exclude_devices', 'value': 'none'})
2022-10-04 02:23:58,665 p=32584 u=root n=ansible | changed: [127.0.0.1] => (item={'option': 'num_lan_interfaces', 'value': '2'})
2022-10-04 02:23:59,277 p=32584 u=root n=ansible | changed: [127.0.0.1] => (item={'option': 'gui_static_wan', 'value': False})
2022-10-04 02:23:59,888 p=32584 u=root n=ansible | changed: [127.0.0.1] => (item={'option': 'iiab_lan_iface', 'value': 'br0'})
2022-10-04 02:24:00,501 p=32584 u=root n=ansible | changed: [127.0.0.1] => (item={'option': 'iiab_wan_iface', 'value': 'eth0'})
2022-10-04 02:24:01,149 p=32584 u=root n=ansible | changed: [127.0.0.1] => (item={'option': 'can_be_ap', 'value': True})

2022-10-04 02:24:57,042 p=32584 u=root n=ansible | TASK [network : Copy the bridge script - Assigns IP address] ********************************>
2022-10-04 02:24:58,311 p=32584 u=root n=ansible | changed: [127.0.0.1]
2022-10-04 02:24:58,393 p=32584 u=root n=ansible | TASK [network : Wired enslaving - Assigns lan_list_results to br0 as wired slaves if present]>
2022-10-04 02:24:58,480 p=32584 u=root n=ansible | skipping: [127.0.0.1] => (item=eth1)
2022-10-04 02:24:58,495 p=32584 u=root n=ansible | skipping: [127.0.0.1] => (item=wlan0)

Applied this PR then sudo iiab-network

changed: [127.0.0.1] => (item={'option': 'prior_gateway_device', 'value': 'eth0'})
ok: [127.0.0.1] => (item={'option': 'dhcpcd_result', 'value': 'disabled'})
ok: [127.0.0.1] => (item={'option': 'network_manager_active', 'value': True})
changed: [127.0.0.1] => (item={'option': 'systemd_networkd_active', 'value': True})
ok: [127.0.0.1] => (item={'option': 'wan_in_interfaces', 'value': False})
ok: [127.0.0.1] => (item={'option': 'wireless_list_1(wifi1)', 'value': 'not found-1'})
ok: [127.0.0.1] => (item={'option': 'wireless_list_2(wifi2)', 'value': 'wlan0'})
ok: [127.0.0.1] => (item={'option': 'num_wifi_interfaces', 'value': '1'})
ok: [127.0.0.1] => (item={'option': 'discovered_wireless_iface', 'value': 'wlan0'})
ok: [127.0.0.1] => (item={'option': 'discovered_wired_iface', 'value': 'eth1'})
ok: [127.0.0.1] => (item={'option': 'exclude_devices', 'value': 'none'})
changed: [127.0.0.1] => (item={'option': 'num_lan_interfaces', 'value': '1'})
ok: [127.0.0.1] => (item={'option': 'gui_static_wan', 'value': False})
ok: [127.0.0.1] => (item={'option': 'iiab_lan_iface', 'value': 'br0'})
ok: [127.0.0.1] => (item={'option': 'iiab_wan_iface', 'value': 'eth0'})
ok: [127.0.0.1] => (item={'option': 'can_be_ap', 'value': True})

TASK [network : Copy the bridge script - Assigns IP address] ************************************************************************************
ok: [127.0.0.1]
TASK [network : Wired enslaving - Assigns lan_list_results to br0 as wired slaves if present] ***************************************************
skipping: [127.0.0.1] => (item=eth1)

Note the unused wifi device is not part of lan_list_results and was skipped because of NM being active, Ubuntu server would of written the eth1 slave file.

Temporary disable the NM conditional to check that the template is correct and works

git diff
diff --git a/roles/network/tasks/detected_network.yml b/roles/network/tasks/detected_network.yml
index c4414b5e..50c660b0 100644
--- a/roles/network/tasks/detected_network.yml
+++ b/roles/network/tasks/detected_network.yml
@@ -209,7 +209,8 @@
 - name: Set iiab_wired_lan_iface if present
   set_fact:
     iiab_wired_lan_iface: "{{ discovered_wired_iface }}"
-  when: discovered_wired_iface is defined and discovered_wired_iface != "none" and discovered_wired_iface != iiab_wan_iface and not is_raspbian
+  when: discovered_wired_iface is defined and discovered_wired_iface != "none" and discovered_wired_iface != iiab_wan_iface 
+#and not is_raspbian
 
 # use value only if present
 - name: 2 or more devices on the LAN - use bridging
diff --git a/roles/network/tasks/sysd-netd-debian.yml b/roles/network/tasks/sysd-netd-debian.yml
index 57c70e88..3f43916c 100644
--- a/roles/network/tasks/sysd-netd-debian.yml
+++ b/roles/network/tasks/sysd-netd-debian.yml
@@ -18,7 +18,8 @@
     dest: /etc/systemd/network/IIAB-Slave-{{ item|trim }}.network
   with_items:
     - "{{ lan_list_result.stdout_lines }}"
-  when: iiab_wired_lan_iface is defined and num_lan_interfaces|int >= 1 and not network_manager_active
+  when: iiab_wired_lan_iface is defined and num_lan_interfaces|int >= 1
+# and not network_manager_active

sudo iiab-network

TASK [network : Copy the bridge script - Assigns IP address] ************************************************************************************
ok: [127.0.0.1]
TASK [network : Wired enslaving - Assigns lan_list_results to br0 as wired slaves if present] ***************************************************
changed: [127.0.0.1] => (item=eth1)

http://sprunge.us/ECOHjA

@holta
Copy link
Copy Markdown
Member

holta commented Oct 4, 2022

Is this PR generally safe to merge?

Any objections?

@jvonau
Copy link
Copy Markdown
Contributor Author

jvonau commented Oct 4, 2022

Is this PR generally safe to merge?

It was safe to merge before the above hoops had be jumped through. Don't burn through all your credits in the first couple of days..

@holta
Copy link
Copy Markdown
Member

holta commented Oct 4, 2022

Testing needs to be communicated.

So others can build trust.

Otherwise nothing will move forward.

As @georgejhunt explained to @deldesir yesterday:

@holta holta merged commit 38fa807 into iiab:master Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants