[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] Use existing tun/tap network interface
From: |
Lars Munch |
Subject: |
Re: [Qemu-devel] [PATCH] Use existing tun/tap network interface |
Date: |
Sun, 28 Nov 2004 20:37:09 +0100 |
User-agent: |
Mutt/1.5.6+20040907i |
On Sun, Nov 28, 2004 at 07:26:44PM +0100, Thomas Schwinge wrote:
> On Sun, Nov 28, 2004 at 05:36:48PM +0100, Lars Munch wrote:
> > +static int net_if_init(NetDriverState *nd, char *ifname)
> > +{
> > + pstrcpy(nd->ifname, sizeof(nd->ifname), ifname);
> > +
> > + nd->fd = tun_open(nd->ifname, sizeof(nd->ifname));
> > + if (nd->fd < 0)
> > + return -1;
> > +
> > + nd->send_packet = tun_send_packet;
> > + nd->add_read_packet = tun_add_read_packet;
> > + return 0;
> > +}
> > +
>
> Why do you need this function?
> (Sorry, I don't have the time to dig through qemu's networking code at
> the moment.)
I need net_if_init functions because I do not want to call the network
configuration script for preconfigured interfaces.
> Is it because I am doing
> #v+
> case QEMU_OPTION_net_if:
> net_if_type = NET_IF_TUN;
> if (nb_net_ifs < MAX_NICS) {
> pstrcpy (nd_table[nb_net_ifs].ifname,
> sizeof(nd_table[nb_net_ifs].ifname), optarg);
> nb_net_ifs++;
> }
> break;
> #v-
> ..., whereas you are putting the devices' names into an array and copy it
> to the interfaces' structure later?
> What's the advantage of your approach compared to mine?
If you copy the device names into the nd_table structure immediately,
you will get into trouble later because the n'th first interfaces are
used for -tun-fd's.
Regards
Lars Munch