Yeah, I'm good with that, and in fact enm_addrlo is defined as u_int8_t which I 
hadn't gone to check.

../sys/netinet/if_ether.h:      u_int8_t enm_addrlo[ETHER_ADDR_LEN]; /* low  or 
only address of range */

I've verified the code works:

# tcpdump -e -s 1500 -p multicast and not broadcast
tcpdump: listening on tl0, link-type EN10MB
08:49:37.903615 00:25:00:3e:ae:2d 01:00:5e:00:00:fb ip 72: 192.168.42.64.mdns > 
224.0.0.251.mdns: 0 A (QU)? nobody.local. (30)
08:49:38.936298 00:25:00:3e:ae:2d 01:00:5e:00:00:fb ip 72: 192.168.42.64.mdns > 
224.0.0.251.mdns: 0 A? nobody.local. (30)
08:49:41.963983 00:25:00:3e:ae:2d 01:00:5e:00:00:fb ip 72: 192.168.42.64.mdns > 
224.0.0.251.mdns: 0 A? nobody.local. (30)

Thanks.

-- Nick Briggs

> On Jul 13, 2017, at 7:44 AM, Christian Weisgerber <[email protected]> wrote:
> 
> Nick Briggs:
> 
>>      The code in if_tl.c, tl_calchash() is wrong in that it doesn't 
>> compensate for signed char type so that the XOR operations to generate the 
>> multicast hash index are polluted by sign extension if the MSbit of the 1st 
>> and 4th or 2nd and 5th bytes of the multicast destination ethernet address 
>> are not equal.  This is the patch for that problem:
> 
> We should just use unsigned chars.
> Kill a prototype for a nonexisting function in a neighboring file,
> while here.
> 
> Index: if_tl.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_tl.c,v
> retrieving revision 1.70
> diff -u -p -r1.70 if_tl.c
> --- if_tl.c   22 Jan 2017 10:17:38 -0000      1.70
> +++ if_tl.c   13 Jul 2017 14:39:09 -0000
> @@ -272,7 +272,7 @@ void tl_miibus_writereg(struct device *,
> void tl_miibus_statchg(struct device *);
> 
> void tl_setmode(struct tl_softc *, uint64_t);
> -int tl_calchash(caddr_t);
> +int tl_calchash(u_int8_t *);
> void tl_iff(struct tl_softc *);
> void tl_setfilt(struct tl_softc *, caddr_t, int);
> void tl_softreset(struct tl_softc *, int);
> @@ -747,7 +747,7 @@ tl_setmode(struct tl_softc *sc, uint64_t
>  * the folded 24-bit value is split into 6-bit portions and XOR'd.
>  */
> int
> -tl_calchash(caddr_t addr)
> +tl_calchash(u_int8_t *addr)
> {
>       int                     t;
> 
> Index: if_wb.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_wb.c,v
> retrieving revision 1.68
> diff -u -p -r1.68 if_wb.c
> --- if_wb.c   22 Jan 2017 10:17:38 -0000      1.68
> +++ if_wb.c   13 Jul 2017 14:36:07 -0000
> @@ -154,7 +154,6 @@ int wb_mii_readreg(struct wb_softc *, st
> int wb_mii_writereg(struct wb_softc *, struct wb_mii_frame *);
> 
> void wb_setcfg(struct wb_softc *, uint64_t);
> -u_int8_t wb_calchash(caddr_t);
> void wb_setmulti(struct wb_softc *);
> void wb_reset(struct wb_softc *);
> void wb_fixmedia(struct wb_softc *);
> -- 
> Christian "naddy" Weisgerber                          [email protected]

Reply via email to