Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Jul 2019 15:56:40 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r350465 - in stable: 11/sys/net 12/sys/net
Message-ID:  <201907311556.x6VFueup029647@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Wed Jul 31 15:56:40 2019
New Revision: 350465
URL: https://svnweb.freebsd.org/changeset/base/350465

Log:
  MFC r350336: if_tun(4): Add TUNGIFNAME
  
  This is effectively a direct commit to stable branches as tun/tap have been
  merged in head. The code here is identical, just in a slightly different
  context.

Modified:
  stable/11/sys/net/if_tun.c
  stable/11/sys/net/if_tun.h
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/net/if_tun.c
  stable/12/sys/net/if_tun.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/net/if_tun.c
==============================================================================
--- stable/11/sys/net/if_tun.c	Wed Jul 31 15:16:51 2019	(r350464)
+++ stable/11/sys/net/if_tun.c	Wed Jul 31 15:56:40 2019	(r350465)
@@ -735,12 +735,16 @@ static	int
 tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag,
     struct thread *td)
 {
-	struct ifreq ifr;
+	struct ifreq ifr, *ifrp;
 	struct tun_softc *tp = dev->si_drv1;
 	struct tuninfo *tunp;
 	int error;
 
 	switch (cmd) {
+	case TUNGIFNAME:
+		ifrp = (struct ifreq *)data;
+		strlcpy(ifrp->ifr_name, TUN2IFP(tp)->if_xname, IFNAMSIZ);
+		break;
 	case TUNSIFINFO:
 		tunp = (struct tuninfo *)data;
 		if (TUN2IFP(tp)->if_type != tunp->type)

Modified: stable/11/sys/net/if_tun.h
==============================================================================
--- stable/11/sys/net/if_tun.h	Wed Jul 31 15:16:51 2019	(r350464)
+++ stable/11/sys/net/if_tun.h	Wed Jul 31 15:56:40 2019	(r350465)
@@ -40,6 +40,7 @@ struct tuninfo {
 #define	TUNSIFINFO	_IOW('t', 91, struct tuninfo)
 #define	TUNGIFINFO	_IOR('t', 92, struct tuninfo)
 #define	TUNSLMODE	_IOW('t', 93, int)
+#define	TUNGIFNAME	_IOR('t', 93, struct ifreq)
 #define	TUNSIFMODE	_IOW('t', 94, int)
 #define	TUNSIFPID	_IO('t', 95)
 #define	TUNSIFHEAD	_IOW('t', 96, int)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907311556.x6VFueup029647>