Skip to content

24.04 backport of pure Python implementation for rtnetlink & nl80211#163

Merged
ogayot merged 12 commits intocanonical:ubuntu/noblefrom
ogayot:noble-no-c-ext
Jan 29, 2026
Merged

24.04 backport of pure Python implementation for rtnetlink & nl80211#163
ogayot merged 12 commits intocanonical:ubuntu/noblefrom
ogayot:noble-no-c-ext

Conversation

@ogayot
Copy link
Member

@ogayot ogayot commented Jan 23, 2026

This is a backport of the following PRs:

Also picked up some CI backports so CI actually runs.

https://launchpad.net/bugs/2139131

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
(cherry picked from commit ccfc3e2)
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
(cherry picked from commit ca9dd8c)
This is a first step to reimplement probert.rtnetlink in pure Python using
pyroute2. While libnl supports caches, pyroute2 doesn't so we need to implement
it ourselves.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
(cherry picked from commit db46d80)
Based on the libnl implementation of caches, we now have a LinkCache,
RouteCache and AddrCache. This should provide all the features needed to
reimplement the rtnetlink module in python.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
(cherry picked from commit 1773634)
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
(cherry picked from commit cd20754)
@ogayot
Copy link
Member Author

ogayot commented Jan 23, 2026

Testing in a core22 snap shows the following error:

TypeError: NetlinkMixIn.__init__() got an unexpected keyword argument 'groups'

Unfortunately, support for netlink groups came in with pyroute2 0.7.3: svinota/pyroute2#997

@ogayot
Copy link
Member Author

ogayot commented Jan 23, 2026

Another issue:

  File "probert/nl80211.py", line 111, in dump_scan_results
    if (ssid := bss.get_nested("NL80211_BSS_INFORMATION_ELEMENTS"
  File "pr2modules/netlink/__init__.py", line 1151, get_nested
    pointer = pointer.get_attr(attr)
AttributeError: "dict" object has no attribute 'get_attr'

@ogayot
Copy link
Member Author

ogayot commented Jan 28, 2026

Works when using against pyroute2 from core24 or the backport in PPA https://launchpad.net/~subiquity/+archive/ubuntu/core22

@ogayot ogayot marked this pull request as ready for review January 28, 2026 15:45
ogayot and others added 5 commits January 28, 2026 16:47
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
(cherry picked from commit 3769a65)
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
(cherry picked from commit 2f226cf)
`imp` has been removed as of python3.12.
https://docs.python.org/3.12/library/imp.html

We could migrate to importlib, but this is about python2 compat and we
don't need that anymore, so just delete stuff.

(reimplement curtin 1667812bc4b2393776a8ee32d558b6ffe37d3b11 here)

(cherry picked from commit d855222)
(cherry picked from commit 9fb7baa)
(cherry picked from commit 4eef8e1)
ogayot and others added 2 commits January 28, 2026 16:54
When building the debian package, dh_missing complains that files in
probert/rtnetlink/tests are not installed. We could add them to
debian/not-installed but really we don't want them in the package at all.
Drop them along with other existing test modules.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
(cherry picked from commit a714e0a)
(cherry picked from commit 0499c1d)

Updated to remove inclusion of test data since we removed it previously.
Copy link
Collaborator

@Chris-Peterson444 Chris-Peterson444 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

Copy link
Member

@dbungert dbungert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ogayot ogayot merged commit 26175bb into canonical:ubuntu/noble Jan 29, 2026
3 of 6 checks passed
@ogayot ogayot deleted the noble-no-c-ext branch January 29, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants