mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-05 08:31:53 +00:00
Flowspec formatting: removed excessive spaces
This commit is contained in:
parent
9833c0f879
commit
9aa8d1dc47
@ -558,6 +558,7 @@ prefix p;
|
|||||||
bt_assert(p !~ [ 10.0.0.0/8 ] );
|
bt_assert(p !~ [ 10.0.0.0/8 ] );
|
||||||
|
|
||||||
bt_assert(format(flow4 { dst 10.0.0.0/8; proto = 23; }) = "flow4 { dst 10.0.0.0/8; proto 23; }");
|
bt_assert(format(flow4 { dst 10.0.0.0/8; proto = 23; }) = "flow4 { dst 10.0.0.0/8; proto 23; }");
|
||||||
|
print(flow4 { dst 10.0.0.0/8; proto = 23; });
|
||||||
bt_assert(format(flow6 { dst ::1/128; src ::2/127; }) = "flow6 { dst ::1/128; src ::2/127; }");
|
bt_assert(format(flow6 { dst ::1/128; src ::2/127; }) = "flow6 { dst ::1/128; src ::2/127; }");
|
||||||
bt_assert(format(flow6 { next header false 42; }) = "flow6 { next header false 42; }");
|
bt_assert(format(flow6 { next header false 42; }) = "flow6 { next header false 42; }");
|
||||||
bt_assert(format(flow6 { port 80; }) = "flow6 { port 80; }");
|
bt_assert(format(flow6 { port 80; }) = "flow6 { port 80; }");
|
||||||
|
@ -966,13 +966,13 @@ net_format_flow_ip(buffer *b, const byte *part, int ipv6)
|
|||||||
{
|
{
|
||||||
uint pxoffset = *(part+2);
|
uint pxoffset = *(part+2);
|
||||||
if (pxoffset)
|
if (pxoffset)
|
||||||
buffer_print(b, "%I6/%u offset %u; ", flow_read_ip6(part+3,pxlen,pxoffset), pxlen, pxoffset);
|
buffer_print(b, "%I6/%u offset %u;", flow_read_ip6(part+3,pxlen,pxoffset), pxlen, pxoffset);
|
||||||
else
|
else
|
||||||
buffer_print(b, "%I6/%u; ", flow_read_ip6(part+3,pxlen,0), pxlen);
|
buffer_print(b, "%I6/%u;", flow_read_ip6(part+3,pxlen,0), pxlen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer_print(b, "%I4/%u; ", flow_read_ip4(part+2,pxlen), pxlen);
|
buffer_print(b, "%I4/%u;", flow_read_ip4(part+2,pxlen), pxlen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1028,7 +1028,7 @@ net_format_flow_num(buffer *b, const byte *part)
|
|||||||
|
|
||||||
if (isset_end(op))
|
if (isset_end(op))
|
||||||
{
|
{
|
||||||
buffer_puts(b, "; ");
|
buffer_puts(b, ";");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1087,7 +1087,7 @@ net_format_flow_bitmask(buffer *b, const byte *part)
|
|||||||
|
|
||||||
if (isset_end(op))
|
if (isset_end(op))
|
||||||
{
|
{
|
||||||
buffer_puts(b, "; ");
|
buffer_puts(b, ";");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -584,7 +584,7 @@ t_formatting4(void)
|
|||||||
|
|
||||||
const char *expect = "flow4 { dst 10.0.0.0/8; proto 23; dport > 24 && < 30 || 40..50,60..70,80 && >= 90; sport > 24 && < 30 || 40,50,60..70,80; icmp type 80; icmp code 90; tcp flags 0x3/0x3,0x0/0xc; length 0..65535; dscp 63; fragment dont_fragment || !is_fragment; }";
|
const char *expect = "flow4 { dst 10.0.0.0/8; proto 23; dport > 24 && < 30 || 40..50,60..70,80 && >= 90; sport > 24 && < 30 || 40,50,60..70,80; icmp type 80; icmp code 90; tcp flags 0x3/0x3,0x0/0xc; length 0..65535; dscp 63; fragment dont_fragment || !is_fragment; }";
|
||||||
|
|
||||||
bt_assert(flow4_net_format(b, sizeof(b), input) == strlen(expect));
|
bt_assert(flow4_net_format(b, sizeof(b), input, " ") == strlen(expect));
|
||||||
bt_debug(" expect: '%s',\n output: '%s'\n", expect, b);
|
bt_debug(" expect: '%s',\n output: '%s'\n", expect, b);
|
||||||
bt_assert(strcmp(b, expect) == 0);
|
bt_assert(strcmp(b, expect) == 0);
|
||||||
|
|
||||||
@ -611,7 +611,7 @@ t_formatting6(void)
|
|||||||
|
|
||||||
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 !0x0/0x12345678; }";
|
||||||
|
|
||||||
bt_assert(flow6_net_format(b, sizeof(b), input) == strlen(expect));
|
bt_assert(flow6_net_format(b, sizeof(b), input, " ") == strlen(expect));
|
||||||
bt_debug(" expect: '%s',\n output: '%s'\n", expect, b);
|
bt_debug(" expect: '%s',\n output: '%s'\n", expect, b);
|
||||||
bt_assert(strcmp(b, expect) == 0);
|
bt_assert(strcmp(b, expect) == 0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user