]> git.puffer.fish Git - mirror/frr.git/commitdiff
isisd: fix validation of prefix-sid flags 4992/head
authorRenato Westphal <renato@opensourcerouting.org>
Fri, 9 Aug 2019 17:18:52 +0000 (14:18 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Tue, 17 Sep 2019 04:30:12 +0000 (01:30 -0300)
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 <renato@opensourcerouting.org>
isisd/isis_tlvs.c

index ee253c7a31ae4afb4aaff513146a2b6a414932d7..bdf00b64cce15f3f98b909275148baeae27d46a9 100644 (file)
@@ -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);