Hello!
I've found some issues with sequence of flow spec elements inside BGP Flow SPEC NLRI.
I've announced this announce with up to date GoBGP:
gobgp global rib -a ipv4-flowspec add match protocol tcp destination 10.0.0.0/24 source 20.0.0.0/24 then redirect 10:10
And it correctly received from other side with same GoBGPD's version:
gobgp global rib -a ipv4-flowspec
Network Next Hop AS_PATH Age Attrs
*> [protocol: tcp][destination:10.0.0.0/24][source:20.0.0.0/24]fictitious 00:00:54 [{LocalPref: 100} {Origin: ?} {Extcomms: [redirect: 10:10]}]
Wireshark also correctly parses this announce:

But please take a look at sequence of types. We have following order: protocol (type 3), destination prefix (type 1) and source prefix (type 2).
But in RFC we have strict requirements about order of types (https://tools.ietf.org/html/rfc5575):
Flow specification components must follow strict type ordering. A
given component type may or may not be present in the specification,
but if present, it MUST precede any component of higher numeric type
value.
So we need to order they from lowest type to highest type. I.e.: destination prefix, source prefix and protocol.
Wireshark could parse this but other devices from Cisco or Juniper could just reject it because we are conflicting with reference.
So I could like to ask you to change type's ordering in this place.
I've reproduced this tests with my custom flow spec announce and got same results.
Example announce "match destination 10.0.0.0/24 protocol tcp source 20.0.0.0/24 then redirect 10:10" encoded with function serialize_path into following Flow Spec NLRI:
0x01 (<--destination prefix type) 0x18 0x0a 0x00 0x00 0x03 (<-- protocol type) 0x81 0x06 0x02 (<-- source prefix) 0x18 0x14 0x00 0x00
As you can see they haven't any ordering at all: 1 => 3 => 2. But they should be 1 => 2 => 3.
Finally, thank you for your work on Open Source BGP. :)
Hello!
I've found some issues with sequence of flow spec elements inside BGP Flow SPEC NLRI.
I've announced this announce with up to date GoBGP:
And it correctly received from other side with same GoBGPD's version:
gobgp global rib -a ipv4-flowspec Network Next Hop AS_PATH Age Attrs *> [protocol: tcp][destination:10.0.0.0/24][source:20.0.0.0/24]fictitious 00:00:54 [{LocalPref: 100} {Origin: ?} {Extcomms: [redirect: 10:10]}]Wireshark also correctly parses this announce:

But please take a look at sequence of types. We have following order: protocol (type 3), destination prefix (type 1) and source prefix (type 2).
But in RFC we have strict requirements about order of types (https://tools.ietf.org/html/rfc5575):
So we need to order they from lowest type to highest type. I.e.: destination prefix, source prefix and protocol.
Wireshark could parse this but other devices from Cisco or Juniper could just reject it because we are conflicting with reference.
So I could like to ask you to change type's ordering in this place.
I've reproduced this tests with my custom flow spec announce and got same results.
Example announce "match destination 10.0.0.0/24 protocol tcp source 20.0.0.0/24 then redirect 10:10" encoded with function serialize_path into following Flow Spec NLRI:
As you can see they haven't any ordering at all: 1 => 3 => 2. But they should be 1 => 2 => 3.
Finally, thank you for your work on Open Source BGP. :)