udp.c (9e9fd65d1fa51d919d54d731be0e66492b5b6c5a) | udp.c (55be7a9c6074f749d617a7fc1914c9a23505438c) |
---|---|
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 User Datagram Protocol (UDP). 7 * 8 * Authors: Ross Biro --- 94 unchanged lines hidden (view full) --- 103#include <linux/seq_file.h> 104#include <net/net_namespace.h> 105#include <net/icmp.h> 106#include <net/route.h> 107#include <net/checksum.h> 108#include <net/xfrm.h> 109#include <trace/events/udp.h> 110#include <linux/static_key.h> | 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 User Datagram Protocol (UDP). 7 * 8 * Authors: Ross Biro --- 94 unchanged lines hidden (view full) --- 103#include <linux/seq_file.h> 104#include <net/net_namespace.h> 105#include <net/icmp.h> 106#include <net/route.h> 107#include <net/checksum.h> 108#include <net/xfrm.h> 109#include <trace/events/udp.h> 110#include <linux/static_key.h> |
111#include <trace/events/skb.h> |
|
111#include "udp_impl.h" 112 113struct udp_table udp_table __read_mostly; 114EXPORT_SYMBOL(udp_table); 115 116long sysctl_udp_mem[3] __read_mostly; 117EXPORT_SYMBOL(sysctl_udp_mem); 118 --- 491 unchanged lines hidden (view full) --- 610 case ICMP_SOURCE_QUENCH: 611 goto out; 612 case ICMP_PARAMETERPROB: 613 err = EPROTO; 614 harderr = 1; 615 break; 616 case ICMP_DEST_UNREACH: 617 if (code == ICMP_FRAG_NEEDED) { /* Path MTU discovery */ | 112#include "udp_impl.h" 113 114struct udp_table udp_table __read_mostly; 115EXPORT_SYMBOL(udp_table); 116 117long sysctl_udp_mem[3] __read_mostly; 118EXPORT_SYMBOL(sysctl_udp_mem); 119 --- 491 unchanged lines hidden (view full) --- 611 case ICMP_SOURCE_QUENCH: 612 goto out; 613 case ICMP_PARAMETERPROB: 614 err = EPROTO; 615 harderr = 1; 616 break; 617 case ICMP_DEST_UNREACH: 618 if (code == ICMP_FRAG_NEEDED) { /* Path MTU discovery */ |
619 ipv4_sk_update_pmtu(skb, sk, info); |
|
618 if (inet->pmtudisc != IP_PMTUDISC_DONT) { 619 err = EMSGSIZE; 620 harderr = 1; 621 break; 622 } 623 goto out; 624 } 625 err = EHOSTUNREACH; 626 if (code <= NR_ICMP_UNREACH) { 627 harderr = icmp_err_convert[code].fatal; 628 err = icmp_err_convert[code].errno; 629 } 630 break; | 620 if (inet->pmtudisc != IP_PMTUDISC_DONT) { 621 err = EMSGSIZE; 622 harderr = 1; 623 break; 624 } 625 goto out; 626 } 627 err = EHOSTUNREACH; 628 if (code <= NR_ICMP_UNREACH) { 629 harderr = icmp_err_convert[code].fatal; 630 err = icmp_err_convert[code].errno; 631 } 632 break; |
633 case ICMP_REDIRECT: 634 ipv4_sk_redirect(skb, sk); 635 break; |
|
631 } 632 633 /* 634 * RFC1122: OK. Passes ICMP errors back to application, as per 635 * 4.1.3.3. 636 */ 637 if (!inet->recverr) { 638 if (!harderr || sk->sk_state != TCP_ESTABLISHED) --- 575 unchanged lines hidden (view full) --- 1214 err = skb_copy_and_csum_datagram_iovec(skb, 1215 sizeof(struct udphdr), 1216 msg->msg_iov); 1217 1218 if (err == -EINVAL) 1219 goto csum_copy_err; 1220 } 1221 | 636 } 637 638 /* 639 * RFC1122: OK. Passes ICMP errors back to application, as per 640 * 4.1.3.3. 641 */ 642 if (!inet->recverr) { 643 if (!harderr || sk->sk_state != TCP_ESTABLISHED) --- 575 unchanged lines hidden (view full) --- 1219 err = skb_copy_and_csum_datagram_iovec(skb, 1220 sizeof(struct udphdr), 1221 msg->msg_iov); 1222 1223 if (err == -EINVAL) 1224 goto csum_copy_err; 1225 } 1226 |
1222 if (err) | 1227 if (unlikely(err)) { 1228 trace_kfree_skb(skb, udp_recvmsg); |
1223 goto out_free; | 1229 goto out_free; |
1230 } |
|
1224 1225 if (!peeked) 1226 UDP_INC_STATS_USER(sock_net(sk), 1227 UDP_MIB_INDATAGRAMS, is_udplite); 1228 1229 sock_recv_ts_and_drops(msg, sk, skb); 1230 1231 /* Copy the address. */ --- 1063 unchanged lines hidden --- | 1231 1232 if (!peeked) 1233 UDP_INC_STATS_USER(sock_net(sk), 1234 UDP_MIB_INDATAGRAMS, is_udplite); 1235 1236 sock_recv_ts_and_drops(msg, sk, skb); 1237 1238 /* Copy the address. */ --- 1063 unchanged lines hidden --- |