On Mon, Mar 04, 2019 at 12:10:55AM +0100, Mike Belopuhov wrote:
> > diff 716b4707a904aa2012c47dd657b6db0fd4417862 /usr/src
> > blob - 7c5d9a62eafaa49b574f517fb4296488fc2c4ad0
> > file + sys/net/pfkeyv2.h
> > --- sys/net/pfkeyv2.h
> > +++ sys/net/pfkeyv2.h
> > @@ -221,6 +221,7 @@ struct sadb_x_tap {
> >  struct sadb_x_counter {
> >     uint16_t  sadb_x_counter_len;
> >     uint16_t  sadb_x_counter_exttype;
> > +   uint32_t  pad;
> 
> Perhaps call it sadb_x_counter_pad?  There are reserved fields
> with names like sadb_x_foo_reserved so sadb_x_counter_pad would
> be consistent in my opinion.  This brought me here in the first
> place (:

Sure!

> >     uint64_t  sadb_x_counter_ipackets;      /* Input IPsec packets */
> >     uint64_t  sadb_x_counter_opackets;      /* Output IPsec packets */
> >     uint64_t  sadb_x_counter_ibytes;        /* Input bytes */
> > blob - 732a39d7004f8f55ee36a86fe40bebcde37da947
> > file + sys/net/pfkeyv2_convert.c
> > --- sys/net/pfkeyv2_convert.c
> > +++ sys/net/pfkeyv2_convert.c
> > @@ -906,6 +906,7 @@ export_counter(void **p, struct tdb *tdb)
> >  
> >     scnt->sadb_x_counter_len = sizeof(struct sadb_x_counter) /
> >         sizeof(uint64_t);
> > +   scnt->pad = 0;
> >     scnt->sadb_x_counter_ipackets = tdb->tdb_ipackets;
> >     scnt->sadb_x_counter_opackets = tdb->tdb_opackets;
> >     scnt->sadb_x_counter_ibytes = tdb->tdb_ibytes;
> 
> It's hard to argue whether or not this is needed since nothing
> calls this function in the tree (:

Nothing calls export_counter() in your tree?
Your tree must be outdated then.
It is called by pfkeyv2_get() in mine.

$ grep export_counter *
pfkeyv2.c:      export_counter(&p, tdb);
pfkeyv2.h:void export_counter(void **, struct tdb *);
pfkeyv2_convert.c:export_counter(void **p, struct tdb *tdb)

> Looks like other PFKEYv2 structures avoid this problem
> (uint64_t is aligned to the 64 byte boundary).
> 
> Ok mikeb regardless whether or not you'll be renaming the pad.

Thanks! I'll rename it.

Reply via email to