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

Add compatibility with compressed kernel modules #2251

Merged
merged 2 commits into from
Oct 21, 2024

Conversation

hyposcaler-bot
Copy link
Contributor

@hyposcaler-bot hyposcaler-bot commented Oct 21, 2024

addresses issue described in #1988
fix #1988

Before fix

dfanshaw@midgard:~/src/eos-labs/single$ grep tables /proc/modules
nf_tables 376832 218 nft_limit,nft_chain_nat,nft_compat, Live 0x0000000000000000
nfnetlink 20480 8 nfnetlink_log,nf_conntrack_netlink,nft_compat,nf_tables, Live 0x0000000000000000
ip_tables 32768 2 iptable_nat,iptable_filter, Live 0x0000000000000000
x_tables 65536 22 xt_HL,ip6t_REJECT,ip6t_ipv6header,ipt_REJECT,xt_hl,xt_multiport,xt_limit,xt_LOG,xt_CT,xt_comment,xt_policy,xt_mark,xt_bpf,iptable_nat,iptable_filter,xt_nat,xt_tcpudp,xt_conntrack,xt_MASQUERADE,xt_addrtype,nft_compat,ip_tables, Live 0x0000000000000000
libcrc32c 12288 5 nf_nat,nf_conntrack,nf_tables,btrfs,raid456, Live 0x0000000000000000
dfanshaw@midgard:~/src/eos-labs/single$ sudo modprobe -D -n ip6_tables
insmod /lib/modules/6.9.3-76060903-generic/kernel/net/netfilter/x_tables.ko.zst
insmod /lib/modules/6.9.3-76060903-generic/kernel/net/ipv6/netfilter/ip6_tables.ko.zst
dfanshaw@midgard:~/src/eos-labs/single$ which containerlab
/usr/bin/containerlab
dfanshaw@midgard:~/src/eos-labs/single$ /usr/bin/containerlab version
  ____ ___  _   _ _____  _    ___ _   _ _____ ____  _       _
 / ___/ _ \| \ | |_   _|/ \  |_ _| \ | | ____|  _ \| | __ _| |__
| |  | | | |  \| | | | / _ \  | ||  \| |  _| | |_) | |/ _` | '_ \
| |__| |_| | |\  | | |/ ___ \ | || |\  | |___|  _ <| | (_| | |_) |
 \____\___/|_| \_| |_/_/   \_\___|_| \_|_____|_| \_\_|\__,_|_.__/

    version: 0.58.0
     commit: 2c249b2c
       date: 2024-10-15T11:38:50Z
     source: https://github.com/srl-labs/containerlab
 rel. notes: https://containerlab.dev/rn/0.58/
dfanshaw@midgard:~/src/eos-labs/single$ sudo /usr/bin/containerlab deploy -t simple-eos.yml
INFO[0000] Containerlab v0.58.0 started
INFO[0000] Parsing & checking topology file: simple-eos.yml
INFO[0000] Creating docker network: Name="clab", IPv4Subnet="172.20.20.0/24", IPv6Subnet="3fff:172:20:20::/64", MTU=1500
WARN[0000] Unable to load kernel module "ip6_tables" automatically "load ip6_tables failed: exec format error"
INFO[0000] Creating lab directory: /home/dfanshaw/src/eos-labs/single/clab-eos-simple
INFO[0000] config file '/home/dfanshaw/src/eos-labs/single/clab-eos-simple/clab-eos-switch/flash/startup-config' for node 'clab-eos-switch' already exists and will not be generated/reset
INFO[0000] Creating container: "clab-eos-switch"
INFO[0000] Running postdeploy actions for Arista cEOS 'clab-eos-switch' node
INFO[0018] Adding containerlab host entries to /etc/hosts file
INFO[0018] Adding ssh config for containerlab nodes
+---+---------------------------------+--------------+--------------------+------+---------+----------------+----------------------+
| # |              Name               | Container ID |       Image        | Kind |  State  |  IPv4 Address  |     IPv6 Address     |
+---+---------------------------------+--------------+--------------------+------+---------+----------------+----------------------+
| 1 | clab-eos-simple-clab-eos-switch | 025df3aef3d3 | ceos64-lab-4.33.0f | ceos | running | 172.20.20.2/24 | 3fff:172:20:20::2/64 |
+---+---------------------------------+--------------+--------------------+------+---------+----------------+----------------------+
dfanshaw@midgard:~/src/eos-labs/single$

After Fix

dfanshaw@midgard:~/src/eos-labs/single$ sudo ~/src/containerlab/bin/containerlab version
  ____ ___  _   _ _____  _    ___ _   _ _____ ____  _       _
 / ___/ _ \| \ | |_   _|/ \  |_ _| \ | | ____|  _ \| | __ _| |__
| |  | | | |  \| | | | / _ \  | ||  \| |  _| | |_) | |/ _` | '_ \
| |__| |_| | |\  | | |/ ___ \ | || |\  | |___|  _ <| | (_| | |_) |
 \____\___/|_| \_| |_/_/   \_\___|_| \_|_____|_| \_\_|\__,_|_.__/

    version: 0.0.0
     commit: 6859e39f
       date: Mon Oct 21 12:07:48 UTC 2024
     source: https://github.com/srl-labs/containerlab
 rel. notes: https://containerlab.dev/rn/0.0/
