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 support for missing TUN/TAP parameters from Linux kernel #1066

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vanytsvetkov
Copy link

Hey folks! This PR fixes TUN/TAP implementation to handle several kernel parameters we've been missing. No rocket science – just closing gaps with well-known features.

What's changed

  1. New field in Tuntap struct

    • Added DisabledQueues to track inactive multiqueue slots (critical for live migration in VMs).
  2. Now parsing kernel flags

    • IFLA_TUN_PI → sets TUNTAP_NO_PI (for "raw" packet mode)
    • IFLA_TUN_VNET_HDR → sets TUNTAP_VNET_HDR (QEMU/virtio needs this)
    • IFLA_TUN_MULTI_QUEUE support
    • Reads actual queue counts from IFLA_TUN_NUM_QUEUES/DISABLED_QUEUES

Why this is needed

  • We were dropping important settings: Before this, flags like VNET_HDR or multiqueue configs got silently ignored.
  • Kernel compatibility: These parameters exist since Linux 3.8 (2012!) but our code never acknowledged them.
  • Real-world impact:
    • Cloud setups need DisabledQueues for VM migrations
    • MULTI_QUEUE matters for anyone using DPDK/VPP for fast packet processing

How I tested

  • Ran on real 5.10+ kernels with:
    ✓ 4 active + 2 disabled queues
    VNET_HDR flag (matching QEMU's requirements)
    ✓ Legacy configs (verified old behavior stays intact)

Notes for review

  • Zero breakage:
    • New fields start as 0 (backward-safe)
    • Older kernels without these attributes work normally
  • Matches Linux tooling: Logic aligns with iproute2's implementation (see here) – we're not inventing wheels.

Signed-off-by: Ivan Tsvetkov [email protected]

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.

1 participant