From: Renato Westphal Date: Fri, 9 Aug 2019 17:18:52 +0000 (-0300) Subject: isisd: fix validation of prefix-sid flags X-Git-Tag: base_7.3~345^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F4992%2Fhead;p=mirror%2Ffrr.git 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 --- 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);