From 8e98018c75db0d5cadb9f12d4e8f2cf24ad59e08 Mon Sep 17 00:00:00 2001 From: IWASE Yusuke Date: Mon, 20 Nov 2017 08:57:42 +0900 Subject: packet/bgp: Invert FlowSpec bitmask operand position Currently, if the both NOT and MATCH bit are set for the FlowSpec bitmask operand, the string representation will be "=!". For the readability and the consistency with the representation of numeric operator, it should be "!=". This patch inverts "=!" into "!=" for the bitmask operand. Signed-off-by: IWASE Yusuke --- packet/bgp/bgp.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'packet/bgp') diff --git a/packet/bgp/bgp.go b/packet/bgp/bgp.go index 8c4400ba..bf90cfc6 100644 --- a/packet/bgp/bgp.go +++ b/packet/bgp/bgp.go @@ -3772,12 +3772,12 @@ func formatProto(op int, value int) string { func formatTCPFlag(op int, value int) string { var retString string - if op&BITMASK_FLAG_OP_MATCH > 0 { - retString = fmt.Sprintf("%s%s", retString, BitmaskFlagOpNameMap[BITMASK_FLAG_OP_MATCH]) - } if op&BITMASK_FLAG_OP_NOT > 0 { retString = fmt.Sprintf("%s%s", retString, BitmaskFlagOpNameMap[BITMASK_FLAG_OP_NOT]) } + if op&BITMASK_FLAG_OP_MATCH > 0 { + retString = fmt.Sprintf("%s%s", retString, BitmaskFlagOpNameMap[BITMASK_FLAG_OP_MATCH]) + } // Prepare a sorted list of flags because map iterations does not happen // in a consistent order in Golang. @@ -3802,12 +3802,12 @@ func formatTCPFlag(op int, value int) string { func formatFragment(op int, value int) string { var retString string - if op&BITMASK_FLAG_OP_MATCH > 0 { - retString = fmt.Sprintf("%s%s", retString, BitmaskFlagOpNameMap[BITMASK_FLAG_OP_MATCH]) - } if op&BITMASK_FLAG_OP_NOT > 0 { retString = fmt.Sprintf("%s%s", retString, BitmaskFlagOpNameMap[BITMASK_FLAG_OP_NOT]) } + if op&BITMASK_FLAG_OP_MATCH > 0 { + retString = fmt.Sprintf("%s%s", retString, BitmaskFlagOpNameMap[BITMASK_FLAG_OP_MATCH]) + } // Prepare a sorted list of flags because map iterations does not happen // in a consistent order in Golang. -- cgit v1.2.3