X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Flearn.c;h=8727a5539c2b0900922cb4a964c010925af687a7;hb=28c5588e8e1a8d091c5d2275232c35f2968a97fa;hp=68d95cbed4259d71a20dce57906b3c0afeb586e7;hpb=0fb88c18fb26dcbe353501d346ac03295d552b36;p=sliver-openvswitch.git diff --git a/lib/learn.c b/lib/learn.c index 68d95cbed..8727a5539 100644 --- a/lib/learn.c +++ b/lib/learn.c @@ -127,7 +127,7 @@ learn_from_openflow(const struct nx_action_learn *nal, struct ofpbuf *ofpacts) } spec = ofpbuf_put_zeros(ofpacts, sizeof *spec); - learn = ofpacts->l2; + learn = ofpacts->frame; learn->n_specs++; spec->src_type = header & NX_LEARN_SRC_MASK; @@ -255,7 +255,7 @@ learn_to_nxast(const struct ofpact_learn *learn, struct ofpbuf *openflow) struct nx_action_learn *nal; size_t start_ofs; - start_ofs = openflow->size; + start_ofs = ofpbuf_size(openflow); nal = ofputil_put_NXAST_LEARN(openflow); nal->idle_timeout = htons(learn->idle_timeout); nal->hard_timeout = htons(learn->hard_timeout); @@ -287,12 +287,12 @@ learn_to_nxast(const struct ofpact_learn *learn, struct ofpbuf *openflow) } } - if ((openflow->size - start_ofs) % 8) { - ofpbuf_put_zeros(openflow, 8 - (openflow->size - start_ofs) % 8); + if ((ofpbuf_size(openflow) - start_ofs) % 8) { + ofpbuf_put_zeros(openflow, 8 - (ofpbuf_size(openflow) - start_ofs) % 8); } nal = ofpbuf_at_assert(openflow, start_ofs, sizeof *nal); - nal->len = htons(openflow->size - start_ofs); + nal->len = htons(ofpbuf_size(openflow) - start_ofs); } /* Composes 'fm' so that executing it will implement 'learn' given that the @@ -314,7 +314,7 @@ learn_execute(const struct ofpact_learn *learn, const struct flow *flow, fm->cookie = htonll(0); fm->cookie_mask = htonll(0); fm->new_cookie = htonll(learn->cookie); - fm->modify_cookie = fm->new_cookie != htonll(UINT64_MAX); + fm->modify_cookie = fm->new_cookie != OVS_BE64_MAX; fm->table_id = learn->table_id; fm->command = OFPFC_MODIFY_STRICT; fm->idle_timeout = learn->idle_timeout; @@ -382,8 +382,8 @@ learn_execute(const struct ofpact_learn *learn, const struct flow *flow, } ofpact_pad(ofpacts); - fm->ofpacts = ofpacts->data; - fm->ofpacts_len = ofpacts->size; + fm->ofpacts = ofpbuf_data(ofpacts); + fm->ofpacts_len = ofpbuf_size(ofpacts); } /* Perform a bitwise-OR on 'wc''s fields that are relevant as sources in @@ -585,7 +585,7 @@ learn_parse__(char *orig, char *arg, struct ofpbuf *ofpacts) char *error; spec = ofpbuf_put_zeros(ofpacts, sizeof *spec); - learn = ofpacts->l2; + learn = ofpacts->frame; learn->n_specs++; error = learn_parse_spec(orig, name, value, spec);