From nobody@FreeBSD.org Wed Oct 24 16:38:22 2007 Return-Path: Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED17B16A419 for ; Wed, 24 Oct 2007 16:38:21 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id E7A8013C48A for ; Wed, 24 Oct 2007 16:38:21 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.1/8.14.1) with ESMTP id l9OGbse7017557 for ; Wed, 24 Oct 2007 16:37:54 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.1/8.14.1/Submit) id l9OGbsIm017556; Wed, 24 Oct 2007 16:37:54 GMT (envelope-from nobody) Message-Id: <200710241637.l9OGbsIm017556@www.freebsd.org> Date: Wed, 24 Oct 2007 16:37:54 GMT From: Jacek Zapala To: freebsd-gnats-submit@FreeBSD.org Subject: ipv6 neighbour discovery / bce multicast problem X-Send-Pr-Version: www-3.1 X-GNATS-Notify: >Number: 117456 >Category: kern >Synopsis: [ipv6] ipv6 neighbour discovery / bce multicast problem >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-net >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Oct 24 16:40:02 UTC 2007 >Closed-Date: Fri Nov 16 03:09:17 UTC 2007 >Last-Modified: Fri Nov 16 03:09:17 UTC 2007 >Originator: Jacek Zapala >Release: 6.2-RELEASE-p8 >Organization: >Environment: FreeBSD 6.2-RELEASE-p8 #0: Mon Oct 15 15:29:48 CEST 2007 root@server:/usr/src/sys/i386/compile/DELL_2950 i386 >Description: There are two FreeBSD-6.2 servers on the same subnet: A (2001:XXXX:YYYY:1::270) and B (2001:XXXX:YYYY:1::267) I try to ping6 B from A. B does not see neighbour discovery packets sent by A. It starts to see them just after enabling promiscuous mode on B. A:~# ifconfig bce0 bce0: flags=8843 mtu 1500 options=3b inet6 fe80::21a:a0ff:fe0e:8990%bce0 prefixlen 64 scopeid 0x1 inet6 2001:XXXX:YYYY:1::270 prefixlen 120 inet6 2001:XXXX:YYYY:1::272 prefixlen 120 (inet4 addresses deleted) ether 00:1a:a0:0e:89:90 media: Ethernet autoselect (100baseTX ) status: active B:~# ifconfig bce0 bce0: flags=8843 mtu 1500 options=3b inet6 fe80::21a:a0ff:fe34:e724%bce0 prefixlen 64 scopeid 0x1 inet6 2001:XXXX:YYYY:1::267 prefixlen 120 inet6 2001:XXXX:YYYY:1::269 prefixlen 120 (inet4 addresses deleted) ether 00:1a:a0:34:e7:24 media: Ethernet autoselect (100baseTX ) status: active B:~# netstat -ia Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll bce0 1500 00:1a:a0:34:e7:24 398232 0 416485 0 0 33:33:ff:00:02:69 729 8 33:33:ff:00:02:67 729 8 01:00:5e:00:00:01 729 8 33:33:f2:4c:bf:48 729 8 33:33:00:00:00:01 729 8 33:33:ff:34:e7:24 729 8 Packets on the wire (sniffed on third machine): 16:06:55.584139 00:1a:a0:0e:89:90 > 33:33:ff:00:02:67, ethertype IPv6 (0x86dd), length 86: 2001:XXXX:YYYY:1::270 > ff02::1:ff00:267: ICMP6, neighbor solicitation, who has 2001:XXXX:YYYY:1::267, length 32 16:06:56.607487 00:1a:a0:0e:89:90 > 33:33:ff:00:02:67, ethertype IPv6 (0x86dd), length 86: 2001:XXXX:YYYY:1::270 > ff02::1:ff00:267: ICMP6, neighbor solicitation, who has 2001:XXXX:YYYY:1::267, length 32 B does not see them: B:~# tcpdump -n -p host 2001:XXXX:YYYY:1::270 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on bce0, link-type EN10MB (Ethernet), capture size 96 bytes ^C 0 packets captured 746805 packets received by filter 0 packets dropped by kernel Enabling promiscuous mode (no -p option) solves the problem: B:~# tcpdump -n host 2001:XXXX:YYYY:1::270 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on bce0, link-type EN10MB (Ethernet), capture size 96 bytes 16:46:11.348129 IP6 2001:XXXX:YYYY:1::270 > ff02::1:ff00:267: ICMP6, neighbor solicitation, who has 2001:XXXX:YYYY:1::267, length 32 16:46:11.348202 IP6 2001:XXXX:YYYY:1::267 > 2001:XXXX:YYYY:1::270: ICMP6, neighbor advertisement, tgt is 2001:XXXX:YYYY:1::267, length 32 16:46:11.348373 IP6 2001:XXXX:YYYY:1::270 > 2001:XXXX:YYYY:1::267: ICMP6, echo request, seq 258, length 16 16:46:11.348393 IP6 2001:XXXX:YYYY:1::267 > 2001:XXXX:YYYY:1::270: ICMP6, echo reply, seq 258, length 16 Do I miss something very obvious? I use pf, but pfctl -d does not help >How-To-Repeat: Well, boot a machine and try to ping6 it. I know it sounds like I'm drunk ;-) >Fix: >Release-Note: >Audit-Trail: Responsible-Changed-From-To: freebsd-bugs->freebsd-net Responsible-Changed-By: remko Responsible-Changed-When: Wed Oct 24 16:45:30 UTC 2007 Responsible-Changed-Why: This sounds more like a networking problem. http://www.freebsd.org/cgi/query-pr.cgi?pr=117456 From: Jacek Zapala To: bug-followup@FreeBSD.org Cc: Subject: Re: kern/117456: ipv6 neighbour discovery / bce multicast problem Date: Mon, 29 Oct 2007 10:50:18 +0100 --=-OnEZhZq5git3EvQIW/zR Content-Type: text/plain Content-Transfer-Encoding: 7bit I have found the bug in the bce driver. Patch attached. -- Jacek --=-OnEZhZq5git3EvQIW/zR Content-Disposition: attachment; filename=bce_multicast_patch.diff Content-Type: text/x-patch; name=bce_multicast_patch.diff; charset=ISO-8859-2 Content-Transfer-Encoding: 7bit --- dev/bce/if_bce.c.old Sun Oct 28 02:35:08 2007 +++ dev/bce/if_bce.c Mon Oct 29 10:27:22 2007 @@ -5209,10 +5209,12 @@ { struct ifnet *ifp; struct ifmultiaddr *ifma; - u32 hashes[4] = { 0, 0, 0, 0 }; + u32 hashes[NUM_MC_HASH_REGISTERS]; u32 rx_mode, sort_mode; int h, i; + memset(hashes, 0, 4 * NUM_MC_HASH_REGISTERS); + BCE_LOCK_ASSERT(sc); ifp = sc->bce_ifp; @@ -5257,12 +5259,12 @@ if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ether_crc32_le(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) & 0x7F; - hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F); + ifma->ifma_addr), ETHER_ADDR_LEN) & 0xFF; + hashes[(h & 0xe0) >> 5] |= 1 << (h & 0x1F); } IF_ADDR_UNLOCK(ifp); - for (i = 0; i < 4; i++) + for (i = 0; i < NUM_MC_HASH_REGISTERS; i++) REG_WR(sc, BCE_EMAC_MULTICAST_HASH0 + (i * 4), hashes[i]); sort_mode |= BCE_RPM_SORT_USER0_MC_HSH_EN; --=-OnEZhZq5git3EvQIW/zR-- From: Jacek Zapala To: bug-followup@FreeBSD.org Cc: Subject: Re: kern/117456: ipv6 neighbour discovery / bce multicast problem Date: Tue, 30 Oct 2007 16:32:38 +0100 OK, it looks like I have reinvented the wheel. Close the PR please. Revision 1.26: Sat Jan 20 17:05:12 2007 UTC (9 months, 1 week ago) by scottl Branches: MAIN Changes since revision 1.25: +4 -4 lines The multicast hash table has 8 slots in the BCE hardware, not 4 slots like the BGE hardware. Adapt the driver for this. Submitted by: Mike Karels MFC After: 3 days State-Changed-From-To: open->closed State-Changed-By: kmacy State-Changed-When: Fri Nov 16 03:08:39 UTC 2007 State-Changed-Why: Fixed by Mike Karels. http://www.freebsd.org/cgi/query-pr.cgi?pr=117456 >Unformatted: Fixed. Closed per request of submitter.