On 28/05/17(Sun) 16:02, Florian Riehm wrote:
> [...] 
> Ok, new diff below.

I overlooked something!  See below:

> Index: sys/netinet/ip_carp.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet/ip_carp.c,v
> retrieving revision 1.310
> diff -u -p -r1.310 ip_carp.c
> --- sys/netinet/ip_carp.c     27 May 2017 21:55:52 -0000      1.310
> +++ sys/netinet/ip_carp.c     28 May 2017 13:50:25 -0000
> @@ -1422,8 +1422,23 @@ carp_input(struct ifnet *ifp0, struct mb
>                   (IFF_UP|IFF_RUNNING))
>                       continue;
>  
> -             if (carp_vhe_match(sc, eh->ether_dhost))
> +             if (carp_vhe_match(sc, eh->ether_dhost)) {
> +                     /*
> +                      * These packets look like layer 2 multicast but they
> +                      * are unicast at layer 3. With help of the tag the
> +                      * mbuf's M_MCAST flag can be removed by carp_lsdrop()
> +                      * after we have passed layer 2.
> +                      */
> +                     if (sc->sc_balancing == CARP_BAL_IP) {
> +                             struct m_tag *mtag;
> +                             mtag = m_tag_get(PACKET_TAG_CARP_BAL_IP, 0,
> +                                 M_NOWAIT);
> +                             if (mtag == NULL)
> +                                     return (0);

If the CPU failed to allocate memory, then we cannot return 0.  This
means this packet is not for carp(4).  Instead you should free the
packet and return 1.

> +                             m_tag_prepend(m, mtag);
> +                     }
>                       break;
> +             }
>       }
>  
>       if (sc == NULL) {
> @@ -1456,13 +1471,6 @@ carp_input(struct ifnet *ifp0, struct mb
>               return (0);
>       }
>  
> -     /*
> -      * Clear mcast if received on a carp IP balanced address.
> -      */
> -     if (sc->sc_balancing == CARP_BAL_IP &&
> -         ETHER_IS_MULTICAST(eh->ether_dhost))
> -             *(eh->ether_dhost) &= ~0x01;
> -
>       ml_enqueue(&ml, m);
>       if_input(&sc->sc_if, &ml);
>       SRPL_LEAVE(&sr);

Reply via email to