From 4b5e13376c70481aacc1c2c508738279f8cc9e5c Mon Sep 17 00:00:00 2001 From: Satoshi Fujimoto Date: Mon, 19 Jun 2017 16:32:38 +0900 Subject: packet: Use bitmask operand format to fragment RFC 5575 suggests using "bitmask operand format" for fragmentation field, but GoBGP does not have an interface to configure it. This patch introduce the way to configure bitmask operands for "fragment" field. The syntax is similar to TCP flags rules. For example: =not-a-fragment =is-fragment&!last-fragment Signed-off-by: Satoshi Fujimoto --- docs/sources/flowspec.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'docs/sources') diff --git a/docs/sources/flowspec.md b/docs/sources/flowspec.md index da7d17f0..6d48d8a6 100644 --- a/docs/sources/flowspec.md +++ b/docs/sources/flowspec.md @@ -45,7 +45,7 @@ CLI syntax to add ipv4/ipv6 flowspec rule is ```shell % global rib add match then -a [ipv4-flowspec|ipv6-flowspec] : { destination [] | source [] | - protocol ... | fragment | tcp-flags [!] [=] ... | + protocol ... | fragment [!] [=] | tcp-flags [!] [=] ... | { port | destination-port | source-port | icmp-type | icmp-code | packet-length | dscp | label } ... }... : ospf, pim, igp, udp, igmp, tcp, egp, rsvp, gre, ipip, unknown, icmp, sctp, : dont-fragment, is-fragment, first-fragment, last-fragment, not-a-fragment @@ -98,22 +98,26 @@ All decimal values like ports, destination port, source port, procotol number ca Network Next Hop AS_PATH Age Attrs *> [destination:10.0.0.0/24][source:20.0.0.0/24] 0.0.0.0 00:00:04 [{Origin: i} {Extcomms: [redirect: 10:10]}] -# add another flowspec rule which discard flows whose ip protocol is tcp and destination port is 80 or greater than or equal to 8080 and lesser than or equal to 8888 -% gobgp global rib -a ipv4-flowspec add match protocol tcp destination-port '==80' '>=8080&<=8888' then discard +# add another flowspec rule which discard flows whose + # ip protocol is tcp and + # destination port is 80 or greater than or equal to 8080 and lesser than or equal to 8888 and + # packet is a first fragment or a last fragment +% gobgp global rib -a ipv4-flowspec add match protocol tcp destination-port '==80' '>=8080&<=8888' fragment '=first-fragment =last-fragment' then discard # add flowspec rule to drop traffic not going to destination port 80, 443 or 22 gobgp global rib -a ipv4-flowspec add match destination 2.2.2.2/32 dest-port '!=80&!=443&!=22' then discard % gobgp global rib -a ipv4-flowspec - Network Next Hop AS_PATH Age Attrs -*> [destination:10.0.0.0/24][source:20.0.0.0/24] 0.0.0.0 00:03:19 [{Origin: i} {Extcomms: [redirect: 10:10]}] -*> [protocol: tcp][destination-port: ==80 >=8080&<=8888] 0.0.0.0 00:00:03 [{Origin: i} {Extcomms: [discard]}] + Network Next Hop AS_PATH Age Attrs +*> [destination:10.0.0.0/24][source:20.0.0.0/24] 0.0.0.0 00:03:19 [{Origin: i} {Extcomms: [redirect: 10:10]}] +*> [protocol:==tcp ][destination-port: ==80 >=8080&<=8888][fragment:=first-fragment =last-fragment ]0.0.0.0 00:00:05 [{Origin: ?} {Extcomms: [discard]}] + # delete a flowspec rule % gobgp global rib -a ipv4-flowspec del match destination 10.0.0.0/24 source 20.0.0.0/24 then redirect 10:10 % gobgp global rib -a ipv4-flowspec - Network Next Hop AS_PATH Age Attrs -*> [protocol: tcp][destination-port: ==80 >=8080&<=8888] 0.0.0.0 00:00:03 [{Origin: i} {Extcomms: [discard]}] + Network Next Hop AS_PATH Age Attrs +*> [protocol:==tcp ][destination-port: ==80 >=8080&<=8888][fragment:=first-fragment =last-fragment ]0.0.0.0 00:00:05 [{Origin: ?} {Extcomms: [discard]}] ``` -- cgit v1.2.3