Skip to content

Conversation

@rlmenge
Copy link
Contributor

@rlmenge rlmenge commented Dec 14, 2025

Introduce xfrm_interface tests. This is to validate the config option CONFIG_XFRM_INTERFACE
Steps:
1. Check if CONFIG_XFRM_INTERFACE is enabled in kernel config. (will skip if not)
2. Load the xfrm_interface module if not already loaded.
3. Verify the module is loaded successfully.
4. Create a test xfrm interface (xfrm0).
ip link add xfrm0 type xfrm dev eth0 if_id 100
5. Verify the interface was created.
ip link show
6. Clean up the test interface.
sudo ip link del xfrm0

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces comprehensive test coverage for the xfrm_interface kernel module, which is used for IPsec VPN tunnels. The tests validate that the CONFIG_XFRM_INTERFACE kernel configuration option is properly enabled and functional on Azure Linux VMs.

Key Changes:

  • New test suite for XFRM interface functionality with two test cases
  • Validates kernel module loading, interface creation, and module load/unload operations
  • Includes proper cleanup and error handling for test isolation

@rlmenge rlmenge marked this pull request as ready for review December 17, 2025 00:39
)
def verify_xfrm_interface_load_unload(self, node: Node) -> None:
kernel_config = node.tools[KernelConfig]
modprobe = node.tools[Modprobe]
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

# Skip if built-in (can't unload built-in modules)
if kernel_config.is_built_in("CONFIG_XFRM_INTERFACE"):
raise SkippedException(
"CONFIG_XFRM_INTERFACE is built-in, " "cannot test module load/unload"
Copy link
Collaborator

Choose a reason for hiding this comment

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

"CONFIG_XFRM_INTERFACE is built-in, cannot test module load/unload"

).is_false()

# Reload the module to leave system in working state
modprobe.load("xfrm_interface")
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to keep the original state, and decide to unload or load it to restore it into original state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Also updated in the verify_xfrm_interface function

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.

2 participants