version 1.130.2.14, 2002/10/18 02:45:17 |
version 1.164, 2003/02/26 06:31:14 |
|
|
printf("%s:%d: ipq already locked\n", __FILE__, __LINE__); \ |
printf("%s:%d: ipq already locked\n", __FILE__, __LINE__); \ |
panic("ipq_lock"); \ |
panic("ipq_lock"); \ |
} \ |
} \ |
} while (0) |
} while (/*CONSTCOND*/ 0) |
#define IPQ_LOCK_CHECK() \ |
#define IPQ_LOCK_CHECK() \ |
do { \ |
do { \ |
if (ipq_locked == 0) { \ |
if (ipq_locked == 0) { \ |
printf("%s:%d: ipq lock not held\n", __FILE__, __LINE__); \ |
printf("%s:%d: ipq lock not held\n", __FILE__, __LINE__); \ |
panic("ipq lock check"); \ |
panic("ipq lock check"); \ |
} \ |
} \ |
} while (0) |
} while (/*CONSTCOND*/ 0) |
#else |
#else |
#define IPQ_LOCK() (void) ipq_lock_try() |
#define IPQ_LOCK() (void) ipq_lock_try() |
#define IPQ_LOCK_CHECK() /* nothing */ |
#define IPQ_LOCK_CHECK() /* nothing */ |
Line 309 static struct ip_srcrt { |
|
Line 309 static struct ip_srcrt { |
|
|
|
static void save_rte __P((u_char *, struct in_addr)); |
static void save_rte __P((u_char *, struct in_addr)); |
|
|
|
#ifdef MBUFTRACE |
|
struct mowner ip_rx_mowner = { "internet", "rx" }; |
|
struct mowner ip_tx_mowner = { "internet", "tx" }; |
|
#endif |
|
|
/* |
/* |
* IP initialization: fill in IP protocol switch table. |
* IP initialization: fill in IP protocol switch table. |
* All protocols not implemented in kernel go to raw IP protocol handler. |
* All protocols not implemented in kernel go to raw IP protocol handler. |
|
|
TAILQ_INIT(&in_ifaddr); |
TAILQ_INIT(&in_ifaddr); |
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) |
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(); |
ipflow_init(); |
#endif |
#endif |
|
|
evcnt_attach_static(&ip_hwcsum_ok); |
evcnt_attach_static(&ip_hwcsum_ok); |
evcnt_attach_static(&ip_swcsum); |
evcnt_attach_static(&ip_swcsum); |
#endif /* INET_CSUM_COUNTERS */ |
#endif /* INET_CSUM_COUNTERS */ |
|
|
|
#ifdef MBUFTRACE |
|
MOWNER_ATTACH(&ip_tx_mowner); |
|
MOWNER_ATTACH(&ip_rx_mowner); |
|
#endif /* MBUFTRACE */ |
} |
} |
|
|
struct sockaddr_in ipaddr = { sizeof(ipaddr), AF_INET }; |
struct sockaddr_in ipaddr = { sizeof(ipaddr), AF_INET }; |
|
|
splx(s); |
splx(s); |
if (m == 0) |
if (m == 0) |
return; |
return; |
|
MCLAIM(m, &ip_rx_mowner); |
ip_input(m); |
ip_input(m); |
} |
} |
} |
} |
Line 399 ip_input(struct mbuf *m) |
|
Line 408 ip_input(struct mbuf *m) |
|
int hlen = 0, mff, len; |
int hlen = 0, mff, len; |
int downmatch; |
int downmatch; |
|
|
|
MCLAIM(m, &ip_rx_mowner); |
#ifdef DIAGNOSTIC |
#ifdef DIAGNOSTIC |
if ((m->m_flags & M_PKTHDR) == 0) |
if ((m->m_flags & M_PKTHDR) == 0) |
panic("ipintr no HDR"); |
panic("ipintr no HDR"); |
Line 413 ip_input(struct mbuf *m) |
|
Line 423 ip_input(struct mbuf *m) |
|
m->m_flags &= ~M_AUTHIPDGM; |
m->m_flags &= ~M_AUTHIPDGM; |
} |
} |
#endif |
#endif |
|
|
/* |
/* |
* If no IP addresses have been set yet but the interfaces |
* If no IP addresses have been set yet but the interfaces |
* are receiving, can't do anything with incoming packets yet. |
* are receiving, can't do anything with incoming packets yet. |
|
|
if (m == 0) |
if (m == 0) |
return ((struct mbuf *)0); |
return ((struct mbuf *)0); |
|
|
|
MCLAIM(m, &inetdomain.dom_mowner); |
#define OPTSIZ (sizeof(ip_srcrt.nop) + sizeof(ip_srcrt.srcopt)) |
#define OPTSIZ (sizeof(ip_srcrt.nop) + sizeof(ip_srcrt.srcopt)) |
|
|
/* length is (nhops+1)*sizeof(addr) + sizeof(nop + srcrt header) */ |
/* length is (nhops+1)*sizeof(addr) + sizeof(nop + srcrt header) */ |
Line 1511 ip_forward(m, srcrt) |
|
Line 1523 ip_forward(m, srcrt) |
|
#endif |
#endif |
|
|
/* |
/* |
|
* We are now in the output path. |
|
*/ |
|
MCLAIM(m, &ip_tx_mowner); |
|
|
|
/* |
* Clear any in-bound checksum flags for this packet. |
* Clear any in-bound checksum flags for this packet. |
*/ |
*/ |
m->m_pkthdr.csum_flags = 0; |
m->m_pkthdr.csum_flags = 0; |
Line 1828 ip_sysctl(name, namelen, oldp, oldlenp, |
|
Line 1845 ip_sysctl(name, namelen, oldp, oldlenp, |
|
case IPCTL_MTUDISC: |
case IPCTL_MTUDISC: |
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 (error == 0 && ip_mtudisc == 0) |
ip_mtudisc_timeout_q = |
rt_timer_queue_remove_all(ip_mtudisc_timeout_q, TRUE); |
rt_timer_queue_create(ip_mtudisc_timeout); |
|
} else if (ip_mtudisc == 0 && ip_mtudisc_timeout_q != NULL) { |
|
rt_timer_queue_destroy(ip_mtudisc_timeout_q, TRUE); |
|
ip_mtudisc_timeout_q = NULL; |
|
} |
|
return error; |
return error; |
case IPCTL_ANONPORTMIN: |
case IPCTL_ANONPORTMIN: |
old = anonportmin; |
old = anonportmin; |
Line 1870 ip_sysctl(name, namelen, oldp, oldlenp, |
|
Line 1882 ip_sysctl(name, namelen, oldp, oldlenp, |
|
ip_mtudisc_timeout = old; |
ip_mtudisc_timeout = old; |
return (EINVAL); |
return (EINVAL); |
} |
} |
if (ip_mtudisc_timeout_q != NULL) |
if (error == 0) |
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); |