From: Paul Brook <paul@codesourcery.com>
To: hadi@cyberus.ca
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] patch: allow defining MAC address etc
Date: Sun, 21 Aug 2005 03:22:35 +0100 [thread overview]
Message-ID: <200508210322.36010.paul@codesourcery.com> (raw)
In-Reply-To: <1124589394.6521.51.camel@localhost.localdomain>
On Sunday 21 August 2005 02:56, jamal wrote:
> On Sun, 2005-21-08 at 02:04 +0100, Paul Brook wrote:
> > On Sunday 21 August 2005 01:36, jamal wrote:
> > > This attached patch is intended for allowing automated clever scripting
> > > for networking (tuntap only). Please read and apply if possible.
> > >
> > > It does the following:
> > > a) allow for specifying the guest netdevice interface MAC address
> > > (in addition to keeping the old functionality of specifying just
> > > the first one and letting qemu decide what subsequent ones should be)
> > > So now you can say something along the lines of:
> > > "-nics 2 -macaddr0 00:11:a:0:2:19 -macaddr1 00:11:a:0:1:19"
> > > We allow upto 6 such MAC addresses to be specified. Maybe theres
> > > a more clever way to achieve this.
> >
> > Maybe a comma separated list of MAC addresses. e.g.
> > "-nics 2 macaddr 00:11:a:0:2:19,00:11:a:0:1:19"
>
> i could do this; macaddr is already being used to imply the start
> macaddr. Does macaddrs sound better?
Part of the reason I suggested this was because it is an extension of the
existing option. A user can either specifies a single address and have qemu
assign sequential addresses (the current behaviour), or they can specify a
list of addresses, one for each NIC.
> > Whatever you do, you should really support up to MAX_NICS addresses.
>
> ok
>
> > > b) allows to specify an opaque integer to be passed to the host script.
> > > Such an integer is useful if you are creating many NICs and you want
> > > to do different things depending on what this extra parameter is;
> > > example you may wanna add/del a route for one but not other
> > > syntax is of the form: "-ID1 1 -ID2 2"
> > > The IDs are mapped to the NICs. i.e ID1 maps to the first NIC
> > > and ID2 to the second etc. If you dont specify an ID, a 0 is used.
> > > Just like NICS/MACs we allow upto 6 such IDs to be specified.
> >
> > Wouldn't it make more sense to just pass the mac address and/or the NIC
> > number? Introducing yet another value seems unnecessarily complicated.
>
> The NIC number would not be sufficient for what i want; As an example,
> I could use the ID to tell me the "type" of processing needed.
> Example test script:
>
> ---
> if [ $2 = "0" ]; then
> #not really visible from host
> /usr/sbin/brctl addif base $1
> /sbin/ifconfig $1 up
> fi
> if [ $2 = "1" ]; then
> .....
> ...
> fi
> if [ $2 = "2" ]; then
> #visible from host; give it an IP address
> /sbin/ifconfig $1 10.0.3.24 netmask 255.255.255.0 up
> /sbin/route add 10.0.3.25 dev $1
> fi
> ---------
>
> If i was to get rid of anything it probably would be the MAC address of
> the guest since this is a host side setup. So i would like to keep the
> ID but could let go of the guest MAC. Thoughts?
Your script should be able to get all the information it needs from the MAC
address. You can either hardcode addresses or do pattern matching.
The guest MAC address is arbitrary, so you can choose whatever numbering is
convenient. For example you could use the last digit of the address to
encode your ID field. Your script would then look like:
case $2 in
*0)
# do something
;;
*1)
# do something else
;;
[etc]
esac
Paul
next prev parent reply other threads:[~2005-08-21 2:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-21 0:36 [Qemu-devel] patch: allow defining MAC address etc jamal
2005-08-21 1:04 ` Paul Brook
2005-08-21 1:56 ` jamal
2005-08-21 2:22 ` Paul Brook [this message]
2005-08-21 2:46 ` jamal
2005-08-21 3:18 ` jamal
2005-08-21 4:30 ` Jim C. Brown
2005-08-21 15:51 ` jamal
2005-08-21 4:06 ` Jim C. Brown
2005-08-21 17:03 ` Fabrice Bellard
2005-08-26 11:43 ` Henrik Nordstrom
-- strict thread matches above, loose matches on Subject: below --
2005-08-22 1:44 [Qemu-devel] PATCH: " jamal
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=200508210322.36010.paul@codesourcery.com \
--to=paul@codesourcery.com \
--cc=hadi@cyberus.ca \
--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).