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

interface sometimes doesn't get created correctly in namespace (tuntap mode) #117

Open
fszyang opened this issue Mar 18, 2018 · 0 comments

Comments

@fszyang
Copy link
Contributor

fszyang commented Mar 18, 2018

Very rare. On repeated test of creating interfaces in namespace net1, on occasion see interface in both default and net1 namespace. The interface in net1 namespace shows state UNKNOWN and cannot be ping'ed. After deleting the interface in net1 namespace and moving the interface (with same name) from default to net1 namespace, admin up, assign address, then ping works.

Below script can create the problem (takes hundreds of loops). All ports in 25g mode. Odd ports looped to even ports. goPing is just a separate go script to run pings in parallel.

#!/bin/bash

loop=1
while true; do
    echo "========loop $loop=========="
    echo "restart goes"
    ip netns del net1
    goes restart
    sleep 5
    
    goes vnet show runtime event
    
    echo "create net1 namespace"
    ip netns add net1

    echo "bring up interfaces in default namespace"
    for i in $(seq 1 2 31); do
	for j in $(seq 1 1 4); do
	    ip link set dev eth-$i-$j up
            ip addr add 10.1.$i.${j}0/31 brd + dev eth-$i-$j
	done
    done

    echo "bring up interfaces in net1 namespace"
    for i in $(seq 2 2 32); do
	for j in $(seq 1 1 4); do
	    ip link set eth-$i-$j netns net1
	    ip netns exec net1 ip link set dev eth-$i-$j up
            ip netns exec net1 ip addr add 10.1.$(($i-1)).${j}1/31 brd + dev eth-$i-$j
	done
    done

    sleep 2
    
    goes vnet show runtime event

    f=$(goes vnet show ip fib | grep net1 | head -1)
    if [ -z "$f" ]; then
	echo "namespace failed"
	exit 1
    else
	echo "namespace passed"
    fi
    
    sleep 2
    
    echo "start traffic test"
    p=$(/usr/local/go/bin/go run goPing4.go)
    echo "$p"
    case "$p" in
	*fail*)
	    exit 1
	    ;;
    esac
    ((loop++))
    sleep 2

done
exit 0
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

No branches or pull requests

1 participant