[Lguest] [PATCH 3/3] lguest: Support assigning a MAC address
Mark McLoughlin
markmc at redhat.com
Mon Jul 7 23:31:26 EST 2008
Hi Rusty,
Tiny buglet below ...
On Sat, 2008-06-14 at 19:20 +1000, Rusty Russell wrote:
> On Friday 13 June 2008 23:05:00 Mark McLoughlin wrote:
> > Allow assigning a MAC address to the network interface with
> > e.g.
> >
> > --tunnet=bridge:eth0:00:FF:95:6B:DA:3D
> >
> > or:
> >
> > --tunnet=192.168.121.1:00:FF:95:6B:DA:3D
> >
> > which is pretty unintelligable, but ...
>
> Agreed... ugly but clear.
>
> Not sure about tossing around the ifr just to hold the interface name
> across configure_device and get_mac though. If we put it in a nice var,
> we can have a cleaner interface and a better verbose() message.
>
> Oh, and I'm trying to hang with the cool kids and use bool :)
>
> Here's the patch I put on top (testing now)...
> Rusty.
>
> diff -r 8416df781ce4 Documentation/lguest/lguest.c
> --- a/Documentation/lguest/lguest.c Sat Jun 14 15:11:24 2008 +1000
> +++ b/Documentation/lguest/lguest.c Sat Jun 14 19:17:47 2008 +1000
> @@ -1265,17 +1265,19 @@ static void setup_console(void)
...
> static void str2mac(const char *macaddr, unsigned char mac[6])
> {
> unsigned int m[6];
> - sscanf(macaddr, "%02x:%02x:%02x:%02x:%02x:%02x",
> - &m[0], &m[1], &m[2], &m[3], &m[4], &m[5]);
> + if (sscanf(macaddr, "%02x:%02x:%02x:%02x:%02x:%02x",
> + &m[0], &m[1], &m[2], &m[3], &m[4], &m[5]) != 6)
> + errx(1, "Failed to parse mac address '%s'", mac);
Need to pass "macaddr" to errx(), not "mac"
Cheers,
Mark.
More information about the Lguest
mailing list