Page MenuHomeFreeBSD

D26538.diff
No OneTemporary

D26538.diff

diff --git a/share/man/man9/ifnet.9 b/share/man/man9/ifnet.9
--- a/share/man/man9/ifnet.9
+++ b/share/man/man9/ifnet.9
@@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd November 14, 2018
+.Dd September 28, 2020
.Dt IFNET 9
.Os
.Sh NAME
@@ -1276,12 +1276,13 @@
Caller must have appropriate privilege.
(No call-down to driver.)
.It Dv SIOCGIFCAP
+.It Dv SIOCGIFDATA
.It Dv SIOCGIFFIB
.It Dv SIOCGIFFLAGS
.It Dv SIOCGIFMETRIC
.It Dv SIOCGIFMTU
.It Dv SIOCGIFPHYS
-Get interface capabilities, FIB, flags, metric, MTU, medium selection.
+Get interface capabilities, data, FIB, flags, metric, MTU, medium selection.
(No call-down to driver.)
.Pp
.It Dv SIOCSIFCAP
diff --git a/sys/net/if.c b/sys/net/if.c
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -2633,6 +2633,18 @@
ifr->ifr_curcap = ifp->if_capenable;
break;
+ case SIOCGIFDATA:
+ {
+ struct if_data ifd;
+
+ /* Ensure uninitialised padding is not leaked. */
+ memset(&ifd, 0, sizeof(ifd));
+
+ if_data_copy(ifp, &ifd);
+ error = copyout(&ifd, ifr_data_get_ptr(ifr), sizeof(ifd));
+ break;
+ }
+
#ifdef MAC
case SIOCGIFMAC:
error = mac_ifnet_ioctl_get(td->td_ucred, ifr, ifp);
diff --git a/sys/sys/sockio.h b/sys/sys/sockio.h
--- a/sys/sys/sockio.h
+++ b/sys/sys/sockio.h
@@ -83,6 +83,7 @@
#define SIOCSIFDESCR _IOW('i', 41, struct ifreq) /* set ifnet descr */
#define SIOCGIFDESCR _IOWR('i', 42, struct ifreq) /* get ifnet descr */
#define SIOCAIFADDR _IOW('i', 43, struct ifaliasreq)/* add/chg IF alias */
+#define SIOCGIFDATA _IOW('i', 44, struct ifreq) /* get if_data */
#define SIOCGIFALIAS _IOWR('i', 45, struct ifaliasreq)/* get IF alias */
#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 20, 11:54 AM (11 h, 45 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27096829
Default Alt Text
D26538.diff (1 KB)

Event Timeline