Reyk Floeter([email protected]) on 2015.10.30 19:25:28 +0100:
> On Fri, Oct 30, 2015 at 06:16:53PM +0100, Sebastian Benoit wrote:
> > 
> > i think it should be documented ;)
> > 
> > otherwise ok
> > 
> 
> Ooops, good point, I missed the manpage.
> 
> It looks about right, but maybe it is better to have it less pf-
> specific (also regarding bluhm's update)?
> 
> Otherwise OK

thanks, just saw your mail.


> 
> Reyk
> 
> > Index: mbuf.9
> > ===================================================================
> > RCS file: /cvs/src/share/man/man9/mbuf.9,v
> > retrieving revision 1.91
> > diff -u -p -u -r1.91 mbuf.9
> > --- mbuf.9  8 Oct 2015 14:09:34 -0000       1.91
> > +++ mbuf.9  30 Oct 2015 17:15:40 -0000
> > @@ -44,6 +44,8 @@
> >  .Fn MGET "struct mbuf *m" "int how" "int type"
> >  .Ft struct mbuf *
> >  .Fn m_getclr "int how" "int type"
> > +.Ft void
> > +.Fn m_resethdr struct mbuf *
> >  .Ft struct mbuf *
> >  .Fn m_gethdr "int how" "int type"
> >  .Fn MGETHDR "struct mbuf *m" "int how" "int type"
> > @@ -445,6 +447,11 @@ See
> >  .Fn m_get
> >  for a description of
> >  .Fa how .
> > +.It Fn m_resethdr "struct mbuf *"
> > +Deletes all
> > +.Xr pf 4
> > +data and all tags attached to packet
> > +.Fa mbuf .
> >  .It Fn m_gethdr "int how" "int type"
> >  Return a pointer to an mbuf of the type specified after initializing
> >  it to contain a packet header.
> > 
> > 
> > Reyk Floeter([email protected]) on 2015.10.30 14:04:52 +0100:
> > > On Fri, Oct 30, 2015 at 01:40:19PM +0100, Alexander Bluhm wrote:
> > > > On Fri, Oct 30, 2015 at 12:56:34PM +0100, Reyk Floeter wrote:
> > > > > --- sys/sys/mbuf.h    22 Oct 2015 05:26:06 -0000      1.198
> > > > > +++ sys/sys/mbuf.h    30 Oct 2015 11:30:33 -0000
> > > > > @@ -410,6 +410,7 @@ struct    mbuf *m_get(int, int);
> > > > >  struct       mbuf *m_getclr(int, int);
> > > > >  struct       mbuf *m_gethdr(int, int);
> > > > >  struct       mbuf *m_inithdr(struct mbuf *);
> > > > > +void m_resethdr(struct mbuf *);
> > > > >  int        m_defrag(struct mbuf *, int);
> > > > 
> > > > The m_resethdr should have the same indent as m_defrag.
> > > > 
> > > 
> > > Really?  The indent of m_defrag() is wrong - many spaces and not like
> > > the other int functions further down - but I didn't dare to touch it.
> > > It sticks in the eye, so I'll fix m_defrag indent as well.
> > > 
> > > > > --- sys/net/if_pair.c 25 Oct 2015 12:59:57 -0000      1.4
> > > > > +++ sys/net/if_pair.c 30 Oct 2015 11:30:33 -0000
> > > > > @@ -30,6 +30,11 @@
> > > > >  #include <netinet/in.h>
> > > > >  #include <netinet/if_ether.h>
> > > > >  
> > > > > +#include "pf.h"
> > > > > +#if NPF > 0
> > > > > +#include <net/pfvar.h>
> > > > > +#endif
> > > > 
> > > > I think you don't need that anymore.
> > > > 
> > > > > @@ -182,9 +187,13 @@ pairstart(struct ifnet *ifp)
> > > > >  #endif /* NBPFILTER > 0 */
> > > > >  
> > > > >               ifp->if_opackets++;
> > > > > -             if (pairedifp != NULL)
> > > > > +             if (pairedifp != NULL) {
> > > > > +#if NPF > 0
> > > > > +                     if (m->m_flags & M_PKTHDR)
> > > > > +                             m_resethdr(m);
> > > > > +#endif
> > > > 
> > > > Calling m_tag_delete_chain() is not pf specific, so I would do it
> > > > without the #if NPF.
> > > > 
> > > > Otherwise OK bluhm@
> > > > 
> > > > Socket splicing somove() does the same thing.  I will change it to
> > > > use m_resethdr() after that got commited.
> > > 
> > > Cool.
> > > 
> > > I'm going to commit the attached diff for now.
> > > 
> > > Reyk
> > > 
> > > Index: sys/kern/uipc_mbuf.c
> > > ===================================================================
> > > RCS file: /cvs/src/sys/kern/uipc_mbuf.c,v
> > > retrieving revision 1.208
> > > diff -u -p -u -p -r1.208 uipc_mbuf.c
> > > --- sys/kern/uipc_mbuf.c  22 Oct 2015 05:26:06 -0000      1.208
> > > +++ sys/kern/uipc_mbuf.c  30 Oct 2015 12:45:50 -0000
> > > @@ -250,6 +250,18 @@ m_inithdr(struct mbuf *m)
> > >   return (m);
> > >  }
> > >  
> > > +void
> > > +m_resethdr(struct mbuf *m)
> > > +{
> > > + /* like the previous, but keep any associated data and mbufs */
> > > + m->m_flags = M_PKTHDR;
> > > + memset(&m->m_pkthdr.pf, 0, sizeof(m->m_pkthdr.pf));
> > > + m->m_pkthdr.pf.prio = IFQ_DEFPRIO;
> > > +
> > > + /* also delete all mbuf tags to reset the state */
> > > + m_tag_delete_chain(m);
> > > +}
> > > +
> > >  struct mbuf *
> > >  m_getclr(int nowait, int type)
> > >  {
> > > Index: sys/sys/mbuf.h
> > > ===================================================================
> > > RCS file: /cvs/src/sys/sys/mbuf.h,v
> > > retrieving revision 1.198
> > > diff -u -p -u -p -r1.198 mbuf.h
> > > --- sys/sys/mbuf.h        22 Oct 2015 05:26:06 -0000      1.198
> > > +++ sys/sys/mbuf.h        30 Oct 2015 12:45:50 -0000
> > > @@ -410,7 +410,8 @@ struct        mbuf *m_get(int, int);
> > >  struct   mbuf *m_getclr(int, int);
> > >  struct   mbuf *m_gethdr(int, int);
> > >  struct   mbuf *m_inithdr(struct mbuf *);
> > > -int            m_defrag(struct mbuf *, int);
> > > +void     m_resethdr(struct mbuf *);
> > > +int      m_defrag(struct mbuf *, int);
> > >  struct   mbuf *m_prepend(struct mbuf *, int, int);
> > >  struct   mbuf *m_pulldown(struct mbuf *, int, int, int *);
> > >  struct   mbuf *m_pullup(struct mbuf *, int);
> > > Index: sys/net/if_pair.c
> > > ===================================================================
> > > RCS file: /cvs/src/sys/net/if_pair.c,v
> > > retrieving revision 1.4
> > > diff -u -p -u -p -r1.4 if_pair.c
> > > --- sys/net/if_pair.c     25 Oct 2015 12:59:57 -0000      1.4
> > > +++ sys/net/if_pair.c     30 Oct 2015 12:45:50 -0000
> > > @@ -182,9 +182,11 @@ pairstart(struct ifnet *ifp)
> > >  #endif /* NBPFILTER > 0 */
> > >  
> > >           ifp->if_opackets++;
> > > -         if (pairedifp != NULL)
> > > +         if (pairedifp != NULL) {
> > > +                 if (m->m_flags & M_PKTHDR)
> > > +                         m_resethdr(m);
> > >                   ml_enqueue(&ml, m);
> > > -         else
> > > +         } else
> > >                   m_freem(m);
> > >   }
> > >  
> > > 
> > 
> > -- 
> 
> -- 
> 

-- 

Reply via email to