dfanshaw@midgard:~/src/eos-labs/single$ sudo ~/src/containerlab/bin/containerlab deploy -t simple-eos.yml
INFO[0000] Containerlab v0.0.0 started
INFO[0000] Parsing & checking topology file: simple-eos.yml
INFO[0000] Creating docker network: Name="clab", IPv4Subnet="172.20.20.0/24", IPv6Subnet="3fff:172:20:20::/64", MTU=1500
INFO[0000] Creating lab directory: /home/dfanshaw/src/eos-labs/single/clab-eos-simple
INFO[0000] config file '/home/dfanshaw/src/eos-labs/single/clab-eos-simple/clab-eos-switch/flash/startup-config' for node 'clab-eos-switch' already exists and will not be generated/reset
INFO[0000] Creating container: "clab-eos-switch"
INFO[0000] Running postdeploy actions for Arista cEOS 'clab-eos-switch' node
INFO[0019] Adding containerlab host entries to /etc/hosts file
INFO[0019] Adding ssh config for containerlab nodes
INFO[0019] 🎉 New containerlab version 0.58.0 is available! Release notes: https://containerlab.dev/rn/0.58/
Run 'containerlab version upgrade' to upgrade or go check other installation options at https://containerlab.dev/install/
+---+---------------------------------+--------------+--------------------+------+---------+----------------+----------------------+
| # |              Name               | Container ID |       Image        | Kind |  State  |  IPv4 Address  |     IPv6 Address     |
+---+---------------------------------+--------------+--------------------+------+---------+----------------+----------------------+
| 1 | clab-eos-simple-clab-eos-switch | c09f1c2ad471 | ceos64-lab-4.33.0f | ceos | running | 172.20.20.2/24 | 3fff:172:20:20::2/64 |
+---+---------------------------------+--------------+--------------------+------+---------+----------------+----------------------+
dfanshaw@midgard:~/src/eos-labs/single$

This change adds the following external dependencies

github.com/klauspost/compress/zstd
github.com/ulikunitz/xz
golang.org/x/sys/unix

The fix here is directly pulled from the example on loading compressed modules in kmod

couldn't come up with a way to easily test this with a unit test.

@hellt
Copy link
Member

hellt commented Oct 21, 2024

thanks @hyposcaler-bot
this was bugging me for a while, but I did not know this had to do with file compression

@hellt hellt force-pushed the hyposcaler-bot/issue-1988 branch from 76727f5 to b5c12fd Compare October 21, 2024 13:06
@hellt hellt changed the title fix for issue #1988 adds compatibility with compressed kernel modules Add compatibility with compressed kernel modules Oct 21, 2024
@hellt hellt merged commit 24bbcf3 into srl-labs:main Oct 21, 2024
63 of 65 checks passed
Copy link

codecov bot commented Oct 21, 2024

Codecov Report

Attention: Patch coverage is 27.08333% with 35 lines in your changes missing coverage. Please review.

Project coverage is 51.48%. Comparing base (6859e39) to head (b5c12fd).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
utils/kernel_module.go 18.60% 33 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2251      +/-   ##
==========================================
- Coverage   52.12%   51.48%   -0.64%     
==========================================
  Files         172      172              
  Lines       12714    16690    +3976     
==========================================
+ Hits         6627     8593    +1966     
- Misses       5174     7182    +2008     
- Partials      913      915       +2     
Files with missing lines Coverage Δ
clab/config.go 66.66% <100.00%> (-1.96%) ⬇️
utils/kernel_module.go 55.20% <18.60%> (-29.80%) ⬇️

... and 161 files with indirect coverage changes

@hyposcaler-bot hyposcaler-bot deleted the hyposcaler-bot/issue-1988 branch October 23, 2024 19:23
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.

Rocky 9.1: Unable to load kernel module "ip_tables" automatically
2 participants