• Florian Westphal's avatar
    selftests: xfrm: add block rules with adjacent/overlapping subnets · 0977b238
    Florian Westphal authored
    The existing script lacks a policy pattern that triggers 'tree node
    merges' in the kernel.
    
    Consider adding policy affecting following subnet:
    pol1: dst 10.0.0.0/22
    pol2: dst 10.0.0.0/23 # adds to existing 10.0.0.0/22 node
    
    -> no problems here.  But now, lets consider reverse order:
    pol1: dst 10.0.0.0/24
    pol2: dst 10.0.0.0/23 # CANNOT add to existing node
    
    When second policy gets added, the kernel must check that the new node
    ("10.0.0.0/23") doesn't overlap with any existing subnet.
    
    Example:
    dst 10.0.0.0/24
    dst 10.0.0.1/24
    dst 10.0.0.0/23
    
    When the third policy gets added, the kernel must replace the nodes for
    the 10.0.0.0/24 and 10.0.0.1/24 policies with a single one and must merge
    all the subtrees/lists stored in those nodes into the new node.
    
    The existing test cases only have overlaps with a single node, so no
    merging takes place (we can always remove the 'old' node and replace
    it with the new subnet prefix).
    
    Add a few 'block policies' in a pattern that triggers this, with a priority
    that will make kernel prefer the 'esp' rules.
    
    Make sure the 'tunnel ping' tests still pass after they have been added.
    Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
    Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
    0977b238
xfrm_policy.sh 11.4 KB