PERFORCE change 39849 for review
Sam Leffler
sam at FreeBSD.org
Fri Oct 17 11:14:04 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=39849
Change 39849 by sam at sam_ebb on 2003/10/17 11:13:27
IFC @ 39848
Affected files ...
.. //depot/projects/netperf/sys/dev/ath/if_ath.c#23 integrate
.. //depot/projects/netperf/sys/ia64/ia64/machdep.c#11 integrate
.. //depot/projects/netperf/sys/kern/kern_idle.c#2 integrate
.. //depot/projects/netperf/sys/kern/sched_4bsd.c#6 integrate
.. //depot/projects/netperf/sys/kern/sched_ule.c#10 integrate
.. //depot/projects/netperf/sys/kern/vfs_subr.c#7 integrate
.. //depot/projects/netperf/sys/net/if.c#7 integrate
.. //depot/projects/netperf/sys/net/if_var.h#2 integrate
.. //depot/projects/netperf/sys/net/route.c#16 integrate
.. //depot/projects/netperf/sys/netinet/icmp6.h#4 integrate
.. //depot/projects/netperf/sys/netinet/ip_dummynet.c#11 integrate
.. //depot/projects/netperf/sys/netinet/ip_input.c#13 integrate
.. //depot/projects/netperf/sys/netinet/tcp_input.c#3 integrate
.. //depot/projects/netperf/sys/netinet6/icmp6.c#7 integrate
.. //depot/projects/netperf/sys/netinet6/in6.c#8 integrate
.. //depot/projects/netperf/sys/netinet6/in6_ifattach.c#9 integrate
.. //depot/projects/netperf/sys/netinet6/in6_proto.c#5 integrate
.. //depot/projects/netperf/sys/netinet6/in6_src.c#6 integrate
.. //depot/projects/netperf/sys/netinet6/in6_var.h#3 integrate
.. //depot/projects/netperf/sys/netinet6/ip6_input.c#10 integrate
.. //depot/projects/netperf/sys/netinet6/ip6_output.c#14 integrate
.. //depot/projects/netperf/sys/netinet6/nd6.c#11 integrate
.. //depot/projects/netperf/sys/netinet6/nd6.h#4 integrate
.. //depot/projects/netperf/sys/netinet6/nd6_nbr.c#4 integrate
.. //depot/projects/netperf/sys/netinet6/nd6_rtr.c#7 integrate
.. //depot/projects/netperf/sys/netinet6/scope6.c#4 integrate
.. //depot/projects/netperf/sys/netinet6/scope6_var.h#3 integrate
.. //depot/projects/netperf/sys/sys/domain.h#4 integrate
.. //depot/projects/netperf/sys/sys/kernel.h#2 integrate
.. //depot/projects/netperf/sys/ufs/ffs/ffs_snapshot.c#4 integrate
.. //depot/projects/netperf/sys/vm/vm_pageout.c#7 integrate
Differences ...
==== //depot/projects/netperf/sys/dev/ath/if_ath.c#23 (text+ko) ====
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.25 2003/10/14 22:51:45 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.26 2003/10/16 16:13:11 sam Exp $");
/*
* Driver for the Atheros Wireless LAN controller.
==== //depot/projects/netperf/sys/ia64/ia64/machdep.c#11 (text+ko) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/ia64/ia64/machdep.c,v 1.157 2003/10/03 03:50:29 marcel Exp $
+ * $FreeBSD: src/sys/ia64/ia64/machdep.c,v 1.158 2003/10/17 02:24:59 marcel Exp $
*/
#include "opt_compat.h"
@@ -272,13 +272,21 @@
}
void
-cpu_halt(void)
+cpu_halt()
{
ia64_efi_runtime->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, 0);
}
void
+cpu_idle()
+{
+ struct ia64_pal_result res;
+
+ res = ia64_call_pal_static(PAL_HALT_LIGHT, 0, 0, 0);
+}
+
+void
cpu_reset()
{
==== //depot/projects/netperf/sys/kern/kern_idle.c#2 (text+ko) ====
@@ -4,7 +4,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_idle.c,v 1.32 2003/06/11 00:56:55 obrien Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_idle.c,v 1.34 2003/10/17 03:49:03 peter Exp $");
#include "opt_ktrace.h"
@@ -112,7 +112,7 @@
" for a process");
#endif
-#ifdef __i386__
+#if defined(__i386__) || defined(__amd64__) || defined(__ia64__)
cpu_idle();
#endif
}
==== //depot/projects/netperf/sys/kern/sched_4bsd.c#6 (text+ko) ====
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.24 2003/10/16 08:53:46 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.25 2003/10/16 21:13:14 jeff Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -723,5 +723,11 @@
fixpt_t
sched_pctcpu(struct thread *td)
{
- return (td->td_kse->ke_pctcpu);
+ struct kse *ke;
+
+ ke = td->td_kse;
+ if (ke)
+ return (ke->ke_pctcpu);
+
+ return (0);
}
==== //depot/projects/netperf/sys/kern/sched_ule.c#10 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.63 2003/10/16 10:04:54 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.65 2003/10/16 20:32:57 jeff Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -462,7 +462,7 @@
kseq_rem(from, ke);
ke->ke_cpu = cpu;
- sched_add(ke);
+ sched_add(ke->ke_thread);
}
#endif
@@ -815,14 +815,16 @@
runq_add(ke->ke_runq, ke);
/* setrunqueue(td); */
}
- } else if (ke->ke_runq)
- kseq_rem(KSEQ_CPU(ke->ke_cpu), ke);
- /*
- * We will not be on the run queue. So we must be
- * sleeping or similar.
- */
- if (td->td_proc->p_flag & P_SA)
- kse_reassign(ke);
+ } else {
+ if (ke->ke_runq)
+ kseq_rem(KSEQ_CPU(ke->ke_cpu), ke);
+ /*
+ * We will not be on the run queue. So we must be
+ * sleeping or similar.
+ */
+ if (td->td_proc->p_flag & P_SA)
+ kse_reassign(ke);
+ }
sched_nest = sched_lock.mtx_recurse;
newtd = choosethread();
if (td != newtd)
==== //depot/projects/netperf/sys/kern/vfs_subr.c#7 (text+ko) ====
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/vfs_subr.c,v 1.467 2003/10/12 14:04:39 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/vfs_subr.c,v 1.468 2003/10/17 11:56:48 phk Exp $");
#include "opt_ddb.h"
#include "opt_mac.h"
@@ -2838,12 +2838,12 @@
count_dev(dev)
dev_t dev;
{
- struct vnode *vp;
+ int count;
- vp = SLIST_FIRST(&dev->si_hlist);
- if (vp == NULL)
- return (0);
- return(vcount(vp));
+ mtx_lock(&spechash_mtx);
+ count = dev->si_usecount;
+ mtx_unlock(&spechash_mtx);
+ return(count);
}
/*
==== //depot/projects/netperf/sys/net/if.c#7 (text+ko) ====
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if.c 8.5 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/net/if.c,v 1.167 2003/10/16 13:38:29 ume Exp $
+ * $FreeBSD: src/sys/net/if.c,v 1.168 2003/10/17 15:46:30 ume Exp $
*/
#include "opt_compat.h"
@@ -54,6 +54,7 @@
#include <sys/sockio.h>
#include <sys/syslog.h>
#include <sys/sysctl.h>
+#include <sys/domain.h>
#include <sys/jail.h>
#include <machine/stdarg.h>
@@ -78,6 +79,8 @@
#include <netinet/if_ether.h>
#endif
+static void if_attachdomain(void *);
+static void if_attachdomain1(struct ifnet *);
static int ifconf(u_long, caddr_t);
static void if_grow(void);
static void if_init(void *);
@@ -442,10 +445,48 @@
}
ifp->if_broadcastaddr = 0; /* reliably crash if used uninitialized */
+ if (domains)
+ if_attachdomain1(ifp);
+
/* Announce the interface. */
rt_ifannouncemsg(ifp, IFAN_ARRIVAL);
}
+static void
+if_attachdomain(dummy)
+ void *dummy;
+{
+ struct ifnet *ifp;
+ int s;
+
+ s = splnet();
+ for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list))
+ if_attachdomain1(ifp);
+ splx(s);
+}
+SYSINIT(domainifattach, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_FIRST,
+ if_attachdomain, NULL);
+
+static void
+if_attachdomain1(ifp)
+ struct ifnet *ifp;
+{
+ struct domain *dp;
+ int s;
+
+ s = splnet();
+
+ /* address family dependent data region */
+ bzero(ifp->if_afdata, sizeof(ifp->if_afdata));
+ for (dp = domains; dp; dp = dp->dom_next) {
+ if (dp->dom_ifattach)
+ ifp->if_afdata[dp->dom_family] =
+ (*dp->dom_ifattach)(ifp);
+ }
+
+ splx(s);
+}
+
/*
* Detach an interface, removing it from the
* list of "active" interfaces.
@@ -458,6 +499,7 @@
struct radix_node_head *rnh;
int s;
int i;
+ struct domain *dp;
/*
* Remove routes and flush queues.
@@ -538,6 +580,12 @@
/* Announce that the interface is gone. */
rt_ifannouncemsg(ifp, IFAN_DEPARTURE);
+ for (dp = domains; dp; dp = dp->dom_next) {
+ if (dp->dom_ifdetach && ifp->if_afdata[dp->dom_family])
+ (*dp->dom_ifdetach)(ifp,
+ ifp->if_afdata[dp->dom_family]);
+ }
+
#ifdef MAC
mac_destroy_ifnet(ifp);
#endif /* MAC */
==== //depot/projects/netperf/sys/net/if_var.h#2 (text+ko) ====
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* From: @(#)if.h 8.1 (Berkeley) 6/10/93
- * $FreeBSD: src/sys/net/if_var.h,v 1.58 2003/01/01 18:48:54 schweikh Exp $
+ * $FreeBSD: src/sys/net/if_var.h,v 1.59 2003/10/17 15:46:30 ume Exp $
*/
#ifndef _NET_IF_VAR_H_
@@ -178,6 +178,8 @@
struct ifprefixhead if_prefixhead; /* list of prefixes per if */
u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */
struct label if_label; /* interface MAC label */
+
+ void *if_afdata[AF_MAX];
};
typedef void if_init_f_t(void *);
==== //depot/projects/netperf/sys/net/route.c#16 (text+ko) ====
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)route.c 8.3.1.1 (Berkeley) 2/23/95
- * $FreeBSD: src/sys/net/route.c,v 1.86 2003/10/11 04:48:35 sam Exp $
+ * $FreeBSD: src/sys/net/route.c,v 1.87 2003/10/16 16:17:17 sam Exp $
*/
#include "opt_inet.h"
==== //depot/projects/netperf/sys/netinet/icmp6.h#4 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet/icmp6.h,v 1.11 2003/10/07 15:14:33 ume Exp $ */
+/* $FreeBSD: src/sys/netinet/icmp6.h,v 1.12 2003/10/17 15:46:30 ume Exp $ */
/* $KAME: icmp6.h,v 1.46 2001/04/27 15:09:48 itojun Exp $ */
/*
@@ -649,11 +649,8 @@
/* XXX: is this the right place for these macros? */
#define icmp6_ifstat_inc(ifp, tag) \
do { \
- if ((ifp) && (ifp)->if_index <= if_index \
- && (ifp)->if_index < icmp6_ifstatmax \
- && icmp6_ifstat && icmp6_ifstat[(ifp)->if_index]) { \
- icmp6_ifstat[(ifp)->if_index]->tag++; \
- } \
+ if (ifp) \
+ ((struct in6_ifextra *)((ifp)->if_afdata[AF_INET6]))->icmp6_ifstat->tag++; \
} while (/*CONSTCOND*/ 0)
#define icmp6_ifoutstat_inc(ifp, type, code) \
@@ -661,7 +658,7 @@
icmp6_ifstat_inc(ifp, ifs6_out_msg); \
if (type < ICMP6_INFOMSG_MASK) \
icmp6_ifstat_inc(ifp, ifs6_out_error); \
- switch(type) { \
+ switch (type) { \
case ICMP6_DST_UNREACH: \
icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
if (code == ICMP6_DST_UNREACH_ADMIN) \
==== //depot/projects/netperf/sys/netinet/ip_dummynet.c#11 (text+ko) ====
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/netinet/ip_dummynet.c,v 1.69 2003/09/17 00:54:04 sam Exp $
+ * $FreeBSD: src/sys/netinet/ip_dummynet.c,v 1.70 2003/10/16 16:21:25 sam Exp $
*/
#define DUMMYNET_DEBUG
==== //depot/projects/netperf/sys/netinet/ip_input.c#13 (text+ko) ====
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ip_input.c 8.2 (Berkeley) 1/4/94
- * $FreeBSD: src/sys/netinet/ip_input.c,v 1.245 2003/10/15 18:19:28 sam Exp $
+ * $FreeBSD: src/sys/netinet/ip_input.c,v 1.246 2003/10/16 16:25:25 sam Exp $
*/
#include "opt_bootp.h"
==== //depot/projects/netperf/sys/netinet/tcp_input.c#3 (text+ko) ====
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_input.c 8.12 (Berkeley) 5/24/95
- * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.208 2003/08/13 08:46:54 harti Exp $
+ * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.209 2003/10/17 15:46:30 ume Exp $
*/
#include "opt_ipfw.h" /* for ipfw_fwd */
@@ -2712,8 +2712,7 @@
mss = rt->rt_rmx.rmx_mtu - min_protoh;
else {
if (isipv6) {
- mss = nd_ifinfo[rt->rt_ifp->if_index].linkmtu -
- min_protoh;
+ mss = ND_IFINFO(rt->rt_ifp)->linkmtu - min_protoh;
if (!in6_localaddr(&inp->in6p_faddr))
mss = min(mss, tcp_v6mssdflt);
} else {
==== //depot/projects/netperf/sys/netinet6/icmp6.c#7 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/icmp6.c,v 1.38 2003/10/10 16:04:00 ume Exp $ */
+/* $FreeBSD: src/sys/netinet6/icmp6.c,v 1.39 2003/10/17 15:46:31 ume Exp $ */
/* $KAME: icmp6.c,v 1.211 2001/04/04 05:56:20 itojun Exp $ */
/*
@@ -2158,7 +2158,7 @@
ip6->ip6_nxt = IPPROTO_ICMPV6;
if (m->m_pkthdr.rcvif) {
/* XXX: This may not be the outgoing interface */
- ip6->ip6_hlim = nd_ifinfo[m->m_pkthdr.rcvif->if_index].chlim;
+ ip6->ip6_hlim = ND_IFINFO(m->m_pkthdr.rcvif)->chlim;
} else
ip6->ip6_hlim = ip6_defhlim;
==== //depot/projects/netperf/sys/netinet6/in6.c#8 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/in6.c,v 1.30 2003/10/10 16:04:00 ume Exp $ */
+/* $FreeBSD: src/sys/netinet6/in6.c,v 1.33 2003/10/17 17:50:09 ume Exp $ */
/* $KAME: in6.c,v 1.259 2002/01/21 11:37:50 keiichi Exp $ */
/*
@@ -281,30 +281,6 @@
}
int
-in6_ifindex2scopeid(idx)
- int idx;
-{
- struct ifnet *ifp;
- struct ifaddr *ifa;
- struct sockaddr_in6 *sin6;
-
- if (idx < 0 || if_index < idx)
- return -1;
- ifp = ifnet_byindex(idx);
-
- TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list)
- {
- if (ifa->ifa_addr->sa_family != AF_INET6)
- continue;
- sin6 = (struct sockaddr_in6 *)ifa->ifa_addr;
- if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))
- return sin6->sin6_scope_id & 0xffff;
- }
-
- return -1;
-}
-
-int
in6_mask2len(mask, lim0)
struct in6_addr *mask;
u_char *lim0;
@@ -342,20 +318,6 @@
return x * 8 + y;
}
-void
-in6_len2mask(mask, len)
- struct in6_addr *mask;
- int len;
-{
- int i;
-
- bzero(mask, sizeof(*mask));
- for (i = 0; i < len / 8; i++)
- mask->s6_addr8[i] = 0xff;
- if (len % 8)
- mask->s6_addr8[i] = (0xff00 >> (len % 8)) & 0xff;
-}
-
#define ifa2ia6(ifa) ((struct in6_ifaddr *)(ifa))
#define ia62ifa(ia6) (&((ia6)->ia_ifa))
@@ -420,14 +382,14 @@
case SIOCSSCOPE6:
if (!privileged)
return (EPERM);
- return (scope6_set(ifp, ifr->ifr_ifru.ifru_scope_id));
- break;
+ return (scope6_set(ifp,
+ (struct scope6_id *)ifr->ifr_ifru.ifru_scope_id));
case SIOCGSCOPE6:
- return (scope6_get(ifp, ifr->ifr_ifru.ifru_scope_id));
- break;
+ return (scope6_get(ifp,
+ (struct scope6_id *)ifr->ifr_ifru.ifru_scope_id));
case SIOCGSCOPE6DEF:
- return (scope6_get_default(ifr->ifr_ifru.ifru_scope_id));
- break;
+ return (scope6_get_default((struct scope6_id *)
+ ifr->ifr_ifru.ifru_scope_id));
}
switch (cmd) {
@@ -562,26 +524,19 @@
case SIOCGIFSTAT_IN6:
if (ifp == NULL)
return EINVAL;
- if (in6_ifstat == NULL || ifp->if_index >= in6_ifstatmax
- || in6_ifstat[ifp->if_index] == NULL) {
- /* return EAFNOSUPPORT? */
- bzero(&ifr->ifr_ifru.ifru_stat,
- sizeof(ifr->ifr_ifru.ifru_stat));
- } else
- ifr->ifr_ifru.ifru_stat = *in6_ifstat[ifp->if_index];
+ bzero(&ifr->ifr_ifru.ifru_stat,
+ sizeof(ifr->ifr_ifru.ifru_stat));
+ ifr->ifr_ifru.ifru_stat =
+ *((struct in6_ifextra *)ifp->if_afdata[AF_INET6])->in6_ifstat;
break;
case SIOCGIFSTAT_ICMP6:
if (ifp == NULL)
return EINVAL;
- if (icmp6_ifstat == NULL || ifp->if_index >= icmp6_ifstatmax ||
- icmp6_ifstat[ifp->if_index] == NULL) {
- /* return EAFNOSUPPORT? */
- bzero(&ifr->ifr_ifru.ifru_stat,
- sizeof(ifr->ifr_ifru.ifru_icmp6stat));
- } else
- ifr->ifr_ifru.ifru_icmp6stat =
- *icmp6_ifstat[ifp->if_index];
+ bzero(&ifr->ifr_ifru.ifru_stat,
+ sizeof(ifr->ifr_ifru.ifru_icmp6stat));
+ ifr->ifr_ifru.ifru_icmp6stat =
+ *((struct in6_ifextra *)ifp->if_afdata[AF_INET6])->icmp6_ifstat;
break;
case SIOCGIFALIFETIME_IN6:
@@ -1110,13 +1065,6 @@
ia->ia6_lifetime.ia6t_preferred = 0;
/*
- * make sure to initialize ND6 information. this is to workaround
- * issues with interfaces with IPv6 addresses, which have never brought
- * up. We are assuming that it is safe to nd6_ifattach multiple times.
- */
- nd6_ifattach(ifp);
-
- /*
* Perform DAD, if needed.
* XXX It may be of use, if we can administratively
* disable DAD.
@@ -1401,7 +1349,7 @@
}
ifra.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6);
- in6_len2mask(&ifra.ifra_prefixmask.sin6_addr, prefixlen);
+ in6_prefixlen2mask(&ifra.ifra_prefixmask.sin6_addr, prefixlen);
ifra.ifra_flags = iflr->flags & ~IFLR_PREFIX;
return in6_control(so, SIOCAIFADDR_IN6, (caddr_t)&ifra, ifp, td);
@@ -1417,7 +1365,7 @@
bzero(&mask, sizeof(mask));
if (iflr->flags & IFLR_PREFIX) {
/* lookup a prefix rather than address. */
- in6_len2mask(&mask, iflr->prefixlen);
+ in6_prefixlen2mask(&mask, iflr->prefixlen);
sin6 = (struct sockaddr_in6 *)&iflr->addr;
bcopy(&sin6->sin6_addr, &match, sizeof(match));
@@ -1437,7 +1385,7 @@
cmp = 0; /* XXX */
} else {
/* on deleting an address, do exact match */
- in6_len2mask(&mask, 128);
+ in6_prefixlen2mask(&mask, 128);
sin6 = (struct sockaddr_in6 *)&iflr->addr;
bcopy(&sin6->sin6_addr, &match, sizeof(match));
@@ -2341,14 +2289,51 @@
IFNET_RLOCK();
for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) {
if ((ifp->if_flags & IFF_LOOPBACK) == 0 &&
- nd_ifinfo[ifp->if_index].linkmtu > maxmtu)
- maxmtu = nd_ifinfo[ifp->if_index].linkmtu;
+ ND_IFINFO(ifp)->linkmtu > maxmtu)
+ maxmtu = ND_IFINFO(ifp)->linkmtu;
}
IFNET_RUNLOCK();
if (maxmtu) /* update only when maxmtu is positive */
in6_maxmtu = maxmtu;
}
+void *
+in6_domifattach(ifp)
+ struct ifnet *ifp;
+{
+ struct in6_ifextra *ext;
+
+ ext = (struct in6_ifextra *)malloc(sizeof(*ext), M_IFADDR, M_WAITOK);
+ bzero(ext, sizeof(*ext));
+
+ ext->in6_ifstat = (struct in6_ifstat *)malloc(sizeof(struct in6_ifstat),
+ M_IFADDR, M_WAITOK);
+ bzero(ext->in6_ifstat, sizeof(*ext->in6_ifstat));
+
+ ext->icmp6_ifstat =
+ (struct icmp6_ifstat *)malloc(sizeof(struct icmp6_ifstat),
+ M_IFADDR, M_WAITOK);
+ bzero(ext->icmp6_ifstat, sizeof(*ext->icmp6_ifstat));
+
+ ext->nd_ifinfo = nd6_ifattach(ifp);
+ ext->scope6_id = scope6_ifattach(ifp);
+ return ext;
+}
+
+void
+in6_domifdetach(ifp, aux)
+ struct ifnet *ifp;
+ void *aux;
+{
+ struct in6_ifextra *ext = (struct in6_ifextra *)aux;
+
+ scope6_ifdetach(ext->scope6_id);
+ nd6_ifdetach(ext->nd_ifinfo);
+ free(ext->in6_ifstat, M_IFADDR);
+ free(ext->icmp6_ifstat, M_IFADDR);
+ free(ext, M_IFADDR);
+}
+
/*
* Convert sockaddr_in6 to sockaddr_in. Original sockaddr_in6 must be
* v4 mapped addr or v4 compat addr
==== //depot/projects/netperf/sys/netinet6/in6_ifattach.c#9 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/in6_ifattach.c,v 1.17 2003/10/10 16:04:00 ume Exp $ */
+/* $FreeBSD: src/sys/netinet6/in6_ifattach.c,v 1.18 2003/10/17 15:46:31 ume Exp $ */
/* $KAME: in6_ifattach.c,v 1.118 2001/05/24 07:44:00 itojun Exp $ */
/*
@@ -60,10 +60,6 @@
#include <net/net_osdep.h>
-struct in6_ifstat **in6_ifstat = NULL;
-struct icmp6_ifstat **icmp6_ifstat = NULL;
-size_t in6_ifstatmax = 0;
-size_t icmp6_ifstatmax = 0;
unsigned long in6_maxmtu = 0;
#ifdef IP6_AUTO_LINKLOCAL
@@ -727,7 +723,6 @@
struct ifnet *ifp;
struct ifnet *altifp; /* secondary EUI64 source */
{
- static size_t if_indexlim = 8;
struct in6_ifaddr *ia;
struct in6_addr in6;
@@ -740,50 +735,6 @@
}
/*
- * We have some arrays that should be indexed by if_index.
- * since if_index will grow dynamically, they should grow too.
- * struct in6_ifstat **in6_ifstat
- * struct icmp6_ifstat **icmp6_ifstat
- */
- if (in6_ifstat == NULL || icmp6_ifstat == NULL ||
- if_index >= if_indexlim) {
- size_t n;
- caddr_t q;
- size_t olim;
-
- olim = if_indexlim;
- while (if_index >= if_indexlim)
- if_indexlim <<= 1;
-
- /* grow in6_ifstat */
- n = if_indexlim * sizeof(struct in6_ifstat *);
- q = (caddr_t)malloc(n, M_IFADDR, M_WAITOK);
- bzero(q, n);
- if (in6_ifstat) {
- bcopy((caddr_t)in6_ifstat, q,
- olim * sizeof(struct in6_ifstat *));
- free((caddr_t)in6_ifstat, M_IFADDR);
- }
- in6_ifstat = (struct in6_ifstat **)q;
- in6_ifstatmax = if_indexlim;
-
- /* grow icmp6_ifstat */
- n = if_indexlim * sizeof(struct icmp6_ifstat *);
- q = (caddr_t)malloc(n, M_IFADDR, M_WAITOK);
- bzero(q, n);
- if (icmp6_ifstat) {
- bcopy((caddr_t)icmp6_ifstat, q,
- olim * sizeof(struct icmp6_ifstat *));
- free((caddr_t)icmp6_ifstat, M_IFADDR);
- }
- icmp6_ifstat = (struct icmp6_ifstat **)q;
- icmp6_ifstatmax = if_indexlim;
- }
-
- /* initialize scope identifiers */
- scope6_ifattach(ifp);
-
- /*
* quirks based on interface type
*/
switch (ifp->if_type) {
@@ -844,20 +795,6 @@
/* update dynamically. */
if (in6_maxmtu < ifp->if_mtu)
in6_maxmtu = ifp->if_mtu;
-
- if (in6_ifstat[ifp->if_index] == NULL) {
- in6_ifstat[ifp->if_index] = (struct in6_ifstat *)
- malloc(sizeof(struct in6_ifstat), M_IFADDR, M_WAITOK);
- bzero(in6_ifstat[ifp->if_index], sizeof(struct in6_ifstat));
- }
- if (icmp6_ifstat[ifp->if_index] == NULL) {
- icmp6_ifstat[ifp->if_index] = (struct icmp6_ifstat *)
- malloc(sizeof(struct icmp6_ifstat), M_IFADDR, M_WAITOK);
- bzero(icmp6_ifstat[ifp->if_index], sizeof(struct icmp6_ifstat));
- }
-
- /* initialize NDP variables */
- nd6_ifattach(ifp);
}
/*
@@ -987,7 +924,7 @@
int generate;
{
u_int8_t nullbuf[8];
- struct nd_ifinfo *ndi = &nd_ifinfo[ifp->if_index];
+ struct nd_ifinfo *ndi = ND_IFINFO(ifp);
bzero(nullbuf, sizeof(nullbuf));
if (bcmp(ndi->randomid, nullbuf, sizeof(nullbuf)) == 0) {
@@ -1009,9 +946,9 @@
in6_tmpaddrtimer(ignored_arg)
void *ignored_arg;
{
- int i;
struct nd_ifinfo *ndi;
u_int8_t nullbuf[8];
+ struct ifnet *ifp;
int s = splnet();
callout_reset(&in6_tmpaddrtimer_ch,
@@ -1019,8 +956,8 @@
ip6_temp_regen_advance) * hz, in6_tmpaddrtimer, NULL);
bzero(nullbuf, sizeof(nullbuf));
- for (i = 1; i < if_index + 1; i++) {
- ndi = &nd_ifinfo[i];
+ for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) {
+ ndi = ND_IFINFO(ifp);
if (bcmp(ndi->randomid, nullbuf, sizeof(nullbuf)) != 0) {
/*
* We've been generating a random ID on this interface.
==== //depot/projects/netperf/sys/netinet6/in6_proto.c#5 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/in6_proto.c,v 1.24 2003/10/08 18:26:08 ume Exp $ */
+/* $FreeBSD: src/sys/netinet6/in6_proto.c,v 1.25 2003/10/17 15:46:31 ume Exp $ */
/* $KAME: in6_proto.c,v 1.91 2001/05/27 13:28:35 itojun Exp $ */
/*
@@ -264,7 +264,8 @@
(struct protosw *)&inet6sw[sizeof(inet6sw)/sizeof(inet6sw[0])], 0,
in6_inithead,
offsetof(struct sockaddr_in6, sin6_addr) << 3,
- sizeof(struct sockaddr_in6) };
+ sizeof(struct sockaddr_in6),
+ in6_domifattach, in6_domifdetach, };
DOMAIN_SET(inet6);
==== //depot/projects/netperf/sys/netinet6/in6_src.c#6 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/in6_src.c,v 1.13 2003/10/08 18:26:08 ume Exp $ */
+/* $FreeBSD: src/sys/netinet6/in6_src.c,v 1.14 2003/10/17 15:46:31 ume Exp $ */
/* $KAME: in6_src.c,v 1.37 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -300,7 +300,7 @@
if (in6p && in6p->in6p_hops >= 0)
return (in6p->in6p_hops);
else if (ifp)
- return (nd_ifinfo[ifp->if_index].chlim);
+ return (ND_IFINFO(ifp)->chlim);
else
return (ip6_defhlim);
}
==== //depot/projects/netperf/sys/netinet6/in6_var.h#3 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/in6_var.h,v 1.13 2003/10/08 18:26:08 ume Exp $ */
+/* $FreeBSD: src/sys/netinet6/in6_var.h,v 1.15 2003/10/17 17:50:09 ume Exp $ */
/* $KAME: in6_var.h,v 1.56 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -90,6 +90,15 @@
u_int32_t ia6t_pltime; /* prefix lifetime */
};
+struct nd_ifinfo;
+struct scope6_id;
+struct in6_ifextra {
+ struct in6_ifstat *in6_ifstat;
+ struct icmp6_ifstat *icmp6_ifstat;
+ struct nd_ifinfo *nd_ifinfo;
+ struct scope6_id *scope6_id;
+};
+
struct in6_ifaddr {
struct ifaddr ia_ifa; /* protocol-independent info */
#define ia_ifp ia_ifa.ifa_ifp
@@ -445,18 +454,11 @@
#ifdef _KERNEL
extern struct in6_ifaddr *in6_ifaddr;
-extern struct in6_ifstat **in6_ifstat;
-extern size_t in6_ifstatmax;
extern struct icmp6stat icmp6stat;
-extern struct icmp6_ifstat **icmp6_ifstat;
-extern size_t icmp6_ifstatmax;
#define in6_ifstat_inc(ifp, tag) \
do { \
- if ((ifp) && (ifp)->if_index <= if_index \
- && (ifp)->if_index < in6_ifstatmax \
- && in6_ifstat && in6_ifstat[(ifp)->if_index]) { \
- in6_ifstat[(ifp)->if_index]->tag++; \
- } \
+ if (ifp) \
+ ((struct in6_ifextra *)((ifp)->if_afdata[AF_INET6]))->in6_ifstat->tag++; \
} while (/*CONSTCOND*/ 0)
extern struct in6_addr zeroin6_addr;
@@ -565,9 +567,7 @@
struct in6_multi *in6_addmulti __P((struct in6_addr *, struct ifnet *,
int *));
void in6_delmulti __P((struct in6_multi *));
-extern int in6_ifindex2scopeid __P((int));
-extern int in6_mask2len __P((struct in6_addr *, u_char *));
-extern void in6_len2mask __P((struct in6_addr *, int));
+int in6_mask2len __P((struct in6_addr *, u_char *));
int in6_control __P((struct socket *, u_long, caddr_t, struct ifnet *,
struct thread *));
int in6_update_ifa __P((struct ifnet *, struct in6_aliasreq *,
@@ -576,6 +576,8 @@
int in6if_do_dad __P((struct ifnet *));
void in6_purgeif __P((struct ifnet *));
void in6_savemkludge __P((struct in6_ifaddr *));
+void *in6_domifattach __P((struct ifnet *));
+void in6_domifdetach __P((struct ifnet *, void *));
void in6_setmaxmtu __P((void));
void in6_restoremkludge __P((struct in6_ifaddr *, struct ifnet *));
void in6_purgemkludge __P((struct ifnet *));
==== //depot/projects/netperf/sys/netinet6/ip6_input.c#10 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/ip6_input.c,v 1.54 2003/10/10 19:49:52 ume Exp $ */
+/* $FreeBSD: src/sys/netinet6/ip6_input.c,v 1.57 2003/10/17 15:46:31 ume Exp $ */
/* $KAME: ip6_input.c,v 1.259 2002/01/21 04:58:09 jinmei Exp $ */
/*
@@ -106,6 +106,7 @@
#include <netinet6/ip6_var.h>
#include <netinet/in_pcb.h>
#include <netinet/icmp6.h>
+#include <netinet6/scope6_var.h>
#include <netinet6/in6_ifattach.h>
#include <netinet6/nd6.h>
#include <netinet6/in6_prefix.h>
@@ -196,6 +197,7 @@
ip6intrq.ifq_maxlen = ip6qmaxlen;
mtx_init(&ip6intrq.ifq_mtx, "ip6_inq", NULL, MTX_DEF);
netisr_register(NETISR_IPV6, ip6_input, &ip6intrq);
+ scope6_init();
nd6_init();
frag6_init();
#ifndef RANDOM_IP_ID
@@ -209,12 +211,6 @@
void *dummy;
{
- /*
- * to route local address of p2p link to loopback,
- * assign loopback address first.
- */
- in6_ifattach(&loif[0], NULL);
-
/* nd6_timer_init */
callout_init(&nd6_timer_ch, 0);
callout_reset(&nd6_timer_ch, hz, nd6_timer, NULL);
==== //depot/projects/netperf/sys/netinet6/ip6_output.c#14 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/ip6_output.c,v 1.58 2003/10/10 16:04:00 ume Exp $ */
+/* $FreeBSD: src/sys/netinet6/ip6_output.c,v 1.59 2003/10/17 15:46:31 ume Exp $ */
/* $KAME: ip6_output.c,v 1.279 2002/01/26 06:12:30 jinmei Exp $ */
/*
@@ -794,7 +794,7 @@
}
}
if (ro_pmtu->ro_rt != NULL) {
- u_int32_t ifmtu = nd_ifinfo[ifp->if_index].linkmtu;
+ u_int32_t ifmtu = ND_IFINFO(ifp)->linkmtu;
mtu = ro_pmtu->ro_rt->rt_rmx.rmx_mtu;
if (mtu > ifmtu || mtu == 0) {
@@ -814,7 +814,7 @@
ro_pmtu->ro_rt->rt_rmx.rmx_mtu = mtu; /* XXX */
}
} else {
- mtu = nd_ifinfo[ifp->if_index].linkmtu;
+ mtu = ND_IFINFO(ifp)->linkmtu;
}
/*
==== //depot/projects/netperf/sys/netinet6/nd6.c#11 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/nd6.c,v 1.31 2003/10/14 18:49:08 sam Exp $ */
+/* $FreeBSD: src/sys/netinet6/nd6.c,v 1.32 2003/10/17 15:46:31 ume Exp $ */
/* $KAME: nd6.c,v 1.144 2001/05/24 07:44:00 itojun Exp $ */
/*
@@ -98,14 +98,13 @@
static int nd6_inuse, nd6_allocated;
struct llinfo_nd6 llinfo_nd6 = {&llinfo_nd6, &llinfo_nd6};
-static size_t nd_ifinfo_indexlim = 8;
-struct nd_ifinfo *nd_ifinfo = NULL;
struct nd_drhead nd_defrouter;
struct nd_prhead nd_prefix = { 0 };
int nd6_recalc_reachtm_interval = ND6_RECALC_REACHTM_INTERVAL;
static struct sockaddr_in6 all1_sa;
+static void nd6_setmtu0 __P((struct ifnet *, struct nd_ifinfo *));
static void nd6_slowtimo __P((void *));
static int regen_tmpaddr __P((struct in6_ifaddr *));
@@ -139,59 +138,42 @@
nd6_slowtimo, NULL);
}
-void
+struct nd_ifinfo *
nd6_ifattach(ifp)
struct ifnet *ifp;
{
+ struct nd_ifinfo *nd;
- /*
- * We have some arrays that should be indexed by if_index.
- * since if_index will grow dynamically, they should grow too.
- */
- if (nd_ifinfo == NULL || if_index >= nd_ifinfo_indexlim) {
- size_t n;
- caddr_t q;
+ nd = (struct nd_ifinfo *)malloc(sizeof(*nd), M_IP6NDP, M_WAITOK);
+ bzero(nd, sizeof(*nd));
- while (if_index >= nd_ifinfo_indexlim)
- nd_ifinfo_indexlim <<= 1;
+ nd->initialized = 1;
- /* grow nd_ifinfo */
- n = nd_ifinfo_indexlim * sizeof(struct nd_ifinfo);
- q = (caddr_t)malloc(n, M_IP6NDP, M_WAITOK);
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list