summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2003-12-16 20:33:26 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2003-12-16 20:33:26 +0000
commit92fa34275f0877cb407276efe0ecc07788905c99 (patch)
treee801c036113e3f31f899a9d5ec8bc4fd1922890c /sys
parenta61d2039dbda0d1b9c08355ba862aaa7ed3ad664 (diff)
return error in ifc_destroy; ok deraadt, itojun, cedric, hshoexer
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if.c5
-rw-r--r--sys/net/if.h4
-rw-r--r--sys/net/if_bridge.c7
-rw-r--r--sys/net/if_faith.c7
-rw-r--r--sys/net/if_gif.c9
-rw-r--r--sys/net/if_gre.c7
-rw-r--r--sys/net/if_loop.c9
-rw-r--r--sys/net/if_ppp.c9
-rw-r--r--sys/net/if_sl.c9
-rw-r--r--sys/net/if_tun.c7
-rw-r--r--sys/net/if_vlan.c7
11 files changed, 44 insertions, 36 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 4a8cc93861a..1aba9d82eaf 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.78 2003/12/10 07:22:42 itojun Exp $ */
+/* $OpenBSD: if.c,v 1.79 2003/12/16 20:33:24 markus Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -634,8 +634,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 8d4459b48b8..875355b8916 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.h,v 1.47 2003/12/10 03:30:21 itojun Exp $ */
+/* $OpenBSD: if.h,v 1.48 2003/12/16 20:33:25 markus Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -89,7 +89,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 81a53cb7ac4..93033c5f0fd 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bridge.c,v 1.126 2003/12/03 14:55:58 markus Exp $ */
+/* $OpenBSD: if_bridge.c,v 1.127 2003/12/16 20:33:25 markus Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
@@ -167,7 +167,7 @@ void bridge_send_icmp_err(struct bridge_softc *, struct ifnet *,
int bridge_ipsec(int, int, int, struct mbuf *);
#endif
int bridge_clone_create(struct if_clone *, int);
-void bridge_clone_destroy(struct ifnet *ifp);
+int bridge_clone_destroy(struct ifnet *ifp);
#define ETHERADDR_IS_IP_MCAST(a) \
/* struct etheraddr *a; */ \
@@ -234,7 +234,7 @@ bridge_clone_create(struct if_clone *ifc, int unit)
return (0);
}
-void
+int
bridge_clone_destroy(struct ifnet *ifp)
{
struct bridge_softc *sc = ifp->if_softc;
@@ -266,6 +266,7 @@ bridge_clone_destroy(struct ifnet *ifp)
if_detach(ifp);
free(sc, M_DEVBUF);
+ return (0);
}
int
diff --git a/sys/net/if_faith.c b/sys/net/if_faith.c
index fcd26c3b556..b936b6f4204 100644
--- a/sys/net/if_faith.c
+++ b/sys/net/if_faith.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_faith.c,v 1.16 2003/12/03 14:53:04 markus Exp $ */
+/* $OpenBSD: if_faith.c,v 1.17 2003/12/16 20:33:25 markus Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
@@ -73,7 +73,7 @@ static void faithrtrequest(int, struct rtentry *, struct rt_addrinfo *);
void faithattach(int);
int faith_clone_create(struct if_clone *, int);
-void faith_clone_destroy(struct ifnet *ifp);
+int faith_clone_destroy(struct ifnet *ifp);
struct if_clone faith_cloner =
IF_CLONE_INITIALIZER("faith", faith_clone_create, faith_clone_destroy);
@@ -117,7 +117,7 @@ faith_clone_create(ifc, unit)
return (0);
}
-void
+int
faith_clone_destroy(ifp)
struct ifnet *ifp;
{
@@ -127,6 +127,7 @@ faith_clone_destroy(ifp)
if_detach(ifp);
free(ifp, M_DEVBUF);
+ return (0);
}
int
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index 31b8727b13b..cce663f9a5f 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gif.c,v 1.30 2003/12/10 07:22:42 itojun Exp $ */
+/* $OpenBSD: if_gif.c,v 1.31 2003/12/16 20:33:25 markus Exp $ */
/* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */
/*
@@ -64,8 +64,8 @@
extern int ifqmaxlen;
void gifattach(int);
-int gif_clone_create(struct if_clone *, int);
-void gif_clone_destroy(struct ifnet *);
+int gif_clone_create(struct if_clone *, int);
+int gif_clone_destroy(struct ifnet *);
/*
* gif global variable definitions
@@ -120,7 +120,7 @@ gif_clone_create(ifc, unit)
return (0);
}
-void
+int
gif_clone_destroy(ifp)
struct ifnet *ifp;
{
@@ -143,6 +143,7 @@ gif_clone_destroy(ifp)
free((caddr_t)sc->gif_pdst, M_IFADDR);
sc->gif_pdst = NULL;
free(sc, M_DEVBUF);
+ return (0);
}
void
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index 8e70b4e06ef..51eeabeee2c 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gre.c,v 1.30 2003/12/08 10:23:39 markus Exp $ */
+/* $OpenBSD: if_gre.c,v 1.31 2003/12/16 20:33:25 markus Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
@@ -100,7 +100,7 @@
correct value */
int gre_clone_create(struct if_clone *, int);
-void gre_clone_destroy(struct ifnet *);
+int gre_clone_destroy(struct ifnet *);
struct gre_softc_head gre_softc_list;
struct if_clone gre_cloner =
@@ -171,7 +171,7 @@ gre_clone_create(struct if_clone *ifc, int unit)
return (0);
}
-void
+int
gre_clone_destroy(struct ifnet *ifp)
{
struct gre_softc *sc = ifp->if_softc;
@@ -187,6 +187,7 @@ gre_clone_destroy(struct ifnet *ifp)
if_detach(ifp);
free(sc, M_DEVBUF);
+ return (0);
}
/*
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
index c79682ef1a6..2149f45db29 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_loop.c,v 1.31 2003/12/10 07:22:42 itojun Exp $ */
+/* $OpenBSD: if_loop.c,v 1.32 2003/12/16 20:33:25 markus Exp $ */
/* $NetBSD: if_loop.c,v 1.15 1996/05/07 02:40:33 thorpej Exp $ */
/*
@@ -174,7 +174,7 @@ static void lo_altqstart(struct ifnet *);
#endif
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);
@@ -225,12 +225,12 @@ loop_clone_create(ifc, unit)
return (0);
}
-void
+int
loop_clone_destroy(ifp)
struct ifnet *ifp;
{
if (ifp == lo0ifp)
- return; /* XXX silently fail for lo0 */
+ return (EPERM);
#if NBPFILTER > 0
bpfdetach(ifp);
@@ -238,6 +238,7 @@ loop_clone_destroy(ifp)
if_detach(ifp);
free(ifp, M_DEVBUF);
+ return (0);
}
int
diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c
index f4e1bd5be29..3136933c161 100644
--- a/sys/net/if_ppp.c
+++ b/sys/net/if_ppp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ppp.c,v 1.39 2003/12/13 10:01:16 markus Exp $ */
+/* $OpenBSD: if_ppp.c,v 1.40 2003/12/16 20:33:25 markus Exp $ */
/* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */
/*
@@ -168,7 +168,7 @@ static void pppdumpm(struct mbuf *m0);
static void ppp_ifstart(struct ifnet *ifp);
#endif
int ppp_clone_create(struct if_clone *, int);
-void ppp_clone_destroy(struct ifnet *);
+int ppp_clone_destroy(struct ifnet *);
/*
* Some useful mbuf macros not in mbuf.h.
@@ -270,7 +270,7 @@ ppp_clone_create(ifc, unit)
return (0);
}
-void
+int
ppp_clone_destroy(ifp)
struct ifnet *ifp;
{
@@ -278,7 +278,7 @@ ppp_clone_destroy(ifp)
int s;
if (sc->sc_devp != NULL)
- return;
+ return (EBUSY);
s = splimp();
LIST_REMOVE(sc, sc_list);
@@ -290,6 +290,7 @@ ppp_clone_destroy(ifp)
if_detach(ifp);
free(sc, M_DEVBUF);
+ return (0);
}
/*
diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c
index 7cd01bbb346..ade74e7a9a7 100644
--- a/sys/net/if_sl.c
+++ b/sys/net/if_sl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sl.c,v 1.25 2003/12/13 10:01:16 markus Exp $ */
+/* $OpenBSD: if_sl.c,v 1.26 2003/12/16 20:33:25 markus Exp $ */
/* $NetBSD: if_sl.c,v 1.39.4.1 1996/06/02 16:26:31 thorpej Exp $ */
/*
@@ -184,7 +184,7 @@ static int slinit(struct sl_softc *);
static struct mbuf *sl_btom(struct sl_softc *, int);
int sl_clone_create(struct if_clone *, int);
-void sl_clone_destroy(struct ifnet *);
+int sl_clone_destroy(struct ifnet *);
LIST_HEAD(, sl_softc) sl_softc_list;
struct if_clone sl_cloner =
@@ -239,7 +239,7 @@ sl_clone_create(ifc, unit)
return (0);
}
-void
+int
sl_clone_destroy(ifp)
struct ifnet *ifp;
{
@@ -247,7 +247,7 @@ sl_clone_destroy(ifp)
int s;
if (sc->sc_ttyp != NULL)
- return;
+ return (EBUSY);
s = splimp();
LIST_REMOVE(sc, sc_list);
@@ -259,6 +259,7 @@ sl_clone_destroy(ifp)
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 d73d42a00f3..17b8e33082c 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.54 2003/12/10 07:22:42 itojun Exp $ */
+/* $OpenBSD: if_tun.c,v 1.55 2003/12/16 20:33:25 markus Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -131,7 +131,7 @@ int tunwrite(dev_t, struct uio *, int);
int tunpoll(dev_t, int, struct proc *);
int tunkqfilter(dev_t, struct knote *);
int tun_clone_create(struct if_clone *, int);
-void tun_clone_destroy(struct ifnet *);
+int tun_clone_destroy(struct ifnet *);
struct tun_softc *tun_lookup(int);
void tun_wakeup(struct tun_softc *);
@@ -214,7 +214,7 @@ tun_clone_create(ifc, unit)
return (0);
}
-void
+int
tun_clone_destroy(ifp)
struct ifnet *ifp;
{
@@ -232,6 +232,7 @@ tun_clone_destroy(ifp)
if_detach(ifp);
free(tp, M_DEVBUF);
+ return (0);
}
struct tun_softc *
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index a33baba64fb..46c6303e3ae 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan.c,v 1.43 2003/12/06 09:23:25 grange Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.44 2003/12/16 20:33:25 markus Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
*
@@ -92,7 +92,7 @@ int vlan_ether_addmulti(struct ifvlan *, struct ifreq *);
int vlan_ether_delmulti(struct ifvlan *, struct ifreq *);
void vlan_ether_purgemulti(struct ifvlan *);
int vlan_clone_create(struct if_clone *, int);
-void vlan_clone_destroy(struct ifnet *);
+int vlan_clone_destroy(struct ifnet *);
LIST_HEAD(, ifvlan) vlan_list;
@@ -146,7 +146,7 @@ vlan_clone_create(struct if_clone *ifc, int unit)
return (0);
}
-void
+int
vlan_clone_destroy(struct ifnet *ifp)
{
struct ifvlan *ifv = ifp->if_softc;
@@ -164,6 +164,7 @@ vlan_clone_destroy(struct ifnet *ifp)
if_detach(ifp);
free(ifv, M_DEVBUF);
+ return (0);
}
void