Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T6267: Check interface wireless module before apply config (backport #3368) #3381

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Apr 30, 2024

Change Summary

Check if the wireless device/modem exists in the system and the module ieee802111 was loaded
In cases where we do not have wireless devices, it prevents the unexpected traceback

set interfaces wireless wlan0 address 192.0.2.5/32
commit

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/interfaces_wireless.py", line 269, in <modu>
    c = get_config()
        ^^^^^^^^^^^^
  File "/usr/libexec/vyos/conf_mode/interfaces_wireless.py", line 104, in get_cg
    tmp = find_other_stations(conf, base, wifi['ifname'])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/libexec/vyos/conf_mode/interfaces_wireless.py", line 54, in find_os
    for phy in os.listdir('/sys/class/ieee80211'):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/ieee80211'

(I do not have an actual wireless device to check if it will work when the device really exists, will be perfect to re-check it)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

Component(s) name

wireless

Proposed changes

How to test

In the instance without a wireless device try to configure a wireless interface:

set interfaces wireless wlan0 address 192.0.2.5/32
commit

Before the fix:

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/interfaces_wireless.py", line 269, in <modu>
    c = get_config()
        ^^^^^^^^^^^^
  File "/usr/libexec/vyos/conf_mode/interfaces_wireless.py", line 104, in get_cg
    tmp = find_other_stations(conf, base, wifi['ifname'])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/libexec/vyos/conf_mode/interfaces_wireless.py", line 54, in find_os
    for phy in os.listdir('/sys/class/ieee80211'):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/ieee80211'

After the fix:

vyos@r4# commit
[ interfaces wireless wlan0 ]
Wireless module is not found!

[[interfaces wireless wlan0]] failed
Commit failed
[edit]
vyos@r4# 

Smoketest result

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

This is an automatic backport of pull request #3368 done by [Mergify](https://mergify.com).

Check if the wireless device/modem exists in the system and the
module `ieee802111` was loaded
In cases where we do not have wireless devices, it prevents the
unexpected traceback

```
set interfaces wireless wlan0 address 192.0.2.5/32
commit

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/interfaces_wireless.py", line 269, in <modu>
    c = get_config()
        ^^^^^^^^^^^^
  File "/usr/libexec/vyos/conf_mode/interfaces_wireless.py", line 104, in get_cg
    tmp = find_other_stations(conf, base, wifi['ifname'])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/libexec/vyos/conf_mode/interfaces_wireless.py", line 54, in find_os
    for phy in os.listdir('/sys/class/ieee80211'):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/ieee80211'
```

(cherry picked from commit 09c302d)
@vyosbot vyosbot requested review from a team and dmbaturin and removed request for a team April 30, 2024 18:23
@github-actions github-actions bot added the sagitta VyOS 1.4 LTS label Apr 30, 2024
@c-po c-po merged commit 1e8c98e into sagitta Apr 30, 2024
5 checks passed
@mergify mergify bot deleted the mergify/bp/sagitta/pr-3368 branch April 30, 2024 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sagitta VyOS 1.4 LTS
Development

Successfully merging this pull request may close these issues.

2 participants