From b9c49ebff1303c38c53cb58a99a21924ba2ffb8e Mon Sep 17 00:00:00 2001 From: peter Date: Sat, 4 Dec 2004 18:31:43 +0000 Subject: [PATCH] Change ifc_destroy to return an int instead of void, so that it can pass back errors to ifconfig. --- sys/net/if.c | 7 +++---- sys/net/if.h | 4 ++-- sys/net/if_bridge.c | 10 ++++++---- sys/net/if_faith.c | 10 ++++++---- sys/net/if_gif.c | 10 ++++++---- sys/net/if_gre.c | 10 ++++++---- sys/net/if_loop.c | 14 ++++++++------ sys/net/if_pppoe.c | 10 ++++++---- sys/net/if_stf.c | 10 ++++++---- sys/net/if_tun.c | 10 ++++++---- sys/net/if_vlan.c | 10 ++++++---- 11 files changed, 61 insertions(+), 44 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index e6b224f36422..ca592d29dad8 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $NetBSD: if.c,v 1.148 2004/12/04 16:10:25 peter Exp $ */ +/* $NetBSD: if.c,v 1.149 2004/12/04 18:31:43 peter Exp $ */ /*- * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.148 2004/12/04 16:10:25 peter Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.149 2004/12/04 18:31:43 peter Exp $"); #include "opt_inet.h" @@ -807,8 +807,7 @@ if_clone_destroy(name) if (ifc->ifc_destroy == NULL) return (EOPNOTSUPP); - (*ifc->ifc_destroy)(ifp); - return (0); + return ((*ifc->ifc_destroy)(ifp)); } /* diff --git a/sys/net/if.h b/sys/net/if.h index 01f7bb78808e..c553c237fea8 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -1,4 +1,4 @@ -/* $NetBSD: if.h,v 1.97 2004/12/04 16:10:25 peter Exp $ */ +/* $NetBSD: if.h,v 1.98 2004/12/04 18:31:43 peter Exp $ */ /*- * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -143,7 +143,7 @@ struct if_clone { size_t ifc_namelen; /* length of name */ int (*ifc_create)(struct if_clone *, int); - void (*ifc_destroy)(struct ifnet *); + int (*ifc_destroy)(struct ifnet *); }; #define IF_CLONE_INITIALIZER(name, create, destroy) \ diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index d32e9b9200bc..d55bfc525912 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_bridge.c,v 1.26 2004/10/06 10:01:00 bad Exp $ */ +/* $NetBSD: if_bridge.c,v 1.27 2004/12/04 18:31:43 peter Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -80,7 +80,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.26 2004/10/06 10:01:00 bad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.27 2004/12/04 18:31:43 peter Exp $"); #include "opt_bridge_ipf.h" #include "opt_inet.h" @@ -168,7 +168,7 @@ struct pool bridge_rtnode_pool; void bridgeattach(int); int bridge_clone_create(struct if_clone *, int); -void bridge_clone_destroy(struct ifnet *); +int bridge_clone_destroy(struct ifnet *); int bridge_ioctl(struct ifnet *, u_long, caddr_t); int bridge_init(struct ifnet *); @@ -401,7 +401,7 @@ bridge_clone_create(struct if_clone *ifc, int unit) * * Destroy a bridge instance. */ -void +int bridge_clone_destroy(struct ifnet *ifp) { struct bridge_softc *sc = ifp->if_softc; @@ -425,6 +425,8 @@ bridge_clone_destroy(struct ifnet *ifp) bridge_rtable_fini(sc); free(sc, M_DEVBUF); + + return (0); } /* diff --git a/sys/net/if_faith.c b/sys/net/if_faith.c index 495e9dc0c811..ae256db0e008 100644 --- a/sys/net/if_faith.c +++ b/sys/net/if_faith.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_faith.c,v 1.29 2004/08/20 00:37:07 enami Exp $ */ +/* $NetBSD: if_faith.c,v 1.30 2004/12/04 18:31:43 peter Exp $ */ /* $KAME: if_faith.c,v 1.21 2001/02/20 07:59:26 itojun Exp $ */ /* @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_faith.c,v 1.29 2004/08/20 00:37:07 enami Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_faith.c,v 1.30 2004/12/04 18:31:43 peter Exp $"); #include "opt_inet.h" @@ -98,7 +98,7 @@ void faithattach __P((int)); LIST_HEAD(, faith_softc) faith_softc_list; int faith_clone_create __P((struct if_clone *, int)); -void faith_clone_destroy __P((struct ifnet *)); +int faith_clone_destroy __P((struct ifnet *)); struct if_clone faith_cloner = IF_CLONE_INITIALIZER("faith", faith_clone_create, faith_clone_destroy); @@ -146,7 +146,7 @@ faith_clone_create(ifc, unit) return (0); } -void +int faith_clone_destroy(ifp) struct ifnet *ifp; { @@ -158,6 +158,8 @@ faith_clone_destroy(ifp) #endif if_detach(ifp); free(sc, M_DEVBUF); + + return (0); } int diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index 10a27669ec53..eb09e39a5b98 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_gif.c,v 1.46 2004/08/19 20:58:24 christos Exp $ */ +/* $NetBSD: if_gif.c,v 1.47 2004/12/04 18:31:43 peter Exp $ */ /* $KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.46 2004/08/19 20:58:24 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.47 2004/12/04 18:31:43 peter Exp $"); #include "opt_inet.h" #include "opt_iso.h" @@ -104,7 +104,7 @@ static struct mbuf *gif_eon_decap __P((struct ifnet *, struct mbuf *)); LIST_HEAD(, gif_softc) gif_softc_list; int gif_clone_create __P((struct if_clone *, int)); -void gif_clone_destroy __P((struct ifnet *)); +int gif_clone_destroy __P((struct ifnet *)); struct if_clone gif_cloner = IF_CLONE_INITIALIZER("gif", gif_clone_create, gif_clone_destroy); @@ -173,7 +173,7 @@ gifattach0(sc) #endif } -void +int gif_clone_destroy(ifp) struct ifnet *ifp; { @@ -194,6 +194,8 @@ gif_clone_destroy(ifp) if_detach(ifp); free(sc, M_DEVBUF); + + return (0); } #ifdef GIF_ENCAPCHECK diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index 4f714bf0ed08..c1df4a8cece8 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_gre.c,v 1.52 2004/08/19 20:58:24 christos Exp $ */ +/* $NetBSD: if_gre.c,v 1.53 2004/12/04 18:31:43 peter Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.52 2004/08/19 20:58:24 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.53 2004/12/04 18:31:43 peter Exp $"); #include "opt_inet.h" #include "opt_ns.h" @@ -111,7 +111,7 @@ struct gre_softc_head gre_softc_list; int ip_gre_ttl = GRE_TTL; int gre_clone_create __P((struct if_clone *, int)); -void gre_clone_destroy __P((struct ifnet *)); +int gre_clone_destroy __P((struct ifnet *)); struct if_clone gre_cloner = IF_CLONE_INITIALIZER("gre", gre_clone_create, gre_clone_destroy); @@ -163,7 +163,7 @@ gre_clone_create(ifc, unit) return (0); } -void +int gre_clone_destroy(ifp) struct ifnet *ifp; { @@ -175,6 +175,8 @@ gre_clone_destroy(ifp) #endif if_detach(ifp); free(sc, M_DEVBUF); + + return (0); } /* diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index 6ecac1d535d5..6cf98f245731 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_loop.c,v 1.52 2004/12/04 16:10:25 peter Exp $ */ +/* $NetBSD: if_loop.c,v 1.53 2004/12/04 18:31:43 peter Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.52 2004/12/04 16:10:25 peter Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.53 2004/12/04 18:31:43 peter Exp $"); #include "opt_inet.h" #include "opt_atalk.h" @@ -151,7 +151,7 @@ struct loop_softc { LIST_HEAD(, loop_softc) loop_softc_list; int loop_clone_create(struct if_clone *, int); -void loop_clone_destroy(struct ifnet *); +int loop_clone_destroy(struct ifnet *); struct if_clone loop_cloner = IF_CLONE_INITIALIZER("lo", loop_clone_create, loop_clone_destroy); @@ -207,13 +207,13 @@ loop_clone_create(struct if_clone *ifc, int unit) return (0); } -void +int loop_clone_destroy(struct ifnet *ifp) { struct loop_softc *sc = ifp->if_softc; - if (ifp == lo0ifp) /* don't kill lo0 */ - return; + if (ifp == lo0ifp) + return (EPERM); #ifdef MBUFTRACE MOWNER_DETACH(ifp->if_mowner); @@ -227,6 +227,8 @@ loop_clone_destroy(struct ifnet *ifp) LIST_REMOVE(sc, sc_list); free(sc, M_DEVBUF); + + return (0); } int diff --git a/sys/net/if_pppoe.c b/sys/net/if_pppoe.c index c9cd28806229..4584b1810add 100644 --- a/sys/net/if_pppoe.c +++ b/sys/net/if_pppoe.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_pppoe.c,v 1.55 2004/11/28 17:16:10 skrll Exp $ */ +/* $NetBSD: if_pppoe.c,v 1.56 2004/12/04 18:31:43 peter Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.55 2004/11/28 17:16:10 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.56 2004/12/04 18:31:43 peter Exp $"); #include "pppoe.h" #include "bpfilter.h" @@ -204,7 +204,7 @@ static int pppoe_ifattach_hook(void *, struct mbuf **, struct ifnet *, int); LIST_HEAD(pppoe_softc_head, pppoe_softc) pppoe_softc_list; int pppoe_clone_create __P((struct if_clone *, int)); -void pppoe_clone_destroy __P((struct ifnet *)); +int pppoe_clone_destroy __P((struct ifnet *)); struct if_clone pppoe_cloner = IF_CLONE_INITIALIZER("pppoe", pppoe_clone_create, pppoe_clone_destroy); @@ -274,7 +274,7 @@ pppoe_clone_create(ifc, unit) return 0; } -void +int pppoe_clone_destroy(ifp) struct ifnet *ifp; { @@ -298,6 +298,8 @@ pppoe_clone_destroy(ifp) if (sc->sc_ac_cookie) free(sc->sc_ac_cookie, M_DEVBUF); free(sc, M_DEVBUF); + + return (0); } /* diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c index a13513916884..107e96652c79 100644 --- a/sys/net/if_stf.c +++ b/sys/net/if_stf.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_stf.c,v 1.40 2004/08/19 20:58:24 christos Exp $ */ +/* $NetBSD: if_stf.c,v 1.41 2004/12/04 18:31:43 peter Exp $ */ /* $KAME: if_stf.c,v 1.62 2001/06/07 22:32:16 itojun Exp $ */ /* @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.40 2004/08/19 20:58:24 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.41 2004/12/04 18:31:43 peter Exp $"); #include "opt_inet.h" @@ -144,7 +144,7 @@ struct stf_softc { LIST_HEAD(, stf_softc) stf_softc_list; int stf_clone_create __P((struct if_clone *, int)); -void stf_clone_destroy __P((struct ifnet *)); +int stf_clone_destroy __P((struct ifnet *)); struct if_clone stf_cloner = IF_CLONE_INITIALIZER("stf", stf_clone_create, stf_clone_destroy); @@ -227,7 +227,7 @@ stf_clone_create(ifc, unit) return (0); } -void +int stf_clone_destroy(ifp) struct ifnet *ifp; { @@ -240,6 +240,8 @@ stf_clone_destroy(ifp) #endif if_detach(ifp); free(sc, M_DEVBUF); + + return (0); } static int diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 397e1d7570d6..949e775b8602 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_tun.c,v 1.72 2004/08/19 20:58:24 christos Exp $ */ +/* $NetBSD: if_tun.c,v 1.73 2004/12/04 18:31:43 peter Exp $ */ /* * Copyright (c) 1988, Julian Onions @@ -15,7 +15,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.72 2004/08/19 20:58:24 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.73 2004/12/04 18:31:43 peter Exp $"); #include "tun.h" @@ -80,7 +80,7 @@ int tun_ioctl __P((struct ifnet *, u_long, caddr_t)); int tun_output __P((struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *rt)); int tun_clone_create __P((struct if_clone *, int)); -void tun_clone_destroy __P((struct ifnet *)); +int tun_clone_destroy __P((struct ifnet *)); struct if_clone tun_cloner = IF_CLONE_INITIALIZER("tun", tun_clone_create, tun_clone_destroy); @@ -230,7 +230,7 @@ tunattach0(tp) #endif } -void +int tun_clone_destroy(ifp) struct ifnet *ifp; { @@ -271,6 +271,8 @@ tun_clone_destroy(ifp) if (!zombie) free(tp, M_DEVBUF); + + return (0); } /* diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index aca1931e2adf..2a5dc2ca04c0 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_vlan.c,v 1.41 2004/07/08 19:09:12 mycroft Exp $ */ +/* $NetBSD: if_vlan.c,v 1.42 2004/12/04 18:31:43 peter Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -85,7 +85,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.41 2004/07/08 19:09:12 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.42 2004/12/04 18:31:43 peter Exp $"); #include "opt_inet.h" #include "bpfilter.h" @@ -175,7 +175,7 @@ const struct vlan_multisw vlan_ether_multisw = { }; static int vlan_clone_create(struct if_clone *, int); -static void vlan_clone_destroy(struct ifnet *); +static int vlan_clone_destroy(struct ifnet *); static int vlan_config(struct ifvlan *, struct ifnet *); static int vlan_ioctl(struct ifnet *, u_long, caddr_t); static void vlan_start(struct ifnet *); @@ -247,7 +247,7 @@ vlan_clone_create(struct if_clone *ifc, int unit) return (0); } -static void +static int vlan_clone_destroy(struct ifnet *ifp) { struct ifvlan *ifv = ifp->if_softc; @@ -260,6 +260,8 @@ vlan_clone_destroy(struct ifnet *ifp) if_detach(ifp); free(ifv, M_DEVBUF); + + return (0); } /*