rfc8956v3.txt | rfc8956.txt | |||
---|---|---|---|---|
skipping to change at line 744 ¶ | skipping to change at line 744 ¶ | |||
# use the below algorithm for sorting | # use the below algorithm for sorting | |||
result = flow_rule_cmp_v6(self, other) | result = flow_rule_cmp_v6(self, other) | |||
if result == B_HAS_PRECEDENCE: | if result == B_HAS_PRECEDENCE: | |||
return True | return True | |||
else: | else: | |||
return False | return False | |||
def flow_rule_cmp_v6(a, b): | def flow_rule_cmp_v6(a, b): | |||
""" | """ | |||
Implementation of the flowspec sorting algorithm in | Implementation of the flowspec sorting algorithm in | |||
draft-ietf-idr-flow-spec-v6. | RFC 8956. | |||
""" | """ | |||
for comp_a, comp_b in itertools.zip_longest(a.components, | for comp_a, comp_b in itertools.zip_longest(a.components, | |||
b.components): | b.components): | |||
# If a component type does not exist in one rule | # If a component type does not exist in one rule | |||
# this rule has lower precedence | # this rule has lower precedence | |||
if not comp_a: | if not comp_a: | |||
return B_HAS_PRECEDENCE | return B_HAS_PRECEDENCE | |||
if not comp_b: | if not comp_b: | |||
return A_HAS_PRECEDENCE | return A_HAS_PRECEDENCE | |||
# Higher precedence for lower component type | # Higher precedence for lower component type | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |