diff options
Diffstat (limited to 'net/ipv4/ip_output.c')
-rw-r--r-- | net/ipv4/ip_output.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 451f97c42eb4..2630900e480a 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -113,19 +113,6 @@ int ip_local_out(struct sk_buff *skb) | |||
113 | } | 113 | } |
114 | EXPORT_SYMBOL_GPL(ip_local_out); | 114 | EXPORT_SYMBOL_GPL(ip_local_out); |
115 | 115 | ||
116 | /* dev_loopback_xmit for use with netfilter. */ | ||
117 | static int ip_dev_loopback_xmit(struct sk_buff *newskb) | ||
118 | { | ||
119 | skb_reset_mac_header(newskb); | ||
120 | __skb_pull(newskb, skb_network_offset(newskb)); | ||
121 | newskb->pkt_type = PACKET_LOOPBACK; | ||
122 | newskb->ip_summed = CHECKSUM_UNNECESSARY; | ||
123 | WARN_ON(!skb_dst(newskb)); | ||
124 | skb_dst_force(newskb); | ||
125 | netif_rx_ni(newskb); | ||
126 | return 0; | ||
127 | } | ||
128 | |||
129 | static inline int ip_select_ttl(struct inet_sock *inet, struct dst_entry *dst) | 116 | static inline int ip_select_ttl(struct inet_sock *inet, struct dst_entry *dst) |
130 | { | 117 | { |
131 | int ttl = inet->uc_ttl; | 118 | int ttl = inet->uc_ttl; |
@@ -200,7 +187,7 @@ static inline int ip_finish_output2(struct sk_buff *skb) | |||
200 | } | 187 | } |
201 | if (skb->sk) | 188 | if (skb->sk) |
202 | skb_set_owner_w(skb2, skb->sk); | 189 | skb_set_owner_w(skb2, skb->sk); |
203 | kfree_skb(skb); | 190 | consume_skb(skb); |
204 | skb = skb2; | 191 | skb = skb2; |
205 | } | 192 | } |
206 | 193 | ||
@@ -281,7 +268,7 @@ int ip_mc_output(struct sk_buff *skb) | |||
281 | if (newskb) | 268 | if (newskb) |
282 | NF_HOOK(NFPROTO_IPV4, NF_INET_POST_ROUTING, | 269 | NF_HOOK(NFPROTO_IPV4, NF_INET_POST_ROUTING, |
283 | newskb, NULL, newskb->dev, | 270 | newskb, NULL, newskb->dev, |
284 | ip_dev_loopback_xmit); | 271 | dev_loopback_xmit); |
285 | } | 272 | } |
286 | 273 | ||
287 | /* Multicasts with ttl 0 must not go beyond the host */ | 274 | /* Multicasts with ttl 0 must not go beyond the host */ |
@@ -296,7 +283,7 @@ int ip_mc_output(struct sk_buff *skb) | |||
296 | struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC); | 283 | struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC); |
297 | if (newskb) | 284 | if (newskb) |
298 | NF_HOOK(NFPROTO_IPV4, NF_INET_POST_ROUTING, newskb, | 285 | NF_HOOK(NFPROTO_IPV4, NF_INET_POST_ROUTING, newskb, |
299 | NULL, newskb->dev, ip_dev_loopback_xmit); | 286 | NULL, newskb->dev, dev_loopback_xmit); |
300 | } | 287 | } |
301 | 288 | ||
302 | return NF_HOOK_COND(NFPROTO_IPV4, NF_INET_POST_ROUTING, skb, NULL, | 289 | return NF_HOOK_COND(NFPROTO_IPV4, NF_INET_POST_ROUTING, skb, NULL, |
@@ -709,7 +696,7 @@ slow_path: | |||
709 | 696 | ||
710 | IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGCREATES); | 697 | IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGCREATES); |
711 | } | 698 | } |
712 | kfree_skb(skb); | 699 | consume_skb(skb); |
713 | IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGOKS); | 700 | IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGOKS); |
714 | return err; | 701 | return err; |
715 | 702 | ||
@@ -1472,13 +1459,14 @@ static int ip_reply_glue_bits(void *dptr, char *to, int offset, | |||
1472 | 1459 | ||
1473 | /* | 1460 | /* |
1474 | * Generic function to send a packet as reply to another packet. | 1461 | * Generic function to send a packet as reply to another packet. |
1475 | * Used to send TCP resets so far. ICMP should use this function too. | 1462 | * Used to send TCP resets so far. |
1476 | * | 1463 | * |
1477 | * Should run single threaded per socket because it uses the sock | 1464 | * Should run single threaded per socket because it uses the sock |
1478 | * structure to pass arguments. | 1465 | * structure to pass arguments. |
1479 | */ | 1466 | */ |
1480 | void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr, | 1467 | void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr, |
1481 | const struct ip_reply_arg *arg, unsigned int len) | 1468 | __be32 saddr, const struct ip_reply_arg *arg, |
1469 | unsigned int len) | ||
1482 | { | 1470 | { |
1483 | struct inet_sock *inet = inet_sk(sk); | 1471 | struct inet_sock *inet = inet_sk(sk); |
1484 | struct ip_options_data replyopts; | 1472 | struct ip_options_data replyopts; |
@@ -1504,7 +1492,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr, | |||
1504 | RT_TOS(arg->tos), | 1492 | RT_TOS(arg->tos), |
1505 | RT_SCOPE_UNIVERSE, sk->sk_protocol, | 1493 | RT_SCOPE_UNIVERSE, sk->sk_protocol, |
1506 | ip_reply_arg_flowi_flags(arg), | 1494 | ip_reply_arg_flowi_flags(arg), |
1507 | daddr, rt->rt_spec_dst, | 1495 | daddr, saddr, |
1508 | tcp_hdr(skb)->source, tcp_hdr(skb)->dest); | 1496 | tcp_hdr(skb)->source, tcp_hdr(skb)->dest); |
1509 | security_skb_classify_flow(skb, flowi4_to_flowi(&fl4)); | 1497 | security_skb_classify_flow(skb, flowi4_to_flowi(&fl4)); |
1510 | rt = ip_route_output_key(sock_net(sk), &fl4); | 1498 | rt = ip_route_output_key(sock_net(sk), &fl4); |