netfilter: nf_tables: explicit nft_set_pktinfo() call from hook path
Instead of calling this function from the family specific variant, this reduces the code size in the fast path for the netdev, bridge and inet families. After this change, we must call nft_set_pktinfo() upfront from the chain hook indirection. Before: text data bss dec hex filename 2145 208 0 2353 931 net/netfilter/nf_tables_netdev.o After: text data bss dec hex filename 2125 208 0 2333 91d net/netfilter/nf_tables_netdev.o Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
@@ -25,15 +25,17 @@ nft_do_chain_bridge(void *priv,
|
||||
{
|
||||
struct nft_pktinfo pkt;
|
||||
|
||||
nft_set_pktinfo(&pkt, skb, state);
|
||||
|
||||
switch (eth_hdr(skb)->h_proto) {
|
||||
case htons(ETH_P_IP):
|
||||
nft_set_pktinfo_ipv4_validate(&pkt, skb, state);
|
||||
nft_set_pktinfo_ipv4_validate(&pkt, skb);
|
||||
break;
|
||||
case htons(ETH_P_IPV6):
|
||||
nft_set_pktinfo_ipv6_validate(&pkt, skb, state);
|
||||
nft_set_pktinfo_ipv6_validate(&pkt, skb);
|
||||
break;
|
||||
default:
|
||||
nft_set_pktinfo_unspec(&pkt, skb, state);
|
||||
nft_set_pktinfo_unspec(&pkt, skb);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user