View previous topic :: View next topic |
Author |
Message |
toralf Developer
Joined: 01 Feb 2004 Posts: 3922 Location: Hamburg
|
Posted: Fri Dec 28, 2012 8:54 pm Post subject: [solved] How to find an unused TAP device ? |
|
|
With kernel 3.8. I just realized that all pre-defined TAP devices are RUNNING even if no virtual linux system is using it. Now I'm wondering whether this is a new feature of the upcoming kernel, a bug of the old - and how I can avoid that.
Background : When I start a user mode linux instance, I currently grep for the next free tap device in this way : Code: | for t in $(ifconfig | grep "^tap" | cut -f1 -d:)
do
ethtool $t | grep -q 'Link detected: no'
if [[ $? -eq 0 ]]; then
NET="tuntap,$t"
break
fi
done
| but this doesn't work now anymore.
Here is the diff in dmesg Code: | $ diff 3.7.1 3.8.0-rc1+ | grep UP
< br0: flags=4355<UP,BROADCAST,PROMISC,MULTICAST> mtu 1500
> br0: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST> mtu 1500
< tap0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
> tap0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 | and my config Code: | $ head -n 20 /etc/conf.d/net
# /etc/conf.d/net
#
# KVM
#
bridge_br0="tap0 tap1 tap2 tap3"
config_br0="192.168.0.254/8"
brctl_br0="setfd 0
sethello 10
stp off"
rc_net_br0_need="net.tap0 net.tap1 net.tap2 net.tap3"
config_tap0="null"
tuntap_tap0="tap"
tunctl_tap0="-u <me>"
... |
Last edited by toralf on Mon Jan 28, 2013 6:39 pm; edited 1 time in total |
|
Back to top |
|
|
Rexilion Veteran
Joined: 17 Mar 2009 Posts: 1044
|
Posted: Sat Jan 26, 2013 11:37 am Post subject: |
|
|
That's a regression, not a feature. The kernel has an explicit goal to consistently (across versions) provide a reliable interface to the user.
I suggest you do a git bisect to speed up the debug. Perhaps:
Code: | git bisect start HEAD v3.7 -- drivers/net/tun.c |
Looks like you are in for a treat =) * points down *
Quote: | gebruiker@Delta:~/Documenten/Ronald/kernel$ git rev-list --oneline v3.7..v3.8-rc3 -- drivers/net/tun.c
9fdc6be tuntap: dont use a private kmem_cache
d32649d tuntap: fix sparse warning
76fe458 tuntap: reset network header before calling skb_get_rxhash()
4008e97 tuntap: fix ambigious multiqueue API
4997442 tuntap: dont use skb after netif_rx_ni(skb)
a676847 tun: allow setting ethernet addresss while running
b3943ae tun: correctly report an error in tun_flow_init()
5d09710 tun: only queue packets on device
eb0fb36 tuntap: attach queue 0 before registering netdevice
3872baf tun: put correct method name in a debug message.
36fe8c09 vtun: fix typos.
9ce99cf tun: change tun_get_iff() prototype.
c260b77 net: Allow userns root to control tun and tap devices
149d36f tun: report orphan frags errors to zero copy callback
96442e42 tuntap: choose the txq based on rxq
cde8b15 tuntap: add ioctl to attach or detach a file form tuntap device
c8d68e6 tuntap: multiqueue support
6e914fc tuntap: RCUify dereferencing between tun_struct and tun_file
54f968d tuntap: move socket to tun_file
1e58833 tuntap: log the unsigned informaiton with %u
6a328d8 cgroup: net_cls: Rework update socket logic
fd9a08a cgroup: net_cls: Pass in task to sock_update_classid() |
_________________ fs/super.c: "Self-destruct in 5 seconds. Have a nice day...\n" |
|
Back to top |
|
|
toralf Developer
Joined: 01 Feb 2004 Posts: 3922 Location: Hamburg
|
Posted: Mon Jan 28, 2013 6:39 pm Post subject: |
|
|
fixed in git tree |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|