From: lars@segv.dk (Lars Munch)
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Use existing tun/tap network interface
Date: Sun, 28 Nov 2004 20:37:09 +0100 [thread overview]
Message-ID: <20041128193708.GA3088@tuxedo.skovlyporten.dk> (raw)
In-Reply-To: <20041128182643.GA3422@bobby.schwinge.homeip.net>
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
prev parent reply other threads:[~2004-11-28 19:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-27 10:54 [Qemu-devel] [PATCH] Use existing tun/tap network interface Lars Munch
2004-11-28 16:07 ` Thomas Schwinge
2004-11-28 16:37 ` Lars Munch
2004-11-28 18:26 ` Thomas Schwinge
2004-11-28 19:37 ` Lars Munch [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041128193708.GA3088@tuxedo.skovlyporten.dk \
--to=lars@segv.dk \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).