From 8319a81a0acbce682f5f24c77cee8dd00ab7f02f Mon Sep 17 00:00:00 2001 From: Jarno Rajahalme Date: Fri, 6 Jan 2017 18:14:48 -0800 Subject: ofp-util: Do not assert fail if decoding malformed property. OVS should not crash if the controller sends a malformed OpenFlow message. Return the error code instead. Suggested-by: Ben Pfaff Signed-off-by: Jarno Rajahalme Acked-by: Ben Pfaff --- lib/ofp-util.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/ofp-util.c') diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 156d8d25c..e4f186de2 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -4061,7 +4061,9 @@ ofputil_decode_packet_in_private(const struct ofp_header *oh, bool loose, uint64_t type; error = ofpprop_pull(&continuation, &payload, &type); - ovs_assert(!error); + if (error) { + break; + } switch (type) { case NXCPT_BRIDGE: @@ -4124,7 +4126,7 @@ ofputil_decode_packet_in_private(const struct ofp_header *oh, bool loose, ofputil_packet_in_private_destroy(pin); } - return 0; + return error; } /* Frees data in 'pin' that is dynamically allocated by -- cgit v1.2.1