diff options
author | Jan Scheurich <jan.scheurich@ericsson.com> | 2017-11-07 15:48:39 +0100 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2017-11-08 12:31:57 -0800 |
commit | 7edef47b4896135b2c4ca62e4458fb9a5f3fff44 (patch) | |
tree | c86d1f040409fffac3962c1b1ca9c3fb0db5681d /lib/odp-util.c | |
parent | ea36b04688f37cf45b7c2304ce31f0d29f212d54 (diff) | |
download | openvswitch-7edef47b4896135b2c4ca62e4458fb9a5f3fff44.tar.gz |
NSH: Minor bugfixes
- Fix 2 incorrect length checks
- Remove unnecessary limit of MD length to 16 bytes
- Remove incorrect comments stating MD2 was not supported
- Pad metadata in encap_nsh with zeroes if not multiple of 4 bytes
Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib/odp-util.c')
-rw-r--r-- | lib/odp-util.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/odp-util.c b/lib/odp-util.c index 6304b3dd2..d8daedea7 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -1864,12 +1864,17 @@ parse_odp_encap_nsh_action(const char *s, struct ofpbuf *actions) else if (encap_nsh.mdtype == NSH_M_TYPE2) { struct ofpbuf b; char buf[512]; - size_t mdlen; + size_t mdlen, padding; if (ovs_scan_len(s, &n, "md2=0x%511[0-9a-fA-F]", buf)) { ofpbuf_use_stub(&b, encap_nsh.metadata, OVS_ENCAP_NSH_MAX_MD_LEN); ofpbuf_put_hex(&b, buf, &mdlen); - encap_nsh.mdlen = mdlen; + /* Pad metadata to 4 bytes. */ + padding = PAD_SIZE(mdlen, 4); + if (padding > 0) { + ofpbuf_push_zeros(&b, padding); + } + encap_nsh.mdlen = mdlen + padding; ofpbuf_uninit(&b); } continue; |