From 8b1e3453da1a1674e05fd802209a5213d89b835b Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Fri, 9 Aug 2019 14:18:52 -0300 Subject: [PATCH] isisd: fix validation of prefix-sid flags The original check would always evaluate to false since ISIS_PREFIX_SID_VALUE and ISIS_PREFIX_SID_LOCAL have different values. Use !! to normalize the return value of the individual checks to either 0 or 1, making the code do what was intended (ensure the V/L flags are both 0 or 1). Signed-off-by: Renato Westphal --- isisd/isis_tlvs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index ee253c7a31..bdf00b64cc 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -186,10 +186,10 @@ static int unpack_item_prefix_sid(uint16_t mtid, uint8_t len, struct stream *s, } sid.flags = stream_getc(s); - if ((sid.flags & ISIS_PREFIX_SID_VALUE) - != (sid.flags & ISIS_PREFIX_SID_LOCAL)) { + if (!!(sid.flags & ISIS_PREFIX_SID_VALUE) + != !!(sid.flags & ISIS_PREFIX_SID_LOCAL)) { sbuf_push(log, indent, "Flags inplausible: Local Flag needs to match Value Flag\n"); - return 0; + return 1; } sid.algorithm = stream_getc(s); -- 2.39.5