@@ -55,10 +55,10 @@ OVNACTS
void *
ovnact_put(struct ofpbuf *ovnacts, enum ovnact_type type, size_t len)
{
- struct ovnact *ovnact;
+ ovs_assert(len == OVNACT_ALIGN(len));
ovnacts->header = ofpbuf_put_uninit(ovnacts, len);
- ovnact = ovnacts->header;
+ struct ovnact *ovnact = ovnacts->header;
ovnact_init(ovnact, type, len);
return ovnact;
}
@@ -67,6 +67,7 @@ ovnact_put(struct ofpbuf *ovnacts, enum ovnact_type type, size_t len)
void
ovnact_init(struct ovnact *ovnact, enum ovnact_type type, size_t len)
{
+ ovs_assert(len == OVNACT_ALIGN(len));
memset(ovnact, 0, len);
ovnact->type = type;
ovnact->len = len;
@@ -1057,7 +1058,8 @@ parse_nested_action(struct action_context *ctx, enum ovnact_type type,
add_prerequisite(ctx, prereq);
- struct ovnact_nest *on = ovnact_put(ctx->ovnacts, type, sizeof *on);
+ struct ovnact_nest *on = ovnact_put(ctx->ovnacts, type,
+ OVNACT_ALIGN(sizeof *on));
on->nested_len = nested.size;
on->nested = ofpbuf_steal_data(&nested);
}
@@ -868,8 +868,8 @@ ct_snat();
Syntax error at `)' expecting IPv4 address.
# arp
-arp { eth.dst = ff:ff:ff:ff:ff:ff; output; };
- encodes as controller(userdata=00.00.00.00.00.00.00.00.00.19.00.10.80.00.06.06.ff.ff.ff.ff.ff.ff.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00)
+arp { eth.dst = ff:ff:ff:ff:ff:ff; output; }; output;
+ encodes as controller(userdata=00.00.00.00.00.00.00.00.00.19.00.10.80.00.06.06.ff.ff.ff.ff.ff.ff.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00),resubmit(,64)
has prereqs ip4
# get_arp
OVN logical actions are supposed to be padded to a multiple of 8 bytes, but the code for parsing "arp" and "nd_na" actions didn't do this properly. The result was that it worked OK if one of these actions was the last one in a sequence of logical actions, but failed badly if they were in the middle. This commit fixes the problem, adds assertions to make it harder for the problem to recur, and adds a test. Signed-off-by: Ben Pfaff <blp@ovn.org> --- ovn/lib/actions.c | 8 +++++--- tests/ovn.at | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-)