On Wed, Nov 02, 2005 at 07:36:17PM +0100, Marco Molteni wrote:
> Hi,
> 
> I have the following setup:
> 
> 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
>  |       |        |         | | | |
>  |       |        |         | | | |     
> ======================================== cisco catalyst switch
> 
> 
> Hosts box1,2,3,4 are running stock fbsd -current.
> 
> 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.
> 
> 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.
> 
> 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.
> 
> 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.
> 
> 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.
> 
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
===================================================================
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 <net/if.h>
 #include <net/if_types.h>
 #include <net/if_arp.h>
-#include <net/if_dl.h>
 #include <net/if_media.h>
 #include <net/bpf.h>
 #include <net/ethernet.h>
@@ -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;
 
        if (priv == NULL || iface == 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 == 0) {
-               ifa = ifaddr_byindex(ifp->if_index);
-               sdl = (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 == 0)
+               if_setlladdr(ifp, IFP2ENADDR(bifp), ETHER_ADDR_LEN);
 
        b->fec_btype = FEC_BTYPE_MAC;
        new->fec_idx = b->fec_ifcnt;
@@ -426,10 +417,7 @@ ng_fec_addport(struct ng_fec_private *pr
            (char *)&new->fec_mac, ETHER_ADDR_LEN);
 
        /* Set up phony MAC address. */
-       ifa = ifaddr_byindex(bifp->if_index);
-       sdl = (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);
 
        /* Save original input vector */
        new->fec_if_input = 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;
 
        if (priv == NULL || iface == NULL)
@@ -487,10 +473,7 @@ ng_fec_delport(struct ng_fec_private *pr
        (*bifp->if_ioctl)(bifp, SIOCSIFFLAGS, NULL);
 
        /* Restore MAC address. */
-       ifa = ifaddr_byindex(bifp->if_index);
-       sdl = (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);
 
        /* Restore input vector */
        bifp->if_input = p->fec_if_input;
%%%


Cheers,
-- 
Ruslan Ermilov
[EMAIL PROTECTED]
FreeBSD committer

Attachment: pgpn4isHog8qx.pgp
Description: PGP signature

Reply via email to