-/* $OpenBSD: if.c,v 1.533 2018/01/02 12:52:17 mpi Exp $ */
+/* $OpenBSD: if.c,v 1.534 2018/01/04 10:48:02 mpi Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
pfi_attach_ifnet(ifp);
#endif
- timeout_set(ifp->if_slowtimo, if_slowtimo, ifp);
+ timeout_set(&ifp->if_slowtimo, if_slowtimo, ifp);
if_slowtimo(ifp);
if_idxmap_insert(ifp);
ifidx = ifp->if_index;
- task_set(ifp->if_watchdogtask, if_watchdog_task, (void *)ifidx);
- task_set(ifp->if_linkstatetask, if_linkstate_task, (void *)ifidx);
+ task_set(&ifp->if_watchdogtask, if_watchdog_task, (void *)ifidx);
+ task_set(&ifp->if_linkstatetask, if_linkstate_task, (void *)ifidx);
/* Announce the interface. */
rtm_ifannounce(ifp, IFAN_ARRIVAL);
if (ifp->if_rtrequest == NULL)
ifp->if_rtrequest = if_rtrequest_dummy;
- ifp->if_slowtimo = malloc(sizeof(*ifp->if_slowtimo), M_TEMP,
- M_WAITOK|M_ZERO);
- ifp->if_watchdogtask = malloc(sizeof(*ifp->if_watchdogtask),
- M_TEMP, M_WAITOK|M_ZERO);
- ifp->if_linkstatetask = malloc(sizeof(*ifp->if_linkstatetask),
- M_TEMP, M_WAITOK|M_ZERO);
ifp->if_llprio = IFQ_DEFPRIO;
SRPL_INIT(&ifp->if_inputs);
ifp->if_watchdog = NULL;
/* Remove the watchdog timeout & task */
- timeout_del(ifp->if_slowtimo);
- task_del(net_tq(ifp->if_index), ifp->if_watchdogtask);
+ timeout_del(&ifp->if_slowtimo);
+ task_del(net_tq(ifp->if_index), &ifp->if_watchdogtask);
/* Remove the link state task */
- task_del(net_tq(ifp->if_index), ifp->if_linkstatetask);
+ task_del(net_tq(ifp->if_index), &ifp->if_linkstatetask);
#if NBPFILTER > 0
bpfdetach(ifp);
free(ifp->if_linkstatehooks, M_TEMP, 0);
free(ifp->if_detachhooks, M_TEMP, 0);
- free(ifp->if_slowtimo, M_TEMP, sizeof(*ifp->if_slowtimo));
- free(ifp->if_watchdogtask, M_TEMP, sizeof(*ifp->if_watchdogtask));
- free(ifp->if_linkstatetask, M_TEMP, sizeof(*ifp->if_linkstatetask));
-
for (i = 0; (dp = domains[i]) != NULL; i++) {
if (dp->dom_ifdetach && ifp->if_afdata[dp->dom_family])
(*dp->dom_ifdetach)(ifp,
void
if_link_state_change(struct ifnet *ifp)
{
- task_add(net_tq(ifp->if_index), ifp->if_linkstatetask);
+ task_add(net_tq(ifp->if_index), &ifp->if_linkstatetask);
}
/*
if (ifp->if_watchdog) {
if (ifp->if_timer > 0 && --ifp->if_timer == 0)
- task_add(net_tq(ifp->if_index), ifp->if_watchdogtask);
- timeout_add(ifp->if_slowtimo, hz / IFNET_SLOWHZ);
+ task_add(net_tq(ifp->if_index), &ifp->if_watchdogtask);
+ timeout_add(&ifp->if_slowtimo, hz / IFNET_SLOWHZ);
}
splx(s);
}
-/* $OpenBSD: if_var.h,v 1.86 2018/01/02 12:52:17 mpi Exp $ */
+/* $OpenBSD: if_var.h,v 1.87 2018/01/04 10:48:02 mpi Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
#include <sys/refcnt.h>
#include <sys/task.h>
#include <sys/time.h>
+#include <sys/timeout.h>
#include <net/ifq.h>
*/
struct rtentry;
-struct timeout;
struct ifnet;
struct task;
u_short if_rtlabelid; /* [c] next route label */
uint8_t if_priority; /* [c] route priority offset */
uint8_t if_llprio; /* [N] link layer priority */
- struct timeout *if_slowtimo; /* [I] watchdog timeout */
- struct task *if_watchdogtask; /* [I] watchdog task */
- struct task *if_linkstatetask; /* [I] task to do route updates */
+ struct timeout if_slowtimo; /* [I] watchdog timeout */
+ struct task if_watchdogtask; /* [I] watchdog task */
+ struct task if_linkstatetask; /* [I] task to do route updates */
/* procedure handles */
SRPL_HEAD(, ifih) if_inputs; /* input routines (dequeue) */