diff options
Diffstat (limited to 'net/core/sock.c')
-rw-r--r-- | net/core/sock.c | 135 |
1 files changed, 72 insertions, 63 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 7dbf3ffb35cc..06e26b77ad9e 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -155,6 +155,7 @@ static const char *af_family_key_strings[AF_MAX+1] = { | |||
155 | "sk_lock-27" , "sk_lock-28" , "sk_lock-AF_CAN" , | 155 | "sk_lock-27" , "sk_lock-28" , "sk_lock-AF_CAN" , |
156 | "sk_lock-AF_TIPC" , "sk_lock-AF_BLUETOOTH", "sk_lock-IUCV" , | 156 | "sk_lock-AF_TIPC" , "sk_lock-AF_BLUETOOTH", "sk_lock-IUCV" , |
157 | "sk_lock-AF_RXRPC" , "sk_lock-AF_ISDN" , "sk_lock-AF_PHONET" , | 157 | "sk_lock-AF_RXRPC" , "sk_lock-AF_ISDN" , "sk_lock-AF_PHONET" , |
158 | "sk_lock-AF_IEEE802154", | ||
158 | "sk_lock-AF_MAX" | 159 | "sk_lock-AF_MAX" |
159 | }; | 160 | }; |
160 | static const char *af_family_slock_key_strings[AF_MAX+1] = { | 161 | static const char *af_family_slock_key_strings[AF_MAX+1] = { |
@@ -170,6 +171,7 @@ static const char *af_family_slock_key_strings[AF_MAX+1] = { | |||
170 | "slock-27" , "slock-28" , "slock-AF_CAN" , | 171 | "slock-27" , "slock-28" , "slock-AF_CAN" , |
171 | "slock-AF_TIPC" , "slock-AF_BLUETOOTH", "slock-AF_IUCV" , | 172 | "slock-AF_TIPC" , "slock-AF_BLUETOOTH", "slock-AF_IUCV" , |
172 | "slock-AF_RXRPC" , "slock-AF_ISDN" , "slock-AF_PHONET" , | 173 | "slock-AF_RXRPC" , "slock-AF_ISDN" , "slock-AF_PHONET" , |
174 | "slock-AF_IEEE802154", | ||
173 | "slock-AF_MAX" | 175 | "slock-AF_MAX" |
174 | }; | 176 | }; |
175 | static const char *af_family_clock_key_strings[AF_MAX+1] = { | 177 | static const char *af_family_clock_key_strings[AF_MAX+1] = { |
@@ -185,6 +187,7 @@ static const char *af_family_clock_key_strings[AF_MAX+1] = { | |||
185 | "clock-27" , "clock-28" , "clock-AF_CAN" , | 187 | "clock-27" , "clock-28" , "clock-AF_CAN" , |
186 | "clock-AF_TIPC" , "clock-AF_BLUETOOTH", "clock-AF_IUCV" , | 188 | "clock-AF_TIPC" , "clock-AF_BLUETOOTH", "clock-AF_IUCV" , |
187 | "clock-AF_RXRPC" , "clock-AF_ISDN" , "clock-AF_PHONET" , | 189 | "clock-AF_RXRPC" , "clock-AF_ISDN" , "clock-AF_PHONET" , |
190 | "clock-AF_IEEE802154", | ||
188 | "clock-AF_MAX" | 191 | "clock-AF_MAX" |
189 | }; | 192 | }; |
190 | 193 | ||
@@ -212,6 +215,7 @@ __u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX; | |||
212 | 215 | ||
213 | /* Maximal space eaten by iovec or ancilliary data plus some space */ | 216 | /* Maximal space eaten by iovec or ancilliary data plus some space */ |
214 | int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512); | 217 | int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512); |
218 | EXPORT_SYMBOL(sysctl_optmem_max); | ||
215 | 219 | ||
216 | static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen) | 220 | static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen) |
217 | { | 221 | { |
@@ -444,7 +448,7 @@ static inline void sock_valbool_flag(struct sock *sk, int bit, int valbool) | |||
444 | int sock_setsockopt(struct socket *sock, int level, int optname, | 448 | int sock_setsockopt(struct socket *sock, int level, int optname, |
445 | char __user *optval, int optlen) | 449 | char __user *optval, int optlen) |
446 | { | 450 | { |
447 | struct sock *sk=sock->sk; | 451 | struct sock *sk = sock->sk; |
448 | int val; | 452 | int val; |
449 | int valbool; | 453 | int valbool; |
450 | struct linger ling; | 454 | struct linger ling; |
@@ -463,15 +467,15 @@ int sock_setsockopt(struct socket *sock, int level, int optname, | |||
463 | if (get_user(val, (int __user *)optval)) | 467 | if (get_user(val, (int __user *)optval)) |
464 | return -EFAULT; | 468 | return -EFAULT; |
465 | 469 | ||
466 | valbool = val?1:0; | 470 | valbool = val ? 1 : 0; |
467 | 471 | ||
468 | lock_sock(sk); | 472 | lock_sock(sk); |
469 | 473 | ||
470 | switch(optname) { | 474 | switch (optname) { |
471 | case SO_DEBUG: | 475 | case SO_DEBUG: |
472 | if (val && !capable(CAP_NET_ADMIN)) { | 476 | if (val && !capable(CAP_NET_ADMIN)) |
473 | ret = -EACCES; | 477 | ret = -EACCES; |
474 | } else | 478 | else |
475 | sock_valbool_flag(sk, SOCK_DBG, valbool); | 479 | sock_valbool_flag(sk, SOCK_DBG, valbool); |
476 | break; | 480 | break; |
477 | case SO_REUSEADDR: | 481 | case SO_REUSEADDR: |
@@ -582,7 +586,7 @@ set_rcvbuf: | |||
582 | ret = -EINVAL; /* 1003.1g */ | 586 | ret = -EINVAL; /* 1003.1g */ |
583 | break; | 587 | break; |
584 | } | 588 | } |
585 | if (copy_from_user(&ling,optval,sizeof(ling))) { | 589 | if (copy_from_user(&ling, optval, sizeof(ling))) { |
586 | ret = -EFAULT; | 590 | ret = -EFAULT; |
587 | break; | 591 | break; |
588 | } | 592 | } |
@@ -690,9 +694,8 @@ set_rcvbuf: | |||
690 | case SO_MARK: | 694 | case SO_MARK: |
691 | if (!capable(CAP_NET_ADMIN)) | 695 | if (!capable(CAP_NET_ADMIN)) |
692 | ret = -EPERM; | 696 | ret = -EPERM; |
693 | else { | 697 | else |
694 | sk->sk_mark = val; | 698 | sk->sk_mark = val; |
695 | } | ||
696 | break; | 699 | break; |
697 | 700 | ||
698 | /* We implement the SO_SNDLOWAT etc to | 701 | /* We implement the SO_SNDLOWAT etc to |
@@ -704,6 +707,7 @@ set_rcvbuf: | |||
704 | release_sock(sk); | 707 | release_sock(sk); |
705 | return ret; | 708 | return ret; |
706 | } | 709 | } |
710 | EXPORT_SYMBOL(sock_setsockopt); | ||
707 | 711 | ||
708 | 712 | ||
709 | int sock_getsockopt(struct socket *sock, int level, int optname, | 713 | int sock_getsockopt(struct socket *sock, int level, int optname, |
@@ -727,7 +731,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
727 | 731 | ||
728 | memset(&v, 0, sizeof(v)); | 732 | memset(&v, 0, sizeof(v)); |
729 | 733 | ||
730 | switch(optname) { | 734 | switch (optname) { |
731 | case SO_DEBUG: | 735 | case SO_DEBUG: |
732 | v.val = sock_flag(sk, SOCK_DBG); | 736 | v.val = sock_flag(sk, SOCK_DBG); |
733 | break; | 737 | break; |
@@ -762,7 +766,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
762 | 766 | ||
763 | case SO_ERROR: | 767 | case SO_ERROR: |
764 | v.val = -sock_error(sk); | 768 | v.val = -sock_error(sk); |
765 | if (v.val==0) | 769 | if (v.val == 0) |
766 | v.val = xchg(&sk->sk_err_soft, 0); | 770 | v.val = xchg(&sk->sk_err_soft, 0); |
767 | break; | 771 | break; |
768 | 772 | ||
@@ -816,7 +820,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
816 | break; | 820 | break; |
817 | 821 | ||
818 | case SO_RCVTIMEO: | 822 | case SO_RCVTIMEO: |
819 | lv=sizeof(struct timeval); | 823 | lv = sizeof(struct timeval); |
820 | if (sk->sk_rcvtimeo == MAX_SCHEDULE_TIMEOUT) { | 824 | if (sk->sk_rcvtimeo == MAX_SCHEDULE_TIMEOUT) { |
821 | v.tm.tv_sec = 0; | 825 | v.tm.tv_sec = 0; |
822 | v.tm.tv_usec = 0; | 826 | v.tm.tv_usec = 0; |
@@ -827,7 +831,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
827 | break; | 831 | break; |
828 | 832 | ||
829 | case SO_SNDTIMEO: | 833 | case SO_SNDTIMEO: |
830 | lv=sizeof(struct timeval); | 834 | lv = sizeof(struct timeval); |
831 | if (sk->sk_sndtimeo == MAX_SCHEDULE_TIMEOUT) { | 835 | if (sk->sk_sndtimeo == MAX_SCHEDULE_TIMEOUT) { |
832 | v.tm.tv_sec = 0; | 836 | v.tm.tv_sec = 0; |
833 | v.tm.tv_usec = 0; | 837 | v.tm.tv_usec = 0; |
@@ -842,7 +846,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
842 | break; | 846 | break; |
843 | 847 | ||
844 | case SO_SNDLOWAT: | 848 | case SO_SNDLOWAT: |
845 | v.val=1; | 849 | v.val = 1; |
846 | break; | 850 | break; |
847 | 851 | ||
848 | case SO_PASSCRED: | 852 | case SO_PASSCRED: |
@@ -1002,8 +1006,9 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority, | |||
1002 | 1006 | ||
1003 | return sk; | 1007 | return sk; |
1004 | } | 1008 | } |
1009 | EXPORT_SYMBOL(sk_alloc); | ||
1005 | 1010 | ||
1006 | void sk_free(struct sock *sk) | 1011 | static void __sk_free(struct sock *sk) |
1007 | { | 1012 | { |
1008 | struct sk_filter *filter; | 1013 | struct sk_filter *filter; |
1009 | 1014 | ||
@@ -1027,6 +1032,18 @@ void sk_free(struct sock *sk) | |||
1027 | sk_prot_free(sk->sk_prot_creator, sk); | 1032 | sk_prot_free(sk->sk_prot_creator, sk); |
1028 | } | 1033 | } |
1029 | 1034 | ||
1035 | void sk_free(struct sock *sk) | ||
1036 | { | ||
1037 | /* | ||
1038 | * We substract one from sk_wmem_alloc and can know if | ||
1039 | * some packets are still in some tx queue. | ||
1040 | * If not null, sock_wfree() will call __sk_free(sk) later | ||
1041 | */ | ||
1042 | if (atomic_dec_and_test(&sk->sk_wmem_alloc)) | ||
1043 | __sk_free(sk); | ||
1044 | } | ||
1045 | EXPORT_SYMBOL(sk_free); | ||
1046 | |||
1030 | /* | 1047 | /* |
1031 | * Last sock_put should drop referrence to sk->sk_net. It has already | 1048 | * Last sock_put should drop referrence to sk->sk_net. It has already |
1032 | * been dropped in sk_change_net. Taking referrence to stopping namespace | 1049 | * been dropped in sk_change_net. Taking referrence to stopping namespace |
@@ -1065,7 +1082,10 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority) | |||
1065 | newsk->sk_backlog.head = newsk->sk_backlog.tail = NULL; | 1082 | newsk->sk_backlog.head = newsk->sk_backlog.tail = NULL; |
1066 | 1083 | ||
1067 | atomic_set(&newsk->sk_rmem_alloc, 0); | 1084 | atomic_set(&newsk->sk_rmem_alloc, 0); |
1068 | atomic_set(&newsk->sk_wmem_alloc, 0); | 1085 | /* |
1086 | * sk_wmem_alloc set to one (see sk_free() and sock_wfree()) | ||
1087 | */ | ||
1088 | atomic_set(&newsk->sk_wmem_alloc, 1); | ||
1069 | atomic_set(&newsk->sk_omem_alloc, 0); | 1089 | atomic_set(&newsk->sk_omem_alloc, 0); |
1070 | skb_queue_head_init(&newsk->sk_receive_queue); | 1090 | skb_queue_head_init(&newsk->sk_receive_queue); |
1071 | skb_queue_head_init(&newsk->sk_write_queue); | 1091 | skb_queue_head_init(&newsk->sk_write_queue); |
@@ -1126,7 +1146,6 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority) | |||
1126 | out: | 1146 | out: |
1127 | return newsk; | 1147 | return newsk; |
1128 | } | 1148 | } |
1129 | |||
1130 | EXPORT_SYMBOL_GPL(sk_clone); | 1149 | EXPORT_SYMBOL_GPL(sk_clone); |
1131 | 1150 | ||
1132 | void sk_setup_caps(struct sock *sk, struct dst_entry *dst) | 1151 | void sk_setup_caps(struct sock *sk, struct dst_entry *dst) |
@@ -1170,13 +1189,20 @@ void __init sk_init(void) | |||
1170 | void sock_wfree(struct sk_buff *skb) | 1189 | void sock_wfree(struct sk_buff *skb) |
1171 | { | 1190 | { |
1172 | struct sock *sk = skb->sk; | 1191 | struct sock *sk = skb->sk; |
1192 | int res; | ||
1173 | 1193 | ||
1174 | /* In case it might be waiting for more memory. */ | 1194 | /* In case it might be waiting for more memory. */ |
1175 | atomic_sub(skb->truesize, &sk->sk_wmem_alloc); | 1195 | res = atomic_sub_return(skb->truesize, &sk->sk_wmem_alloc); |
1176 | if (!sock_flag(sk, SOCK_USE_WRITE_QUEUE)) | 1196 | if (!sock_flag(sk, SOCK_USE_WRITE_QUEUE)) |
1177 | sk->sk_write_space(sk); | 1197 | sk->sk_write_space(sk); |
1178 | sock_put(sk); | 1198 | /* |
1199 | * if sk_wmem_alloc reached 0, we are last user and should | ||
1200 | * free this sock, as sk_free() call could not do it. | ||
1201 | */ | ||
1202 | if (res == 0) | ||
1203 | __sk_free(sk); | ||
1179 | } | 1204 | } |
1205 | EXPORT_SYMBOL(sock_wfree); | ||
1180 | 1206 | ||
1181 | /* | 1207 | /* |
1182 | * Read buffer destructor automatically called from kfree_skb. | 1208 | * Read buffer destructor automatically called from kfree_skb. |
@@ -1188,6 +1214,7 @@ void sock_rfree(struct sk_buff *skb) | |||
1188 | atomic_sub(skb->truesize, &sk->sk_rmem_alloc); | 1214 | atomic_sub(skb->truesize, &sk->sk_rmem_alloc); |
1189 | sk_mem_uncharge(skb->sk, skb->truesize); | 1215 | sk_mem_uncharge(skb->sk, skb->truesize); |
1190 | } | 1216 | } |
1217 | EXPORT_SYMBOL(sock_rfree); | ||
1191 | 1218 | ||
1192 | 1219 | ||
1193 | int sock_i_uid(struct sock *sk) | 1220 | int sock_i_uid(struct sock *sk) |
@@ -1199,6 +1226,7 @@ int sock_i_uid(struct sock *sk) | |||
1199 | read_unlock(&sk->sk_callback_lock); | 1226 | read_unlock(&sk->sk_callback_lock); |
1200 | return uid; | 1227 | return uid; |
1201 | } | 1228 | } |
1229 | EXPORT_SYMBOL(sock_i_uid); | ||
1202 | 1230 | ||
1203 | unsigned long sock_i_ino(struct sock *sk) | 1231 | unsigned long sock_i_ino(struct sock *sk) |
1204 | { | 1232 | { |
@@ -1209,6 +1237,7 @@ unsigned long sock_i_ino(struct sock *sk) | |||
1209 | read_unlock(&sk->sk_callback_lock); | 1237 | read_unlock(&sk->sk_callback_lock); |
1210 | return ino; | 1238 | return ino; |
1211 | } | 1239 | } |
1240 | EXPORT_SYMBOL(sock_i_ino); | ||
1212 | 1241 | ||
1213 | /* | 1242 | /* |
1214 | * Allocate a skb from the socket's send buffer. | 1243 | * Allocate a skb from the socket's send buffer. |
@@ -1217,7 +1246,7 @@ struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force, | |||
1217 | gfp_t priority) | 1246 | gfp_t priority) |
1218 | { | 1247 | { |
1219 | if (force || atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) { | 1248 | if (force || atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) { |
1220 | struct sk_buff * skb = alloc_skb(size, priority); | 1249 | struct sk_buff *skb = alloc_skb(size, priority); |
1221 | if (skb) { | 1250 | if (skb) { |
1222 | skb_set_owner_w(skb, sk); | 1251 | skb_set_owner_w(skb, sk); |
1223 | return skb; | 1252 | return skb; |
@@ -1225,6 +1254,7 @@ struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force, | |||
1225 | } | 1254 | } |
1226 | return NULL; | 1255 | return NULL; |
1227 | } | 1256 | } |
1257 | EXPORT_SYMBOL(sock_wmalloc); | ||
1228 | 1258 | ||
1229 | /* | 1259 | /* |
1230 | * Allocate a skb from the socket's receive buffer. | 1260 | * Allocate a skb from the socket's receive buffer. |
@@ -1261,6 +1291,7 @@ void *sock_kmalloc(struct sock *sk, int size, gfp_t priority) | |||
1261 | } | 1291 | } |
1262 | return NULL; | 1292 | return NULL; |
1263 | } | 1293 | } |
1294 | EXPORT_SYMBOL(sock_kmalloc); | ||
1264 | 1295 | ||
1265 | /* | 1296 | /* |
1266 | * Free an option memory block. | 1297 | * Free an option memory block. |
@@ -1270,11 +1301,12 @@ void sock_kfree_s(struct sock *sk, void *mem, int size) | |||
1270 | kfree(mem); | 1301 | kfree(mem); |
1271 | atomic_sub(size, &sk->sk_omem_alloc); | 1302 | atomic_sub(size, &sk->sk_omem_alloc); |
1272 | } | 1303 | } |
1304 | EXPORT_SYMBOL(sock_kfree_s); | ||
1273 | 1305 | ||
1274 | /* It is almost wait_for_tcp_memory minus release_sock/lock_sock. | 1306 | /* It is almost wait_for_tcp_memory minus release_sock/lock_sock. |
1275 | I think, these locks should be removed for datagram sockets. | 1307 | I think, these locks should be removed for datagram sockets. |
1276 | */ | 1308 | */ |
1277 | static long sock_wait_for_wmem(struct sock * sk, long timeo) | 1309 | static long sock_wait_for_wmem(struct sock *sk, long timeo) |
1278 | { | 1310 | { |
1279 | DEFINE_WAIT(wait); | 1311 | DEFINE_WAIT(wait); |
1280 | 1312 | ||
@@ -1392,6 +1424,7 @@ struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size, | |||
1392 | { | 1424 | { |
1393 | return sock_alloc_send_pskb(sk, size, 0, noblock, errcode); | 1425 | return sock_alloc_send_pskb(sk, size, 0, noblock, errcode); |
1394 | } | 1426 | } |
1427 | EXPORT_SYMBOL(sock_alloc_send_skb); | ||
1395 | 1428 | ||
1396 | static void __lock_sock(struct sock *sk) | 1429 | static void __lock_sock(struct sock *sk) |
1397 | { | 1430 | { |
@@ -1460,7 +1493,6 @@ int sk_wait_data(struct sock *sk, long *timeo) | |||
1460 | finish_wait(sk->sk_sleep, &wait); | 1493 | finish_wait(sk->sk_sleep, &wait); |
1461 | return rc; | 1494 | return rc; |
1462 | } | 1495 | } |
1463 | |||
1464 | EXPORT_SYMBOL(sk_wait_data); | 1496 | EXPORT_SYMBOL(sk_wait_data); |
1465 | 1497 | ||
1466 | /** | 1498 | /** |
@@ -1541,7 +1573,6 @@ suppress_allocation: | |||
1541 | atomic_sub(amt, prot->memory_allocated); | 1573 | atomic_sub(amt, prot->memory_allocated); |
1542 | return 0; | 1574 | return 0; |
1543 | } | 1575 | } |
1544 | |||
1545 | EXPORT_SYMBOL(__sk_mem_schedule); | 1576 | EXPORT_SYMBOL(__sk_mem_schedule); |
1546 | 1577 | ||
1547 | /** | 1578 | /** |
@@ -1560,7 +1591,6 @@ void __sk_mem_reclaim(struct sock *sk) | |||
1560 | (atomic_read(prot->memory_allocated) < prot->sysctl_mem[0])) | 1591 | (atomic_read(prot->memory_allocated) < prot->sysctl_mem[0])) |
1561 | *prot->memory_pressure = 0; | 1592 | *prot->memory_pressure = 0; |
1562 | } | 1593 | } |
1563 | |||
1564 | EXPORT_SYMBOL(__sk_mem_reclaim); | 1594 | EXPORT_SYMBOL(__sk_mem_reclaim); |
1565 | 1595 | ||
1566 | 1596 | ||
@@ -1575,78 +1605,92 @@ int sock_no_bind(struct socket *sock, struct sockaddr *saddr, int len) | |||
1575 | { | 1605 | { |
1576 | return -EOPNOTSUPP; | 1606 | return -EOPNOTSUPP; |
1577 | } | 1607 | } |
1608 | EXPORT_SYMBOL(sock_no_bind); | ||
1578 | 1609 | ||
1579 | int sock_no_connect(struct socket *sock, struct sockaddr *saddr, | 1610 | int sock_no_connect(struct socket *sock, struct sockaddr *saddr, |
1580 | int len, int flags) | 1611 | int len, int flags) |
1581 | { | 1612 | { |
1582 | return -EOPNOTSUPP; | 1613 | return -EOPNOTSUPP; |
1583 | } | 1614 | } |
1615 | EXPORT_SYMBOL(sock_no_connect); | ||
1584 | 1616 | ||
1585 | int sock_no_socketpair(struct socket *sock1, struct socket *sock2) | 1617 | int sock_no_socketpair(struct socket *sock1, struct socket *sock2) |
1586 | { | 1618 | { |
1587 | return -EOPNOTSUPP; | 1619 | return -EOPNOTSUPP; |
1588 | } | 1620 | } |
1621 | EXPORT_SYMBOL(sock_no_socketpair); | ||
1589 | 1622 | ||
1590 | int sock_no_accept(struct socket *sock, struct socket *newsock, int flags) | 1623 | int sock_no_accept(struct socket *sock, struct socket *newsock, int flags) |
1591 | { | 1624 | { |
1592 | return -EOPNOTSUPP; | 1625 | return -EOPNOTSUPP; |
1593 | } | 1626 | } |
1627 | EXPORT_SYMBOL(sock_no_accept); | ||
1594 | 1628 | ||
1595 | int sock_no_getname(struct socket *sock, struct sockaddr *saddr, | 1629 | int sock_no_getname(struct socket *sock, struct sockaddr *saddr, |
1596 | int *len, int peer) | 1630 | int *len, int peer) |
1597 | { | 1631 | { |
1598 | return -EOPNOTSUPP; | 1632 | return -EOPNOTSUPP; |
1599 | } | 1633 | } |
1634 | EXPORT_SYMBOL(sock_no_getname); | ||
1600 | 1635 | ||
1601 | unsigned int sock_no_poll(struct file * file, struct socket *sock, poll_table *pt) | 1636 | unsigned int sock_no_poll(struct file *file, struct socket *sock, poll_table *pt) |
1602 | { | 1637 | { |
1603 | return 0; | 1638 | return 0; |
1604 | } | 1639 | } |
1640 | EXPORT_SYMBOL(sock_no_poll); | ||
1605 | 1641 | ||
1606 | int sock_no_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | 1642 | int sock_no_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) |
1607 | { | 1643 | { |
1608 | return -EOPNOTSUPP; | 1644 | return -EOPNOTSUPP; |
1609 | } | 1645 | } |
1646 | EXPORT_SYMBOL(sock_no_ioctl); | ||
1610 | 1647 | ||
1611 | int sock_no_listen(struct socket *sock, int backlog) | 1648 | int sock_no_listen(struct socket *sock, int backlog) |
1612 | { | 1649 | { |
1613 | return -EOPNOTSUPP; | 1650 | return -EOPNOTSUPP; |
1614 | } | 1651 | } |
1652 | EXPORT_SYMBOL(sock_no_listen); | ||
1615 | 1653 | ||
1616 | int sock_no_shutdown(struct socket *sock, int how) | 1654 | int sock_no_shutdown(struct socket *sock, int how) |
1617 | { | 1655 | { |
1618 | return -EOPNOTSUPP; | 1656 | return -EOPNOTSUPP; |
1619 | } | 1657 | } |
1658 | EXPORT_SYMBOL(sock_no_shutdown); | ||
1620 | 1659 | ||
1621 | int sock_no_setsockopt(struct socket *sock, int level, int optname, | 1660 | int sock_no_setsockopt(struct socket *sock, int level, int optname, |
1622 | char __user *optval, int optlen) | 1661 | char __user *optval, int optlen) |
1623 | { | 1662 | { |
1624 | return -EOPNOTSUPP; | 1663 | return -EOPNOTSUPP; |
1625 | } | 1664 | } |
1665 | EXPORT_SYMBOL(sock_no_setsockopt); | ||
1626 | 1666 | ||
1627 | int sock_no_getsockopt(struct socket *sock, int level, int optname, | 1667 | int sock_no_getsockopt(struct socket *sock, int level, int optname, |
1628 | char __user *optval, int __user *optlen) | 1668 | char __user *optval, int __user *optlen) |
1629 | { | 1669 | { |
1630 | return -EOPNOTSUPP; | 1670 | return -EOPNOTSUPP; |
1631 | } | 1671 | } |
1672 | EXPORT_SYMBOL(sock_no_getsockopt); | ||
1632 | 1673 | ||
1633 | int sock_no_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, | 1674 | int sock_no_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, |
1634 | size_t len) | 1675 | size_t len) |
1635 | { | 1676 | { |
1636 | return -EOPNOTSUPP; | 1677 | return -EOPNOTSUPP; |
1637 | } | 1678 | } |
1679 | EXPORT_SYMBOL(sock_no_sendmsg); | ||
1638 | 1680 | ||
1639 | int sock_no_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, | 1681 | int sock_no_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, |
1640 | size_t len, int flags) | 1682 | size_t len, int flags) |
1641 | { | 1683 | { |
1642 | return -EOPNOTSUPP; | 1684 | return -EOPNOTSUPP; |
1643 | } | 1685 | } |
1686 | EXPORT_SYMBOL(sock_no_recvmsg); | ||
1644 | 1687 | ||
1645 | int sock_no_mmap(struct file *file, struct socket *sock, struct vm_area_struct *vma) | 1688 | int sock_no_mmap(struct file *file, struct socket *sock, struct vm_area_struct *vma) |
1646 | { | 1689 | { |
1647 | /* Mirror missing mmap method error code */ | 1690 | /* Mirror missing mmap method error code */ |
1648 | return -ENODEV; | 1691 | return -ENODEV; |
1649 | } | 1692 | } |
1693 | EXPORT_SYMBOL(sock_no_mmap); | ||
1650 | 1694 | ||
1651 | ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags) | 1695 | ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags) |
1652 | { | 1696 | { |
@@ -1660,6 +1704,7 @@ ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset, siz | |||
1660 | kunmap(page); | 1704 | kunmap(page); |
1661 | return res; | 1705 | return res; |
1662 | } | 1706 | } |
1707 | EXPORT_SYMBOL(sock_no_sendpage); | ||
1663 | 1708 | ||
1664 | /* | 1709 | /* |
1665 | * Default Socket Callbacks | 1710 | * Default Socket Callbacks |
@@ -1723,6 +1768,7 @@ void sk_send_sigurg(struct sock *sk) | |||
1723 | if (send_sigurg(&sk->sk_socket->file->f_owner)) | 1768 | if (send_sigurg(&sk->sk_socket->file->f_owner)) |
1724 | sk_wake_async(sk, SOCK_WAKE_URG, POLL_PRI); | 1769 | sk_wake_async(sk, SOCK_WAKE_URG, POLL_PRI); |
1725 | } | 1770 | } |
1771 | EXPORT_SYMBOL(sk_send_sigurg); | ||
1726 | 1772 | ||
1727 | void sk_reset_timer(struct sock *sk, struct timer_list* timer, | 1773 | void sk_reset_timer(struct sock *sk, struct timer_list* timer, |
1728 | unsigned long expires) | 1774 | unsigned long expires) |
@@ -1730,7 +1776,6 @@ void sk_reset_timer(struct sock *sk, struct timer_list* timer, | |||
1730 | if (!mod_timer(timer, expires)) | 1776 | if (!mod_timer(timer, expires)) |
1731 | sock_hold(sk); | 1777 | sock_hold(sk); |
1732 | } | 1778 | } |
1733 | |||
1734 | EXPORT_SYMBOL(sk_reset_timer); | 1779 | EXPORT_SYMBOL(sk_reset_timer); |
1735 | 1780 | ||
1736 | void sk_stop_timer(struct sock *sk, struct timer_list* timer) | 1781 | void sk_stop_timer(struct sock *sk, struct timer_list* timer) |
@@ -1738,7 +1783,6 @@ void sk_stop_timer(struct sock *sk, struct timer_list* timer) | |||
1738 | if (timer_pending(timer) && del_timer(timer)) | 1783 | if (timer_pending(timer) && del_timer(timer)) |
1739 | __sock_put(sk); | 1784 | __sock_put(sk); |
1740 | } | 1785 | } |
1741 | |||
1742 | EXPORT_SYMBOL(sk_stop_timer); | 1786 | EXPORT_SYMBOL(sk_stop_timer); |
1743 | 1787 | ||
1744 | void sock_init_data(struct socket *sock, struct sock *sk) | 1788 | void sock_init_data(struct socket *sock, struct sock *sk) |
@@ -1795,8 +1839,10 @@ void sock_init_data(struct socket *sock, struct sock *sk) | |||
1795 | sk->sk_stamp = ktime_set(-1L, 0); | 1839 | sk->sk_stamp = ktime_set(-1L, 0); |
1796 | 1840 | ||
1797 | atomic_set(&sk->sk_refcnt, 1); | 1841 | atomic_set(&sk->sk_refcnt, 1); |
1842 | atomic_set(&sk->sk_wmem_alloc, 1); | ||
1798 | atomic_set(&sk->sk_drops, 0); | 1843 | atomic_set(&sk->sk_drops, 0); |
1799 | } | 1844 | } |
1845 | EXPORT_SYMBOL(sock_init_data); | ||
1800 | 1846 | ||
1801 | void lock_sock_nested(struct sock *sk, int subclass) | 1847 | void lock_sock_nested(struct sock *sk, int subclass) |
1802 | { | 1848 | { |
@@ -1812,7 +1858,6 @@ void lock_sock_nested(struct sock *sk, int subclass) | |||
1812 | mutex_acquire(&sk->sk_lock.dep_map, subclass, 0, _RET_IP_); | 1858 | mutex_acquire(&sk->sk_lock.dep_map, subclass, 0, _RET_IP_); |
1813 | local_bh_enable(); | 1859 | local_bh_enable(); |
1814 | } | 1860 | } |
1815 | |||
1816 | EXPORT_SYMBOL(lock_sock_nested); | 1861 | EXPORT_SYMBOL(lock_sock_nested); |
1817 | 1862 | ||
1818 | void release_sock(struct sock *sk) | 1863 | void release_sock(struct sock *sk) |
@@ -1895,7 +1940,6 @@ int sock_common_getsockopt(struct socket *sock, int level, int optname, | |||
1895 | 1940 | ||
1896 | return sk->sk_prot->getsockopt(sk, level, optname, optval, optlen); | 1941 | return sk->sk_prot->getsockopt(sk, level, optname, optval, optlen); |
1897 | } | 1942 | } |
1898 | |||
1899 | EXPORT_SYMBOL(sock_common_getsockopt); | 1943 | EXPORT_SYMBOL(sock_common_getsockopt); |
1900 | 1944 | ||
1901 | #ifdef CONFIG_COMPAT | 1945 | #ifdef CONFIG_COMPAT |
@@ -1925,7 +1969,6 @@ int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1925 | msg->msg_namelen = addr_len; | 1969 | msg->msg_namelen = addr_len; |
1926 | return err; | 1970 | return err; |
1927 | } | 1971 | } |
1928 | |||
1929 | EXPORT_SYMBOL(sock_common_recvmsg); | 1972 | EXPORT_SYMBOL(sock_common_recvmsg); |
1930 | 1973 | ||
1931 | /* | 1974 | /* |
@@ -1938,7 +1981,6 @@ int sock_common_setsockopt(struct socket *sock, int level, int optname, | |||
1938 | 1981 | ||
1939 | return sk->sk_prot->setsockopt(sk, level, optname, optval, optlen); | 1982 | return sk->sk_prot->setsockopt(sk, level, optname, optval, optlen); |
1940 | } | 1983 | } |
1941 | |||
1942 | EXPORT_SYMBOL(sock_common_setsockopt); | 1984 | EXPORT_SYMBOL(sock_common_setsockopt); |
1943 | 1985 | ||
1944 | #ifdef CONFIG_COMPAT | 1986 | #ifdef CONFIG_COMPAT |
@@ -1989,7 +2031,6 @@ void sk_common_release(struct sock *sk) | |||
1989 | sk_refcnt_debug_release(sk); | 2031 | sk_refcnt_debug_release(sk); |
1990 | sock_put(sk); | 2032 | sock_put(sk); |
1991 | } | 2033 | } |
1992 | |||
1993 | EXPORT_SYMBOL(sk_common_release); | 2034 | EXPORT_SYMBOL(sk_common_release); |
1994 | 2035 | ||
1995 | static DEFINE_RWLOCK(proto_list_lock); | 2036 | static DEFINE_RWLOCK(proto_list_lock); |
@@ -2171,7 +2212,6 @@ out_free_sock_slab: | |||
2171 | out: | 2212 | out: |
2172 | return -ENOBUFS; | 2213 | return -ENOBUFS; |
2173 | } | 2214 | } |
2174 | |||
2175 | EXPORT_SYMBOL(proto_register); | 2215 | EXPORT_SYMBOL(proto_register); |
2176 | 2216 | ||
2177 | void proto_unregister(struct proto *prot) | 2217 | void proto_unregister(struct proto *prot) |
@@ -2198,7 +2238,6 @@ void proto_unregister(struct proto *prot) | |||
2198 | prot->twsk_prot->twsk_slab = NULL; | 2238 | prot->twsk_prot->twsk_slab = NULL; |
2199 | } | 2239 | } |
2200 | } | 2240 | } |
2201 | |||
2202 | EXPORT_SYMBOL(proto_unregister); | 2241 | EXPORT_SYMBOL(proto_unregister); |
2203 | 2242 | ||
2204 | #ifdef CONFIG_PROC_FS | 2243 | #ifdef CONFIG_PROC_FS |
@@ -2324,33 +2363,3 @@ static int __init proto_init(void) | |||
2324 | subsys_initcall(proto_init); | 2363 | subsys_initcall(proto_init); |
2325 | 2364 | ||
2326 | #endif /* PROC_FS */ | 2365 | #endif /* PROC_FS */ |
2327 | |||
2328 | EXPORT_SYMBOL(sk_alloc); | ||
2329 | EXPORT_SYMBOL(sk_free); | ||
2330 | EXPORT_SYMBOL(sk_send_sigurg); | ||
2331 | EXPORT_SYMBOL(sock_alloc_send_skb); | ||
2332 | EXPORT_SYMBOL(sock_init_data); | ||
2333 | EXPORT_SYMBOL(sock_kfree_s); | ||
2334 | EXPORT_SYMBOL(sock_kmalloc); | ||
2335 | EXPORT_SYMBOL(sock_no_accept); | ||
2336 | EXPORT_SYMBOL(sock_no_bind); | ||
2337 | EXPORT_SYMBOL(sock_no_connect); | ||
2338 | EXPORT_SYMBOL(sock_no_getname); | ||
2339 | EXPORT_SYMBOL(sock_no_getsockopt); | ||
2340 | EXPORT_SYMBOL(sock_no_ioctl); | ||
2341 | EXPORT_SYMBOL(sock_no_listen); | ||
2342 | EXPORT_SYMBOL(sock_no_mmap); | ||
2343 | EXPORT_SYMBOL(sock_no_poll); | ||
2344 | EXPORT_SYMBOL(sock_no_recvmsg); | ||
2345 | EXPORT_SYMBOL(sock_no_sendmsg); | ||
2346 | EXPORT_SYMBOL(sock_no_sendpage); | ||
2347 | EXPORT_SYMBOL(sock_no_setsockopt); | ||
2348 | EXPORT_SYMBOL(sock_no_shutdown); | ||
2349 | EXPORT_SYMBOL(sock_no_socketpair); | ||
2350 | EXPORT_SYMBOL(sock_rfree); | ||
2351 | EXPORT_SYMBOL(sock_setsockopt); | ||
2352 | EXPORT_SYMBOL(sock_wfree); | ||
2353 | EXPORT_SYMBOL(sock_wmalloc); | ||
2354 | EXPORT_SYMBOL(sock_i_uid); | ||
2355 | EXPORT_SYMBOL(sock_i_ino); | ||
2356 | EXPORT_SYMBOL(sysctl_optmem_max); | ||