Skip to contentSkip to conversation

-net PCI bus order reversed since 1.14.0

Qemu-devel Rob Landley 1 participant 2 messages May 10, 2011 – May 11, 2011

lore
Share & tools
lore
#0 lore raw

Until recently, -net options used to add interfaces to linux in the same order they went on the command line, so the first one you listed on the qemu command line would become eth0, the second -net became eth1, and so on. Now they're added in _reverse_ order, so the _last_ one on the command line is eth0.

I bisected the behavior change to commit 60c07d933c66c4b30a83b7ccbc8a0cb3df1b2d0e but don't understand why it changes this behavior. (Probably making udev do something stupid, but it happens consistently both before and after...)

Rob

#1 lore raw
Quoted 6 lines · Rob Landley

Until recently, -net options used to add interfaces to linux in the same order they went on the command line, so the first one you listed on the qemu command line would become eth0, the second -net became eth1, and so on. Now they're added in _reverse_ order, so the _last_ one on the command line is eth0.

Quoted 6 lines

I bisected the behavior change to commit 60c07d933c66c4b30a83b7ccbc8a0cb3df1b2d0e but don't understand why it changes this behavior. (Probably making udev do something stupid, but it happens consistently both before and after...)

Rob

I poked at this a bit more, and got the problem to be more explicit:

$ ~/qemu/x86_64-softmmu/qemu-system-x86_64 -m 512 \
  -kernel ~/linux/arch/x86/boot/bzImage -no-reboot -hda squeeze.ext3 \
  -append "root=/dev/hda rw" \
  -net nic,model=e1000,macaddr=52:54:00:11:11:11 -net user \
  -redir tcp:9876::22 \
  -net nic,model=e1000,macaddr=52:54:00:22:22:22 \
  -net tap,ifname=kvm0,script=no,downscript=no

Before the above commit the 11:11:11 interface becomes -net user (and thus dhclient works on it), and the 22:22:22 interface becomes -net tap and needs a static IP.

After the above commit, 22:22:22 gets 10.0.2.16 (instead of 10.0.2.15), and 11:11:11 doesn't respond to dhcp.

Would anyone like to explain what's going on, and what I _should_ be doing here to get predictable behavior? I deleted /etc/udev/rules.d/70-persistent-net.rules when it first started misbehaving, but that's not it. The association between -net nic and -net user/tap no longer seems to be in the order the command line options go.

Rob