problem in if_tap.c

Bruce M. Simpson bms at FreeBSD.org
Tue Apr 15 06:40:40 UTC 2008


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


More information about the freebsd-net mailing list