Merge remote-tracking branch 'netfilter-next/master'
authorStephen Rothwell <sfr@canb.auug.org.au>
Tue, 13 Sep 2016 00:08:18 +0000 (10:08 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 13 Sep 2016 00:10:45 +0000 (10:10 +1000)
1  2 
include/net/netfilter/nf_tables_ipv4.h
net/ipv6/netfilter/nft_chain_route_ipv6.c
net/netfilter/nft_meta.c

index ca6ef6bf775ef544bce93b892ee156d449a62f9e,968f00b82fb5590202a232f09a2256ad1f8f9bd2..25e33aee91e73600f4709c5633f3f0ad5cf82383
@@@ -19,6 -20,48 +20,47 @@@ nft_set_pktinfo_ipv4(struct nft_pktinf
        pkt->xt.fragoff = ntohs(ip->frag_off) & IP_OFFSET;
  }
  
 -      iph = ip_hdr(skb);
+ static inline int
+ __nft_set_pktinfo_ipv4_validate(struct nft_pktinfo *pkt,
+                               struct sk_buff *skb,
+                               const struct nf_hook_state *state)
+ {
+       struct iphdr *iph, _iph;
+       u32 len, thoff;
+       iph = skb_header_pointer(skb, skb_network_offset(skb), sizeof(*iph),
+                                &_iph);
+       if (!iph)
+               return -1;
+       if (iph->ihl < 5 || iph->version != 4)
+               return -1;
+       len = ntohs(iph->tot_len);
+       thoff = iph->ihl * 4;
+       if (skb->len < len)
+               return -1;
+       else if (len < thoff)
+               return -1;
+       pkt->tprot_set = true;
+       pkt->tprot = iph->protocol;
+       pkt->xt.thoff = thoff;
+       pkt->xt.fragoff = ntohs(iph->frag_off) & IP_OFFSET;
+       return 0;
+ }
+ static inline void
+ nft_set_pktinfo_ipv4_validate(struct nft_pktinfo *pkt,
+                             struct sk_buff *skb,
+                             const struct nf_hook_state *state)
+ {
+       nft_set_pktinfo(pkt, skb, state);
+       if (__nft_set_pktinfo_ipv4_validate(pkt, skb, state) < 0)
+               nft_set_pktinfo_proto_unspec(pkt, skb);
+ }
  extern struct nft_af_info nft_af_ipv4;
  
  #endif
index 2535223ba9569112d84dae7d3d22b4816fd53497,01eb0f658366964bd3fc5feadbdb8b356625b9ec..f2727475895e77939d48a9df72fec6017fd8de95
@@@ -31,11 -31,8 +31,9 @@@ static unsigned int nf_route_table_hook
        struct in6_addr saddr, daddr;
        u_int8_t hop_limit;
        u32 mark, flowlabel;
 +      int err;
  
-       /* malformed packet, drop it */
-       if (nft_set_pktinfo_ipv6(&pkt, skb, state) < 0)
-               return NF_DROP;
+       nft_set_pktinfo_ipv6(&pkt, skb, state);
  
        /* save source/dest address, mark, hoplimit, flowlabel, priority */
        memcpy(&saddr, &ipv6_hdr(skb)->saddr, sizeof(saddr));
Simple merge
This page took 0.027141 seconds and 5 git commands to generate.