• Florian Westphal's avatar
    xfrm: policy: return NULL when inexact search needed · cc1bb845
    Florian Westphal authored
    currently policy_hash_bysel() returns the hash bucket list
    (for exact policies), or the inexact list (when policy uses a prefix).
    
    Searching this inexact list is slow, so it might be better to pre-sort
    inexact lists into a tree or another data structure for faster
    searching.
    
    However, due to 'any' policies, that need to be searched in any case,
    doing so will require that 'inexact' policies need to be handled
    specially to decide the best search strategy.  So change hash_bysel()
    and return NULL if the policy can't be handled via the policy hash
    table.
    
    Right now, we simply use the inexact list when this happens, but
    future patch can then implement a different strategy.
    Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
    Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
    cc1bb845
xfrm_policy.c 76.8 KB