Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | * Version: $Id: udp.c,v 1.102 2002/02/01 22:01:04 davem Exp $ |
| 9 | * |
Jesper Juhl | 02c30a8 | 2005-05-05 16:16:16 -0700 | [diff] [blame] | 10 | * Authors: Ross Biro |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
| 12 | * Arnt Gulbrandsen, <agulbra@nvg.unit.no> |
| 13 | * Alan Cox, <Alan.Cox@linux.org> |
| 14 | * Hirokazu Takahashi, <taka@valinux.co.jp> |
| 15 | * |
| 16 | * Fixes: |
| 17 | * Alan Cox : verify_area() calls |
| 18 | * Alan Cox : stopped close while in use off icmp |
| 19 | * messages. Not a fix but a botch that |
| 20 | * for udp at least is 'valid'. |
| 21 | * Alan Cox : Fixed icmp handling properly |
| 22 | * Alan Cox : Correct error for oversized datagrams |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 23 | * Alan Cox : Tidied select() semantics. |
| 24 | * Alan Cox : udp_err() fixed properly, also now |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | * select and read wake correctly on errors |
| 26 | * Alan Cox : udp_send verify_area moved to avoid mem leak |
| 27 | * Alan Cox : UDP can count its memory |
| 28 | * Alan Cox : send to an unknown connection causes |
| 29 | * an ECONNREFUSED off the icmp, but |
| 30 | * does NOT close. |
| 31 | * Alan Cox : Switched to new sk_buff handlers. No more backlog! |
| 32 | * Alan Cox : Using generic datagram code. Even smaller and the PEEK |
| 33 | * bug no longer crashes it. |
| 34 | * Fred Van Kempen : Net2e support for sk->broadcast. |
| 35 | * Alan Cox : Uses skb_free_datagram |
| 36 | * Alan Cox : Added get/set sockopt support. |
| 37 | * Alan Cox : Broadcasting without option set returns EACCES. |
| 38 | * Alan Cox : No wakeup calls. Instead we now use the callbacks. |
| 39 | * Alan Cox : Use ip_tos and ip_ttl |
| 40 | * Alan Cox : SNMP Mibs |
| 41 | * Alan Cox : MSG_DONTROUTE, and 0.0.0.0 support. |
| 42 | * Matt Dillon : UDP length checks. |
| 43 | * Alan Cox : Smarter af_inet used properly. |
| 44 | * Alan Cox : Use new kernel side addressing. |
| 45 | * Alan Cox : Incorrect return on truncated datagram receive. |
| 46 | * Arnt Gulbrandsen : New udp_send and stuff |
| 47 | * Alan Cox : Cache last socket |
| 48 | * Alan Cox : Route cache |
| 49 | * Jon Peatfield : Minor efficiency fix to sendto(). |
| 50 | * Mike Shaver : RFC1122 checks. |
| 51 | * Alan Cox : Nonblocking error fix. |
| 52 | * Willy Konynenberg : Transparent proxying support. |
| 53 | * Mike McLagan : Routing by source |
| 54 | * David S. Miller : New socket lookup architecture. |
| 55 | * Last socket cache retained as it |
| 56 | * does have a high hit rate. |
| 57 | * Olaf Kirch : Don't linearise iovec on sendmsg. |
| 58 | * Andi Kleen : Some cleanups, cache destination entry |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 59 | * for connect. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | * Vitaly E. Lavrov : Transparent proxy revived after year coma. |
| 61 | * Melvin Smith : Check msg_name not msg_namelen in sendto(), |
| 62 | * return ENOTCONN for unconnected sockets (POSIX) |
| 63 | * Janos Farkas : don't deliver multi/broadcasts to a different |
| 64 | * bound-to-device socket |
| 65 | * Hirokazu Takahashi : HW checksumming for outgoing UDP |
| 66 | * datagrams. |
| 67 | * Hirokazu Takahashi : sendfile() on UDP works now. |
| 68 | * Arnaldo C. Melo : convert /proc/net/udp to seq_file |
| 69 | * YOSHIFUJI Hideaki @USAGI and: Support IPV6_V6ONLY socket option, which |
| 70 | * Alexey Kuznetsov: allow both IPv4 and IPv6 sockets to bind |
| 71 | * a single port at the same time. |
| 72 | * Derek Atkins <derek@ihtfp.com>: Add Encapulation Support |
James Chapman | 342f023 | 2007-06-27 15:37:46 -0700 | [diff] [blame] | 73 | * James Chapman : Add L2TP encapsulation type. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | * |
| 75 | * |
| 76 | * This program is free software; you can redistribute it and/or |
| 77 | * modify it under the terms of the GNU General Public License |
| 78 | * as published by the Free Software Foundation; either version |
| 79 | * 2 of the License, or (at your option) any later version. |
| 80 | */ |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 81 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | #include <asm/system.h> |
| 83 | #include <asm/uaccess.h> |
| 84 | #include <asm/ioctls.h> |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 85 | #include <linux/bootmem.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | #include <linux/types.h> |
| 87 | #include <linux/fcntl.h> |
| 88 | #include <linux/module.h> |
| 89 | #include <linux/socket.h> |
| 90 | #include <linux/sockios.h> |
Arnaldo Carvalho de Melo | 14c8502 | 2005-12-27 02:43:12 -0200 | [diff] [blame] | 91 | #include <linux/igmp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | #include <linux/in.h> |
| 93 | #include <linux/errno.h> |
| 94 | #include <linux/timer.h> |
| 95 | #include <linux/mm.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | #include <linux/inet.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | #include <linux/netdevice.h> |
Arnaldo Carvalho de Melo | c752f07 | 2005-08-09 20:08:28 -0700 | [diff] [blame] | 98 | #include <net/tcp_states.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | #include <linux/skbuff.h> |
| 100 | #include <linux/proc_fs.h> |
| 101 | #include <linux/seq_file.h> |
Eric W. Biederman | 457c4cb | 2007-09-12 12:01:34 +0200 | [diff] [blame] | 102 | #include <net/net_namespace.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | #include <net/icmp.h> |
| 104 | #include <net/route.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | #include <net/checksum.h> |
| 106 | #include <net/xfrm.h> |
Gerrit Renker | ba4e58e | 2006-11-27 11:10:57 -0800 | [diff] [blame] | 107 | #include "udp_impl.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | |
| 109 | /* |
| 110 | * Snmp MIB for the UDP layer |
| 111 | */ |
| 112 | |
Eric Dumazet | ba89966 | 2005-08-26 12:05:31 -0700 | [diff] [blame] | 113 | DEFINE_SNMP_STAT(struct udp_mib, udp_statistics) __read_mostly; |
Herbert Xu | 1781f7f | 2007-12-11 11:30:32 -0800 | [diff] [blame] | 114 | EXPORT_SYMBOL(udp_statistics); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | |
Herbert Xu | 9055e05 | 2007-12-14 11:25:26 -0800 | [diff] [blame] | 116 | DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6) __read_mostly; |
| 117 | EXPORT_SYMBOL(udp_stats_in6); |
| 118 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | struct hlist_head udp_hash[UDP_HTABLE_SIZE]; |
| 120 | DEFINE_RWLOCK(udp_hash_lock); |
| 121 | |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 122 | int sysctl_udp_mem[3] __read_mostly; |
| 123 | int sysctl_udp_rmem_min __read_mostly; |
| 124 | int sysctl_udp_wmem_min __read_mostly; |
| 125 | |
| 126 | EXPORT_SYMBOL(sysctl_udp_mem); |
| 127 | EXPORT_SYMBOL(sysctl_udp_rmem_min); |
| 128 | EXPORT_SYMBOL(sysctl_udp_wmem_min); |
| 129 | |
| 130 | atomic_t udp_memory_allocated; |
| 131 | EXPORT_SYMBOL(udp_memory_allocated); |
| 132 | |
Pavel Emelyanov | fa4d3c6 | 2008-01-31 05:07:57 -0800 | [diff] [blame] | 133 | static inline int __udp_lib_lport_inuse(struct net *net, __u16 num, |
Stephen Hemminger | 32c1da7 | 2007-08-24 23:09:41 -0700 | [diff] [blame] | 134 | const struct hlist_head udptable[]) |
Gerrit Renker | 25030a7 | 2006-08-26 20:06:05 -0700 | [diff] [blame] | 135 | { |
| 136 | struct sock *sk; |
| 137 | struct hlist_node *node; |
| 138 | |
David S. Miller | df2bc45 | 2007-06-05 15:18:43 -0700 | [diff] [blame] | 139 | sk_for_each(sk, node, &udptable[num & (UDP_HTABLE_SIZE - 1)]) |
Pavel Emelyanov | fa4d3c6 | 2008-01-31 05:07:57 -0800 | [diff] [blame] | 140 | if (sk->sk_net == net && sk->sk_hash == num) |
Gerrit Renker | 25030a7 | 2006-08-26 20:06:05 -0700 | [diff] [blame] | 141 | return 1; |
| 142 | return 0; |
| 143 | } |
| 144 | |
| 145 | /** |
Gerrit Renker | ba4e58e | 2006-11-27 11:10:57 -0800 | [diff] [blame] | 146 | * __udp_lib_get_port - UDP/-Lite port lookup for IPv4 and IPv6 |
Gerrit Renker | 25030a7 | 2006-08-26 20:06:05 -0700 | [diff] [blame] | 147 | * |
| 148 | * @sk: socket struct in question |
| 149 | * @snum: port number to look up |
Gerrit Renker | ba4e58e | 2006-11-27 11:10:57 -0800 | [diff] [blame] | 150 | * @udptable: hash list table, must be of UDP_HTABLE_SIZE |
David S. Miller | df2bc45 | 2007-06-05 15:18:43 -0700 | [diff] [blame] | 151 | * @saddr_comp: AF-dependent comparison of bound local IP addresses |
Gerrit Renker | 25030a7 | 2006-08-26 20:06:05 -0700 | [diff] [blame] | 152 | */ |
Gerrit Renker | ba4e58e | 2006-11-27 11:10:57 -0800 | [diff] [blame] | 153 | int __udp_lib_get_port(struct sock *sk, unsigned short snum, |
Stephen Hemminger | 32c1da7 | 2007-08-24 23:09:41 -0700 | [diff] [blame] | 154 | struct hlist_head udptable[], |
David S. Miller | df2bc45 | 2007-06-05 15:18:43 -0700 | [diff] [blame] | 155 | int (*saddr_comp)(const struct sock *sk1, |
| 156 | const struct sock *sk2 ) ) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | { |
| 158 | struct hlist_node *node; |
Gerrit Renker | 25030a7 | 2006-08-26 20:06:05 -0700 | [diff] [blame] | 159 | struct hlist_head *head; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | struct sock *sk2; |
Gerrit Renker | 25030a7 | 2006-08-26 20:06:05 -0700 | [diff] [blame] | 161 | int error = 1; |
Pavel Emelyanov | fa4d3c6 | 2008-01-31 05:07:57 -0800 | [diff] [blame] | 162 | struct net *net = sk->sk_net; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | |
| 164 | write_lock_bh(&udp_hash_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | |
Stephen Hemminger | 32c1da7 | 2007-08-24 23:09:41 -0700 | [diff] [blame] | 166 | if (!snum) { |
Anton Arapov | a25de53 | 2007-10-18 22:00:17 -0700 | [diff] [blame] | 167 | int i, low, high, remaining; |
Stephen Hemminger | 32c1da7 | 2007-08-24 23:09:41 -0700 | [diff] [blame] | 168 | unsigned rover, best, best_size_so_far; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 | |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 170 | inet_get_local_port_range(&low, &high); |
Anton Arapov | a25de53 | 2007-10-18 22:00:17 -0700 | [diff] [blame] | 171 | remaining = (high - low) + 1; |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 172 | |
Stephen Hemminger | 32c1da7 | 2007-08-24 23:09:41 -0700 | [diff] [blame] | 173 | best_size_so_far = UINT_MAX; |
Anton Arapov | a25de53 | 2007-10-18 22:00:17 -0700 | [diff] [blame] | 174 | best = rover = net_random() % remaining + low; |
Stephen Hemminger | 32c1da7 | 2007-08-24 23:09:41 -0700 | [diff] [blame] | 175 | |
| 176 | /* 1st pass: look for empty (or shortest) hash chain */ |
| 177 | for (i = 0; i < UDP_HTABLE_SIZE; i++) { |
| 178 | int size = 0; |
| 179 | |
| 180 | head = &udptable[rover & (UDP_HTABLE_SIZE - 1)]; |
| 181 | if (hlist_empty(head)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | goto gotit; |
Stephen Hemminger | 32c1da7 | 2007-08-24 23:09:41 -0700 | [diff] [blame] | 183 | |
David S. Miller | 5c66870 | 2006-12-22 11:42:26 -0800 | [diff] [blame] | 184 | sk_for_each(sk2, node, head) { |
| 185 | if (++size >= best_size_so_far) |
| 186 | goto next; |
| 187 | } |
| 188 | best_size_so_far = size; |
Stephen Hemminger | 32c1da7 | 2007-08-24 23:09:41 -0700 | [diff] [blame] | 189 | best = rover; |
David S. Miller | 5c66870 | 2006-12-22 11:42:26 -0800 | [diff] [blame] | 190 | next: |
Stephen Hemminger | 32c1da7 | 2007-08-24 23:09:41 -0700 | [diff] [blame] | 191 | /* fold back if end of range */ |
| 192 | if (++rover > high) |
| 193 | rover = low + ((rover - low) |
| 194 | & (UDP_HTABLE_SIZE - 1)); |
| 195 | |
| 196 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | } |
Stephen Hemminger | 32c1da7 | 2007-08-24 23:09:41 -0700 | [diff] [blame] | 198 | |
| 199 | /* 2nd pass: find hole in shortest hash chain */ |
| 200 | rover = best; |
| 201 | for (i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++) { |
Pavel Emelyanov | fa4d3c6 | 2008-01-31 05:07:57 -0800 | [diff] [blame] | 202 | if (! __udp_lib_lport_inuse(net, rover, udptable)) |
Stephen Hemminger | 32c1da7 | 2007-08-24 23:09:41 -0700 | [diff] [blame] | 203 | goto gotit; |
| 204 | rover += UDP_HTABLE_SIZE; |
| 205 | if (rover > high) |
| 206 | rover = low + ((rover - low) |
| 207 | & (UDP_HTABLE_SIZE - 1)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | } |
Stephen Hemminger | 32c1da7 | 2007-08-24 23:09:41 -0700 | [diff] [blame] | 209 | |
| 210 | |
| 211 | /* All ports in use! */ |
| 212 | goto fail; |
| 213 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | gotit: |
Stephen Hemminger | 32c1da7 | 2007-08-24 23:09:41 -0700 | [diff] [blame] | 215 | snum = rover; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | } else { |
David S. Miller | df2bc45 | 2007-06-05 15:18:43 -0700 | [diff] [blame] | 217 | head = &udptable[snum & (UDP_HTABLE_SIZE - 1)]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | |
Gerrit Renker | 25030a7 | 2006-08-26 20:06:05 -0700 | [diff] [blame] | 219 | sk_for_each(sk2, node, head) |
David S. Miller | df2bc45 | 2007-06-05 15:18:43 -0700 | [diff] [blame] | 220 | if (sk2->sk_hash == snum && |
| 221 | sk2 != sk && |
Pavel Emelyanov | fa4d3c6 | 2008-01-31 05:07:57 -0800 | [diff] [blame] | 222 | sk2->sk_net == net && |
David S. Miller | df2bc45 | 2007-06-05 15:18:43 -0700 | [diff] [blame] | 223 | (!sk2->sk_reuse || !sk->sk_reuse) && |
| 224 | (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if |
| 225 | || sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && |
| 226 | (*saddr_comp)(sk, sk2) ) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | goto fail; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | } |
Stephen Hemminger | 32c1da7 | 2007-08-24 23:09:41 -0700 | [diff] [blame] | 229 | |
Gerrit Renker | 25030a7 | 2006-08-26 20:06:05 -0700 | [diff] [blame] | 230 | inet_sk(sk)->num = snum; |
David S. Miller | df2bc45 | 2007-06-05 15:18:43 -0700 | [diff] [blame] | 231 | sk->sk_hash = snum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 | if (sk_unhashed(sk)) { |
David S. Miller | df2bc45 | 2007-06-05 15:18:43 -0700 | [diff] [blame] | 233 | head = &udptable[snum & (UDP_HTABLE_SIZE - 1)]; |
Gerrit Renker | 25030a7 | 2006-08-26 20:06:05 -0700 | [diff] [blame] | 234 | sk_add_node(sk, head); |
Eric Dumazet | 65f7651 | 2008-01-03 20:46:48 -0800 | [diff] [blame] | 235 | sock_prot_inuse_add(sk->sk_prot, 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | } |
Gerrit Renker | 25030a7 | 2006-08-26 20:06:05 -0700 | [diff] [blame] | 237 | error = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | fail: |
| 239 | write_unlock_bh(&udp_hash_lock); |
Gerrit Renker | 25030a7 | 2006-08-26 20:06:05 -0700 | [diff] [blame] | 240 | return error; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | } |
| 242 | |
Stephen Hemminger | 3fbe070 | 2007-03-08 20:46:41 -0800 | [diff] [blame] | 243 | int udp_get_port(struct sock *sk, unsigned short snum, |
David S. Miller | df2bc45 | 2007-06-05 15:18:43 -0700 | [diff] [blame] | 244 | int (*scmp)(const struct sock *, const struct sock *)) |
Gerrit Renker | ba4e58e | 2006-11-27 11:10:57 -0800 | [diff] [blame] | 245 | { |
Stephen Hemminger | 32c1da7 | 2007-08-24 23:09:41 -0700 | [diff] [blame] | 246 | return __udp_lib_get_port(sk, snum, udp_hash, scmp); |
Gerrit Renker | ba4e58e | 2006-11-27 11:10:57 -0800 | [diff] [blame] | 247 | } |
| 248 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | /* |
| 250 | * IOCTL requests applicable to the UDP protocol |
| 251 | */ |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 252 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | int udp_ioctl(struct sock *sk, int cmd, unsigned long arg) |
| 254 | { |
Stephen Hemminger | 6516c65 | 2007-03-08 20:41:55 -0800 | [diff] [blame] | 255 | switch (cmd) { |
| 256 | case SIOCOUTQ: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | { |
Stephen Hemminger | 6516c65 | 2007-03-08 20:41:55 -0800 | [diff] [blame] | 258 | int amount = atomic_read(&sk->sk_wmem_alloc); |
| 259 | return put_user(amount, (int __user *)arg); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | } |
Stephen Hemminger | 6516c65 | 2007-03-08 20:41:55 -0800 | [diff] [blame] | 261 | |
| 262 | case SIOCINQ: |
| 263 | { |
| 264 | struct sk_buff *skb; |
| 265 | unsigned long amount; |
| 266 | |
| 267 | amount = 0; |
| 268 | spin_lock_bh(&sk->sk_receive_queue.lock); |
| 269 | skb = skb_peek(&sk->sk_receive_queue); |
| 270 | if (skb != NULL) { |
| 271 | /* |
| 272 | * We will only return the amount |
| 273 | * of this packet since that is all |
| 274 | * that will be read. |
| 275 | */ |
| 276 | amount = skb->len - sizeof(struct udphdr); |
| 277 | } |
| 278 | spin_unlock_bh(&sk->sk_receive_queue.lock); |
| 279 | return put_user(amount, (int __user *)arg); |
| 280 | } |
| 281 | |
| 282 | default: |
| 283 | return -ENOIOCTLCMD; |
| 284 | } |
| 285 | |
| 286 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | } |
| 288 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 289 | int udp_disconnect(struct sock *sk, int flags) |
| 290 | { |
| 291 | struct inet_sock *inet = inet_sk(sk); |
| 292 | /* |
| 293 | * 1003.1g - break association. |
| 294 | */ |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 295 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | sk->sk_state = TCP_CLOSE; |
| 297 | inet->daddr = 0; |
| 298 | inet->dport = 0; |
| 299 | sk->sk_bound_dev_if = 0; |
| 300 | if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK)) |
| 301 | inet_reset_saddr(sk); |
| 302 | |
| 303 | if (!(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) { |
| 304 | sk->sk_prot->unhash(sk); |
| 305 | inet->sport = 0; |
| 306 | } |
| 307 | sk_dst_reset(sk); |
| 308 | return 0; |
| 309 | } |
| 310 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | /* |
| 312 | * Socket option code for UDP |
| 313 | */ |
Gerrit Renker | 4c0a6cb | 2006-11-27 09:29:59 -0800 | [diff] [blame] | 314 | int udp_lib_setsockopt(struct sock *sk, int level, int optname, |
| 315 | char __user *optval, int optlen, |
| 316 | int (*push_pending_frames)(struct sock *)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | { |
| 318 | struct udp_sock *up = udp_sk(sk); |
| 319 | int val; |
| 320 | int err = 0; |
YOSHIFUJI Hideaki | e898d4d | 2008-03-01 01:06:47 +0900 | [diff] [blame] | 321 | #ifdef CONFIG_IP_UDPLITE |
Wang Chen | b2bf1e2 | 2007-12-03 22:34:16 +1100 | [diff] [blame] | 322 | int is_udplite = IS_UDPLITE(sk); |
YOSHIFUJI Hideaki | e898d4d | 2008-03-01 01:06:47 +0900 | [diff] [blame] | 323 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | |
Stephen Hemminger | 6516c65 | 2007-03-08 20:41:55 -0800 | [diff] [blame] | 325 | if (optlen<sizeof(int)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | return -EINVAL; |
| 327 | |
| 328 | if (get_user(val, (int __user *)optval)) |
| 329 | return -EFAULT; |
| 330 | |
Stephen Hemminger | 6516c65 | 2007-03-08 20:41:55 -0800 | [diff] [blame] | 331 | switch (optname) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | case UDP_CORK: |
| 333 | if (val != 0) { |
| 334 | up->corkflag = 1; |
| 335 | } else { |
| 336 | up->corkflag = 0; |
| 337 | lock_sock(sk); |
Gerrit Renker | 4c0a6cb | 2006-11-27 09:29:59 -0800 | [diff] [blame] | 338 | (*push_pending_frames)(sk); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | release_sock(sk); |
| 340 | } |
| 341 | break; |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 342 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | case UDP_ENCAP: |
| 344 | switch (val) { |
| 345 | case 0: |
| 346 | case UDP_ENCAP_ESPINUDP: |
| 347 | case UDP_ENCAP_ESPINUDP_NON_IKE: |
James Chapman | 067b207 | 2007-07-05 17:08:05 -0700 | [diff] [blame] | 348 | up->encap_rcv = xfrm4_udp_encap_rcv; |
| 349 | /* FALLTHROUGH */ |
James Chapman | 342f023 | 2007-06-27 15:37:46 -0700 | [diff] [blame] | 350 | case UDP_ENCAP_L2TPINUDP: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | up->encap_type = val; |
| 352 | break; |
| 353 | default: |
| 354 | err = -ENOPROTOOPT; |
| 355 | break; |
| 356 | } |
| 357 | break; |
| 358 | |
YOSHIFUJI Hideaki | e898d4d | 2008-03-01 01:06:47 +0900 | [diff] [blame] | 359 | #ifdef CONFIG_IP_UDPLITE |
Gerrit Renker | ba4e58e | 2006-11-27 11:10:57 -0800 | [diff] [blame] | 360 | /* |
| 361 | * UDP-Lite's partial checksum coverage (RFC 3828). |
| 362 | */ |
| 363 | /* The sender sets actual checksum coverage length via this option. |
| 364 | * The case coverage > packet length is handled by send module. */ |
| 365 | case UDPLITE_SEND_CSCOV: |
Wang Chen | b2bf1e2 | 2007-12-03 22:34:16 +1100 | [diff] [blame] | 366 | if (!is_udplite) /* Disable the option on UDP sockets */ |
Gerrit Renker | ba4e58e | 2006-11-27 11:10:57 -0800 | [diff] [blame] | 367 | return -ENOPROTOOPT; |
| 368 | if (val != 0 && val < 8) /* Illegal coverage: use default (8) */ |
| 369 | val = 8; |
| 370 | up->pcslen = val; |
| 371 | up->pcflag |= UDPLITE_SEND_CC; |
| 372 | break; |
| 373 | |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 374 | /* The receiver specifies a minimum checksum coverage value. To make |
| 375 | * sense, this should be set to at least 8 (as done below). If zero is |
Gerrit Renker | ba4e58e | 2006-11-27 11:10:57 -0800 | [diff] [blame] | 376 | * used, this again means full checksum coverage. */ |
| 377 | case UDPLITE_RECV_CSCOV: |
Wang Chen | b2bf1e2 | 2007-12-03 22:34:16 +1100 | [diff] [blame] | 378 | if (!is_udplite) /* Disable the option on UDP sockets */ |
Gerrit Renker | ba4e58e | 2006-11-27 11:10:57 -0800 | [diff] [blame] | 379 | return -ENOPROTOOPT; |
| 380 | if (val != 0 && val < 8) /* Avoid silly minimal values. */ |
| 381 | val = 8; |
| 382 | up->pcrlen = val; |
| 383 | up->pcflag |= UDPLITE_RECV_CC; |
| 384 | break; |
YOSHIFUJI Hideaki | e898d4d | 2008-03-01 01:06:47 +0900 | [diff] [blame] | 385 | #endif |
Gerrit Renker | ba4e58e | 2006-11-27 11:10:57 -0800 | [diff] [blame] | 386 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 387 | default: |
| 388 | err = -ENOPROTOOPT; |
| 389 | break; |
Stephen Hemminger | 6516c65 | 2007-03-08 20:41:55 -0800 | [diff] [blame] | 390 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 391 | |
| 392 | return err; |
| 393 | } |
| 394 | |
Gerrit Renker | 4c0a6cb | 2006-11-27 09:29:59 -0800 | [diff] [blame] | 395 | int udp_lib_getsockopt(struct sock *sk, int level, int optname, |
| 396 | char __user *optval, int __user *optlen) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 397 | { |
| 398 | struct udp_sock *up = udp_sk(sk); |
| 399 | int val, len; |
| 400 | |
Stephen Hemminger | 6516c65 | 2007-03-08 20:41:55 -0800 | [diff] [blame] | 401 | if (get_user(len,optlen)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 402 | return -EFAULT; |
| 403 | |
| 404 | len = min_t(unsigned int, len, sizeof(int)); |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 405 | |
Stephen Hemminger | 6516c65 | 2007-03-08 20:41:55 -0800 | [diff] [blame] | 406 | if (len < 0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 407 | return -EINVAL; |
| 408 | |
Stephen Hemminger | 6516c65 | 2007-03-08 20:41:55 -0800 | [diff] [blame] | 409 | switch (optname) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 410 | case UDP_CORK: |
| 411 | val = up->corkflag; |
| 412 | break; |
| 413 | |
| 414 | case UDP_ENCAP: |
| 415 | val = up->encap_type; |
| 416 | break; |
| 417 | |
Gerrit Renker | ba4e58e | 2006-11-27 11:10:57 -0800 | [diff] [blame] | 418 | /* The following two cannot be changed on UDP sockets, the return is |
| 419 | * always 0 (which corresponds to the full checksum coverage of UDP). */ |
| 420 | case UDPLITE_SEND_CSCOV: |
| 421 | val = up->pcslen; |
| 422 | break; |
| 423 | |
| 424 | case UDPLITE_RECV_CSCOV: |
| 425 | val = up->pcrlen; |
| 426 | break; |
| 427 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 428 | default: |
| 429 | return -ENOPROTOOPT; |
Stephen Hemminger | 6516c65 | 2007-03-08 20:41:55 -0800 | [diff] [blame] | 430 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 431 | |
Stephen Hemminger | 6516c65 | 2007-03-08 20:41:55 -0800 | [diff] [blame] | 432 | if (put_user(len, optlen)) |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 433 | return -EFAULT; |
Stephen Hemminger | 6516c65 | 2007-03-08 20:41:55 -0800 | [diff] [blame] | 434 | if (copy_to_user(optval, &val,len)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 435 | return -EFAULT; |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 436 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 437 | } |
| 438 | |
| 439 | /** |
| 440 | * udp_poll - wait for a UDP event. |
| 441 | * @file - file struct |
| 442 | * @sock - socket |
| 443 | * @wait - poll table |
| 444 | * |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 445 | * This is same as datagram poll, except for the special case of |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | * blocking sockets. If application is using a blocking fd |
| 447 | * and a packet with checksum error is in the queue; |
| 448 | * then it could get return from select indicating data available |
| 449 | * but then block when reading it. Add special case code |
| 450 | * to work around these arguably broken applications. |
| 451 | */ |
| 452 | unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait) |
| 453 | { |
| 454 | unsigned int mask = datagram_poll(file, sock, wait); |
| 455 | struct sock *sk = sock->sk; |
Gerrit Renker | ba4e58e | 2006-11-27 11:10:57 -0800 | [diff] [blame] | 456 | int is_lite = IS_UDPLITE(sk); |
| 457 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 458 | /* Check for false positives due to checksum errors */ |
| 459 | if ( (mask & POLLRDNORM) && |
| 460 | !(file->f_flags & O_NONBLOCK) && |
| 461 | !(sk->sk_shutdown & RCV_SHUTDOWN)){ |
| 462 | struct sk_buff_head *rcvq = &sk->sk_receive_queue; |
| 463 | struct sk_buff *skb; |
| 464 | |
Herbert Xu | 208d898 | 2005-05-30 15:50:15 -0700 | [diff] [blame] | 465 | spin_lock_bh(&rcvq->lock); |
Herbert Xu | 759e5d0 | 2007-03-25 20:10:56 -0700 | [diff] [blame] | 466 | while ((skb = skb_peek(rcvq)) != NULL && |
| 467 | udp_lib_checksum_complete(skb)) { |
| 468 | UDP_INC_STATS_BH(UDP_MIB_INERRORS, is_lite); |
| 469 | __skb_unlink(skb, rcvq); |
| 470 | kfree_skb(skb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 471 | } |
Herbert Xu | 208d898 | 2005-05-30 15:50:15 -0700 | [diff] [blame] | 472 | spin_unlock_bh(&rcvq->lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | |
| 474 | /* nothing to see, move along */ |
| 475 | if (skb == NULL) |
| 476 | mask &= ~(POLLIN | POLLRDNORM); |
| 477 | } |
| 478 | |
| 479 | return mask; |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 480 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 | } |
| 482 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 483 | |
| 484 | /* ------------------------------------------------------------------------ */ |
| 485 | #ifdef CONFIG_PROC_FS |
| 486 | |
| 487 | static struct sock *udp_get_first(struct seq_file *seq) |
| 488 | { |
| 489 | struct sock *sk; |
| 490 | struct udp_iter_state *state = seq->private; |
| 491 | |
| 492 | for (state->bucket = 0; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) { |
| 493 | struct hlist_node *node; |
Gerrit Renker | ba4e58e | 2006-11-27 11:10:57 -0800 | [diff] [blame] | 494 | sk_for_each(sk, node, state->hashtable + state->bucket) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 495 | if (sk->sk_family == state->family) |
| 496 | goto found; |
| 497 | } |
| 498 | } |
| 499 | sk = NULL; |
| 500 | found: |
| 501 | return sk; |
| 502 | } |
| 503 | |
| 504 | static struct sock *udp_get_next(struct seq_file *seq, struct sock *sk) |
| 505 | { |
| 506 | struct udp_iter_state *state = seq->private; |
| 507 | |
| 508 | do { |
| 509 | sk = sk_next(sk); |
| 510 | try_again: |
| 511 | ; |
| 512 | } while (sk && sk->sk_family != state->family); |
| 513 | |
| 514 | if (!sk && ++state->bucket < UDP_HTABLE_SIZE) { |
Gerrit Renker | ba4e58e | 2006-11-27 11:10:57 -0800 | [diff] [blame] | 515 | sk = sk_head(state->hashtable + state->bucket); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 516 | goto try_again; |
| 517 | } |
| 518 | return sk; |
| 519 | } |
| 520 | |
| 521 | static struct sock *udp_get_idx(struct seq_file *seq, loff_t pos) |
| 522 | { |
| 523 | struct sock *sk = udp_get_first(seq); |
| 524 | |
| 525 | if (sk) |
Stephen Hemminger | 6516c65 | 2007-03-08 20:41:55 -0800 | [diff] [blame] | 526 | while (pos && (sk = udp_get_next(seq, sk)) != NULL) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 527 | --pos; |
| 528 | return pos ? NULL : sk; |
| 529 | } |
| 530 | |
| 531 | static void *udp_seq_start(struct seq_file *seq, loff_t *pos) |
Eric Dumazet | 9a429c4 | 2008-01-01 21:58:02 -0800 | [diff] [blame] | 532 | __acquires(udp_hash_lock) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 533 | { |
| 534 | read_lock(&udp_hash_lock); |
| 535 | return *pos ? udp_get_idx(seq, *pos-1) : (void *)1; |
| 536 | } |
| 537 | |
| 538 | static void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
| 539 | { |
| 540 | struct sock *sk; |
| 541 | |
| 542 | if (v == (void *)1) |
| 543 | sk = udp_get_idx(seq, 0); |
| 544 | else |
| 545 | sk = udp_get_next(seq, v); |
| 546 | |
| 547 | ++*pos; |
| 548 | return sk; |
| 549 | } |
| 550 | |
| 551 | static void udp_seq_stop(struct seq_file *seq, void *v) |
Eric Dumazet | 9a429c4 | 2008-01-01 21:58:02 -0800 | [diff] [blame] | 552 | __releases(udp_hash_lock) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 553 | { |
| 554 | read_unlock(&udp_hash_lock); |
| 555 | } |
| 556 | |
| 557 | static int udp_seq_open(struct inode *inode, struct file *file) |
| 558 | { |
| 559 | struct udp_seq_afinfo *afinfo = PDE(inode)->data; |
| 560 | struct seq_file *seq; |
| 561 | int rc = -ENOMEM; |
Panagiotis Issaris | 0da974f | 2006-07-21 14:51:30 -0700 | [diff] [blame] | 562 | struct udp_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 563 | |
| 564 | if (!s) |
| 565 | goto out; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 566 | s->family = afinfo->family; |
Gerrit Renker | ba4e58e | 2006-11-27 11:10:57 -0800 | [diff] [blame] | 567 | s->hashtable = afinfo->hashtable; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 568 | s->seq_ops.start = udp_seq_start; |
| 569 | s->seq_ops.next = udp_seq_next; |
| 570 | s->seq_ops.show = afinfo->seq_show; |
| 571 | s->seq_ops.stop = udp_seq_stop; |
| 572 | |
| 573 | rc = seq_open(file, &s->seq_ops); |
| 574 | if (rc) |
| 575 | goto out_kfree; |
| 576 | |
| 577 | seq = file->private_data; |
| 578 | seq->private = s; |
| 579 | out: |
| 580 | return rc; |
| 581 | out_kfree: |
| 582 | kfree(s); |
| 583 | goto out; |
| 584 | } |
| 585 | |
| 586 | /* ------------------------------------------------------------------------ */ |
| 587 | int udp_proc_register(struct udp_seq_afinfo *afinfo) |
| 588 | { |
| 589 | struct proc_dir_entry *p; |
| 590 | int rc = 0; |
| 591 | |
| 592 | if (!afinfo) |
| 593 | return -EINVAL; |
| 594 | afinfo->seq_fops->owner = afinfo->owner; |
| 595 | afinfo->seq_fops->open = udp_seq_open; |
| 596 | afinfo->seq_fops->read = seq_read; |
| 597 | afinfo->seq_fops->llseek = seq_lseek; |
| 598 | afinfo->seq_fops->release = seq_release_private; |
| 599 | |
Eric W. Biederman | 457c4cb | 2007-09-12 12:01:34 +0200 | [diff] [blame] | 600 | p = proc_net_fops_create(&init_net, afinfo->name, S_IRUGO, afinfo->seq_fops); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 601 | if (p) |
| 602 | p->data = afinfo; |
| 603 | else |
| 604 | rc = -ENOMEM; |
| 605 | return rc; |
| 606 | } |
| 607 | |
| 608 | void udp_proc_unregister(struct udp_seq_afinfo *afinfo) |
| 609 | { |
| 610 | if (!afinfo) |
| 611 | return; |
Eric W. Biederman | 457c4cb | 2007-09-12 12:01:34 +0200 | [diff] [blame] | 612 | proc_net_remove(&init_net, afinfo->name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 613 | memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops)); |
| 614 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 615 | #endif /* CONFIG_PROC_FS */ |
| 616 | |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 617 | void __init udp_init(void) |
| 618 | { |
| 619 | unsigned long limit; |
| 620 | |
| 621 | /* Set the pressure threshold up by the same strategy of TCP. It is a |
| 622 | * fraction of global memory that is up to 1/2 at 256 MB, decreasing |
| 623 | * toward zero with the amount of memory, with a floor of 128 pages. |
| 624 | */ |
| 625 | limit = min(nr_all_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT); |
| 626 | limit = (limit * (nr_all_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11); |
| 627 | limit = max(limit, 128UL); |
| 628 | sysctl_udp_mem[0] = limit / 4 * 3; |
| 629 | sysctl_udp_mem[1] = limit; |
| 630 | sysctl_udp_mem[2] = sysctl_udp_mem[0] * 2; |
| 631 | |
| 632 | sysctl_udp_rmem_min = SK_MEM_QUANTUM; |
| 633 | sysctl_udp_wmem_min = SK_MEM_QUANTUM; |
| 634 | } |
| 635 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 636 | EXPORT_SYMBOL(udp_disconnect); |
| 637 | EXPORT_SYMBOL(udp_hash); |
| 638 | EXPORT_SYMBOL(udp_hash_lock); |
| 639 | EXPORT_SYMBOL(udp_ioctl); |
Gerrit Renker | 25030a7 | 2006-08-26 20:06:05 -0700 | [diff] [blame] | 640 | EXPORT_SYMBOL(udp_get_port); |
Gerrit Renker | 4c0a6cb | 2006-11-27 09:29:59 -0800 | [diff] [blame] | 641 | EXPORT_SYMBOL(udp_lib_getsockopt); |
| 642 | EXPORT_SYMBOL(udp_lib_setsockopt); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 643 | EXPORT_SYMBOL(udp_poll); |
| 644 | |
| 645 | #ifdef CONFIG_PROC_FS |
| 646 | EXPORT_SYMBOL(udp_proc_register); |
| 647 | EXPORT_SYMBOL(udp_proc_unregister); |
| 648 | #endif |