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 <renato@opensourcerouting.org>
This commit is contained in:
Renato Westphal 2019-08-09 14:18:52 -03:00
parent 6cf3833922
commit 8b1e3453da

View 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);