ip_output.c (b92dacd45698e120104ff81066ceb534916090d9) | ip_output.c (e2cb77db089796f163092326ca25512845df7a3a) |
---|---|
1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * The Internet Protocol (IP) output module. 7 * 8 * Authors: Ross Biro --- 94 unchanged lines hidden (view full) --- 103 104 iph->tot_len = htons(skb->len); 105 ip_send_check(iph); 106 return nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, 107 net, sk, skb, NULL, skb_dst(skb)->dev, 108 dst_output); 109} 110 | 1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * The Internet Protocol (IP) output module. 7 * 8 * Authors: Ross Biro --- 94 unchanged lines hidden (view full) --- 103 104 iph->tot_len = htons(skb->len); 105 ip_send_check(iph); 106 return nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, 107 net, sk, skb, NULL, skb_dst(skb)->dev, 108 dst_output); 109} 110 |
111int ip_local_out_sk(struct sock *sk, struct sk_buff *skb) | 111int ip_local_out(struct sock *sk, struct sk_buff *skb) |
112{ 113 struct net *net = dev_net(skb_dst(skb)->dev); 114 int err; 115 116 err = __ip_local_out(sk, skb); 117 if (likely(err == 1)) 118 err = dst_output(net, sk, skb); 119 120 return err; 121} | 112{ 113 struct net *net = dev_net(skb_dst(skb)->dev); 114 int err; 115 116 err = __ip_local_out(sk, skb); 117 if (likely(err == 1)) 118 err = dst_output(net, sk, skb); 119 120 return err; 121} |
122EXPORT_SYMBOL_GPL(ip_local_out_sk); | 122EXPORT_SYMBOL_GPL(ip_local_out); |
123 124static inline int ip_select_ttl(struct inet_sock *inet, struct dst_entry *dst) 125{ 126 int ttl = inet->uc_ttl; 127 128 if (ttl < 0) 129 ttl = ip4_dst_hoplimit(dst); 130 return ttl; --- 33 unchanged lines hidden (view full) --- 164 iph->ihl += opt->opt.optlen>>2; 165 ip_options_build(skb, &opt->opt, daddr, rt, 0); 166 } 167 168 skb->priority = sk->sk_priority; 169 skb->mark = sk->sk_mark; 170 171 /* Send it out. */ | 123 124static inline int ip_select_ttl(struct inet_sock *inet, struct dst_entry *dst) 125{ 126 int ttl = inet->uc_ttl; 127 128 if (ttl < 0) 129 ttl = ip4_dst_hoplimit(dst); 130 return ttl; --- 33 unchanged lines hidden (view full) --- 164 iph->ihl += opt->opt.optlen>>2; 165 ip_options_build(skb, &opt->opt, daddr, rt, 0); 166 } 167 168 skb->priority = sk->sk_priority; 169 skb->mark = sk->sk_mark; 170 171 /* Send it out. */ |
172 return ip_local_out(skb); | 172 return ip_local_out(skb->sk, skb); |
173} 174EXPORT_SYMBOL_GPL(ip_build_and_send_pkt); 175 176static int ip_finish_output2(struct net *net, struct sock *sk, struct sk_buff *skb) 177{ 178 struct dst_entry *dst = skb_dst(skb); 179 struct rtable *rt = (struct rtable *)dst; 180 struct net_device *dev = dst->dev; --- 270 unchanged lines hidden (view full) --- 451 452 ip_select_ident_segs(sock_net(sk), skb, sk, 453 skb_shinfo(skb)->gso_segs ?: 1); 454 455 /* TODO : should we use skb->sk here instead of sk ? */ 456 skb->priority = sk->sk_priority; 457 skb->mark = sk->sk_mark; 458 | 173} 174EXPORT_SYMBOL_GPL(ip_build_and_send_pkt); 175 176static int ip_finish_output2(struct net *net, struct sock *sk, struct sk_buff *skb) 177{ 178 struct dst_entry *dst = skb_dst(skb); 179 struct rtable *rt = (struct rtable *)dst; 180 struct net_device *dev = dst->dev; --- 270 unchanged lines hidden (view full) --- 451 452 ip_select_ident_segs(sock_net(sk), skb, sk, 453 skb_shinfo(skb)->gso_segs ?: 1); 454 455 /* TODO : should we use skb->sk here instead of sk ? */ 456 skb->priority = sk->sk_priority; 457 skb->mark = sk->sk_mark; 458 |
459 res = ip_local_out_sk(sk, skb); | 459 res = ip_local_out(sk, skb); |
460 rcu_read_unlock(); 461 return res; 462 463no_route: 464 rcu_read_unlock(); 465 IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTNOROUTES); 466 kfree_skb(skb); 467 return -EHOSTUNREACH; --- 963 unchanged lines hidden (view full) --- 1431out: 1432 return skb; 1433} 1434 1435int ip_send_skb(struct net *net, struct sk_buff *skb) 1436{ 1437 int err; 1438 | 460 rcu_read_unlock(); 461 return res; 462 463no_route: 464 rcu_read_unlock(); 465 IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTNOROUTES); 466 kfree_skb(skb); 467 return -EHOSTUNREACH; --- 963 unchanged lines hidden (view full) --- 1431out: 1432 return skb; 1433} 1434 1435int ip_send_skb(struct net *net, struct sk_buff *skb) 1436{ 1437 int err; 1438 |
1439 err = ip_local_out(skb); | 1439 err = ip_local_out(skb->sk, skb); |
1440 if (err) { 1441 if (err > 0) 1442 err = net_xmit_errno(err); 1443 if (err) 1444 IP_INC_STATS(net, IPSTATS_MIB_OUTDISCARDS); 1445 } 1446 1447 return err; --- 169 unchanged lines hidden --- | 1440 if (err) { 1441 if (err > 0) 1442 err = net_xmit_errno(err); 1443 if (err) 1444 IP_INC_STATS(net, IPSTATS_MIB_OUTDISCARDS); 1445 } 1446 1447 return err; --- 169 unchanged lines hidden --- |