Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Apr 2008 07:40:38 +0100
From:      "Bruce M. Simpson" <bms@FreeBSD.org>
To:        Maksim Yevmenkin <maksim.yevmenkin@gmail.com>
Cc:        freebsd-net@freebsd.org, =?ISO-8859-1?Q?Marc_L=F6rner?= <marc.loerner@hob.de>
Subject:   Re: problem in if_tap.c
Message-ID:  <48044DE6.8070600@FreeBSD.org>
In-Reply-To: <bb4a86c70804140945m34a7a612s476025d1888d382f@mail.gmail.com>
References:  <200804141033.35918.marc.loerner@hob.de> <bb4a86c70804140945m34a7a612s476025d1888d382f@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Maksim Yevmenkin wrote:
> please try the following patch. if there is no objections, i will commit it
>
> beetle# diff -u if_tap.c.orig if_tap.c
> --- if_tap.c.orig       2007-04-05 10:58:39.000000000 -0700
> +++ if_tap.c    2008-04-14 09:42:42.000000000 -0700
> @@ -404,6 +404,7 @@
>         struct ifnet            *ifp = NULL;
>         struct tap_softc        *tp = NULL;
>         unsigned short           macaddr_hi;
> +       uint32_t                 macaddr_mid;
>         int                      unit, s;
>         char                    *name = NULL;
>         u_char                  eaddr[6];
> @@ -432,8 +433,9 @@
>
>         /* generate fake MAC address: 00 bd xx xx xx unit_no */
>         macaddr_hi = htons(0x00bd);
> +       macaddr_mid = (uint32_t) ticks;
>         bcopy(&macaddr_hi, eaddr, sizeof(short));
> -       bcopy(&ticks, &eaddr[2], sizeof(long));
> +       bcopy(&macaddr_mid, &eaddr[2], sizeof(uint32_t));
>         eaddr[5] = (u_char)unit;
>
>         /* fill the rest and attach interface */
>   


This patch looks good, please commit.


[Unless of course we want the autogenerated MAC to be deterministic for 
some reason, but given that it comes from a timer, there's not much 
point in fixing the endianness...]

cheers
BMS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48044DE6.8070600>