| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: tcp_usrreq.c,v 1.149 2008/10/11 13:40:57 pooka Exp $ */ | | 1 | /* $NetBSD: tcp_usrreq.c,v 1.149.4.1 2009/06/17 20:29:33 bouyer Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | | 4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -85,27 +85,27 @@ | | | @@ -85,27 +85,27 @@ |
85 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 85 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
86 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 86 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
87 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 87 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
88 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 88 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
89 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 89 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
90 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 90 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
91 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 91 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
92 | * SUCH DAMAGE. | | 92 | * SUCH DAMAGE. |
93 | * | | 93 | * |
94 | * @(#)tcp_usrreq.c 8.5 (Berkeley) 6/21/95 | | 94 | * @(#)tcp_usrreq.c 8.5 (Berkeley) 6/21/95 |
95 | */ | | 95 | */ |
96 | | | 96 | |
97 | #include <sys/cdefs.h> | | 97 | #include <sys/cdefs.h> |
98 | __KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.149 2008/10/11 13:40:57 pooka Exp $"); | | 98 | __KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.149.4.1 2009/06/17 20:29:33 bouyer Exp $"); |
99 | | | 99 | |
100 | #include "opt_inet.h" | | 100 | #include "opt_inet.h" |
101 | #include "opt_ipsec.h" | | 101 | #include "opt_ipsec.h" |
102 | #include "opt_tcp_debug.h" | | 102 | #include "opt_tcp_debug.h" |
103 | #include "opt_mbuftrace.h" | | 103 | #include "opt_mbuftrace.h" |
104 | #include "rnd.h" | | 104 | #include "rnd.h" |
105 | | | 105 | |
106 | #include <sys/param.h> | | 106 | #include <sys/param.h> |
107 | #include <sys/systm.h> | | 107 | #include <sys/systm.h> |
108 | #include <sys/kernel.h> | | 108 | #include <sys/kernel.h> |
109 | #include <sys/malloc.h> | | 109 | #include <sys/malloc.h> |
110 | #include <sys/mbuf.h> | | 110 | #include <sys/mbuf.h> |
111 | #include <sys/socket.h> | | 111 | #include <sys/socket.h> |
| @@ -1543,28 +1543,30 @@ sysctl_inpcblist(SYSCTLFN_ARGS) | | | @@ -1543,28 +1543,30 @@ sysctl_inpcblist(SYSCTLFN_ARGS) |
1543 | in6->sin6_len = sizeof(*in6); | | 1543 | in6->sin6_len = sizeof(*in6); |
1544 | in6->sin6_family = pf; | | 1544 | in6->sin6_family = pf; |
1545 | in6->sin6_port = in6p->in6p_fport; | | 1545 | in6->sin6_port = in6p->in6p_fport; |
1546 | in6->sin6_flowinfo = in6p->in6p_flowinfo; | | 1546 | in6->sin6_flowinfo = in6p->in6p_flowinfo; |
1547 | in6->sin6_addr = in6p->in6p_faddr; | | 1547 | in6->sin6_addr = in6p->in6p_faddr; |
1548 | in6->sin6_scope_id = 0; /* XXX? */ | | 1548 | in6->sin6_scope_id = 0; /* XXX? */ |
1549 | } | | 1549 | } |
1550 | break; | | 1550 | break; |
1551 | #endif | | 1551 | #endif |
1552 | } | | 1552 | } |
1553 | | | 1553 | |
1554 | if (len >= elem_size && elem_count > 0) { | | 1554 | if (len >= elem_size && elem_count > 0) { |
1555 | error = copyout(&pcb, dp, out_size); | | 1555 | error = copyout(&pcb, dp, out_size); |
1556 | if (error) | | 1556 | if (error) { |
| | | 1557 | mutex_exit(softnet_lock); |
1557 | return (error); | | 1558 | return (error); |
| | | 1559 | } |
1558 | dp += elem_size; | | 1560 | dp += elem_size; |
1559 | len -= elem_size; | | 1561 | len -= elem_size; |
1560 | } | | 1562 | } |
1561 | if (elem_count > 0) { | | 1563 | if (elem_count > 0) { |
1562 | needed += elem_size; | | 1564 | needed += elem_size; |
1563 | if (elem_count != INT_MAX) | | 1565 | if (elem_count != INT_MAX) |
1564 | elem_count--; | | 1566 | elem_count--; |
1565 | } | | 1567 | } |
1566 | } | | 1568 | } |
1567 | | | 1569 | |
1568 | *oldlenp = needed; | | 1570 | *oldlenp = needed; |
1569 | if (oldp == NULL) | | 1571 | if (oldp == NULL) |
1570 | *oldlenp += PCB_SLOP * sizeof(struct kinfo_pcb); | | 1572 | *oldlenp += PCB_SLOP * sizeof(struct kinfo_pcb); |