[ovs-dev] [PATCH 19/41] ofp-prop: New function ofpprop_put_zeros().

Ben Pfaff blp at ovn.org
Wed Jan 20 17:20:28 UTC 2016


Thanks, applied, with that fix incorporated.

On Tue, Jan 19, 2016 at 02:44:59PM -0800, Jarno Rajahalme wrote:
> With the bug fix below,
> 
> Acked-by: Jarno Rajahalme <jarno at ovn.org>
> 
> > On Jan 18, 2016, at 11:27 PM, Ben Pfaff <blp at ovn.org> wrote:
> > 
> > This will have additional users in later commits.
> > 
> > Signed-off-by: Ben Pfaff <blp at ovn.org>
> > ---
> > lib/ofp-prop.c | 22 ++++++++++++++++++++++
> > lib/ofp-prop.h |  1 +
> > lib/ofp-util.c | 20 ++++++--------------
> > 3 files changed, 29 insertions(+), 14 deletions(-)
> > 
> > diff --git a/lib/ofp-prop.c b/lib/ofp-prop.c
> > index 76031b6..1641a39 100644
> > --- a/lib/ofp-prop.c
> > +++ b/lib/ofp-prop.c
> > @@ -261,6 +261,28 @@ ofpprop_put(struct ofpbuf *msg, uint64_t type, const void *value, size_t len)
> >     ofpprop_end(msg, start_ofs);
> > }
> > 
> > +/* Adds a property with the given 'type' to 'msg', consisting of a struct
> > + * ofp_prop_header followed by enough zero bytes to total 'len' bytes, followed
> > + * by padding to bring the property up to a multiple of 8 bytes.  Returns the
> > + * property header. */
> > +void *
> > +ofpprop_put_zeros(struct ofpbuf *msg, uint64_t type, size_t len)
> > +{
> > +    void *header = ofpbuf_put_zeros(msg, ROUND_UP(len, 8));
> > +    if (!ofpprop_is_experimenter(type)) {
> > +        struct ofp_prop_header *oph = header;
> > +        oph->type = htons(type);
> > +        oph->len = htons(len);
> > +    } else {
> > +        struct ofp_prop_experimenter *ope = header;
> > +        ope->type = htons(0xffff);
> > +        ope->len = htons(12);
> 
> No ‘len’ here?

You're right, oops.



More information about the dev mailing list