You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TL;DR: Official p4lang/behavioral-model Docker images fail to bind veth interfaces on WSL2, while a source-built image (Ubuntu 22.04, newer deps) works reliably with identical runtime configuration.
Issue Summary
The official p4lang/behavioral-model:latest and p4lang/behavioral-model:stable Docker images fail to bind network interfaces with "Add port operation failed" error when run on WSL2, while a custom build from source works perfectly.
# Create veth pair
ip link add s1p2 type veth peer name h1e1
# Move one end to container namespace
PID=$(docker inspect -f '{{.State.Pid}}' sw-test)
ip link set h1e1 netns $PID# Rename inside container
nsenter -t $PID -n ip link set h1e1 name eth2
nsenter -t $PID -n ip link set eth2 up
# Bring up host side
ip link set s1p2 up
# WSL Version
wsl --version
# WSL version: 2.0.14.0# Kernel version: 5.15.133.1-1# Docker Version
docker version
# Docker version 24.0.6# Verified interfaces exist and are UP
ip link show # All veths present and functional
docker exec sw-test ip link # Interfaces visible in container# Verified capabilities
docker exec sw-test capsh --print
# Current: cap_net_admin,cap_net_raw,cap_sys_admin=eip
Tested Workarounds That FAILED
Using p4lang/behavioral-model:stable instead of latest
Starting BMv2 without -i flags and adding ports later (no API available)
Using host network mode (defeats purpose of isolation)
Only Working Solution
Build BMv2 from source using Ubuntu 22.04 base with full dependencies
Author: Rana Abu Bakar, Working on: Virtual Reconfigurable Pipeline Router on WSL2 Date: February 2, 2026 Build Time: ~20 minutes for custom image Result: 100% success rate with custom build vs 0% with official images
BMv2 Interface Binding Issue - WSL2 & Docker
TL;DR: Official
p4lang/behavioral-modelDocker images fail to bind veth interfaces on WSL2, while a source-built image (Ubuntu 22.04, newer deps) works reliably with identical runtime configuration.Issue Summary
The official
p4lang/behavioral-model:latestandp4lang/behavioral-model:stableDocker images fail to bind network interfaces with "Add port operation failed" error when run on WSL2, while a custom build from source works perfectly.Environment
p4lang/behavioral-model:latestFAILSp4lang/behavioral-model:stableFAILSReproduction Steps
1. Create container with network isolation
2. Create veth pair and attach to container
3. Try to start BMv2 with interface
docker exec sw-test simple_switch_grpc \ -i 2@eth2 \ --no-p4 \ --device-id 1 \ -- --grpc-server-addr 0.0.0.0:50051Expected vs Actual
Expected: Interface binds successfully
Actual (with official images):
Actual (with custom build from source):
Root Cause Analysis
Differences Between Official Image and Working Build
--enable-Werror, stripped-O0 -g(debug)Key Finding
The issue is NOT WSL2 blocking packet capture. We verified with tcpdump:
The issue is in how the official Docker images are built or their dependency versions.
Working Solution: Build from Source
Dockerfile that WORKS
Build Command (IMPORTANT: Use native WSL filesystem, not /mnt/c)
Verification
Recommendations for P4 Project
Short-term Fix
Update the official Dockerfile to:
libnanomsg-devin dependenciesLong-term Improvements
Impact
This issue affects:
Related Issues
Testing Environment Details
Tested Workarounds That FAILED
p4lang/behavioral-model:stableinstead of latestOnly Working Solution
Build BMv2 from source using Ubuntu 22.04 base with full dependencies
Author: Rana Abu Bakar, Working on: Virtual Reconfigurable Pipeline Router on WSL2
Date: February 2, 2026
Build Time: ~20 minutes for custom image
Result: 100% success rate with custom build vs 0% with official images