On Thu, Dec 22, 2016 at 02:03:51PM +0100, Alexander Bluhm wrote:
> Fine. But let's do the other changes. Move timer initialisation
> to nd6_init() and call timeout_set() only once during init. Then
> I don't have to think about wether it is MP safe.
updated diff, parts have been commited
ok?
bluhm
Index: netinet6/ip6_input.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/ip6_input.c,v
retrieving revision 1.172
diff -u -p -r1.172 ip6_input.c
--- netinet6/ip6_input.c 20 Dec 2016 18:33:43 -0000 1.172
+++ netinet6/ip6_input.c 23 Dec 2016 17:57:38 -0000
@@ -119,7 +119,6 @@ struct niqueue ip6intrq = NIQUEUE_INITIA
struct ip6stat ip6stat;
-void ip6_init2(void *);
int ip6_check_rh0hdr(struct mbuf *, int *);
int ip6_hbhchcheck(struct mbuf *, int *, int *, int *);
@@ -157,19 +156,8 @@ ip6_init(void)
ip6_randomid_init();
nd6_init();
frag6_init();
- ip6_init2(NULL);
mq_init(&ip6send_mq, 64, IPL_SOFTNET);
-}
-
-void
-ip6_init2(void *dummy)
-{
-
- /* nd6_timer_init */
- bzero(&nd6_timer_ch, sizeof(nd6_timer_ch));
- timeout_set(&nd6_timer_ch, nd6_timer, NULL);
- timeout_add_sec(&nd6_timer_ch, 1);
}
/*
Index: netinet6/nd6.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/nd6.c,v
retrieving revision 1.201
diff -u -p -r1.201 nd6.c
--- netinet6/nd6.c 23 Dec 2016 15:08:54 -0000 1.201
+++ netinet6/nd6.c 23 Dec 2016 17:59:30 -0000
@@ -93,6 +93,8 @@ struct nd_prhead nd_prefix = { 0 };
int nd6_recalc_reachtm_interval = ND6_RECALC_REACHTM_INTERVAL;
void nd6_slowtimo(void *);
+void nd6_timer_work(void *);
+void nd6_timer(void *);
void nd6_invalidate(struct rtentry *);
struct llinfo_nd6 *nd6_free(struct rtentry *, int);
void nd6_llinfo_timer(void *);
@@ -100,7 +102,6 @@ void nd6_llinfo_timer(void *);
struct timeout nd6_slowtimo_ch;
struct timeout nd6_timer_ch;
struct task nd6_timer_task;
-void nd6_timer_work(void *);
int fill_drlist(void *, size_t *, size_t);
int fill_prlist(void *, size_t *, size_t);
@@ -129,6 +130,8 @@ nd6_init(void)
/* start timer */
timeout_set_proc(&nd6_slowtimo_ch, nd6_slowtimo, NULL);
timeout_add_sec(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL);
+ timeout_set(&nd6_timer_ch, nd6_timer, NULL);
+ timeout_add_sec(&nd6_timer_ch, nd6_prune);
nd6_rs_init();
}
@@ -437,7 +440,6 @@ nd6_timer_work(void *null)
NET_LOCK(s);
- timeout_set(&nd6_timer_ch, nd6_timer, NULL);
timeout_add_sec(&nd6_timer_ch, nd6_prune);
/* expire default router list */
Index: netinet6/nd6.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/nd6.h,v
retrieving revision 1.65
diff -u -p -r1.65 nd6.h
--- netinet6/nd6.h 28 Nov 2016 13:59:51 -0000 1.65
+++ netinet6/nd6.h 23 Dec 2016 17:57:38 -0000
@@ -223,8 +223,6 @@ extern int nd6_debug;
#define nd6log(x) do { if (nd6_debug) log x; } while (0)
-extern struct timeout nd6_timer_ch;
-
union nd_opts {
struct nd_opt_hdr *nd_opt_array[9];
struct {
@@ -260,7 +258,6 @@ int nd6_options(union nd_opts *);
struct rtentry *nd6_lookup(struct in6_addr *, int, struct ifnet *, u_int);
void nd6_setmtu(struct ifnet *);
void nd6_llinfo_settimer(struct llinfo_nd6 *, int);
-void nd6_timer(void *);
void nd6_purge(struct ifnet *);
void nd6_nud_hint(struct rtentry *);
void nd6_rtrequest(struct ifnet *, int, struct rtentry *);