1 #ifndef _NF_TABLES_IPV6_H_
2 #define _NF_TABLES_IPV6_H_
4 #include <linux/netfilter_ipv6/ip6_tables.h>
8 nft_set_pktinfo_ipv6(struct nft_pktinfo *pkt,
10 const struct nf_hook_state *state)
12 unsigned int flags = IP6_FH_F_AUTH;
13 int protohdr, thoff = 0;
14 unsigned short frag_off;
16 nft_set_pktinfo(pkt, skb, state);
18 protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, &flags);
20 nft_set_pktinfo_proto_unspec(pkt, skb);
24 pkt->tprot_set = true;
25 pkt->tprot = protohdr;
26 pkt->xt.thoff = thoff;
27 pkt->xt.fragoff = frag_off;
31 __nft_set_pktinfo_ipv6_validate(struct nft_pktinfo *pkt,
33 const struct nf_hook_state *state)
35 #if IS_ENABLED(CONFIG_IPV6)
36 unsigned int flags = IP6_FH_F_AUTH;
37 struct ipv6hdr *ip6h, _ip6h;
38 unsigned int thoff = 0;
39 unsigned short frag_off;
43 ip6h = skb_header_pointer(skb, skb_network_offset(skb), sizeof(*ip6h),
48 if (ip6h->version != 6)
51 pkt_len = ntohs(ip6h->payload_len);
52 if (pkt_len + sizeof(*ip6h) > skb->len)
55 protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, &flags);
59 pkt->tprot_set = true;
60 pkt->tprot = protohdr;
61 pkt->xt.thoff = thoff;
62 pkt->xt.fragoff = frag_off;
71 nft_set_pktinfo_ipv6_validate(struct nft_pktinfo *pkt,
73 const struct nf_hook_state *state)
75 nft_set_pktinfo(pkt, skb, state);
76 if (__nft_set_pktinfo_ipv6_validate(pkt, skb, state) < 0)
77 nft_set_pktinfo_proto_unspec(pkt, skb);
80 extern struct nft_af_info nft_af_ipv6;