| version 1.266.2.1, 2008/05/18 12:35:29 |
version 1.267, 2008/04/23 06:09:04 |
|
|
| * 2. Redistributions in binary form must reproduce the above copyright |
* 2. Redistributions in binary form must reproduce the above copyright |
| * notice, this list of conditions and the following disclaimer in the |
* notice, this list of conditions and the following disclaimer in the |
| * documentation and/or other materials provided with the distribution. |
* documentation and/or other materials provided with the distribution. |
| |
* 3. All advertising materials mentioning features or use of this software |
| |
* must display the following acknowledgement: |
| |
* This product includes software developed by the NetBSD |
| |
* Foundation, Inc. and its contributors. |
| |
* 4. Neither the name of The NetBSD Foundation nor the names of its |
| |
* contributors may be used to endorse or promote products derived |
| |
* from this software without specific prior written permission. |
| * |
* |
| * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
| * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
|
|
| ip_nmbclusters_changed(); |
ip_nmbclusters_changed(); |
| |
|
| TAILQ_INIT(&in_ifaddrhead); |
TAILQ_INIT(&in_ifaddrhead); |
| in_ifaddrhashtbl = hashinit(IN_IFADDR_HASH_SIZE, HASH_LIST, true, |
in_ifaddrhashtbl = hashinit(IN_IFADDR_HASH_SIZE, HASH_LIST, M_IFADDR, |
| &in_ifaddrhash); |
M_WAITOK, &in_ifaddrhash); |
| in_multihashtbl = hashinit(IN_IFADDR_HASH_SIZE, HASH_LIST, true, |
in_multihashtbl = hashinit(IN_IFADDR_HASH_SIZE, HASH_LIST, M_IPMADDR, |
| &in_multihash); |
M_WAITOK, &in_multihash); |
| ip_mtudisc_timeout_q = rt_timer_queue_create(ip_mtudisc_timeout); |
ip_mtudisc_timeout_q = rt_timer_queue_create(ip_mtudisc_timeout); |
| #ifdef GATEWAY |
#ifdef GATEWAY |
| ipflow_init(ip_hashsize); |
ipflow_init(ip_hashsize); |
|
|
| int s; |
int s; |
| struct mbuf *m; |
struct mbuf *m; |
| |
|
| mutex_enter(softnet_lock); |
|
| KERNEL_LOCK(1, NULL); |
|
| while (!IF_IS_EMPTY(&ipintrq)) { |
while (!IF_IS_EMPTY(&ipintrq)) { |
| s = splnet(); |
s = splnet(); |
| IF_DEQUEUE(&ipintrq, m); |
IF_DEQUEUE(&ipintrq, m); |
| splx(s); |
splx(s); |
| if (m == NULL) |
if (m == 0) |
| break; |
return; |
| ip_input(m); |
ip_input(m); |
| } |
} |
| KERNEL_UNLOCK_ONE(NULL); |
|
| mutex_exit(softnet_lock); |
|
| } |
} |
| |
|
| /* |
/* |
| Line 1386 ip_slowtimo(void) |
|
| Line 1389 ip_slowtimo(void) |
|
| static u_int dropscanidx = 0; |
static u_int dropscanidx = 0; |
| u_int i; |
u_int i; |
| u_int median_ttl; |
u_int median_ttl; |
| |
int s = splsoftnet(); |
| mutex_enter(softnet_lock); |
|
| KERNEL_LOCK(1, NULL); |
|
| |
|
| IPQ_LOCK(); |
IPQ_LOCK(); |
| |
|
| Line 1430 ip_slowtimo(void) |
|
| Line 1431 ip_slowtimo(void) |
|
| dropscanidx = i; |
dropscanidx = i; |
| } |
} |
| IPQ_UNLOCK(); |
IPQ_UNLOCK(); |
| |
splx(s); |
| KERNEL_UNLOCK_ONE(NULL); |
|
| mutex_exit(softnet_lock); |
|
| } |
} |
| |
|
| /* |
/* |
| * Drain off all datagram fragments. Don't acquire softnet_lock as |
* Drain off all datagram fragments. |
| * can be called from hardware interrupt context. |
|
| */ |
*/ |
| void |
void |
| ip_drain(void) |
ip_drain(void) |
| { |
{ |
| |
|
| KERNEL_LOCK(1, NULL); |
|
| |
|
| /* |
/* |
| * We may be called from a device's interrupt context. If |
* We may be called from a device's interrupt context. If |
| * the ipq is already busy, just bail out now. |
* the ipq is already busy, just bail out now. |
| */ |
*/ |
| if (ipq_lock_try() != 0) { |
if (ipq_lock_try() == 0) |
| /* |
return; |
| * Drop half the total fragments now. If more mbufs are |
|
| * needed, we will be called again soon. |
|
| */ |
|
| ip_reass_drophalf(); |
|
| IPQ_UNLOCK(); |
|
| } |
|
| |
|
| KERNEL_UNLOCK_ONE(NULL); |
/* |
| |
* Drop half the total fragments now. If more mbufs are needed, |
| |
* we will be called again soon. |
| |
*/ |
| |
ip_reass_drophalf(); |
| |
|
| |
IPQ_UNLOCK(); |
| } |
} |
| |
|
| /* |
/* |
| Line 2202 sysctl_net_inet_ip_hashsize(SYSCTLFN_ARG |
|
| Line 2198 sysctl_net_inet_ip_hashsize(SYSCTLFN_ARG |
|
| static int |
static int |
| sysctl_net_inet_ip_stats(SYSCTLFN_ARGS) |
sysctl_net_inet_ip_stats(SYSCTLFN_ARGS) |
| { |
{ |
| |
netstat_sysctl_context ctx; |
| |
uint64_t ips[IP_NSTATS]; |
| |
|
| return (NETSTAT_SYSCTL(ipstat_percpu, IP_NSTATS)); |
ctx.ctx_stat = ipstat_percpu; |
| |
ctx.ctx_counters = ips; |
| |
ctx.ctx_ncounters = IP_NSTATS; |
| |
return (NETSTAT_SYSCTL(&ctx)); |
| } |
} |
| |
|
| SYSCTL_SETUP(sysctl_net_inet_ip_setup, "sysctl net.inet.ip subtree setup") |
SYSCTL_SETUP(sysctl_net_inet_ip_setup, "sysctl net.inet.ip subtree setup") |