From a388ebb962934fe140e9559cc12ca537afae2187 Mon Sep 17 00:00:00 2001 From: yar Date: Mon, 30 Jan 2006 13:37:34 +0000 Subject: Do address assignment/removal operations after callbacks. Presently, ifconfig callbacks are used for L2 configuration, media and vlan, so actions associated with address assignment, like sending out a gratuitous ARP, should go when L2 is running already. This also should fix the problem with setting up vlan interfaces from rc.conf, when both IP and vlan+vlandev parameters are passed to ifconfig at once. Future work: Consider introducing several ifconfig callback lists to invoke callbacks orderly. MFC after: 1 week --- sbin/ifconfig/ifconfig.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'sbin') diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index ee0f066..9c6efe5 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -535,6 +535,12 @@ ifconfig(int argc, char *const *argv, const struct afswtch *afp) if (afp->af_postproc != NULL) afp->af_postproc(s, afp); /* + * Do deferred callbacks registered while processing + * command-line arguments. + */ + for (cb = callbacks; cb != NULL; cb = cb->cb_next) + cb->cb_func(s, cb->cb_arg); + /* * Do deferred operations. */ if (clearaddr) { @@ -568,13 +574,6 @@ ifconfig(int argc, char *const *argv, const struct afswtch *afp) Perror("ioctl (SIOCAIFADDR)"); } - /* - * Do deferred callbacks registered while processing - * command-line arguments. - */ - for (cb = callbacks; cb != NULL; cb = cb->cb_next) - cb->cb_func(s, cb->cb_arg); - close(s); return(0); } -- cgit v1.1