Linux does this by passing the name of the tap interface Qemu has to create, so when the interface is created its name is known and can be used outside of Qemu. From what I see, NetBSD has the option to fetch the name of the interface created, using the TAPGIFNAME ioctl, but this is not really helpful because we create the interface from Qemu, but the scripts that attach the network interface are launched from the toolstack (xl). Will it be possible to provide a TAPSIFNAME ioctl to set the name of the created interface? I will start looking into this, but I would also like some feedback. So you basically want to have in dom0, have xl tell qemu to make an interface for the guest, and to name it /dev/tap-NNN where xl chooses that have qemu create a tap and arrange the name have xl in the dom0 bridge tapNNN to whatever and the problem with just using what tap picks is that there's no communication path from qemu create back to xl? Does qemu use /dev/tap, which picks a name, or by finding a /dev/tapN to open and then using create? Or is the problem that you need arbitrary names, rather than just to have xl be able to pick something? A few thoughts, not particularly coherent: qemu could be given a name and then create a symlink from that name to whatever tap chooses. or use mknod to make the name actually be the special file. TAPSIFNAME seems tricky, because it seems to be about controlling the whole name, whereas tap seems to be tapN for some (printed representation of) number N, correpsonding to character special file (169,N). So is this just about choosing N, or choosing the rest of the interface name? Or is it that choosing N is sufficient, but you'd like to be able to do TAPSIFNAME on /dev/tap? That seems awkward, because as I read the code the interface is created on open, so it would have to swap the softc, essentially closing the current tap and opening a new one. Overall, it seems easiest to teach qemu to use 'ifconfig tapN create' as an alternative to clone/set-name.
Attachment:
pgpvvG5vmi36M.pgp
Description: PGP signature