Page MenuHomeFreeBSD

D22780.id.diff
No OneTemporary

D22780.id.diff

Index: head/sys/net/if.c
===================================================================
--- head/sys/net/if.c
+++ head/sys/net/if.c
@@ -274,7 +274,7 @@
static int if_detach_internal(struct ifnet *, int, struct if_clone **);
static void if_siocaddmulti(void *, int);
#ifdef VIMAGE
-static void if_vmove(struct ifnet *, struct vnet *);
+static int if_vmove(struct ifnet *, struct vnet *);
#endif
#ifdef INET6
@@ -1257,7 +1257,7 @@
* unused if_index in target vnet and calls if_grow() if necessary,
* and finally find an unused if_xname for the target vnet.
*/
-static void
+static int
if_vmove(struct ifnet *ifp, struct vnet *new_vnet)
{
struct if_clone *ifc;
@@ -1283,7 +1283,7 @@
*/
rc = if_detach_internal(ifp, 1, &ifc);
if (rc != 0)
- return;
+ return (rc);
/*
* Unlink the ifnet from ifindex_table[] in current vnet, and shrink
@@ -1327,6 +1327,7 @@
#endif
CURVNET_RESTORE();
+ return (0);
}
/*
@@ -1337,6 +1338,7 @@
{
struct prison *pr;
struct ifnet *difp;
+ int error;
/* Try to find the prison within our visibility. */
sx_slock(&allprison_lock);
@@ -1372,13 +1374,14 @@
CURVNET_RESTORE();
/* Move the interface into the child jail/vnet. */
- if_vmove(ifp, pr->pr_vnet);
+ error = if_vmove(ifp, pr->pr_vnet);
- /* Report the new if_xname back to the userland. */
- sprintf(ifname, "%s", ifp->if_xname);
+ /* Report the new if_xname back to the userland on success. */
+ if (error == 0)
+ sprintf(ifname, "%s", ifp->if_xname);
prison_free(pr);
- return (0);
+ return (error);
}
static int
@@ -1387,6 +1390,7 @@
struct prison *pr;
struct vnet *vnet_dst;
struct ifnet *ifp;
+ int error;
/* Try to find the prison within our visibility. */
sx_slock(&allprison_lock);
@@ -1422,14 +1426,15 @@
}
/* Get interface back from child jail/vnet. */
- if_vmove(ifp, vnet_dst);
+ error = if_vmove(ifp, vnet_dst);
CURVNET_RESTORE();
- /* Report the new if_xname back to the userland. */
- sprintf(ifname, "%s", ifp->if_xname);
+ /* Report the new if_xname back to the userland on success. */
+ if (error == 0)
+ sprintf(ifname, "%s", ifp->if_xname);
prison_free(pr);
- return (0);
+ return (error);
}
#endif /* VIMAGE */

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 21, 10:29 PM (1 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25816127
Default Alt Text
D22780.id.diff (2 KB)

Event Timeline