Hello Ralf,

On Thu, Nov 05, 2020 at 07:59:18AM +0100, Ralf Horstmann wrote:
> Hi Sashan,
> 
> * Alexandr Nedvedicky <[email protected]> [2020-11-05 00:25]:
> > Hello Ralf,
> > 
> > I think we should rather give a try diff below. I would rather add
> > a return after m_freem(). Will diff below work for you too?
> 
> Without understanding the full background I went with ignoring the return 
> value

    I'm sorry I have not provide better explanation in my first email.
    this is the code after applying diff I've suggested earlier:

2277 void
2278 carp_transmit(struct carp_softc *sc, struct ifnet *ifp0, struct mbuf *m)
2279 {
2280         struct ifnet *ifp = &sc->sc_if;
2281 
2282 #if NBPFILTER > 0
2283         {
2284                 caddr_t if_bpf = ifp->if_bpf;
2285                 if (if_bpf) {
2286                         if (bpf_mtap_ether(if_bpf, m, BPF_DIRECTION_OUT)) {
2287                                 m_freem(m);
2288                                 return;
2289                         }
2290                 }
2291         }
2292 #endif /* NBPFILTER > 0 */
2293 
2294         if (!ISSET(ifp0->if_flags, IFF_RUNNING)) {
2295                 counters_inc(ifp->if_counters, ifc_oerrors);
2296                 m_freem(m);
2297                 return;
2298         }


    the proposed change adds a 'return;' to line 2288, which is also consistent
    with code, we can see at following line 2297.

    poking to bpf_mtap(), we can see the function returns non-zero value 
ordering
    caller to drop packet. The bpf drop action has been added by dlg@ 4 years
    ago:

Author: dlg <[email protected]>
Date:   Tue Mar 29 10:38:27 2016 +0000

    make bpf_mtap et al return whether the mbuf should be dropped
    
    ok mpi@

> Anyway, I will give it a try to see whether it works.
> 

    thank you very much. you definitely earn credit for the hardest part:
        finding a buggy line

regards
sashan

Reply via email to