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
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;
_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel