From owner-freebsd-net@FreeBSD.ORG Thu Nov 3 14:52:49 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3525216A41F; Thu, 3 Nov 2005 14:52:49 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8D8DD43D45; Thu, 3 Nov 2005 14:52:48 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from localhost (rocky.ip.net.ua [82.193.96.2]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id jA3Eqk0f018222; Thu, 3 Nov 2005 16:52:46 +0200 (EET) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua ([82.193.96.10]) by localhost (rocky.ipnet [82.193.96.2]) (amavisd-new, port 10024) with LMTP id 23016-02-8; Thu, 3 Nov 2005 16:52:45 +0200 (EET) Received: from heffalump.ip.net.ua (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id jA3Epe4G017920 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 3 Nov 2005 16:51:40 +0200 (EET) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.13.4/8.13.4) id jA3EpitX079785; Thu, 3 Nov 2005 16:51:44 +0200 (EET) (envelope-from ru) Date: Thu, 3 Nov 2005 16:51:44 +0200 From: Ruslan Ermilov To: Marco Molteni Message-ID: <20051103145144.GM63539@ip.net.ua> References: <20051102193617.1013be88.molter@tin.it> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="M2Pxvdb9QxnGd/3e" Content-Disposition: inline In-Reply-To: <20051102193617.1013be88.molter@tin.it> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at ip.net.ua Cc: freebsd-net@freebsd.org, Bill Paul Subject: Re: troubles with ng_fec on -current X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Nov 2005 14:52:49 -0000 --M2Pxvdb9QxnGd/3e Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 02, 2005 at 07:36:17PM +0100, Marco Molteni wrote: > Hi, >=20 > I have the following setup: >=20 > box1 box2 box3 box4 > xl0 xl0 xl0 ste0/ste1/ste2/ste3 -> fec0 > 1.1.1.1 1.1.1.2 1.1.1.3 1.1.1.4 > | | | | | | | > | | | | | | | =20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D cisco catalyst switch >=20 >=20 > Hosts box1,2,3,4 are running stock fbsd -current. >=20 > box4 has a 4-port ethernet card (forgot brand, think d-link) > recognized by the ste driver, without IP addresses. I then configure > bonding on the ste0..3 interfaces with ng_fec, which gives me a fec0 > interface. I then configure fec0 with set_mode_mac and with IP address > 1.1.1.4. >=20 > The switch is configured to perform etherchannel on the 4 ports > connected to the ste0..4 interfaces. Load "balancing" is done > on a per source MAC address. >=20 > Problem is when I ping box4 from the other boxes. I get a reply only > for ping from box1. I then ran tcpdump on the 4 ste interfaces. > Things become to get interesting. >=20 > If tcpdump is ran in non-promiscuos mode (-p option), only ping > (and ARP) from box1 goes thru, as if I wasn't running tcpdump at all. > If on the other hand tcpdump is ran in promiscuos mode, then all the > pings go thru as expected. >=20 > Am I doing something wrong in configuring the fec0 interface or is this > a known problem? I think I don't need to add any IP address on the > ste interfaces themselves. >=20 Looks like a bug. The ng_fec code uses the MAC address of the first real interface as the MAC address for the virtual and all other ports in the bundle, but it lacks a call to ifp->if_init() to actually reprogram the hardware MAC filter. Please try this patch: %%% Index: ng_fec.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/netgraph/ng_fec.c,v retrieving revision 1.21 diff -u -p -r1.21 ng_fec.c --- ng_fec.c 25 Aug 2005 17:00:02 -0000 1.21 +++ ng_fec.c 3 Nov 2005 14:48:27 -0000 @@ -104,7 +104,6 @@ #include #include #include -#include #include #include #include @@ -345,8 +344,6 @@ ng_fec_addport(struct ng_fec_private *pr { struct ng_fec_bundle *b; struct ifnet *ifp, *bifp; - struct ifaddr *ifa; - struct sockaddr_dl *sdl; struct ng_fec_portlist *p, *new; =20 if (priv =3D=3D NULL || iface =3D=3D NULL) @@ -408,14 +405,8 @@ ng_fec_addport(struct ng_fec_private *pr * use its MAC address for the virtual interface (and, * by extension, all the other ports in the bundle). */ - if (b->fec_ifcnt =3D=3D 0) { - ifa =3D ifaddr_byindex(ifp->if_index); - sdl =3D (struct sockaddr_dl *)ifa->ifa_addr; - bcopy(IFP2ENADDR(bifp), - IFP2ENADDR(priv->ifp), ETHER_ADDR_LEN); - bcopy(IFP2ENADDR(bifp), - LLADDR(sdl), ETHER_ADDR_LEN); - } + if (b->fec_ifcnt =3D=3D 0) + if_setlladdr(ifp, IFP2ENADDR(bifp), ETHER_ADDR_LEN); =20 b->fec_btype =3D FEC_BTYPE_MAC; new->fec_idx =3D b->fec_ifcnt; @@ -426,10 +417,7 @@ ng_fec_addport(struct ng_fec_private *pr (char *)&new->fec_mac, ETHER_ADDR_LEN); =20 /* Set up phony MAC address. */ - ifa =3D ifaddr_byindex(bifp->if_index); - sdl =3D (struct sockaddr_dl *)ifa->ifa_addr; - bcopy(IFP2ENADDR(priv->ifp), IFP2ENADDR(bifp), ETHER_ADDR_LEN); - bcopy(IFP2ENADDR(priv->ifp), LLADDR(sdl), ETHER_ADDR_LEN); + if_setlladdr(bifp, IFP2ENADDR(ifp), ETHER_ADDR_LEN); =20 /* Save original input vector */ new->fec_if_input =3D bifp->if_input; @@ -453,8 +441,6 @@ ng_fec_delport(struct ng_fec_private *pr { struct ng_fec_bundle *b; struct ifnet *ifp, *bifp; - struct ifaddr *ifa; - struct sockaddr_dl *sdl; struct ng_fec_portlist *p; =20 if (priv =3D=3D NULL || iface =3D=3D NULL) @@ -487,10 +473,7 @@ ng_fec_delport(struct ng_fec_private *pr (*bifp->if_ioctl)(bifp, SIOCSIFFLAGS, NULL); =20 /* Restore MAC address. */ - ifa =3D ifaddr_byindex(bifp->if_index); - sdl =3D (struct sockaddr_dl *)ifa->ifa_addr; - bcopy((char *)&p->fec_mac, IFP2ENADDR(bifp), ETHER_ADDR_LEN); - bcopy((char *)&p->fec_mac, LLADDR(sdl), ETHER_ADDR_LEN); + if_setlladdr(bifp, (u_char *)&p->fec_mac, ETHER_ADDR_LEN); =20 /* Restore input vector */ bifp->if_input =3D p->fec_if_input; %%% Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --M2Pxvdb9QxnGd/3e Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (FreeBSD) iD8DBQFDaiQAqRfpzJluFF4RAsnxAJ4hMwch0e6CGOqWxaQM109MgGhN1ACbBbdM R34s9ELPHsrvSucm5keZ+qk= =WqJW -----END PGP SIGNATURE----- --M2Pxvdb9QxnGd/3e--