summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2021-05-18 20:18:06 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2021-05-18 20:23:08 +0200
commitabc9ccc5cb7a3adcbb2090ba7314031b835b0e04 (patch)
treeb5e137243217e4316dd6925bc8c18c49906b4371 /lib
parentdd8481cc1c92af32ec69cded42b985b7bad40b26 (diff)
Flowspec: Label field should use numeric operator and not bitmask operator
Diffstat (limited to 'lib')
-rw-r--r--lib/flowspec.c2
-rw-r--r--lib/flowspec_test.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/flowspec.c b/lib/flowspec.c
index 1445435a..14b42b52 100644
--- a/lib/flowspec.c
+++ b/lib/flowspec.c
@@ -1351,11 +1351,11 @@ net_format_flow(char *buf, uint blen, const byte *data, uint dlen, int ipv6)
case FLOW_TYPE_ICMP_CODE:
case FLOW_TYPE_PACKET_LENGTH:
case FLOW_TYPE_DSCP:
+ case FLOW_TYPE_LABEL:
net_format_flow_num(&b, part);
break;
case FLOW_TYPE_TCP_FLAGS:
case FLOW_TYPE_FRAGMENT:
- case FLOW_TYPE_LABEL:
net_format_flow_bitmask(&b, part);
break;
}
diff --git a/lib/flowspec_test.c b/lib/flowspec_test.c
index 2285075c..ed4afe51 100644
--- a/lib/flowspec_test.c
+++ b/lib/flowspec_test.c
@@ -650,14 +650,14 @@ t_formatting6(void)
FLOW_TYPE_SRC_PREFIX, 8, 0, 0xc0,
FLOW_TYPE_NEXT_HEADER, 0x81, 0x06,
FLOW_TYPE_PORT, 0x03, 20, 0x45, 40, 0x91, 0x01, 0x11,
- FLOW_TYPE_LABEL, 0xa0, 0x12, 0x34, 0x56, 0x78,
+ FLOW_TYPE_LABEL, 0xa4, 0x00, 0x07, 0xa1, 0x20,
};
*nlri = (u8) sizeof(nlri);
net_addr_flow6 *input;
NET_ADDR_FLOW6_(input, ip6_build(0, 1, 0x12345678, 0x98000000), 103, nlri);
- const char *expect = "flow6 { dst ::1:1234:5678:9800:0/103 offset 61; src c000::/8; next header 6; port 20..40,273; label !0x0/0x12345678; }";
+ const char *expect = "flow6 { dst ::1:1234:5678:9800:0/103 offset 61; src c000::/8; next header 6; port 20..40,273; label < 500000; }";
bt_assert(flow6_net_format(b, sizeof(b), input) == strlen(expect));
bt_debug(" expect: '%s',\n output: '%s'\n", expect, b);