diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-02-17 15:09:59 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-02-17 15:09:59 -0500 |
commit | 48c871c1f6a7c7044dd76774fb469e65c7e2e4e8 (patch) | |
tree | da3aa535c98cc0957851354ceb0fbff7482d7a9d /net/sunrpc/svcsock.c | |
parent | 1a1689344add3333d28d1b5495d8043a3877d01c (diff) | |
parent | 4409d28140d9a6e6e3f4f1fdaf7234c4b965d954 (diff) |
Merge branch 'gfar' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc into upstream
Diffstat (limited to 'net/sunrpc/svcsock.c')
-rw-r--r-- | net/sunrpc/svcsock.c | 355 |
1 files changed, 241 insertions, 114 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index cf93cd1d857b..63ae94771b8e 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -36,11 +36,13 @@ | |||
36 | #include <net/sock.h> | 36 | #include <net/sock.h> |
37 | #include <net/checksum.h> | 37 | #include <net/checksum.h> |
38 | #include <net/ip.h> | 38 | #include <net/ip.h> |
39 | #include <net/ipv6.h> | ||
39 | #include <net/tcp_states.h> | 40 | #include <net/tcp_states.h> |
40 | #include <asm/uaccess.h> | 41 | #include <asm/uaccess.h> |
41 | #include <asm/ioctls.h> | 42 | #include <asm/ioctls.h> |
42 | 43 | ||
43 | #include <linux/sunrpc/types.h> | 44 | #include <linux/sunrpc/types.h> |
45 | #include <linux/sunrpc/clnt.h> | ||
44 | #include <linux/sunrpc/xdr.h> | 46 | #include <linux/sunrpc/xdr.h> |
45 | #include <linux/sunrpc/svcsock.h> | 47 | #include <linux/sunrpc/svcsock.h> |
46 | #include <linux/sunrpc/stats.h> | 48 | #include <linux/sunrpc/stats.h> |
@@ -58,7 +60,7 @@ | |||
58 | * providing that certain rules are followed: | 60 | * providing that certain rules are followed: |
59 | * | 61 | * |
60 | * SK_CONN, SK_DATA, can be set or cleared at any time. | 62 | * SK_CONN, SK_DATA, can be set or cleared at any time. |
61 | * after a set, svc_sock_enqueue must be called. | 63 | * after a set, svc_sock_enqueue must be called. |
62 | * after a clear, the socket must be read/accepted | 64 | * after a clear, the socket must be read/accepted |
63 | * if this succeeds, it must be set again. | 65 | * if this succeeds, it must be set again. |
64 | * SK_CLOSE can set at any time. It is never cleared. | 66 | * SK_CLOSE can set at any time. It is never cleared. |
@@ -75,7 +77,7 @@ | |||
75 | 77 | ||
76 | 78 | ||
77 | static struct svc_sock *svc_setup_socket(struct svc_serv *, struct socket *, | 79 | static struct svc_sock *svc_setup_socket(struct svc_serv *, struct socket *, |
78 | int *errp, int pmap_reg); | 80 | int *errp, int flags); |
79 | static void svc_delete_socket(struct svc_sock *svsk); | 81 | static void svc_delete_socket(struct svc_sock *svsk); |
80 | static void svc_udp_data_ready(struct sock *, int); | 82 | static void svc_udp_data_ready(struct sock *, int); |
81 | static int svc_udp_recvfrom(struct svc_rqst *); | 83 | static int svc_udp_recvfrom(struct svc_rqst *); |
@@ -121,6 +123,41 @@ static inline void svc_reclassify_socket(struct socket *sock) | |||
121 | } | 123 | } |
122 | #endif | 124 | #endif |
123 | 125 | ||
126 | static char *__svc_print_addr(struct sockaddr *addr, char *buf, size_t len) | ||
127 | { | ||
128 | switch (addr->sa_family) { | ||
129 | case AF_INET: | ||
130 | snprintf(buf, len, "%u.%u.%u.%u, port=%u", | ||
131 | NIPQUAD(((struct sockaddr_in *) addr)->sin_addr), | ||
132 | htons(((struct sockaddr_in *) addr)->sin_port)); | ||
133 | break; | ||
134 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
135 | case AF_INET6: | ||
136 | snprintf(buf, len, "%x:%x:%x:%x:%x:%x:%x:%x, port=%u", | ||
137 | NIP6(((struct sockaddr_in6 *) addr)->sin6_addr), | ||
138 | htons(((struct sockaddr_in6 *) addr)->sin6_port)); | ||
139 | break; | ||
140 | #endif | ||
141 | default: | ||
142 | snprintf(buf, len, "unknown address type: %d", addr->sa_family); | ||
143 | break; | ||
144 | } | ||
145 | return buf; | ||
146 | } | ||
147 | |||
148 | /** | ||
149 | * svc_print_addr - Format rq_addr field for printing | ||
150 | * @rqstp: svc_rqst struct containing address to print | ||
151 | * @buf: target buffer for formatted address | ||
152 | * @len: length of target buffer | ||
153 | * | ||
154 | */ | ||
155 | char *svc_print_addr(struct svc_rqst *rqstp, char *buf, size_t len) | ||
156 | { | ||
157 | return __svc_print_addr(svc_addr(rqstp), buf, len); | ||
158 | } | ||
159 | EXPORT_SYMBOL_GPL(svc_print_addr); | ||
160 | |||
124 | /* | 161 | /* |
125 | * Queue up an idle server thread. Must have pool->sp_lock held. | 162 | * Queue up an idle server thread. Must have pool->sp_lock held. |
126 | * Note: this is really a stack rather than a queue, so that we only | 163 | * Note: this is really a stack rather than a queue, so that we only |
@@ -252,7 +289,7 @@ svc_sock_enqueue(struct svc_sock *svsk) | |||
252 | svsk->sk_sk, rqstp); | 289 | svsk->sk_sk, rqstp); |
253 | svc_thread_dequeue(pool, rqstp); | 290 | svc_thread_dequeue(pool, rqstp); |
254 | if (rqstp->rq_sock) | 291 | if (rqstp->rq_sock) |
255 | printk(KERN_ERR | 292 | printk(KERN_ERR |
256 | "svc_sock_enqueue: server %p, rq_sock=%p!\n", | 293 | "svc_sock_enqueue: server %p, rq_sock=%p!\n", |
257 | rqstp, rqstp->rq_sock); | 294 | rqstp, rqstp->rq_sock); |
258 | rqstp->rq_sock = svsk; | 295 | rqstp->rq_sock = svsk; |
@@ -410,6 +447,43 @@ svc_wake_up(struct svc_serv *serv) | |||
410 | } | 447 | } |
411 | } | 448 | } |
412 | 449 | ||
450 | union svc_pktinfo_u { | ||
451 | struct in_pktinfo pkti; | ||
452 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
453 | struct in6_pktinfo pkti6; | ||
454 | #endif | ||
455 | }; | ||
456 | |||
457 | static void svc_set_cmsg_data(struct svc_rqst *rqstp, struct cmsghdr *cmh) | ||
458 | { | ||
459 | switch (rqstp->rq_sock->sk_sk->sk_family) { | ||
460 | case AF_INET: { | ||
461 | struct in_pktinfo *pki = CMSG_DATA(cmh); | ||
462 | |||
463 | cmh->cmsg_level = SOL_IP; | ||
464 | cmh->cmsg_type = IP_PKTINFO; | ||
465 | pki->ipi_ifindex = 0; | ||
466 | pki->ipi_spec_dst.s_addr = rqstp->rq_daddr.addr.s_addr; | ||
467 | cmh->cmsg_len = CMSG_LEN(sizeof(*pki)); | ||
468 | } | ||
469 | break; | ||
470 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
471 | case AF_INET6: { | ||
472 | struct in6_pktinfo *pki = CMSG_DATA(cmh); | ||
473 | |||
474 | cmh->cmsg_level = SOL_IPV6; | ||
475 | cmh->cmsg_type = IPV6_PKTINFO; | ||
476 | pki->ipi6_ifindex = 0; | ||
477 | ipv6_addr_copy(&pki->ipi6_addr, | ||
478 | &rqstp->rq_daddr.addr6); | ||
479 | cmh->cmsg_len = CMSG_LEN(sizeof(*pki)); | ||
480 | } | ||
481 | break; | ||
482 | #endif | ||
483 | } | ||
484 | return; | ||
485 | } | ||
486 | |||
413 | /* | 487 | /* |
414 | * Generic sendto routine | 488 | * Generic sendto routine |
415 | */ | 489 | */ |
@@ -419,9 +493,8 @@ svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr) | |||
419 | struct svc_sock *svsk = rqstp->rq_sock; | 493 | struct svc_sock *svsk = rqstp->rq_sock; |
420 | struct socket *sock = svsk->sk_sock; | 494 | struct socket *sock = svsk->sk_sock; |
421 | int slen; | 495 | int slen; |
422 | char buffer[CMSG_SPACE(sizeof(struct in_pktinfo))]; | 496 | char buffer[CMSG_SPACE(sizeof(union svc_pktinfo_u))]; |
423 | struct cmsghdr *cmh = (struct cmsghdr *)buffer; | 497 | struct cmsghdr *cmh = (struct cmsghdr *)buffer; |
424 | struct in_pktinfo *pki = (struct in_pktinfo *)CMSG_DATA(cmh); | ||
425 | int len = 0; | 498 | int len = 0; |
426 | int result; | 499 | int result; |
427 | int size; | 500 | int size; |
@@ -429,25 +502,20 @@ svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr) | |||
429 | size_t base = xdr->page_base; | 502 | size_t base = xdr->page_base; |
430 | unsigned int pglen = xdr->page_len; | 503 | unsigned int pglen = xdr->page_len; |
431 | unsigned int flags = MSG_MORE; | 504 | unsigned int flags = MSG_MORE; |
505 | char buf[RPC_MAX_ADDRBUFLEN]; | ||
432 | 506 | ||
433 | slen = xdr->len; | 507 | slen = xdr->len; |
434 | 508 | ||
435 | if (rqstp->rq_prot == IPPROTO_UDP) { | 509 | if (rqstp->rq_prot == IPPROTO_UDP) { |
436 | /* set the source and destination */ | 510 | struct msghdr msg = { |
437 | struct msghdr msg; | 511 | .msg_name = &rqstp->rq_addr, |
438 | msg.msg_name = &rqstp->rq_addr; | 512 | .msg_namelen = rqstp->rq_addrlen, |
439 | msg.msg_namelen = sizeof(rqstp->rq_addr); | 513 | .msg_control = cmh, |
440 | msg.msg_iov = NULL; | 514 | .msg_controllen = sizeof(buffer), |
441 | msg.msg_iovlen = 0; | 515 | .msg_flags = MSG_MORE, |
442 | msg.msg_flags = MSG_MORE; | 516 | }; |
443 | 517 | ||
444 | msg.msg_control = cmh; | 518 | svc_set_cmsg_data(rqstp, cmh); |
445 | msg.msg_controllen = sizeof(buffer); | ||
446 | cmh->cmsg_len = CMSG_LEN(sizeof(*pki)); | ||
447 | cmh->cmsg_level = SOL_IP; | ||
448 | cmh->cmsg_type = IP_PKTINFO; | ||
449 | pki->ipi_ifindex = 0; | ||
450 | pki->ipi_spec_dst.s_addr = rqstp->rq_daddr; | ||
451 | 519 | ||
452 | if (sock_sendmsg(sock, &msg, 0) < 0) | 520 | if (sock_sendmsg(sock, &msg, 0) < 0) |
453 | goto out; | 521 | goto out; |
@@ -484,16 +552,16 @@ svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr) | |||
484 | if (xdr->tail[0].iov_len) { | 552 | if (xdr->tail[0].iov_len) { |
485 | result = kernel_sendpage(sock, rqstp->rq_respages[0], | 553 | result = kernel_sendpage(sock, rqstp->rq_respages[0], |
486 | ((unsigned long)xdr->tail[0].iov_base) | 554 | ((unsigned long)xdr->tail[0].iov_base) |
487 | & (PAGE_SIZE-1), | 555 | & (PAGE_SIZE-1), |
488 | xdr->tail[0].iov_len, 0); | 556 | xdr->tail[0].iov_len, 0); |
489 | 557 | ||
490 | if (result > 0) | 558 | if (result > 0) |
491 | len += result; | 559 | len += result; |
492 | } | 560 | } |
493 | out: | 561 | out: |
494 | dprintk("svc: socket %p sendto([%p %Zu... ], %d) = %d (addr %x)\n", | 562 | dprintk("svc: socket %p sendto([%p %Zu... ], %d) = %d (addr %s)\n", |
495 | rqstp->rq_sock, xdr->head[0].iov_base, xdr->head[0].iov_len, xdr->len, len, | 563 | rqstp->rq_sock, xdr->head[0].iov_base, xdr->head[0].iov_len, |
496 | rqstp->rq_addr.sin_addr.s_addr); | 564 | xdr->len, len, svc_print_addr(rqstp, buf, sizeof(buf))); |
497 | 565 | ||
498 | return len; | 566 | return len; |
499 | } | 567 | } |
@@ -568,31 +636,22 @@ svc_recv_available(struct svc_sock *svsk) | |||
568 | static int | 636 | static int |
569 | svc_recvfrom(struct svc_rqst *rqstp, struct kvec *iov, int nr, int buflen) | 637 | svc_recvfrom(struct svc_rqst *rqstp, struct kvec *iov, int nr, int buflen) |
570 | { | 638 | { |
571 | struct msghdr msg; | 639 | struct svc_sock *svsk = rqstp->rq_sock; |
572 | struct socket *sock; | 640 | struct msghdr msg = { |
573 | int len, alen; | 641 | .msg_flags = MSG_DONTWAIT, |
574 | 642 | }; | |
575 | rqstp->rq_addrlen = sizeof(rqstp->rq_addr); | 643 | int len; |
576 | sock = rqstp->rq_sock->sk_sock; | ||
577 | |||
578 | msg.msg_name = &rqstp->rq_addr; | ||
579 | msg.msg_namelen = sizeof(rqstp->rq_addr); | ||
580 | msg.msg_control = NULL; | ||
581 | msg.msg_controllen = 0; | ||
582 | |||
583 | msg.msg_flags = MSG_DONTWAIT; | ||
584 | 644 | ||
585 | len = kernel_recvmsg(sock, &msg, iov, nr, buflen, MSG_DONTWAIT); | 645 | len = kernel_recvmsg(svsk->sk_sock, &msg, iov, nr, buflen, |
646 | msg.msg_flags); | ||
586 | 647 | ||
587 | /* sock_recvmsg doesn't fill in the name/namelen, so we must.. | 648 | /* sock_recvmsg doesn't fill in the name/namelen, so we must.. |
588 | * possibly we should cache this in the svc_sock structure | ||
589 | * at accept time. FIXME | ||
590 | */ | 649 | */ |
591 | alen = sizeof(rqstp->rq_addr); | 650 | memcpy(&rqstp->rq_addr, &svsk->sk_remote, svsk->sk_remotelen); |
592 | kernel_getpeername(sock, (struct sockaddr *)&rqstp->rq_addr, &alen); | 651 | rqstp->rq_addrlen = svsk->sk_remotelen; |
593 | 652 | ||
594 | dprintk("svc: socket %p recvfrom(%p, %Zu) = %d\n", | 653 | dprintk("svc: socket %p recvfrom(%p, %Zu) = %d\n", |
595 | rqstp->rq_sock, iov[0].iov_base, iov[0].iov_len, len); | 654 | svsk, iov[0].iov_base, iov[0].iov_len, len); |
596 | 655 | ||
597 | return len; | 656 | return len; |
598 | } | 657 | } |
@@ -662,6 +721,47 @@ svc_write_space(struct sock *sk) | |||
662 | } | 721 | } |
663 | } | 722 | } |
664 | 723 | ||
724 | static void svc_udp_get_sender_address(struct svc_rqst *rqstp, | ||
725 | struct sk_buff *skb) | ||
726 | { | ||
727 | switch (rqstp->rq_sock->sk_sk->sk_family) { | ||
728 | case AF_INET: { | ||
729 | /* this seems to come from net/ipv4/udp.c:udp_recvmsg */ | ||
730 | struct sockaddr_in *sin = svc_addr_in(rqstp); | ||
731 | |||
732 | sin->sin_family = AF_INET; | ||
733 | sin->sin_port = skb->h.uh->source; | ||
734 | sin->sin_addr.s_addr = skb->nh.iph->saddr; | ||
735 | rqstp->rq_addrlen = sizeof(struct sockaddr_in); | ||
736 | /* Remember which interface received this request */ | ||
737 | rqstp->rq_daddr.addr.s_addr = skb->nh.iph->daddr; | ||
738 | } | ||
739 | break; | ||
740 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
741 | case AF_INET6: { | ||
742 | /* this is derived from net/ipv6/udp.c:udpv6_recvmesg */ | ||
743 | struct sockaddr_in6 *sin6 = svc_addr_in6(rqstp); | ||
744 | |||
745 | sin6->sin6_family = AF_INET6; | ||
746 | sin6->sin6_port = skb->h.uh->source; | ||
747 | sin6->sin6_flowinfo = 0; | ||
748 | sin6->sin6_scope_id = 0; | ||
749 | if (ipv6_addr_type(&sin6->sin6_addr) & | ||
750 | IPV6_ADDR_LINKLOCAL) | ||
751 | sin6->sin6_scope_id = IP6CB(skb)->iif; | ||
752 | ipv6_addr_copy(&sin6->sin6_addr, | ||
753 | &skb->nh.ipv6h->saddr); | ||
754 | rqstp->rq_addrlen = sizeof(struct sockaddr_in); | ||
755 | /* Remember which interface received this request */ | ||
756 | ipv6_addr_copy(&rqstp->rq_daddr.addr6, | ||
757 | &skb->nh.ipv6h->saddr); | ||
758 | } | ||
759 | break; | ||
760 | #endif | ||
761 | } | ||
762 | return; | ||
763 | } | ||
764 | |||
665 | /* | 765 | /* |
666 | * Receive a datagram from a UDP socket. | 766 | * Receive a datagram from a UDP socket. |
667 | */ | 767 | */ |
@@ -711,7 +811,7 @@ svc_udp_recvfrom(struct svc_rqst *rqstp) | |||
711 | tv.tv_sec = xtime.tv_sec; | 811 | tv.tv_sec = xtime.tv_sec; |
712 | tv.tv_usec = xtime.tv_nsec / NSEC_PER_USEC; | 812 | tv.tv_usec = xtime.tv_nsec / NSEC_PER_USEC; |
713 | skb_set_timestamp(skb, &tv); | 813 | skb_set_timestamp(skb, &tv); |
714 | /* Don't enable netstamp, sunrpc doesn't | 814 | /* Don't enable netstamp, sunrpc doesn't |
715 | need that much accuracy */ | 815 | need that much accuracy */ |
716 | } | 816 | } |
717 | skb_get_timestamp(skb, &svsk->sk_sk->sk_stamp); | 817 | skb_get_timestamp(skb, &svsk->sk_sk->sk_stamp); |
@@ -725,13 +825,9 @@ svc_udp_recvfrom(struct svc_rqst *rqstp) | |||
725 | len = skb->len - sizeof(struct udphdr); | 825 | len = skb->len - sizeof(struct udphdr); |
726 | rqstp->rq_arg.len = len; | 826 | rqstp->rq_arg.len = len; |
727 | 827 | ||
728 | rqstp->rq_prot = IPPROTO_UDP; | 828 | rqstp->rq_prot = IPPROTO_UDP; |
729 | 829 | ||
730 | /* Get sender address */ | 830 | svc_udp_get_sender_address(rqstp, skb); |
731 | rqstp->rq_addr.sin_family = AF_INET; | ||
732 | rqstp->rq_addr.sin_port = skb->h.uh->source; | ||
733 | rqstp->rq_addr.sin_addr.s_addr = skb->nh.iph->saddr; | ||
734 | rqstp->rq_daddr = skb->nh.iph->daddr; | ||
735 | 831 | ||
736 | if (skb_is_nonlinear(skb)) { | 832 | if (skb_is_nonlinear(skb)) { |
737 | /* we have to copy */ | 833 | /* we have to copy */ |
@@ -743,7 +839,7 @@ svc_udp_recvfrom(struct svc_rqst *rqstp) | |||
743 | return 0; | 839 | return 0; |
744 | } | 840 | } |
745 | local_bh_enable(); | 841 | local_bh_enable(); |
746 | skb_free_datagram(svsk->sk_sk, skb); | 842 | skb_free_datagram(svsk->sk_sk, skb); |
747 | } else { | 843 | } else { |
748 | /* we can use it in-place */ | 844 | /* we can use it in-place */ |
749 | rqstp->rq_arg.head[0].iov_base = skb->data + sizeof(struct udphdr); | 845 | rqstp->rq_arg.head[0].iov_base = skb->data + sizeof(struct udphdr); |
@@ -794,7 +890,7 @@ svc_udp_init(struct svc_sock *svsk) | |||
794 | svsk->sk_sendto = svc_udp_sendto; | 890 | svsk->sk_sendto = svc_udp_sendto; |
795 | 891 | ||
796 | /* initialise setting must have enough space to | 892 | /* initialise setting must have enough space to |
797 | * receive and respond to one request. | 893 | * receive and respond to one request. |
798 | * svc_udp_recvfrom will re-adjust if necessary | 894 | * svc_udp_recvfrom will re-adjust if necessary |
799 | */ | 895 | */ |
800 | svc_sock_setbufsize(svsk->sk_sock, | 896 | svc_sock_setbufsize(svsk->sk_sock, |
@@ -875,18 +971,36 @@ svc_tcp_data_ready(struct sock *sk, int count) | |||
875 | wake_up_interruptible(sk->sk_sleep); | 971 | wake_up_interruptible(sk->sk_sleep); |
876 | } | 972 | } |
877 | 973 | ||
974 | static inline int svc_port_is_privileged(struct sockaddr *sin) | ||
975 | { | ||
976 | switch (sin->sa_family) { | ||
977 | case AF_INET: | ||
978 | return ntohs(((struct sockaddr_in *)sin)->sin_port) | ||
979 | < PROT_SOCK; | ||
980 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
981 | case AF_INET6: | ||
982 | return ntohs(((struct sockaddr_in6 *)sin)->sin6_port) | ||
983 | < PROT_SOCK; | ||
984 | #endif | ||
985 | default: | ||
986 | return 0; | ||
987 | } | ||
988 | } | ||
989 | |||
878 | /* | 990 | /* |
879 | * Accept a TCP connection | 991 | * Accept a TCP connection |
880 | */ | 992 | */ |
881 | static void | 993 | static void |
882 | svc_tcp_accept(struct svc_sock *svsk) | 994 | svc_tcp_accept(struct svc_sock *svsk) |
883 | { | 995 | { |
884 | struct sockaddr_in sin; | 996 | struct sockaddr_storage addr; |
997 | struct sockaddr *sin = (struct sockaddr *) &addr; | ||
885 | struct svc_serv *serv = svsk->sk_server; | 998 | struct svc_serv *serv = svsk->sk_server; |
886 | struct socket *sock = svsk->sk_sock; | 999 | struct socket *sock = svsk->sk_sock; |
887 | struct socket *newsock; | 1000 | struct socket *newsock; |
888 | struct svc_sock *newsvsk; | 1001 | struct svc_sock *newsvsk; |
889 | int err, slen; | 1002 | int err, slen; |
1003 | char buf[RPC_MAX_ADDRBUFLEN]; | ||
890 | 1004 | ||
891 | dprintk("svc: tcp_accept %p sock %p\n", svsk, sock); | 1005 | dprintk("svc: tcp_accept %p sock %p\n", svsk, sock); |
892 | if (!sock) | 1006 | if (!sock) |
@@ -907,8 +1021,7 @@ svc_tcp_accept(struct svc_sock *svsk) | |||
907 | set_bit(SK_CONN, &svsk->sk_flags); | 1021 | set_bit(SK_CONN, &svsk->sk_flags); |
908 | svc_sock_enqueue(svsk); | 1022 | svc_sock_enqueue(svsk); |
909 | 1023 | ||
910 | slen = sizeof(sin); | 1024 | err = kernel_getpeername(newsock, sin, &slen); |
911 | err = kernel_getpeername(newsock, (struct sockaddr *) &sin, &slen); | ||
912 | if (err < 0) { | 1025 | if (err < 0) { |
913 | if (net_ratelimit()) | 1026 | if (net_ratelimit()) |
914 | printk(KERN_WARNING "%s: peername failed (err %d)!\n", | 1027 | printk(KERN_WARNING "%s: peername failed (err %d)!\n", |
@@ -917,27 +1030,30 @@ svc_tcp_accept(struct svc_sock *svsk) | |||
917 | } | 1030 | } |
918 | 1031 | ||
919 | /* Ideally, we would want to reject connections from unauthorized | 1032 | /* Ideally, we would want to reject connections from unauthorized |
920 | * hosts here, but when we get encription, the IP of the host won't | 1033 | * hosts here, but when we get encryption, the IP of the host won't |
921 | * tell us anything. For now just warn about unpriv connections. | 1034 | * tell us anything. For now just warn about unpriv connections. |
922 | */ | 1035 | */ |
923 | if (ntohs(sin.sin_port) >= 1024) { | 1036 | if (!svc_port_is_privileged(sin)) { |
924 | dprintk(KERN_WARNING | 1037 | dprintk(KERN_WARNING |
925 | "%s: connect from unprivileged port: %u.%u.%u.%u:%d\n", | 1038 | "%s: connect from unprivileged port: %s\n", |
926 | serv->sv_name, | 1039 | serv->sv_name, |
927 | NIPQUAD(sin.sin_addr.s_addr), ntohs(sin.sin_port)); | 1040 | __svc_print_addr(sin, buf, sizeof(buf))); |
928 | } | 1041 | } |
929 | 1042 | dprintk("%s: connect from %s\n", serv->sv_name, | |
930 | dprintk("%s: connect from %u.%u.%u.%u:%04x\n", serv->sv_name, | 1043 | __svc_print_addr(sin, buf, sizeof(buf))); |
931 | NIPQUAD(sin.sin_addr.s_addr), ntohs(sin.sin_port)); | ||
932 | 1044 | ||
933 | /* make sure that a write doesn't block forever when | 1045 | /* make sure that a write doesn't block forever when |
934 | * low on memory | 1046 | * low on memory |
935 | */ | 1047 | */ |
936 | newsock->sk->sk_sndtimeo = HZ*30; | 1048 | newsock->sk->sk_sndtimeo = HZ*30; |
937 | 1049 | ||
938 | if (!(newsvsk = svc_setup_socket(serv, newsock, &err, 0))) | 1050 | if (!(newsvsk = svc_setup_socket(serv, newsock, &err, |
1051 | (SVC_SOCK_ANONYMOUS | SVC_SOCK_TEMPORARY)))) | ||
939 | goto failed; | 1052 | goto failed; |
1053 | memcpy(&newsvsk->sk_remote, sin, slen); | ||
1054 | newsvsk->sk_remotelen = slen; | ||
940 | 1055 | ||
1056 | svc_sock_received(newsvsk); | ||
941 | 1057 | ||
942 | /* make sure that we don't have too many active connections. | 1058 | /* make sure that we don't have too many active connections. |
943 | * If we have, something must be dropped. | 1059 | * If we have, something must be dropped. |
@@ -960,11 +1076,9 @@ svc_tcp_accept(struct svc_sock *svsk) | |||
960 | "sockets, consider increasing the " | 1076 | "sockets, consider increasing the " |
961 | "number of nfsd threads\n", | 1077 | "number of nfsd threads\n", |
962 | serv->sv_name); | 1078 | serv->sv_name); |
963 | printk(KERN_NOTICE "%s: last TCP connect from " | 1079 | printk(KERN_NOTICE |
964 | "%u.%u.%u.%u:%d\n", | 1080 | "%s: last TCP connect from %s\n", |
965 | serv->sv_name, | 1081 | serv->sv_name, buf); |
966 | NIPQUAD(sin.sin_addr.s_addr), | ||
967 | ntohs(sin.sin_port)); | ||
968 | } | 1082 | } |
969 | /* | 1083 | /* |
970 | * Always select the oldest socket. It's not fair, | 1084 | * Always select the oldest socket. It's not fair, |
@@ -1038,7 +1152,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp) | |||
1038 | * on the number of threads which will access the socket. | 1152 | * on the number of threads which will access the socket. |
1039 | * | 1153 | * |
1040 | * rcvbuf just needs to be able to hold a few requests. | 1154 | * rcvbuf just needs to be able to hold a few requests. |
1041 | * Normally they will be removed from the queue | 1155 | * Normally they will be removed from the queue |
1042 | * as soon a a complete request arrives. | 1156 | * as soon a a complete request arrives. |
1043 | */ | 1157 | */ |
1044 | svc_sock_setbufsize(svsk->sk_sock, | 1158 | svc_sock_setbufsize(svsk->sk_sock, |
@@ -1063,7 +1177,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp) | |||
1063 | 1177 | ||
1064 | if (len < want) { | 1178 | if (len < want) { |
1065 | dprintk("svc: short recvfrom while reading record length (%d of %lu)\n", | 1179 | dprintk("svc: short recvfrom while reading record length (%d of %lu)\n", |
1066 | len, want); | 1180 | len, want); |
1067 | svc_sock_received(svsk); | 1181 | svc_sock_received(svsk); |
1068 | return -EAGAIN; /* record header not complete */ | 1182 | return -EAGAIN; /* record header not complete */ |
1069 | } | 1183 | } |
@@ -1221,7 +1335,7 @@ svc_tcp_init(struct svc_sock *svsk) | |||
1221 | tp->nonagle = 1; /* disable Nagle's algorithm */ | 1335 | tp->nonagle = 1; /* disable Nagle's algorithm */ |
1222 | 1336 | ||
1223 | /* initialise setting must have enough space to | 1337 | /* initialise setting must have enough space to |
1224 | * receive and respond to one request. | 1338 | * receive and respond to one request. |
1225 | * svc_tcp_recvfrom will re-adjust if necessary | 1339 | * svc_tcp_recvfrom will re-adjust if necessary |
1226 | */ | 1340 | */ |
1227 | svc_sock_setbufsize(svsk->sk_sock, | 1341 | svc_sock_setbufsize(svsk->sk_sock, |
@@ -1230,7 +1344,7 @@ svc_tcp_init(struct svc_sock *svsk) | |||
1230 | 1344 | ||
1231 | set_bit(SK_CHNGBUF, &svsk->sk_flags); | 1345 | set_bit(SK_CHNGBUF, &svsk->sk_flags); |
1232 | set_bit(SK_DATA, &svsk->sk_flags); | 1346 | set_bit(SK_DATA, &svsk->sk_flags); |
1233 | if (sk->sk_state != TCP_ESTABLISHED) | 1347 | if (sk->sk_state != TCP_ESTABLISHED) |
1234 | set_bit(SK_CLOSE, &svsk->sk_flags); | 1348 | set_bit(SK_CLOSE, &svsk->sk_flags); |
1235 | } | 1349 | } |
1236 | } | 1350 | } |
@@ -1246,7 +1360,7 @@ svc_sock_update_bufs(struct svc_serv *serv) | |||
1246 | 1360 | ||
1247 | spin_lock_bh(&serv->sv_lock); | 1361 | spin_lock_bh(&serv->sv_lock); |
1248 | list_for_each(le, &serv->sv_permsocks) { | 1362 | list_for_each(le, &serv->sv_permsocks) { |
1249 | struct svc_sock *svsk = | 1363 | struct svc_sock *svsk = |
1250 | list_entry(le, struct svc_sock, sk_list); | 1364 | list_entry(le, struct svc_sock, sk_list); |
1251 | set_bit(SK_CHNGBUF, &svsk->sk_flags); | 1365 | set_bit(SK_CHNGBUF, &svsk->sk_flags); |
1252 | } | 1366 | } |
@@ -1266,7 +1380,7 @@ svc_sock_update_bufs(struct svc_serv *serv) | |||
1266 | int | 1380 | int |
1267 | svc_recv(struct svc_rqst *rqstp, long timeout) | 1381 | svc_recv(struct svc_rqst *rqstp, long timeout) |
1268 | { | 1382 | { |
1269 | struct svc_sock *svsk =NULL; | 1383 | struct svc_sock *svsk = NULL; |
1270 | struct svc_serv *serv = rqstp->rq_server; | 1384 | struct svc_serv *serv = rqstp->rq_server; |
1271 | struct svc_pool *pool = rqstp->rq_pool; | 1385 | struct svc_pool *pool = rqstp->rq_pool; |
1272 | int len, i; | 1386 | int len, i; |
@@ -1278,11 +1392,11 @@ svc_recv(struct svc_rqst *rqstp, long timeout) | |||
1278 | rqstp, timeout); | 1392 | rqstp, timeout); |
1279 | 1393 | ||
1280 | if (rqstp->rq_sock) | 1394 | if (rqstp->rq_sock) |
1281 | printk(KERN_ERR | 1395 | printk(KERN_ERR |
1282 | "svc_recv: service %p, socket not NULL!\n", | 1396 | "svc_recv: service %p, socket not NULL!\n", |
1283 | rqstp); | 1397 | rqstp); |
1284 | if (waitqueue_active(&rqstp->rq_wait)) | 1398 | if (waitqueue_active(&rqstp->rq_wait)) |
1285 | printk(KERN_ERR | 1399 | printk(KERN_ERR |
1286 | "svc_recv: service %p, wait queue active!\n", | 1400 | "svc_recv: service %p, wait queue active!\n", |
1287 | rqstp); | 1401 | rqstp); |
1288 | 1402 | ||
@@ -1363,7 +1477,7 @@ svc_recv(struct svc_rqst *rqstp, long timeout) | |||
1363 | svsk->sk_lastrecv = get_seconds(); | 1477 | svsk->sk_lastrecv = get_seconds(); |
1364 | clear_bit(SK_OLD, &svsk->sk_flags); | 1478 | clear_bit(SK_OLD, &svsk->sk_flags); |
1365 | 1479 | ||
1366 | rqstp->rq_secure = ntohs(rqstp->rq_addr.sin_port) < 1024; | 1480 | rqstp->rq_secure = svc_port_is_privileged(svc_addr(rqstp)); |
1367 | rqstp->rq_chandle.defer = svc_defer; | 1481 | rqstp->rq_chandle.defer = svc_defer; |
1368 | 1482 | ||
1369 | if (serv->sv_stats) | 1483 | if (serv->sv_stats) |
@@ -1371,7 +1485,7 @@ svc_recv(struct svc_rqst *rqstp, long timeout) | |||
1371 | return len; | 1485 | return len; |
1372 | } | 1486 | } |
1373 | 1487 | ||
1374 | /* | 1488 | /* |
1375 | * Drop request | 1489 | * Drop request |
1376 | */ | 1490 | */ |
1377 | void | 1491 | void |
@@ -1476,12 +1590,14 @@ svc_age_temp_sockets(unsigned long closure) | |||
1476 | * Initialize socket for RPC use and create svc_sock struct | 1590 | * Initialize socket for RPC use and create svc_sock struct |
1477 | * XXX: May want to setsockopt SO_SNDBUF and SO_RCVBUF. | 1591 | * XXX: May want to setsockopt SO_SNDBUF and SO_RCVBUF. |
1478 | */ | 1592 | */ |
1479 | static struct svc_sock * | 1593 | static struct svc_sock *svc_setup_socket(struct svc_serv *serv, |
1480 | svc_setup_socket(struct svc_serv *serv, struct socket *sock, | 1594 | struct socket *sock, |
1481 | int *errp, int pmap_register) | 1595 | int *errp, int flags) |
1482 | { | 1596 | { |
1483 | struct svc_sock *svsk; | 1597 | struct svc_sock *svsk; |
1484 | struct sock *inet; | 1598 | struct sock *inet; |
1599 | int pmap_register = !(flags & SVC_SOCK_ANONYMOUS); | ||
1600 | int is_temporary = flags & SVC_SOCK_TEMPORARY; | ||
1485 | 1601 | ||
1486 | dprintk("svc: svc_setup_socket %p\n", sock); | 1602 | dprintk("svc: svc_setup_socket %p\n", sock); |
1487 | if (!(svsk = kzalloc(sizeof(*svsk), GFP_KERNEL))) { | 1603 | if (!(svsk = kzalloc(sizeof(*svsk), GFP_KERNEL))) { |
@@ -1523,7 +1639,7 @@ svc_setup_socket(struct svc_serv *serv, struct socket *sock, | |||
1523 | svc_tcp_init(svsk); | 1639 | svc_tcp_init(svsk); |
1524 | 1640 | ||
1525 | spin_lock_bh(&serv->sv_lock); | 1641 | spin_lock_bh(&serv->sv_lock); |
1526 | if (!pmap_register) { | 1642 | if (is_temporary) { |
1527 | set_bit(SK_TEMP, &svsk->sk_flags); | 1643 | set_bit(SK_TEMP, &svsk->sk_flags); |
1528 | list_add(&svsk->sk_list, &serv->sv_tempsocks); | 1644 | list_add(&svsk->sk_list, &serv->sv_tempsocks); |
1529 | serv->sv_tmpcnt++; | 1645 | serv->sv_tmpcnt++; |
@@ -1543,8 +1659,6 @@ svc_setup_socket(struct svc_serv *serv, struct socket *sock, | |||
1543 | dprintk("svc: svc_setup_socket created %p (inet %p)\n", | 1659 | dprintk("svc: svc_setup_socket created %p (inet %p)\n", |
1544 | svsk, svsk->sk_sk); | 1660 | svsk, svsk->sk_sk); |
1545 | 1661 | ||
1546 | clear_bit(SK_BUSY, &svsk->sk_flags); | ||
1547 | svc_sock_enqueue(svsk); | ||
1548 | return svsk; | 1662 | return svsk; |
1549 | } | 1663 | } |
1550 | 1664 | ||
@@ -1567,9 +1681,11 @@ int svc_addsock(struct svc_serv *serv, | |||
1567 | else if (so->state > SS_UNCONNECTED) | 1681 | else if (so->state > SS_UNCONNECTED) |
1568 | err = -EISCONN; | 1682 | err = -EISCONN; |
1569 | else { | 1683 | else { |
1570 | svsk = svc_setup_socket(serv, so, &err, 1); | 1684 | svsk = svc_setup_socket(serv, so, &err, SVC_SOCK_DEFAULTS); |
1571 | if (svsk) | 1685 | if (svsk) { |
1686 | svc_sock_received(svsk); | ||
1572 | err = 0; | 1687 | err = 0; |
1688 | } | ||
1573 | } | 1689 | } |
1574 | if (err) { | 1690 | if (err) { |
1575 | sockfd_put(so); | 1691 | sockfd_put(so); |
@@ -1583,18 +1699,18 @@ EXPORT_SYMBOL_GPL(svc_addsock); | |||
1583 | /* | 1699 | /* |
1584 | * Create socket for RPC service. | 1700 | * Create socket for RPC service. |
1585 | */ | 1701 | */ |
1586 | static int | 1702 | static int svc_create_socket(struct svc_serv *serv, int protocol, |
1587 | svc_create_socket(struct svc_serv *serv, int protocol, struct sockaddr_in *sin) | 1703 | struct sockaddr *sin, int len, int flags) |
1588 | { | 1704 | { |
1589 | struct svc_sock *svsk; | 1705 | struct svc_sock *svsk; |
1590 | struct socket *sock; | 1706 | struct socket *sock; |
1591 | int error; | 1707 | int error; |
1592 | int type; | 1708 | int type; |
1709 | char buf[RPC_MAX_ADDRBUFLEN]; | ||
1593 | 1710 | ||
1594 | dprintk("svc: svc_create_socket(%s, %d, %u.%u.%u.%u:%d)\n", | 1711 | dprintk("svc: svc_create_socket(%s, %d, %s)\n", |
1595 | serv->sv_program->pg_name, protocol, | 1712 | serv->sv_program->pg_name, protocol, |
1596 | NIPQUAD(sin->sin_addr.s_addr), | 1713 | __svc_print_addr(sin, buf, sizeof(buf))); |
1597 | ntohs(sin->sin_port)); | ||
1598 | 1714 | ||
1599 | if (protocol != IPPROTO_UDP && protocol != IPPROTO_TCP) { | 1715 | if (protocol != IPPROTO_UDP && protocol != IPPROTO_TCP) { |
1600 | printk(KERN_WARNING "svc: only UDP and TCP " | 1716 | printk(KERN_WARNING "svc: only UDP and TCP " |
@@ -1603,15 +1719,15 @@ svc_create_socket(struct svc_serv *serv, int protocol, struct sockaddr_in *sin) | |||
1603 | } | 1719 | } |
1604 | type = (protocol == IPPROTO_UDP)? SOCK_DGRAM : SOCK_STREAM; | 1720 | type = (protocol == IPPROTO_UDP)? SOCK_DGRAM : SOCK_STREAM; |
1605 | 1721 | ||
1606 | if ((error = sock_create_kern(PF_INET, type, protocol, &sock)) < 0) | 1722 | error = sock_create_kern(sin->sa_family, type, protocol, &sock); |
1723 | if (error < 0) | ||
1607 | return error; | 1724 | return error; |
1608 | 1725 | ||
1609 | svc_reclassify_socket(sock); | 1726 | svc_reclassify_socket(sock); |
1610 | 1727 | ||
1611 | if (type == SOCK_STREAM) | 1728 | if (type == SOCK_STREAM) |
1612 | sock->sk->sk_reuse = 1; /* allow address reuse */ | 1729 | sock->sk->sk_reuse = 1; /* allow address reuse */ |
1613 | error = kernel_bind(sock, (struct sockaddr *) sin, | 1730 | error = kernel_bind(sock, sin, len); |
1614 | sizeof(*sin)); | ||
1615 | if (error < 0) | 1731 | if (error < 0) |
1616 | goto bummer; | 1732 | goto bummer; |
1617 | 1733 | ||
@@ -1620,8 +1736,10 @@ svc_create_socket(struct svc_serv *serv, int protocol, struct sockaddr_in *sin) | |||
1620 | goto bummer; | 1736 | goto bummer; |
1621 | } | 1737 | } |
1622 | 1738 | ||
1623 | if ((svsk = svc_setup_socket(serv, sock, &error, 1)) != NULL) | 1739 | if ((svsk = svc_setup_socket(serv, sock, &error, flags)) != NULL) { |
1624 | return 0; | 1740 | svc_sock_received(svsk); |
1741 | return ntohs(inet_sk(svsk->sk_sk)->sport); | ||
1742 | } | ||
1625 | 1743 | ||
1626 | bummer: | 1744 | bummer: |
1627 | dprintk("svc: svc_create_socket error = %d\n", -error); | 1745 | dprintk("svc: svc_create_socket error = %d\n", -error); |
@@ -1651,7 +1769,7 @@ svc_delete_socket(struct svc_sock *svsk) | |||
1651 | 1769 | ||
1652 | if (!test_and_set_bit(SK_DETACHED, &svsk->sk_flags)) | 1770 | if (!test_and_set_bit(SK_DETACHED, &svsk->sk_flags)) |
1653 | list_del_init(&svsk->sk_list); | 1771 | list_del_init(&svsk->sk_list); |
1654 | /* | 1772 | /* |
1655 | * We used to delete the svc_sock from whichever list | 1773 | * We used to delete the svc_sock from whichever list |
1656 | * it's sk_ready node was on, but we don't actually | 1774 | * it's sk_ready node was on, but we don't actually |
1657 | * need to. This is because the only time we're called | 1775 | * need to. This is because the only time we're called |
@@ -1681,23 +1799,30 @@ void svc_close_socket(struct svc_sock *svsk) | |||
1681 | svc_sock_put(svsk); | 1799 | svc_sock_put(svsk); |
1682 | } | 1800 | } |
1683 | 1801 | ||
1684 | /* | 1802 | /** |
1685 | * Make a socket for nfsd and lockd | 1803 | * svc_makesock - Make a socket for nfsd and lockd |
1804 | * @serv: RPC server structure | ||
1805 | * @protocol: transport protocol to use | ||
1806 | * @port: port to use | ||
1807 | * @flags: requested socket characteristics | ||
1808 | * | ||
1686 | */ | 1809 | */ |
1687 | int | 1810 | int svc_makesock(struct svc_serv *serv, int protocol, unsigned short port, |
1688 | svc_makesock(struct svc_serv *serv, int protocol, unsigned short port) | 1811 | int flags) |
1689 | { | 1812 | { |
1690 | struct sockaddr_in sin; | 1813 | struct sockaddr_in sin = { |
1814 | .sin_family = AF_INET, | ||
1815 | .sin_addr.s_addr = INADDR_ANY, | ||
1816 | .sin_port = htons(port), | ||
1817 | }; | ||
1691 | 1818 | ||
1692 | dprintk("svc: creating socket proto = %d\n", protocol); | 1819 | dprintk("svc: creating socket proto = %d\n", protocol); |
1693 | sin.sin_family = AF_INET; | 1820 | return svc_create_socket(serv, protocol, (struct sockaddr *) &sin, |
1694 | sin.sin_addr.s_addr = INADDR_ANY; | 1821 | sizeof(sin), flags); |
1695 | sin.sin_port = htons(port); | ||
1696 | return svc_create_socket(serv, protocol, &sin); | ||
1697 | } | 1822 | } |
1698 | 1823 | ||
1699 | /* | 1824 | /* |
1700 | * Handle defer and revisit of requests | 1825 | * Handle defer and revisit of requests |
1701 | */ | 1826 | */ |
1702 | 1827 | ||
1703 | static void svc_revisit(struct cache_deferred_req *dreq, int too_many) | 1828 | static void svc_revisit(struct cache_deferred_req *dreq, int too_many) |
@@ -1742,7 +1867,8 @@ svc_defer(struct cache_req *req) | |||
1742 | 1867 | ||
1743 | dr->handle.owner = rqstp->rq_server; | 1868 | dr->handle.owner = rqstp->rq_server; |
1744 | dr->prot = rqstp->rq_prot; | 1869 | dr->prot = rqstp->rq_prot; |
1745 | dr->addr = rqstp->rq_addr; | 1870 | memcpy(&dr->addr, &rqstp->rq_addr, rqstp->rq_addrlen); |
1871 | dr->addrlen = rqstp->rq_addrlen; | ||
1746 | dr->daddr = rqstp->rq_daddr; | 1872 | dr->daddr = rqstp->rq_daddr; |
1747 | dr->argslen = rqstp->rq_arg.len >> 2; | 1873 | dr->argslen = rqstp->rq_arg.len >> 2; |
1748 | memcpy(dr->args, rqstp->rq_arg.head[0].iov_base-skip, dr->argslen<<2); | 1874 | memcpy(dr->args, rqstp->rq_arg.head[0].iov_base-skip, dr->argslen<<2); |
@@ -1766,7 +1892,8 @@ static int svc_deferred_recv(struct svc_rqst *rqstp) | |||
1766 | rqstp->rq_arg.page_len = 0; | 1892 | rqstp->rq_arg.page_len = 0; |
1767 | rqstp->rq_arg.len = dr->argslen<<2; | 1893 | rqstp->rq_arg.len = dr->argslen<<2; |
1768 | rqstp->rq_prot = dr->prot; | 1894 | rqstp->rq_prot = dr->prot; |
1769 | rqstp->rq_addr = dr->addr; | 1895 | memcpy(&rqstp->rq_addr, &dr->addr, dr->addrlen); |
1896 | rqstp->rq_addrlen = dr->addrlen; | ||
1770 | rqstp->rq_daddr = dr->daddr; | 1897 | rqstp->rq_daddr = dr->daddr; |
1771 | rqstp->rq_respages = rqstp->rq_pages; | 1898 | rqstp->rq_respages = rqstp->rq_pages; |
1772 | return dr->argslen<<2; | 1899 | return dr->argslen<<2; |
@@ -1776,7 +1903,7 @@ static int svc_deferred_recv(struct svc_rqst *rqstp) | |||
1776 | static struct svc_deferred_req *svc_deferred_dequeue(struct svc_sock *svsk) | 1903 | static struct svc_deferred_req *svc_deferred_dequeue(struct svc_sock *svsk) |
1777 | { | 1904 | { |
1778 | struct svc_deferred_req *dr = NULL; | 1905 | struct svc_deferred_req *dr = NULL; |
1779 | 1906 | ||
1780 | if (!test_bit(SK_DEFERRED, &svsk->sk_flags)) | 1907 | if (!test_bit(SK_DEFERRED, &svsk->sk_flags)) |
1781 | return NULL; | 1908 | return NULL; |
1782 | spin_lock_bh(&svsk->sk_defer_lock); | 1909 | spin_lock_bh(&svsk->sk_defer_lock); |