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)
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to