diff options
Diffstat (limited to 'net/ipv4/ip_output.c')
-rw-r--r-- | net/ipv4/ip_output.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index e527628f56cf..465544f6281a 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -5,8 +5,6 @@ | |||
5 | * | 5 | * |
6 | * The Internet Protocol (IP) output module. | 6 | * The Internet Protocol (IP) output module. |
7 | * | 7 | * |
8 | * Version: $Id: ip_output.c,v 1.100 2002/02/01 22:01:03 davem Exp $ | ||
9 | * | ||
10 | * Authors: Ross Biro | 8 | * Authors: Ross Biro |
11 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 9 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
12 | * Donald Becker, <becker@super.org> | 10 | * Donald Becker, <becker@super.org> |
@@ -184,9 +182,9 @@ static inline int ip_finish_output2(struct sk_buff *skb) | |||
184 | unsigned int hh_len = LL_RESERVED_SPACE(dev); | 182 | unsigned int hh_len = LL_RESERVED_SPACE(dev); |
185 | 183 | ||
186 | if (rt->rt_type == RTN_MULTICAST) | 184 | if (rt->rt_type == RTN_MULTICAST) |
187 | IP_INC_STATS(IPSTATS_MIB_OUTMCASTPKTS); | 185 | IP_INC_STATS(dev_net(dev), IPSTATS_MIB_OUTMCASTPKTS); |
188 | else if (rt->rt_type == RTN_BROADCAST) | 186 | else if (rt->rt_type == RTN_BROADCAST) |
189 | IP_INC_STATS(IPSTATS_MIB_OUTBCASTPKTS); | 187 | IP_INC_STATS(dev_net(dev), IPSTATS_MIB_OUTBCASTPKTS); |
190 | 188 | ||
191 | /* Be paranoid, rather than too clever. */ | 189 | /* Be paranoid, rather than too clever. */ |
192 | if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { | 190 | if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { |
@@ -246,7 +244,7 @@ int ip_mc_output(struct sk_buff *skb) | |||
246 | /* | 244 | /* |
247 | * If the indicated interface is up and running, send the packet. | 245 | * If the indicated interface is up and running, send the packet. |
248 | */ | 246 | */ |
249 | IP_INC_STATS(IPSTATS_MIB_OUTREQUESTS); | 247 | IP_INC_STATS(dev_net(dev), IPSTATS_MIB_OUTREQUESTS); |
250 | 248 | ||
251 | skb->dev = dev; | 249 | skb->dev = dev; |
252 | skb->protocol = htons(ETH_P_IP); | 250 | skb->protocol = htons(ETH_P_IP); |
@@ -300,7 +298,7 @@ int ip_output(struct sk_buff *skb) | |||
300 | { | 298 | { |
301 | struct net_device *dev = skb->dst->dev; | 299 | struct net_device *dev = skb->dst->dev; |
302 | 300 | ||
303 | IP_INC_STATS(IPSTATS_MIB_OUTREQUESTS); | 301 | IP_INC_STATS(dev_net(dev), IPSTATS_MIB_OUTREQUESTS); |
304 | 302 | ||
305 | skb->dev = dev; | 303 | skb->dev = dev; |
306 | skb->protocol = htons(ETH_P_IP); | 304 | skb->protocol = htons(ETH_P_IP); |
@@ -391,7 +389,7 @@ packet_routed: | |||
391 | return ip_local_out(skb); | 389 | return ip_local_out(skb); |
392 | 390 | ||
393 | no_route: | 391 | no_route: |
394 | IP_INC_STATS(IPSTATS_MIB_OUTNOROUTES); | 392 | IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTNOROUTES); |
395 | kfree_skb(skb); | 393 | kfree_skb(skb); |
396 | return -EHOSTUNREACH; | 394 | return -EHOSTUNREACH; |
397 | } | 395 | } |
@@ -453,7 +451,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) | |||
453 | iph = ip_hdr(skb); | 451 | iph = ip_hdr(skb); |
454 | 452 | ||
455 | if (unlikely((iph->frag_off & htons(IP_DF)) && !skb->local_df)) { | 453 | if (unlikely((iph->frag_off & htons(IP_DF)) && !skb->local_df)) { |
456 | IP_INC_STATS(IPSTATS_MIB_FRAGFAILS); | 454 | IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS); |
457 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, | 455 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, |
458 | htonl(ip_skb_dst_mtu(skb))); | 456 | htonl(ip_skb_dst_mtu(skb))); |
459 | kfree_skb(skb); | 457 | kfree_skb(skb); |
@@ -544,7 +542,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) | |||
544 | err = output(skb); | 542 | err = output(skb); |
545 | 543 | ||
546 | if (!err) | 544 | if (!err) |
547 | IP_INC_STATS(IPSTATS_MIB_FRAGCREATES); | 545 | IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGCREATES); |
548 | if (err || !frag) | 546 | if (err || !frag) |
549 | break; | 547 | break; |
550 | 548 | ||
@@ -554,7 +552,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) | |||
554 | } | 552 | } |
555 | 553 | ||
556 | if (err == 0) { | 554 | if (err == 0) { |
557 | IP_INC_STATS(IPSTATS_MIB_FRAGOKS); | 555 | IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGOKS); |
558 | return 0; | 556 | return 0; |
559 | } | 557 | } |
560 | 558 | ||
@@ -563,7 +561,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) | |||
563 | kfree_skb(frag); | 561 | kfree_skb(frag); |
564 | frag = skb; | 562 | frag = skb; |
565 | } | 563 | } |
566 | IP_INC_STATS(IPSTATS_MIB_FRAGFAILS); | 564 | IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS); |
567 | return err; | 565 | return err; |
568 | } | 566 | } |
569 | 567 | ||
@@ -675,15 +673,15 @@ slow_path: | |||
675 | if (err) | 673 | if (err) |
676 | goto fail; | 674 | goto fail; |
677 | 675 | ||
678 | IP_INC_STATS(IPSTATS_MIB_FRAGCREATES); | 676 | IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGCREATES); |
679 | } | 677 | } |
680 | kfree_skb(skb); | 678 | kfree_skb(skb); |
681 | IP_INC_STATS(IPSTATS_MIB_FRAGOKS); | 679 | IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGOKS); |
682 | return err; | 680 | return err; |
683 | 681 | ||
684 | fail: | 682 | fail: |
685 | kfree_skb(skb); | 683 | kfree_skb(skb); |
686 | IP_INC_STATS(IPSTATS_MIB_FRAGFAILS); | 684 | IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS); |
687 | return err; | 685 | return err; |
688 | } | 686 | } |
689 | 687 | ||
@@ -1049,7 +1047,7 @@ alloc_new_skb: | |||
1049 | 1047 | ||
1050 | error: | 1048 | error: |
1051 | inet->cork.length -= length; | 1049 | inet->cork.length -= length; |
1052 | IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS); | 1050 | IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTDISCARDS); |
1053 | return err; | 1051 | return err; |
1054 | } | 1052 | } |
1055 | 1053 | ||
@@ -1191,7 +1189,7 @@ ssize_t ip_append_page(struct sock *sk, struct page *page, | |||
1191 | 1189 | ||
1192 | error: | 1190 | error: |
1193 | inet->cork.length -= size; | 1191 | inet->cork.length -= size; |
1194 | IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS); | 1192 | IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTDISCARDS); |
1195 | return err; | 1193 | return err; |
1196 | } | 1194 | } |
1197 | 1195 | ||
@@ -1213,6 +1211,7 @@ int ip_push_pending_frames(struct sock *sk) | |||
1213 | struct sk_buff *skb, *tmp_skb; | 1211 | struct sk_buff *skb, *tmp_skb; |
1214 | struct sk_buff **tail_skb; | 1212 | struct sk_buff **tail_skb; |
1215 | struct inet_sock *inet = inet_sk(sk); | 1213 | struct inet_sock *inet = inet_sk(sk); |
1214 | struct net *net = sock_net(sk); | ||
1216 | struct ip_options *opt = NULL; | 1215 | struct ip_options *opt = NULL; |
1217 | struct rtable *rt = (struct rtable *)inet->cork.dst; | 1216 | struct rtable *rt = (struct rtable *)inet->cork.dst; |
1218 | struct iphdr *iph; | 1217 | struct iphdr *iph; |
@@ -1282,7 +1281,7 @@ int ip_push_pending_frames(struct sock *sk) | |||
1282 | skb->dst = dst_clone(&rt->u.dst); | 1281 | skb->dst = dst_clone(&rt->u.dst); |
1283 | 1282 | ||
1284 | if (iph->protocol == IPPROTO_ICMP) | 1283 | if (iph->protocol == IPPROTO_ICMP) |
1285 | icmp_out_count(((struct icmphdr *) | 1284 | icmp_out_count(net, ((struct icmphdr *) |
1286 | skb_transport_header(skb))->type); | 1285 | skb_transport_header(skb))->type); |
1287 | 1286 | ||
1288 | /* Netfilter gets whole the not fragmented skb. */ | 1287 | /* Netfilter gets whole the not fragmented skb. */ |
@@ -1299,7 +1298,7 @@ out: | |||
1299 | return err; | 1298 | return err; |
1300 | 1299 | ||
1301 | error: | 1300 | error: |
1302 | IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS); | 1301 | IP_INC_STATS(net, IPSTATS_MIB_OUTDISCARDS); |
1303 | goto out; | 1302 | goto out; |
1304 | } | 1303 | } |
1305 | 1304 | ||