You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
netfilter: nf_tables: kill nft_pktinfo.ops
- Add nft_pktinfo.pf to replace ops->pf - Add nft_pktinfo.hook to replace ops->hooknum This simplifies the code, makes it more readable, and likely reduces cache line misses. Maintainability is enhanced as the details of nft_hook_ops are of no concern to the recpients of nft_pktinfo. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
committed by
Pablo Neira Ayuso
parent
082a758f04
commit
6aa187f21c
@@ -16,7 +16,8 @@ struct nft_pktinfo {
|
||||
struct sk_buff *skb;
|
||||
const struct net_device *in;
|
||||
const struct net_device *out;
|
||||
const struct nf_hook_ops *ops;
|
||||
u8 pf;
|
||||
u8 hook;
|
||||
u8 nhoff;
|
||||
u8 thoff;
|
||||
u8 tprot;
|
||||
@@ -25,16 +26,14 @@ struct nft_pktinfo {
|
||||
};
|
||||
|
||||
static inline void nft_set_pktinfo(struct nft_pktinfo *pkt,
|
||||
const struct nf_hook_ops *ops,
|
||||
struct sk_buff *skb,
|
||||
const struct nf_hook_state *state)
|
||||
{
|
||||
pkt->skb = skb;
|
||||
pkt->in = pkt->xt.in = state->in;
|
||||
pkt->out = pkt->xt.out = state->out;
|
||||
pkt->ops = ops;
|
||||
pkt->xt.hooknum = ops->hooknum;
|
||||
pkt->xt.family = ops->pf;
|
||||
pkt->hook = pkt->xt.hooknum = state->hook;
|
||||
pkt->pf = pkt->xt.family = state->pf;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,13 +6,12 @@
|
||||
|
||||
static inline void
|
||||
nft_set_pktinfo_ipv4(struct nft_pktinfo *pkt,
|
||||
const struct nf_hook_ops *ops,
|
||||
struct sk_buff *skb,
|
||||
const struct nf_hook_state *state)
|
||||
{
|
||||
struct iphdr *ip;
|
||||
|
||||
nft_set_pktinfo(pkt, ops, skb, state);
|
||||
nft_set_pktinfo(pkt, skb, state);
|
||||
|
||||
ip = ip_hdr(pkt->skb);
|
||||
pkt->tprot = ip->protocol;
|
||||
|
||||
@@ -6,14 +6,13 @@
|
||||
|
||||
static inline int
|
||||
nft_set_pktinfo_ipv6(struct nft_pktinfo *pkt,
|
||||
const struct nf_hook_ops *ops,
|
||||
struct sk_buff *skb,
|
||||
const struct nf_hook_state *state)
|
||||
{
|
||||
int protohdr, thoff = 0;
|
||||
unsigned short frag_off;
|
||||
|
||||
nft_set_pktinfo(pkt, ops, skb, state);
|
||||
nft_set_pktinfo(pkt, skb, state);
|
||||
|
||||
protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, NULL);
|
||||
/* If malformed, drop it */
|
||||
|
||||
Reference in New Issue
Block a user