Mfp4 @180378:
Factor out nd6 and in6_attach initialization to their own files. Also move destruction into those files though still called from the central initialization. Sponsored by: CK Software GmbH Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: gnn Differential Revision: https://reviews.freebsd.org/D5033
This commit is contained in:
parent
936ce65444
commit
9901091eba
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=297192
@ -890,3 +890,29 @@ in6_purgemaddrs(struct ifnet *ifp)
|
||||
|
||||
IN6_MULTI_UNLOCK();
|
||||
}
|
||||
|
||||
void
|
||||
in6_ifattach_destroy(void)
|
||||
{
|
||||
|
||||
callout_drain(&V_in6_tmpaddrtimer_ch);
|
||||
}
|
||||
|
||||
static void
|
||||
in6_ifattach_init(void *dummy)
|
||||
{
|
||||
|
||||
/* Timer for regeneranation of temporary addresses randomize ID. */
|
||||
callout_init(&V_in6_tmpaddrtimer_ch, 0);
|
||||
callout_reset(&V_in6_tmpaddrtimer_ch,
|
||||
(V_ip6_temp_preferred_lifetime - V_ip6_desync_factor -
|
||||
V_ip6_temp_regen_advance) * hz,
|
||||
in6_tmpaddrtimer, curvnet);
|
||||
}
|
||||
|
||||
/*
|
||||
* Cheat.
|
||||
* This must be after route_init(), which is now SI_ORDER_THIRD.
|
||||
*/
|
||||
SYSINIT(in6_ifattach_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE,
|
||||
in6_ifattach_init, NULL);
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
#ifdef _KERNEL
|
||||
void in6_ifattach(struct ifnet *, struct ifnet *);
|
||||
void in6_ifattach_destroy(void);
|
||||
void in6_ifdetach(struct ifnet *);
|
||||
int in6_get_tmpifid(struct ifnet *, u_int8_t *, const u_int8_t *, int);
|
||||
void in6_tmpaddrtimer(void *);
|
||||
|
@ -156,9 +156,6 @@ static struct netisr_handler ip6_direct_nh = {
|
||||
};
|
||||
#endif
|
||||
|
||||
VNET_DECLARE(struct callout, in6_tmpaddrtimer_ch);
|
||||
#define V_in6_tmpaddrtimer_ch VNET(in6_tmpaddrtimer_ch)
|
||||
|
||||
VNET_DEFINE(struct pfil_head, inet6_pfil_hook);
|
||||
|
||||
VNET_PCPUSTAT_DEFINE(struct ip6stat, ip6stat);
|
||||
@ -170,7 +167,6 @@ VNET_PCPUSTAT_SYSUNINIT(ip6stat);
|
||||
struct rmlock in6_ifaddr_lock;
|
||||
RM_SYSINIT(in6_ifaddr_lock, &in6_ifaddr_lock, "in6_ifaddr_lock");
|
||||
|
||||
static void ip6_init2(void *);
|
||||
static int ip6_hopopts_input(u_int32_t *, u_int32_t *, struct mbuf **, int *);
|
||||
#ifdef PULLDOWN_TEST
|
||||
static struct mbuf *ip6_pullexthdr(struct mbuf *, size_t, int);
|
||||
@ -331,39 +327,10 @@ ip6_destroy()
|
||||
}
|
||||
hashdestroy(V_in6_ifaddrhashtbl, M_IFADDR, V_in6_ifaddrhmask);
|
||||
nd6_destroy();
|
||||
callout_drain(&V_in6_tmpaddrtimer_ch);
|
||||
in6_ifattach_destroy();
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
ip6_init2_vnet(const void *unused __unused)
|
||||
{
|
||||
|
||||
/* nd6_timer_init */
|
||||
callout_init(&V_nd6_timer_ch, 0);
|
||||
callout_reset(&V_nd6_timer_ch, hz, nd6_timer, curvnet);
|
||||
|
||||
/* timer for regeneranation of temporary addresses randomize ID */
|
||||
callout_init(&V_in6_tmpaddrtimer_ch, 0);
|
||||
callout_reset(&V_in6_tmpaddrtimer_ch,
|
||||
(V_ip6_temp_preferred_lifetime - V_ip6_desync_factor -
|
||||
V_ip6_temp_regen_advance) * hz,
|
||||
in6_tmpaddrtimer, curvnet);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
ip6_init2(void *dummy)
|
||||
{
|
||||
|
||||
ip6_init2_vnet(NULL);
|
||||
}
|
||||
|
||||
/* cheat */
|
||||
/* This must be after route_init(), which is now SI_ORDER_THIRD */
|
||||
SYSINIT(netinet6init2, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, ip6_init2, NULL);
|
||||
|
||||
static int
|
||||
ip6_input_hbh(struct mbuf *m, uint32_t *plen, uint32_t *rtalert, int *off,
|
||||
int *nxt, int *ours)
|
||||
|
@ -142,6 +142,7 @@ static VNET_DEFINE(struct callout, nd6_slowtimo_ch);
|
||||
#define V_nd6_slowtimo_ch VNET(nd6_slowtimo_ch)
|
||||
|
||||
VNET_DEFINE(struct callout, nd6_timer_ch);
|
||||
#define V_nd6_timer_ch VNET(nd6_timer_ch)
|
||||
|
||||
static void
|
||||
nd6_lle_event(void *arg __unused, struct llentry *lle, int evt)
|
||||
@ -213,11 +214,14 @@ nd6_init(void)
|
||||
/* initialization of the default router list */
|
||||
TAILQ_INIT(&V_nd_defrouter);
|
||||
|
||||
/* start timer */
|
||||
/* Start timers. */
|
||||
callout_init(&V_nd6_slowtimo_ch, 0);
|
||||
callout_reset(&V_nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz,
|
||||
nd6_slowtimo, curvnet);
|
||||
|
||||
callout_init(&V_nd6_timer_ch, 0);
|
||||
callout_reset(&V_nd6_timer_ch, hz, nd6_timer, curvnet);
|
||||
|
||||
nd6_dad_init();
|
||||
if (IS_DEFAULT_VNET(curvnet)) {
|
||||
lle_event_eh = EVENTHANDLER_REGISTER(lle_event, nd6_lle_event,
|
||||
|
@ -355,9 +355,6 @@ VNET_DECLARE(struct rwlock, nd6_lock);
|
||||
|
||||
#define nd6log(x) do { if (V_nd6_debug) log x; } while (/*CONSTCOND*/ 0)
|
||||
|
||||
VNET_DECLARE(struct callout, nd6_timer_ch);
|
||||
#define V_nd6_timer_ch VNET(nd6_timer_ch)
|
||||
|
||||
/* nd6_rtr.c */
|
||||
VNET_DECLARE(int, nd6_defifindex);
|
||||
VNET_DECLARE(int, ip6_desync_factor); /* seconds */
|
||||
|
Loading…
Reference in New Issue
Block a user