0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-01-03 07:31:54 +00:00

Flowspec formatting: removed excessive spaces

This commit is contained in:
Jan Maria Matejka 2018-04-17 15:30:08 +02:00
parent 9833c0f879
commit 9aa8d1dc47
3 changed files with 8 additions and 7 deletions

View File

@ -558,6 +558,7 @@ prefix p;
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; }");
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 { next header false 42; }) = "flow6 { next header false 42; }");
bt_assert(format(flow6 { port 80; }) = "flow6 { port 80; }");

View File

@ -966,13 +966,13 @@ net_format_flow_ip(buffer *b, const byte *part, int ipv6)
{
uint pxoffset = *(part+2);
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
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
{
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))
{
buffer_puts(b, "; ");
buffer_puts(b, ";");
break;
}
else
@ -1087,7 +1087,7 @@ net_format_flow_bitmask(buffer *b, const byte *part)
if (isset_end(op))
{
buffer_puts(b, "; ");
buffer_puts(b, ";");
break;
}
else

View File

@ -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; }";
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_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; }";
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_assert(strcmp(b, expect) == 0);