qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: jamal <hadi@cyberus.ca>
To: qemu-devel@nongnu.org
Cc: Paul Brook <paul@codesourcery.com>, "Jim C. Brown" <jma5@umd.edu>
Subject: [Qemu-devel] Re: PATCH: allow defining MAC address etc
Date: Mon, 22 Aug 2005 07:00:41 -0400	[thread overview]
Message-ID: <1124708442.6521.86.camel@localhost.localdomain> (raw)
In-Reply-To: <1124675047.6521.81.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1434 bytes --]


And heres a small cleanup on top of that patch.
Just removes and extraneous printfs and makes sure we use the
":" as delimiter for mac address instead of ".". If needed i can resend
the whole thing again with this new cleanup.

cheers,
jamal

On Sun, 2005-21-08 at 21:44 -0400, jamal wrote:
> Ok, here goes as per discussion...
> 
> Please apply.
> This patch is intended for allowing automated clever scripting
> for networking (tuntap only).
> 
> It does the following:
> 1) extends syntax for specifying the macaddr
> 
> Examples:
> 
> a) "-nics 2"
> Which will give you the
>     0x52:0x54:0x00:0x12:0x34:0x56 for the first nic
> and 0x52:0x54:0x00:0x12:0x34:0x57 for the second nic
> 
> b) "-nics 3 -macaddr 00:11:a:0:1:39"
> 
> Which will give first NIC 00:11:a:0:1:39, the second 00:11:a:0:1:3A
> and the third 00:11:a:0:1:3B.
> 
> c) "-nics 2 -macaddr 00:11:a:0:2:19,00:11:a:0:1:19"
> Which will give first NIC 00:11:a:0:2:19, the second 00:11:a:0:1:19
> 
> d) "-nics 3 -macaddr 00:11:a:0:1:39,00:11:a:0:3:19"
> 
> which will give the first NIC a MAC of 00:11:a:0:1:39 the second
> 00:11:a:0:3:19 and the last 00:11:a:0:1:3B
> 
> 2) In addition to receiving the tun device name as $1, the
> net setup script now receives $2 as the guest MAC address.
> One could encode a byte or two in this MAC address for example as a
> message to the host script so that it can do something like prepare a
> route etc
> 
> cheers,
> jamal

[-- Attachment #2: qemu_p3 --]
[-- Type: text/x-patch, Size: 945 bytes --]

diff --git a/vl.c b/vl.c
--- a/vl.c
+++ b/vl.c
@@ -1665,7 +1665,7 @@ static int net_tun_init(NetDriverState *
         if (pid == 0) {
             char MAC[24];
             memset(MAC,0,24);
-            sprintf(MAC, "%X.%X.%X.%X.%X.%X",  nd->macaddr[0],nd->macaddr[1], nd->macaddr[2], nd->macaddr[3],nd->macaddr[4],nd->macaddr[5]);
+            sprintf(MAC, "%X:%X:%X:%X:%X:%X",  nd->macaddr[0],nd->macaddr[1], nd->macaddr[2], nd->macaddr[3],nd->macaddr[4],nd->macaddr[5]);
             parg = args;
             *parg++ = network_script;
             *parg++ = nd->ifname;
@@ -3233,7 +3233,6 @@ int main(int argc, char **argv)
                  }
                  /* set the defaults */
                   while (j++ < nb_nics-1) {
-                     printf("setting default for NIC %d",j);
                      for(i = 0; i < 6; i++) {
                          if (i == 5)
                              macaddrs[j][i] = macaddr[i]+j;

      reply	other threads:[~2005-08-22 11:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-22  1:44 [Qemu-devel] PATCH: allow defining MAC address etc jamal
2005-08-22 11:00 ` jamal [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=1124708442.6521.86.camel@localhost.localdomain \
    --to=hadi@cyberus.ca \
    --cc=jma5@umd.edu \
    --cc=paul@codesourcery.com \
    --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).