Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109339952
D48820.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D48820.diff
View Options
diff --git a/sys/net/if.c b/sys/net/if.c
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -285,12 +285,12 @@
static int if_getgroupmembers(struct ifgroupreq *);
static void if_delgroups(struct ifnet *);
static void if_attach_internal(struct ifnet *, bool);
-static int if_detach_internal(struct ifnet *, bool);
+static void if_detach_internal(struct ifnet *, bool);
static void if_siocaddmulti(void *, int);
static void if_link_ifnet(struct ifnet *);
static bool if_unlink_ifnet(struct ifnet *, bool);
#ifdef VIMAGE
-static int if_vmove(struct ifnet *, struct vnet *);
+static void if_vmove(struct ifnet *, struct vnet *);
#endif
#ifdef INET6
@@ -1113,7 +1113,7 @@
* on a vnet instance shutdown without this flag being set, e.g., when
* the cloned interfaces are destoyed as first thing of teardown.
*/
-static int
+static void
if_detach_internal(struct ifnet *ifp, bool vmove)
{
struct ifaddr *ifa;
@@ -1244,7 +1244,7 @@
ifp->if_afdata_initialized = 0;
IF_AFDATA_UNLOCK(ifp);
if (i == 0)
- return (0);
+ return;
SLIST_FOREACH(dp, &domains, dom_next) {
if (dp->dom_ifdetach && ifp->if_afdata[dp->dom_family]) {
(*dp->dom_ifdetach)(ifp,
@@ -1252,8 +1252,6 @@
ifp->if_afdata[dp->dom_family] = NULL;
}
}
-
- return (0);
}
#ifdef VIMAGE
@@ -1261,19 +1259,14 @@
* if_vmove() performs a limited version of if_detach() in current
* vnet and if_attach()es the ifnet to the vnet specified as 2nd arg.
*/
-static int
+static void
if_vmove(struct ifnet *ifp, struct vnet *new_vnet)
{
- int rc;
-
/*
* Detach from current vnet, but preserve LLADDR info, do not
* mark as dead etc. so that the ifnet can be reattached later.
- * If we cannot find it, we lost the race to someone else.
*/
- rc = if_detach_internal(ifp, true);
- if (rc != 0)
- return (rc);
+ if_detach_internal(ifp, true);
/*
* Perform interface-specific reassignment tasks, if provided by
@@ -1288,7 +1281,6 @@
CURVNET_SET_QUIET(new_vnet);
if_attach_internal(ifp, true);
CURVNET_RESTORE();
- return (0);
}
/*
@@ -1299,8 +1291,7 @@
{
struct prison *pr;
struct ifnet *difp;
- int error;
- bool found __diagused;
+ bool found;
bool shutdown;
MPASS(ifindex_table[ifp->if_index].ife_ifnet == ifp);
@@ -1347,16 +1338,15 @@
}
/* Move the interface into the child jail/vnet. */
- error = if_vmove(ifp, pr->pr_vnet);
+ if_vmove(ifp, pr->pr_vnet);
- /* Report the new if_xname back to the userland on success. */
- if (error == 0)
- sprintf(ifname, "%s", ifp->if_xname);
+ /* Report the new if_xname back to the userland. */
+ sprintf(ifname, "%s", ifp->if_xname);
sx_xunlock(&ifnet_detach_sxlock);
prison_free(pr);
- return (error);
+ return (0);
}
static int
@@ -1365,7 +1355,7 @@
struct prison *pr;
struct vnet *vnet_dst;
struct ifnet *ifp;
- int error, found __diagused;
+ int found __diagused;
bool shutdown;
/* Try to find the prison within our visibility. */
@@ -1406,16 +1396,15 @@
found = if_unlink_ifnet(ifp, true);
MPASS(found);
sx_xlock(&ifnet_detach_sxlock);
- error = if_vmove(ifp, vnet_dst);
+ if_vmove(ifp, vnet_dst);
sx_xunlock(&ifnet_detach_sxlock);
CURVNET_RESTORE();
- /* Report the new if_xname back to the userland on success. */
- if (error == 0)
- sprintf(ifname, "%s", ifp->if_xname);
+ /* Report the new if_xname back to the userland. */
+ sprintf(ifname, "%s", ifp->if_xname);
prison_free(pr);
- return (error);
+ return (0);
}
#endif /* VIMAGE */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 4, 7:06 PM (13 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16459022
Default Alt Text
D48820.diff (3 KB)
Attached To
Mode
D48820: ifnet: Make if_detach_internal() and if_vmove() void
Attached
Detach File
Event Timeline
Log In to Comment