From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1E7A79-00020S-U7 for qemu-devel@nongnu.org; Mon, 22 Aug 2005 07:05:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1E7A75-0001yn-V5 for qemu-devel@nongnu.org; Mon, 22 Aug 2005 07:05:13 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E7A74-0001wo-CM for qemu-devel@nongnu.org; Mon, 22 Aug 2005 07:05:11 -0400 Received: from [209.197.145.105] (helo=mx02.cybersurf.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1E7A3Q-0000Rw-01 for qemu-devel@nongnu.org; Mon, 22 Aug 2005 07:01:24 -0400 Received: from mail.cyberus.ca ([209.197.145.21]) by mx02.cybersurf.com with esmtp (Exim 4.30) id 1E7A2q-00074j-3J for qemu-devel@nongnu.org; Mon, 22 Aug 2005 07:00:48 -0400 From: jamal In-Reply-To: <1124675047.6521.81.camel@localhost.localdomain> References: <1124675047.6521.81.camel@localhost.localdomain> Content-Type: multipart/mixed; boundary="=-RTA0lLOWvV5cBG7Dh9cA" Date: Mon, 22 Aug 2005 07:00:41 -0400 Message-Id: <1124708442.6521.86.camel@localhost.localdomain> Mime-Version: 1.0 Subject: [Qemu-devel] Re: PATCH: allow defining MAC address etc Reply-To: hadi@cyberus.ca, qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paul Brook , "Jim C. Brown" --=-RTA0lLOWvV5cBG7Dh9cA Content-Type: text/plain Content-Transfer-Encoding: 7bit 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 --=-RTA0lLOWvV5cBG7Dh9cA Content-Disposition: attachment; filename=qemu_p3 Content-Type: text/x-patch; name=qemu_p3; charset=utf-8 Content-Transfer-Encoding: 7bit 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; --=-RTA0lLOWvV5cBG7Dh9cA--