diff options
Diffstat (limited to 'net/ipv6/ip6_input.c')
-rw-r--r-- | net/ipv6/ip6_input.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index 7e14cccd0561..936f48946e20 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c | |||
@@ -59,6 +59,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
59 | struct ipv6hdr *hdr; | 59 | struct ipv6hdr *hdr; |
60 | u32 pkt_len; | 60 | u32 pkt_len; |
61 | struct inet6_dev *idev; | 61 | struct inet6_dev *idev; |
62 | struct net *net = dev_net(skb->dev); | ||
62 | 63 | ||
63 | if (skb->pkt_type == PACKET_OTHERHOST) { | 64 | if (skb->pkt_type == PACKET_OTHERHOST) { |
64 | kfree_skb(skb); | 65 | kfree_skb(skb); |
@@ -69,11 +70,11 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
69 | 70 | ||
70 | idev = __in6_dev_get(skb->dev); | 71 | idev = __in6_dev_get(skb->dev); |
71 | 72 | ||
72 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INRECEIVES); | 73 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INRECEIVES); |
73 | 74 | ||
74 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL || | 75 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL || |
75 | !idev || unlikely(idev->cnf.disable_ipv6)) { | 76 | !idev || unlikely(idev->cnf.disable_ipv6)) { |
76 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INDISCARDS); | 77 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INDISCARDS); |
77 | rcu_read_unlock(); | 78 | rcu_read_unlock(); |
78 | goto out; | 79 | goto out; |
79 | } | 80 | } |
@@ -118,11 +119,12 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
118 | /* pkt_len may be zero if Jumbo payload option is present */ | 119 | /* pkt_len may be zero if Jumbo payload option is present */ |
119 | if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) { | 120 | if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) { |
120 | if (pkt_len + sizeof(struct ipv6hdr) > skb->len) { | 121 | if (pkt_len + sizeof(struct ipv6hdr) > skb->len) { |
121 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INTRUNCATEDPKTS); | 122 | IP6_INC_STATS_BH(net, |
123 | idev, IPSTATS_MIB_INTRUNCATEDPKTS); | ||
122 | goto drop; | 124 | goto drop; |
123 | } | 125 | } |
124 | if (pskb_trim_rcsum(skb, pkt_len + sizeof(struct ipv6hdr))) { | 126 | if (pskb_trim_rcsum(skb, pkt_len + sizeof(struct ipv6hdr))) { |
125 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS); | 127 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INHDRERRORS); |
126 | goto drop; | 128 | goto drop; |
127 | } | 129 | } |
128 | hdr = ipv6_hdr(skb); | 130 | hdr = ipv6_hdr(skb); |
@@ -130,7 +132,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
130 | 132 | ||
131 | if (hdr->nexthdr == NEXTHDR_HOP) { | 133 | if (hdr->nexthdr == NEXTHDR_HOP) { |
132 | if (ipv6_parse_hopopts(skb) < 0) { | 134 | if (ipv6_parse_hopopts(skb) < 0) { |
133 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS); | 135 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INHDRERRORS); |
134 | rcu_read_unlock(); | 136 | rcu_read_unlock(); |
135 | return 0; | 137 | return 0; |
136 | } | 138 | } |
@@ -141,7 +143,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
141 | return NF_HOOK(PF_INET6, NF_INET_PRE_ROUTING, skb, dev, NULL, | 143 | return NF_HOOK(PF_INET6, NF_INET_PRE_ROUTING, skb, dev, NULL, |
142 | ip6_rcv_finish); | 144 | ip6_rcv_finish); |
143 | err: | 145 | err: |
144 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS); | 146 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INHDRERRORS); |
145 | drop: | 147 | drop: |
146 | rcu_read_unlock(); | 148 | rcu_read_unlock(); |
147 | kfree_skb(skb); | 149 | kfree_skb(skb); |
@@ -161,6 +163,7 @@ static int ip6_input_finish(struct sk_buff *skb) | |||
161 | int nexthdr, raw; | 163 | int nexthdr, raw; |
162 | u8 hash; | 164 | u8 hash; |
163 | struct inet6_dev *idev; | 165 | struct inet6_dev *idev; |
166 | struct net *net = dev_net(skb->dst->dev); | ||
164 | 167 | ||
165 | /* | 168 | /* |
166 | * Parse extension headers | 169 | * Parse extension headers |
@@ -205,24 +208,25 @@ resubmit: | |||
205 | if (ret > 0) | 208 | if (ret > 0) |
206 | goto resubmit; | 209 | goto resubmit; |
207 | else if (ret == 0) | 210 | else if (ret == 0) |
208 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INDELIVERS); | 211 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INDELIVERS); |
209 | } else { | 212 | } else { |
210 | if (!raw) { | 213 | if (!raw) { |
211 | if (xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { | 214 | if (xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { |
212 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INUNKNOWNPROTOS); | 215 | IP6_INC_STATS_BH(net, idev, |
216 | IPSTATS_MIB_INUNKNOWNPROTOS); | ||
213 | icmpv6_send(skb, ICMPV6_PARAMPROB, | 217 | icmpv6_send(skb, ICMPV6_PARAMPROB, |
214 | ICMPV6_UNK_NEXTHDR, nhoff, | 218 | ICMPV6_UNK_NEXTHDR, nhoff, |
215 | skb->dev); | 219 | skb->dev); |
216 | } | 220 | } |
217 | } else | 221 | } else |
218 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INDELIVERS); | 222 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INDELIVERS); |
219 | kfree_skb(skb); | 223 | kfree_skb(skb); |
220 | } | 224 | } |
221 | rcu_read_unlock(); | 225 | rcu_read_unlock(); |
222 | return 0; | 226 | return 0; |
223 | 227 | ||
224 | discard: | 228 | discard: |
225 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INDISCARDS); | 229 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INDISCARDS); |
226 | rcu_read_unlock(); | 230 | rcu_read_unlock(); |
227 | kfree_skb(skb); | 231 | kfree_skb(skb); |
228 | return 0; | 232 | return 0; |
@@ -240,7 +244,8 @@ int ip6_mc_input(struct sk_buff *skb) | |||
240 | struct ipv6hdr *hdr; | 244 | struct ipv6hdr *hdr; |
241 | int deliver; | 245 | int deliver; |
242 | 246 | ||
243 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INMCASTPKTS); | 247 | IP6_INC_STATS_BH(dev_net(skb->dst->dev), |
248 | ip6_dst_idev(skb->dst), IPSTATS_MIB_INMCASTPKTS); | ||
244 | 249 | ||
245 | hdr = ipv6_hdr(skb); | 250 | hdr = ipv6_hdr(skb); |
246 | deliver = ipv6_chk_mcast_addr(skb->dev, &hdr->daddr, NULL); | 251 | deliver = ipv6_chk_mcast_addr(skb->dev, &hdr->daddr, NULL); |