diff options
-rw-r--r-- | net/ipv4/netfilter/nf_socket_ipv4.c | 6 | ||||
-rw-r--r-- | net/ipv6/netfilter/nf_socket_ipv6.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/net/ipv4/netfilter/nf_socket_ipv4.c b/net/ipv4/netfilter/nf_socket_ipv4.c index e9293bdebba0..4824b1e183a1 100644 --- a/net/ipv4/netfilter/nf_socket_ipv4.c +++ b/net/ipv4/netfilter/nf_socket_ipv4.c | |||
@@ -108,10 +108,12 @@ struct sock *nf_sk_lookup_slow_v4(struct net *net, const struct sk_buff *skb, | |||
108 | int doff = 0; | 108 | int doff = 0; |
109 | 109 | ||
110 | if (iph->protocol == IPPROTO_UDP || iph->protocol == IPPROTO_TCP) { | 110 | if (iph->protocol == IPPROTO_UDP || iph->protocol == IPPROTO_TCP) { |
111 | struct udphdr _hdr, *hp; | 111 | struct tcphdr _hdr; |
112 | struct udphdr *hp; | ||
112 | 113 | ||
113 | hp = skb_header_pointer(skb, ip_hdrlen(skb), | 114 | hp = skb_header_pointer(skb, ip_hdrlen(skb), |
114 | sizeof(_hdr), &_hdr); | 115 | iph->protocol == IPPROTO_UDP ? |
116 | sizeof(*hp) : sizeof(_hdr), &_hdr); | ||
115 | if (hp == NULL) | 117 | if (hp == NULL) |
116 | return NULL; | 118 | return NULL; |
117 | 119 | ||
diff --git a/net/ipv6/netfilter/nf_socket_ipv6.c b/net/ipv6/netfilter/nf_socket_ipv6.c index ebb2bf84232a..f14de4b6d639 100644 --- a/net/ipv6/netfilter/nf_socket_ipv6.c +++ b/net/ipv6/netfilter/nf_socket_ipv6.c | |||
@@ -116,9 +116,11 @@ struct sock *nf_sk_lookup_slow_v6(struct net *net, const struct sk_buff *skb, | |||
116 | } | 116 | } |
117 | 117 | ||
118 | if (tproto == IPPROTO_UDP || tproto == IPPROTO_TCP) { | 118 | if (tproto == IPPROTO_UDP || tproto == IPPROTO_TCP) { |
119 | struct udphdr _hdr, *hp; | 119 | struct tcphdr _hdr; |
120 | struct udphdr *hp; | ||
120 | 121 | ||
121 | hp = skb_header_pointer(skb, thoff, sizeof(_hdr), &_hdr); | 122 | hp = skb_header_pointer(skb, thoff, tproto == IPPROTO_UDP ? |
123 | sizeof(*hp) : sizeof(_hdr), &_hdr); | ||
122 | if (hp == NULL) | 124 | if (hp == NULL) |
123 | return NULL; | 125 | return NULL; |
124 | 126 | ||