version 1.150, 2002/05/12 20:33:50 |
version 1.150.2.2, 2002/07/15 10:36:58 |
|
|
/* |
/* |
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
* All rights reserved. |
* All rights reserved. |
* |
* |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* modification, are permitted provided that the following conditions |
* are met: |
* are met: |
|
|
* 3. Neither the name of the project nor the names of its contributors |
* 3. Neither the name of the project nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* without specific prior written permission. |
* |
* |
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND |
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
Line 168 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 168 __KERNEL_RCSID(0, "$NetBSD$"); |
|
#define IPALLOWSRCRT 1 /* allow source-routed packets */ |
#define IPALLOWSRCRT 1 /* allow source-routed packets */ |
#endif |
#endif |
#ifndef IPMTUDISC |
#ifndef IPMTUDISC |
#define IPMTUDISC 0 |
#define IPMTUDISC 1 |
#endif |
#endif |
#ifndef IPMTUDISCTIMEOUT |
#ifndef IPMTUDISCTIMEOUT |
#define IPMTUDISCTIMEOUT (10 * 60) /* as per RFC 1191 */ |
#define IPMTUDISCTIMEOUT (10 * 60) /* as per RFC 1191 */ |
|
|
in_ifaddrhashtbl = hashinit(IN_IFADDR_HASH_SIZE, HASH_LIST, M_IFADDR, |
in_ifaddrhashtbl = hashinit(IN_IFADDR_HASH_SIZE, HASH_LIST, M_IFADDR, |
M_WAITOK, &in_ifaddrhash); |
M_WAITOK, &in_ifaddrhash); |
if (ip_mtudisc != 0) |
if (ip_mtudisc != 0) |
ip_mtudisc_timeout_q = |
ip_mtudisc_timeout_q = |
rt_timer_queue_create(ip_mtudisc_timeout); |
rt_timer_queue_create(ip_mtudisc_timeout); |
#ifdef GATEWAY |
#ifdef GATEWAY |
ipflow_init(); |
ipflow_init(); |
Line 420 ip_input(struct mbuf *m) |
|
Line 420 ip_input(struct mbuf *m) |
|
if (TAILQ_FIRST(&in_ifaddr) == 0) |
if (TAILQ_FIRST(&in_ifaddr) == 0) |
goto bad; |
goto bad; |
ipstat.ips_total++; |
ipstat.ips_total++; |
if (m->m_len < sizeof (struct ip) && |
/* |
(m = m_pullup(m, sizeof (struct ip))) == 0) { |
* If the IP header is not aligned, slurp it up into a new |
ipstat.ips_toosmall++; |
* mbuf with space for link headers, in the event we forward |
return; |
* it. Otherwise, if it is aligned, make sure the entire |
|
* base IP header is in the first mbuf of the chain. |
|
*/ |
|
if (IP_HDR_ALIGNED_P(mtod(m, caddr_t)) == 0) { |
|
if ((m = m_copyup(m, sizeof(struct ip), |
|
(max_linkhdr + 3) & ~3)) == NULL) { |
|
/* XXXJRT new stat, please */ |
|
ipstat.ips_toosmall++; |
|
return; |
|
} |
|
} else if (__predict_false(m->m_len < sizeof (struct ip))) { |
|
if ((m = m_pullup(m, sizeof (struct ip))) == NULL) { |
|
ipstat.ips_toosmall++; |
|
return; |
|
} |
} |
} |
ip = mtod(m, struct ip *); |
ip = mtod(m, struct ip *); |
if (ip->ip_v != IPVERSION) { |
if (ip->ip_v != IPVERSION) { |
Line 1662 ip_forward(m, srcrt) |
|
Line 1676 ip_forward(m, srcrt) |
|
ro = &sp->req->sav->sah->sa_route; |
ro = &sp->req->sav->sah->sa_route; |
if (ro->ro_rt && ro->ro_rt->rt_ifp) { |
if (ro->ro_rt && ro->ro_rt->rt_ifp) { |
dummyifp.if_mtu = |
dummyifp.if_mtu = |
|
ro->ro_rt->rt_rmx.rmx_mtu ? |
|
ro->ro_rt->rt_rmx.rmx_mtu : |
ro->ro_rt->rt_ifp->if_mtu; |
ro->ro_rt->rt_ifp->if_mtu; |
dummyifp.if_mtu -= ipsechdr; |
dummyifp.if_mtu -= ipsechdr; |
destifp = &dummyifp; |
destifp = &dummyifp; |
Line 1805 ip_sysctl(name, namelen, oldp, oldlenp, |
|
Line 1821 ip_sysctl(name, namelen, oldp, oldlenp, |
|
error = sysctl_int(oldp, oldlenp, newp, newlen, |
error = sysctl_int(oldp, oldlenp, newp, newlen, |
&ip_mtudisc); |
&ip_mtudisc); |
if (ip_mtudisc != 0 && ip_mtudisc_timeout_q == NULL) { |
if (ip_mtudisc != 0 && ip_mtudisc_timeout_q == NULL) { |
ip_mtudisc_timeout_q = |
ip_mtudisc_timeout_q = |
rt_timer_queue_create(ip_mtudisc_timeout); |
rt_timer_queue_create(ip_mtudisc_timeout); |
} else if (ip_mtudisc == 0 && ip_mtudisc_timeout_q != NULL) { |
} else if (ip_mtudisc == 0 && ip_mtudisc_timeout_q != NULL) { |
rt_timer_queue_destroy(ip_mtudisc_timeout_q, TRUE); |
rt_timer_queue_destroy(ip_mtudisc_timeout_q, TRUE); |
Line 1842 ip_sysctl(name, namelen, oldp, oldlenp, |
|
Line 1858 ip_sysctl(name, namelen, oldp, oldlenp, |
|
error = sysctl_int(oldp, oldlenp, newp, newlen, |
error = sysctl_int(oldp, oldlenp, newp, newlen, |
&ip_mtudisc_timeout); |
&ip_mtudisc_timeout); |
if (ip_mtudisc_timeout_q != NULL) |
if (ip_mtudisc_timeout_q != NULL) |
rt_timer_queue_change(ip_mtudisc_timeout_q, |
rt_timer_queue_change(ip_mtudisc_timeout_q, |
ip_mtudisc_timeout); |
ip_mtudisc_timeout); |
return (error); |
return (error); |
#ifdef GATEWAY |
#ifdef GATEWAY |