Subject: [Idr] Precedence order of BGP Flowspec rules (RFC 5575)

From: PVLR Pavana Murthy <[email-masked]>
Date: Thu, 25 Jan 2018 15:32:16 +0530

Hello,

How to decide the precedence order when the match components have multiple
sub-components. I will try to explain it through an example.

Lets say we have 2 Flow Spec Rules.

Rule-1:

(type 1) destination prefix : 1.2.3.0/24

(type 5) Destination port   :  245 OR 256

Rule-2:

(type 1) destination prefix : 1.2.3.0/24

(type 5) Destination port   :  <=200 AND >=150

 Now as per the RFC 5575, since the content of type 1 is same, we need to
compare the data of type 5.

The RFC just says to compare the component data upto common length. Here
operators and values are different in the sub-components of the component
of type 5.  Does RFC mean to treat the complete content of the component
(the chain of <opertator,value>) as the string while comparing?

 Can you please explain how to compare now Rule-1 and Rule-2 to decide
which has higher precedence?

Thanks,

Pavana Murthy Petla

---

From: Jeffrey Haas <[email-masked]>
Date: Thu, 25 Jan 2018 10:01:58 -0500

The following snippet from 5575 should clarify:

   For all other component types, unless otherwise specified, the
   comparison is performed by comparing the component data as a binary
   string using the memcmp() function as defined by the ISO C standard.
   For strings of different lengths, the common prefix is compared.  If
   equal, the longest string is considered to have higher precedence
   than the shorter one.

So, the binary form of each of the type 5 is memcmp()'d.

-- Jeff

> On Jan 25, 2018, at 5:02 AM, PVLR Pavana Murthy <[email-masked]> wrote:
> 
> Hello,
> 
> How to decide the precedence order when the match components have multiple sub-components. I will try to explain it through an example.
> 
>  
> (type 1) destination prefix : 1.2.3.0/24 <http://1.2.3.0/24>   
> 
> (type 1) destination prefix : 1.2.3.0/24 <http://1.2.3.0/24>   
> 
>  Now as per the RFC 5575, since the content of type 1 is same, we need to compare the data of type 5.   
> 
> The RFC just says to compare the component data upto common length. Here operators and values are different in the sub-components of the component of type 5.  Does RFC mean to treat the complete content of the component (the chain of <opertator,value>) as the string while comparing? 
> 
>  Can you please explain how to compare now Rule-1 and Rule-2 to decide which has higher precedence?
> 
> 
> 
> Thanks,
> 
> Pavana Murthy Petla
> 
> _______________________________________________
> Idr mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/idr