svn commit: r222945 - stable/7/sys/net
John Baldwin
jhb at FreeBSD.org
Fri Jun 10 19:08:18 UTC 2011
Author: jhb
Date: Fri Jun 10 19:08:17 2011
New Revision: 222945
URL: http://svn.freebsd.org/changeset/base/222945
Log:
MFC 222651:
Properly return an ENOBUFS error if a write to a tun(4) device fails
due to m_uiotombuf() failing.
While here, trim unneeded error handling related to tuninit() since it
can never fail.
Modified:
stable/7/sys/net/if_tun.c
Directory Properties:
stable/7/sys/ (props changed)
stable/7/sys/cddl/contrib/opensolaris/ (props changed)
stable/7/sys/contrib/dev/acpica/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
Modified: stable/7/sys/net/if_tun.c
==============================================================================
--- stable/7/sys/net/if_tun.c Fri Jun 10 19:08:07 2011 (r222944)
+++ stable/7/sys/net/if_tun.c Fri Jun 10 19:08:17 2011 (r222945)
@@ -125,7 +125,7 @@ static void tunclone(void *arg, struct u
int namelen, struct cdev **dev);
static void tuncreate(const char *name, struct cdev *dev);
static int tunifioctl(struct ifnet *, u_long, caddr_t);
-static int tuninit(struct ifnet *);
+static void tuninit(struct ifnet *);
static int tunmodevent(module_t, int, void *);
static int tunoutput(struct ifnet *, struct mbuf *, struct sockaddr *,
struct rtentry *rt);
@@ -485,14 +485,13 @@ tunclose(struct cdev *dev, int foo, int
return (0);
}
-static int
+static void
tuninit(struct ifnet *ifp)
{
struct tun_softc *tp = ifp->if_softc;
#ifdef INET
struct ifaddr *ifa;
#endif
- int error = 0;
TUNDEBUG(ifp, "tuninit\n");
@@ -517,7 +516,6 @@ tuninit(struct ifnet *ifp)
}
#endif
mtx_unlock(&tp->tun_mtx);
- return (error);
}
/*
@@ -541,12 +539,12 @@ tunifioctl(struct ifnet *ifp, u_long cmd
mtx_unlock(&tp->tun_mtx);
break;
case SIOCSIFADDR:
- error = tuninit(ifp);
- TUNDEBUG(ifp, "address set, error=%d\n", error);
+ tuninit(ifp);
+ TUNDEBUG(ifp, "address set\n");
break;
case SIOCSIFDSTADDR:
- error = tuninit(ifp);
- TUNDEBUG(ifp, "destination address set, error=%d\n", error);
+ tuninit(ifp);
+ TUNDEBUG(ifp, "destination address set\n");
break;
case SIOCSIFMTU:
ifp->if_mtu = ifr->ifr_mtu;
@@ -850,7 +848,6 @@ tunwrite(struct cdev *dev, struct uio *u
struct tun_softc *tp = dev->si_drv1;
struct ifnet *ifp = TUN2IFP(tp);
struct mbuf *m;
- int error = 0;
uint32_t family;
int isr;
@@ -870,7 +867,7 @@ tunwrite(struct cdev *dev, struct uio *u
if ((m = m_uiotombuf(uio, M_DONTWAIT, 0, 0, M_PKTHDR)) == NULL) {
ifp->if_ierrors++;
- return (error);
+ return (ENOBUFS);
}
m->m_pkthdr.rcvif = ifp;
More information about the svn-src-stable-7
mailing list