• Pablo Neira Ayuso's avatar
    netfilter: nf_tables: add rule blob layout · 2c865a8a
    Pablo Neira Ayuso authored
    This patch adds a blob layout per chain to represent the ruleset in the
    packet datapath.
    
    	size (unsigned long)
    	struct nft_rule_dp
    	  struct nft_expr
    	  ...
            struct nft_rule_dp
              struct nft_expr
              ...
            struct nft_rule_dp (is_last=1)
    
    The new structure nft_rule_dp represents the rule in a more compact way
    (smaller memory footprint) compared to the control-plane nft_rule
    structure.
    
    The ruleset blob is a read-only data structure. The first field contains
    the blob size, then the rules containing expressions. There is a trailing
    rule which is used by the tracing infrastructure which is equivalent to
    the NULL rule marker in the previous representation. The blob size field
    does not include the size of this trailing rule marker.
    
    The ruleset blob is generated from the commit path.
    
    This patch reuses the infrastructure available since 0cbc06b3
    ("netfilter: nf_tables: remove synchronize_rcu in commit phase") to
    build the array of rules per chain.
    Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
    2c865a8a
nf_tables_trace.c 7.33 KB