diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2001-02-08 14:51:24 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2001-02-08 14:51:24 +0000 |
commit | 3c202e57e0ac6104a9ac1d9c58ea8450a310e2c3 (patch) | |
tree | 03693be914affe097b98006ee0dad043fc27f42c | |
parent | 35eb94911efb3d17fd511aa733e810b77a71fa76 (diff) |
use timeout_xx() throughout sys/netinet6. sync with kame.
-rw-r--r-- | sys/net/net_osdep.h | 15 | ||||
-rw-r--r-- | sys/netinet6/in6_prefix.c | 20 | ||||
-rw-r--r-- | sys/netinet6/in6_prefix.h | 10 | ||||
-rw-r--r-- | sys/netinet6/ip6_input.c | 33 | ||||
-rw-r--r-- | sys/netinet6/ip6_mroute.c | 15 | ||||
-rw-r--r-- | sys/netinet6/nd6.c | 36 | ||||
-rw-r--r-- | sys/netinet6/nd6.h | 7 | ||||
-rw-r--r-- | sys/netinet6/nd6_nbr.c | 30 |
8 files changed, 84 insertions, 82 deletions
diff --git a/sys/net/net_osdep.h b/sys/net/net_osdep.h index 54f11da861e..0c7d6c19df4 100644 --- a/sys/net/net_osdep.h +++ b/sys/net/net_osdep.h @@ -1,5 +1,5 @@ -/* $OpenBSD: net_osdep.h,v 1.4 2001/02/06 01:31:57 itojun Exp $ */ -/* $KAME: net_osdep.h,v 1.33 2001/01/31 09:36:16 jinmei Exp $ */ +/* $OpenBSD: net_osdep.h,v 1.5 2001/02/08 14:51:21 itojun Exp $ */ +/* $KAME: net_osdep.h,v 1.36 2001/02/08 10:21:27 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -56,9 +56,9 @@ * note that cloned routes from an interface direct route * still remain. * NetBSD: official release versions (the latest is 1.5 as of Jan. 2001) - * have no side effects. KAME for NetBSD has the same effects - * as of BSDI. - * OpenBSD: no side effects. + * have no side effects. KAME for NetBSD has the same effects + * as of BSDI. + * OpenBSD: no side effects. * * - privileged process * NetBSD, FreeBSD 3 @@ -108,6 +108,8 @@ * timeout() is non-void, must keep returned value for untimeout() * NetBSD 1.5 * timeout() is obsoleted, use callout_xx (sys/callout.h) + * OpenBSD 2.8 + * timeout_{add,set,del} is encouraged (sys/timeout.h) * - sysctl * NetBSD, OpenBSD * foo_sysctl() @@ -141,7 +143,8 @@ * - struct ifnet for loopback interface * BSDI3: struct ifnet loif; * BSDI4: struct ifnet *loifp; - * NetBSD, OpenBSD, FreeBSD2: struct ifnet loif[NLOOP]; + * NetBSD, OpenBSD 2.8, FreeBSD2: struct ifnet loif[NLOOP]; + * OpenBSD 2.9: struct ifnet *lo0ifp; * * odd thing is that many of them refers loif as ifnet *loif, * not loif[NLOOP], from outside of if_loop.c. diff --git a/sys/netinet6/in6_prefix.c b/sys/netinet6/in6_prefix.c index c9a23f5ea79..d1b57d9f34e 100644 --- a/sys/netinet6/in6_prefix.c +++ b/sys/netinet6/in6_prefix.c @@ -1,5 +1,5 @@ -/* $OpenBSD: in6_prefix.c,v 1.7 2000/12/29 02:15:08 itojun Exp $ */ -/* $KAME: in6_prefix.c,v 1.29 2000/06/07 05:59:38 itojun Exp $ */ +/* $OpenBSD: in6_prefix.c,v 1.8 2001/02/08 14:51:22 itojun Exp $ */ +/* $KAME: in6_prefix.c,v 1.45 2001/02/08 11:33:32 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -86,6 +86,8 @@ struct rr_prhead rr_prefix; +struct timeout in6_rr_timer_ch; + #include <net/net_osdep.h> static void add_each_addr __P((struct socket *so, struct rr_prefix *rpp, @@ -379,7 +381,7 @@ search_ifidwithprefix(struct rr_prefix *rpp, struct in6_addr *ifid) } static int -assigne_ra_entry(struct rr_prefix *rpp, int iilen, struct in6_ifaddr *ia) +assign_ra_entry(struct rr_prefix *rpp, int iilen, struct in6_ifaddr *ia) { int error = 0; struct rp_addr *rap; @@ -514,7 +516,7 @@ in6_prefix_add_ifid(int iilen, struct in6_ifaddr *ia) } else if (rap->ra_addr != ia) { /* There may be some inconsistencies between addrs. */ log(LOG_ERR, "ip6_prefix.c: addr %s/%d matched prefix" - "has already another ia %p(%s) on its ifid list\n", + " already has another ia %p(%s) on its ifid list\n", ip6_sprintf(IA6_IN6(ia)), plen, rap->ra_addr, ip6_sprintf(IA6_IN6(rap->ra_addr))); @@ -523,7 +525,7 @@ in6_prefix_add_ifid(int iilen, struct in6_ifaddr *ia) ia->ia6_ifpr = ifpr; return 0; } - error = assigne_ra_entry(ifpr2rp(ifpr), iilen, ia); + error = assign_ra_entry(ifpr2rp(ifpr), iilen, ia); if (error == 0) ia->ia6_ifpr = ifpr; return (error); @@ -633,12 +635,13 @@ add_each_addr(struct socket *so, struct rr_prefix *rpp, struct rp_addr *rap) ifra.ifra_flags |= IN6_IFF_ANYCAST; error = in6_control(so, SIOCAIFADDR_IN6, (caddr_t)&ifra, rpp->rp_ifp , curproc); - if (error != 0) + if (error != 0) { log(LOG_ERR, "in6_prefix.c: add_each_addr: addition of an addr" "%s/%d failed because in6_control failed for error %d\n", ip6_sprintf(&ifra.ifra_addr.sin6_addr), rpp->rp_plen, error); return; + } /* * link beween this addr and the prefix will be done @@ -1014,7 +1017,7 @@ link_stray_ia6s(struct rr_prefix *rpp) rpp->rp_plen); continue; } - if ((error = assigne_ra_entry(rpp, + if ((error = assign_ra_entry(rpp, (sizeof(rap->ra_ifid) << 3) - rpp->rp_plen, (struct in6_ifaddr *)ifa)) != 0) @@ -1159,7 +1162,8 @@ in6_rr_timer(void *ignored_arg) struct rr_prefix *rpp; long time_second = time.tv_sec; - timeout(in6_rr_timer, (caddr_t)0, ip6_rr_prune * hz); + timeout_set(&in6_rr_timer_ch, in6_rr_timer, NULL); + timeout_add(&in6_rr_timer_ch, ip6_rr_prune * hz); s = splnet(); /* expire */ diff --git a/sys/netinet6/in6_prefix.h b/sys/netinet6/in6_prefix.h index f6856a61aa9..c8ba52446ff 100644 --- a/sys/netinet6/in6_prefix.h +++ b/sys/netinet6/in6_prefix.h @@ -1,9 +1,10 @@ -/* $OpenBSD: in6_prefix.h,v 1.2 2000/02/04 18:13:36 itojun Exp $ */ +/* $OpenBSD: in6_prefix.h,v 1.3 2001/02/08 14:51:22 itojun Exp $ */ +/* $KAME: in6_prefix.h,v 1.9 2001/02/08 10:57:00 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, 1998 and 1999 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -15,7 +16,7 @@ * 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 * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -29,6 +30,8 @@ * SUCH DAMAGE. */ +#include <sys/timeout.h> + struct rr_prefix { struct ifprefix rp_ifpr; LIST_ENTRY(rr_prefix) rp_entry; @@ -84,4 +87,5 @@ LIST_HEAD(rr_prhead, rr_prefix); extern struct rr_prhead rr_prefix; void in6_rr_timer __P((void *)); +extern struct timeout in6_rr_timer_ch; int delete_each_prefix __P((struct rr_prefix *rpp, u_char origin)); diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 67de254f5c1..47865f2091a 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ip6_input.c,v 1.21 2001/02/07 11:43:53 itojun Exp $ */ -/* $KAME: ip6_input.c,v 1.170 2001/02/07 07:50:02 itojun Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.22 2001/02/08 14:51:22 itojun Exp $ */ +/* $KAME: ip6_input.c,v 1.172 2001/02/08 11:18:05 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -187,9 +187,14 @@ ip6_init2(dummy) #endif /* nd6_timer_init */ - timeout(nd6_timer, (caddr_t)0, hz); + bzero(&nd6_timer_ch, sizeof(nd6_timer_ch)); + timeout_set(&nd6_timer_ch, nd6_timer, NULL); + timeout_add(&nd6_timer_ch, hz); + /* router renumbering prefix list maintenance */ - timeout(in6_rr_timer, (caddr_t)0, hz); + bzero(&in6_rr_timer_ch, sizeof(in6_rr_timer_ch)); + timeout_set(&in6_rr_timer_ch, in6_rr_timer, (caddr_t)0); + timeout_add(&in6_rr_timer_ch, hz); } /* @@ -207,24 +212,6 @@ ip6intr() splx(s); if (m == 0) return; -#ifndef PULLDOWN_TEST - /* - * KAME requirement: make sure mbuf is packed well - */ - - if (m->m_next) { - int l; - if (m->m_pkthdr.len > MCLBYTES) - l = MCLBYTES; - else - l = m->m_pkthdr.len; - if (l > m->m_len) { - m = m_pullup2(m, l); - if (!m) - continue; - } - } -#endif ip6_input(m); } } @@ -1275,7 +1262,7 @@ ip6_get_prevhdr(m, off) while (len < off) { ip6e = (struct ip6_ext *)(mtod(m, caddr_t) + len); - switch(nxt) { + switch (nxt) { case IPPROTO_FRAGMENT: len += sizeof(struct ip6_frag); break; diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index 24d4d1c2eab..5717aca1281 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ip6_mroute.c,v 1.8 2000/11/10 15:33:11 provos Exp $ */ -/* $KAME: ip6_mroute.c,v 1.33 2000/10/19 02:23:43 jinmei Exp $ */ +/* $OpenBSD: ip6_mroute.c,v 1.9 2001/02/08 14:51:22 itojun Exp $ */ +/* $KAME: ip6_mroute.c,v 1.37 2001/02/08 10:57:00 itojun Exp $ */ /* * Copyright (C) 1998 WIDE Project. @@ -53,6 +53,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/timeout.h> #include <sys/mbuf.h> #include <sys/socket.h> #include <sys/socketvar.h> @@ -222,6 +223,8 @@ static int del_m6if __P((mifi_t *)); static int add_m6fc __P((struct mf6cctl *)); static int del_m6fc __P((struct mf6cctl *)); +static struct timeout expire_upcalls_ch; + /* * Handle MRT setsockopt commands to modify the multicast routing tables. */ @@ -410,7 +413,8 @@ ip6_mrouter_init(so, m, cmd) pim6 = 0;/* used for stubbing out/in pim stuff */ - timeout(expire_upcalls, (caddr_t)NULL, EXPIRE_TIMEOUT); + timeout_set(&expire_upcalls_ch, expire_upcalls, NULL); + timeout_add(&expire_upcalls_ch, EXPIRE_TIMEOUT); #ifdef MRT6DEBUG if (mrt6debug) @@ -472,7 +476,7 @@ ip6_mrouter_done() pim6 = 0; /* used to stub out/in pim specific code */ - untimeout(expire_upcalls, (caddr_t)NULL); + timeout_del(&expire_upcalls_ch); /* * Free all multicast forwarding cache entries. @@ -1239,7 +1243,8 @@ expire_upcalls(unused) } } splx(s); - timeout(expire_upcalls, (caddr_t)NULL, EXPIRE_TIMEOUT); + timeout_set(&expire_upcalls_ch, expire_upcalls, NULL); + timeout_add(&expire_upcalls_ch, EXPIRE_TIMEOUT); } /* diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index c7abb5797c0..b91584497cc 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,5 +1,5 @@ -/* $OpenBSD: nd6.c,v 1.22 2001/02/07 11:43:54 itojun Exp $ */ -/* $KAME: nd6.c,v 1.110 2001/02/06 09:14:38 jinmei Exp $ */ +/* $OpenBSD: nd6.c,v 1.23 2001/02/08 14:51:22 itojun Exp $ */ +/* $KAME: nd6.c,v 1.114 2001/02/08 10:57:00 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -40,6 +40,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/timeout.h> #include <sys/malloc.h> #include <sys/mbuf.h> #include <sys/socket.h> @@ -109,6 +110,10 @@ static struct sockaddr_in6 all1_sa; static void nd6_slowtimo __P((void *)); +struct timeout nd6_slowtimo_ch; +struct timeout nd6_timer_ch; +extern struct timeout in6_tmpaddrtimer_ch; + void nd6_init() { @@ -131,7 +136,8 @@ nd6_init() nd6_init_done = 1; /* start timer */ - timeout(nd6_slowtimo, (caddr_t)0, ND6_SLOWTIMER_INTERVAL * hz); + timeout_set(&nd6_slowtimo_ch, nd6_slowtimo, NULL); + timeout_add(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz); } void @@ -376,14 +382,15 @@ nd6_timer(ignored_arg) void *ignored_arg; { int s; - register struct llinfo_nd6 *ln; - register struct nd_defrouter *dr; - register struct nd_prefix *pr; + struct llinfo_nd6 *ln; + struct nd_defrouter *dr; + struct nd_prefix *pr; long time_second = time.tv_sec; s = splnet(); - timeout(nd6_timer, (caddr_t)0, nd6_prune * hz); + timeout_set(&nd6_timer_ch, nd6_timer, NULL); + timeout_add(&nd6_timer_ch, nd6_prune * hz); ln = llinfo_nd6.ln_next; /* XXX BSD/OS separates this code -- itojun */ @@ -740,7 +747,7 @@ nd6_is_addr_neighbor(addr, ifp) struct sockaddr_in6 *addr; struct ifnet *ifp; { - register struct ifaddr *ifa; + struct ifaddr *ifa; int i; #define IFADDR6(a) ((((struct in6_ifaddr *)(a))->ia_addr).sin6_addr) @@ -1729,10 +1736,11 @@ nd6_slowtimo(ignored_arg) void *ignored_arg; { int s = splnet(); - register int i; - register struct nd_ifinfo *nd6if; + int i; + struct nd_ifinfo *nd6if; - timeout(nd6_slowtimo, (caddr_t)0, ND6_SLOWTIMER_INTERVAL * hz); + timeout_set(&nd6_slowtimo_ch, nd6_slowtimo, NULL); + timeout_add(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz); for (i = 1; i < if_index + 1; i++) { if (!nd_ifinfo || i >= nd_ifinfo_indexlim) continue; @@ -1755,14 +1763,14 @@ nd6_slowtimo(ignored_arg) #define senderr(e) { error = (e); goto bad;} int nd6_output(ifp, origifp, m0, dst, rt0) - register struct ifnet *ifp; + struct ifnet *ifp; struct ifnet *origifp; struct mbuf *m0; struct sockaddr_in6 *dst; struct rtentry *rt0; { - register struct mbuf *m = m0; - register struct rtentry *rt = rt0; + struct mbuf *m = m0; + struct rtentry *rt = rt0; struct sockaddr_in6 *gw6 = NULL; struct llinfo_nd6 *ln = NULL; int error = 0; diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index 62851f3ac48..f22b6bbd787 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -1,5 +1,5 @@ -/* $OpenBSD: nd6.h,v 1.10 2001/02/07 11:43:54 itojun Exp $ */ -/* $KAME: nd6.h,v 1.42 2001/02/06 09:14:39 jinmei Exp $ */ +/* $OpenBSD: nd6.h,v 1.11 2001/02/08 14:51:22 itojun Exp $ */ +/* $KAME: nd6.h,v 1.46 2001/02/08 10:57:00 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -39,6 +39,7 @@ #endif #include <sys/queue.h> +#include <sys/timeout.h> struct llinfo_nd6 { struct llinfo_nd6 *ln_next; @@ -240,6 +241,8 @@ extern int nd6_debug; #define nd6log(x) do { if (nd6_debug) log x; } while (0) +extern struct timeout nd6_timer_ch; + /* nd6_rtr.c */ extern struct ifnet *nd6_defifp; /* XXXYYY */ extern int nd6_defifindex; diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index f55551520a6..fdddd70a55a 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,5 +1,5 @@ -/* $OpenBSD: nd6_nbr.c,v 1.12 2001/02/07 11:43:54 itojun Exp $ */ -/* $KAME: nd6_nbr.c,v 1.57 2001/02/07 08:18:21 itojun Exp $ */ +/* $OpenBSD: nd6_nbr.c,v 1.13 2001/02/08 14:51:23 itojun Exp $ */ +/* $KAME: nd6_nbr.c,v 1.58 2001/02/08 10:57:00 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -42,6 +42,7 @@ #include <sys/ioctl.h> #include <sys/syslog.h> #include <sys/queue.h> +#include <sys/timeout.h> #include <net/if.h> #include <net/if_types.h> @@ -954,6 +955,7 @@ struct dadq { int dad_ns_ocount; /* NS sent so far */ int dad_ns_icount; int dad_na_icount; + struct timeout dad_timer_ch; }; static struct dadq_head dadq; @@ -978,16 +980,9 @@ nd6_dad_starttimer(dp, ticks) int ticks; { -#ifdef __NetBSD__ - callout_reset(&dp->dad_timer_ch, ticks, - (void (*) __P((void *)))nd6_dad_timer, (void *)dp->dad_ifa); -#else -#if defined(__FreeBSD__) && __FreeBSD__ >= 3 - dp->dad_timer = -#endif - timeout((void (*) __P((void *)))nd6_dad_timer, (void *)dp->dad_ifa, - ticks); -#endif + timeout_set(&dp->dad_timer_ch, (void (*) __P((void *)))nd6_dad_timer, + (void *)dp->dad_ifa); + timeout_add(&dp->dad_timer_ch, ticks); } static void @@ -995,15 +990,7 @@ nd6_dad_stoptimer(dp) struct dadq *dp; { -#ifdef __NetBSD__ - callout_stop(&dp->dad_timer_ch); -#else - untimeout((void (*) __P((void *)))nd6_dad_timer, (void *)dp->dad_ifa -#if defined(__FreeBSD__) && __FreeBSD__ >= 3 - , dp->dad_timer -#endif - ); -#endif + timeout_del(&dp->dad_timer_ch); } /* @@ -1062,6 +1049,7 @@ nd6_dad_start(ifa, tick) return; } bzero(dp, sizeof(*dp)); + bzero(&dp->dad_timer_ch, sizeof(dp->dad_timer_ch)); TAILQ_INSERT_TAIL(&dadq, (struct dadq *)dp, dad_list); nd6log((LOG_DEBUG, "%s: starting DAD for %s\n", if_name(ifa->ifa_ifp), |