svn commit: r257696 - in head: libexec/rbootd share/man/man9 sys/compat/svr4 sys/net sys/sys
Gleb Smirnoff
glebius at FreeBSD.org
Tue Nov 5 10:29:50 UTC 2013
Author: glebius
Date: Tue Nov 5 10:29:47 2013
New Revision: 257696
URL: http://svnweb.freebsd.org/changeset/base/257696
Log:
Drop support for historic ioctls and also undefine them, so that code
that checks their presence via ifdef, won't use them.
Bump __FreeBSD_version as safety measure.
Modified:
head/libexec/rbootd/bpf.c
head/share/man/man9/ifnet.9
head/sys/compat/svr4/svr4_sockio.c
head/sys/net/if.c
head/sys/net/if.h
head/sys/net/if_tap.c
head/sys/sys/param.h
head/sys/sys/sockio.h
Modified: head/libexec/rbootd/bpf.c
==============================================================================
--- head/libexec/rbootd/bpf.c Tue Nov 5 09:46:01 2013 (r257695)
+++ head/libexec/rbootd/bpf.c Tue Nov 5 10:29:47 2013 (r257696)
@@ -237,19 +237,11 @@ BpfGetIntfName(char **errmsg)
ifc.ifc_len = sizeof ibuf;
ifc.ifc_buf = (caddr_t)ibuf;
-#ifdef OSIOCGIFCONF
- if (ioctl(fd, OSIOCGIFCONF, (char *)&ifc) < 0 ||
- ifc.ifc_len < sizeof(struct ifreq)) {
- (void) strcpy(errbuf, "bpf: ioctl(OSIOCGIFCONF): %m");
- return(NULL);
- }
-#else
if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) < 0 ||
ifc.ifc_len < sizeof(struct ifreq)) {
(void) strcpy(errbuf, "bpf: ioctl(SIOCGIFCONF): %m");
return(NULL);
}
-#endif
ifrp = ibuf;
ifend = (struct ifreq *)((char *)ibuf + ifc.ifc_len);
Modified: head/share/man/man9/ifnet.9
==============================================================================
--- head/share/man/man9/ifnet.9 Tue Nov 5 09:46:01 2013 (r257695)
+++ head/share/man/man9/ifnet.9 Tue Nov 5 10:29:47 2013 (r257696)
@@ -1284,9 +1284,8 @@ further interpretation.
The following commands are handled by
.Fn ifioctl :
.Pp
-.Bl -tag -width ".Dv OSIOCGIFNETMASK" -offset indent -compact
+.Bl -tag -width ".Dv SIOCGIFNETMASK" -offset indent -compact
.It Dv SIOCGIFCONF
-.It Dv OSIOCGIFCONF
Get interface configuration.
(No call-down to driver.)
.Pp
@@ -1380,17 +1379,6 @@ function is called to perform the operat
The socket's protocol control routine is called to implement the
requested action.
.Pp
-.It Dv OSIOCGIFADDR
-.It Dv OSIOCGIFDSTADDR
-.It Dv OSIOCGIFBRDADDR
-.It Dv OSIOCGIFNETMASK
-The socket's protocol control routine is called to implement the
-requested action.
-On return,
-.Vt sockaddr
-structures are converted into old-style (no
-.Va sa_len
-member).
.El
.El
.Pp
Modified: head/sys/compat/svr4/svr4_sockio.c
==============================================================================
--- head/sys/compat/svr4/svr4_sockio.c Tue Nov 5 09:46:01 2013 (r257695)
+++ head/sys/compat/svr4/svr4_sockio.c Tue Nov 5 10:29:47 2013 (r257696)
@@ -144,6 +144,7 @@ svr4_sock_ioctl(fp, td, retval, fd, cmd,
case SVR4_SIOCGIFCONF:
{
struct svr4_ifconf sc;
+ struct ifconf *ifc;
if ((error = copyin(data, &sc, sizeof(sc))) != 0)
return error;
@@ -152,9 +153,18 @@ svr4_sock_ioctl(fp, td, retval, fd, cmd,
sizeof(struct ifreq), sizeof(struct svr4_ifreq),
sc.svr4_ifc_len));
- if ((error = fo_ioctl(fp, OSIOCGIFCONF,
- (caddr_t) &sc, td->td_ucred,
- td)) != 0)
+ ifc = (struct ifconf *)≻
+ ifc->ifc_req.ifr_addr.sa_family =
+ sc.svr4_ifc_req.svr4_ifr_addr.sa_family;
+ ifc->ifc_req.ifr_addr.sa_len = sizeof(struct osockaddr);
+
+ error = fo_ioctl(fp, SIOCGIFCONF, &sc,
+ td->td_ucred, td));
+
+ sc.svr4_ifc_req.svr4_ifr_addr.sa_family =
+ ifc->ifc_req.ifr_addr.sa_family;
+
+ if (error != 0)
return error;
DPRINTF(("SIOCGIFCONF\n"));
Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c Tue Nov 5 09:46:01 2013 (r257695)
+++ head/sys/net/if.c Tue Nov 5 10:29:47 2013 (r257696)
@@ -2511,7 +2511,6 @@ ifioctl(struct socket *so, u_long cmd, c
CURVNET_SET(so->so_vnet);
switch (cmd) {
case SIOCGIFCONF:
- case OSIOCGIFCONF:
error = ifconf(cmd, data);
CURVNET_RESTORE();
return (error);
@@ -2611,71 +2610,12 @@ ifioctl(struct socket *so, u_long cmd, c
* layer, and do not perform any credentials checks or input
* validation.
*/
-#ifndef COMPAT_43
- error = ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd,
- data,
- ifp, td));
+ error = ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd, data,
+ ifp, td));
if (error == EOPNOTSUPP && ifp != NULL && ifp->if_ioctl != NULL &&
cmd != SIOCSIFADDR && cmd != SIOCSIFBRDADDR &&
cmd != SIOCSIFDSTADDR && cmd != SIOCSIFNETMASK)
error = (*ifp->if_ioctl)(ifp, cmd, data);
-#else
- {
- u_long ocmd = cmd;
-
- switch (cmd) {
-
- case SIOCSIFDSTADDR:
- case SIOCSIFADDR:
- case SIOCSIFBRDADDR:
- case SIOCSIFNETMASK:
-#if BYTE_ORDER != BIG_ENDIAN
- if (ifr->ifr_addr.sa_family == 0 &&
- ifr->ifr_addr.sa_len < 16) {
- ifr->ifr_addr.sa_family = ifr->ifr_addr.sa_len;
- ifr->ifr_addr.sa_len = 16;
- }
-#else
- if (ifr->ifr_addr.sa_len == 0)
- ifr->ifr_addr.sa_len = 16;
-#endif
- break;
-
- case OSIOCGIFADDR:
- cmd = SIOCGIFADDR;
- break;
-
- case OSIOCGIFDSTADDR:
- cmd = SIOCGIFDSTADDR;
- break;
-
- case OSIOCGIFBRDADDR:
- cmd = SIOCGIFBRDADDR;
- break;
-
- case OSIOCGIFNETMASK:
- cmd = SIOCGIFNETMASK;
- }
- error = ((*so->so_proto->pr_usrreqs->pru_control)(so,
- cmd,
- data,
- ifp, td));
- if (error == EOPNOTSUPP && ifp != NULL &&
- ifp->if_ioctl != NULL &&
- cmd != SIOCSIFADDR && cmd != SIOCSIFBRDADDR &&
- cmd != SIOCSIFDSTADDR && cmd != SIOCSIFNETMASK)
- error = (*ifp->if_ioctl)(ifp, cmd, data);
- switch (ocmd) {
-
- case OSIOCGIFADDR:
- case OSIOCGIFDSTADDR:
- case OSIOCGIFBRDADDR:
- case OSIOCGIFNETMASK:
- *(u_short *)&ifr->ifr_addr = ifr->ifr_addr.sa_family;
-
- }
- }
-#endif /* COMPAT_43 */
if ((oif_flags ^ ifp->if_flags) & IFF_UP) {
#ifdef INET6
@@ -2841,16 +2781,6 @@ again:
if (prison_if(curthread->td_ucred, sa) != 0)
continue;
addrs++;
-#ifdef COMPAT_43
- if (cmd == OSIOCGIFCONF) {
- struct osockaddr *osa =
- (struct osockaddr *)&ifr.ifr_addr;
- ifr.ifr_addr = *sa;
- osa->sa_family = sa->sa_family;
- sbuf_bcat(sb, &ifr, sizeof(ifr));
- max_len += sizeof(ifr);
- } else
-#endif
if (sa->sa_len <= sizeof(*sa)) {
ifr.ifr_addr = *sa;
sbuf_bcat(sb, &ifr, sizeof(ifr));
Modified: head/sys/net/if.h
==============================================================================
--- head/sys/net/if.h Tue Nov 5 09:46:01 2013 (r257695)
+++ head/sys/net/if.h Tue Nov 5 10:29:47 2013 (r257696)
@@ -412,14 +412,6 @@ struct ifaliasreq {
int ifra_vhid;
};
-/* Compat with pre-10.x */
-struct oifaliasreq {
- char ifra_name[IFNAMSIZ];
- struct sockaddr ifra_addr;
- struct sockaddr ifra_broadaddr;
- struct sockaddr ifra_mask;
-};
-
struct ifmediareq {
char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */
int ifm_current; /* current media options */
Modified: head/sys/net/if_tap.c
==============================================================================
--- head/sys/net/if_tap.c Tue Nov 5 09:46:01 2013 (r257695)
+++ head/sys/net/if_tap.c Tue Nov 5 10:29:47 2013 (r257696)
@@ -829,8 +829,7 @@ tapioctl(struct cdev *dev, u_long cmd, c
mtx_unlock(&tp->tap_mtx);
break;
- case OSIOCGIFADDR: /* get MAC address of the remote side */
- case SIOCGIFADDR:
+ case SIOCGIFADDR: /* get MAC address of the remote side */
mtx_lock(&tp->tap_mtx);
bcopy(tp->ether_addr, data, sizeof(tp->ether_addr));
mtx_unlock(&tp->tap_mtx);
Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h Tue Nov 5 09:46:01 2013 (r257695)
+++ head/sys/sys/param.h Tue Nov 5 10:29:47 2013 (r257696)
@@ -58,7 +58,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 1100001 /* Master, propagated to newvers */
+#define __FreeBSD_version 1100002 /* Master, propagated to newvers */
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
Modified: head/sys/sys/sockio.h
==============================================================================
--- head/sys/sys/sockio.h Tue Nov 5 09:46:01 2013 (r257695)
+++ head/sys/sys/sockio.h Tue Nov 5 10:29:47 2013 (r257696)
@@ -50,25 +50,25 @@
#define SIOCGETSGCNT _IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */
#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */
-#define OSIOCGIFADDR _IOWR('i', 13, struct ifreq) /* get ifnet address */
+/* OSIOCGIFADDR _IOWR('i', 13, struct ifreq) 4.3BSD */
#define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */
#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */
-#define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) /* get p-p address */
+/* OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) 4.3BSD */
#define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */
#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */
#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */
-#define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) /* get broadcast addr */
+/* OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) 4.3BSD */
#define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */
#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */
-#define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* get ifnet list */
+/* OSIOCGIFCONF _IOWR('i', 20, struct ifconf) 4.3BSD */
#define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */
-#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */
+/* OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) 4.3BSD */
#define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */
#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */
#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */
#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */
#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */
-#define OSIOCAIFADDR _IOW('i', 26, struct oifaliasreq)/* add/chg IF alias */
+/* OSIOCAIFADDR _IOW('i', 26, struct oifaliasreq) FreeBSD 9.x */
#define SIOCALIFADDR _IOW('i', 27, struct if_laddrreq) /* add IF addr */
#define SIOCGLIFADDR _IOWR('i', 28, struct if_laddrreq) /* get IF addr */
#define SIOCDLIFADDR _IOW('i', 29, struct if_laddrreq) /* delete IF addr */
More information about the svn-src-head
mailing list