From d27209aa998274e70a7c1c2ed44afc301b8fa3d5 Mon Sep 17 00:00:00 2001 From: Antonio Huete Jimenez Date: Mon, 2 Jun 2014 17:55:49 +0200 Subject: [PATCH] network - Remove OSIOCG* ioctls. DragonFly-Bug: Taken-from: FreeBSD r257696 --- libexec/rbootd/bpf.c | 8 ------ share/man/man9/ifnet.9 | 15 +--------- sys/emulation/linux/linux_ioctl.c | 4 --- sys/net/if.c | 58 --------------------------------------- sys/net/tap/if_tap.c | 3 +- sys/sys/param.h | 3 +- sys/sys/sockio.h | 5 ---- 7 files changed, 4 insertions(+), 92 deletions(-) diff --git a/libexec/rbootd/bpf.c b/libexec/rbootd/bpf.c index 4e74830..e41e808 100644 --- a/libexec/rbootd/bpf.c +++ b/libexec/rbootd/bpf.c @@ -228,19 +228,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); diff --git a/share/man/man9/ifnet.9 b/share/man/man9/ifnet.9 index 5981dd8..676693c 100644 --- a/share/man/man9/ifnet.9 +++ b/share/man/man9/ifnet.9 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD: src/share/man/man9/ifnet.9,v 1.9.2.10 2003/06/15 02:22:30 hmp Exp $ .\" -.Dd May 10, 2008 +.Dd June 2, 2014 .Dt IFNET 9 .Os .Sh NAME @@ -835,9 +835,7 @@ further interpretation. The following commands are handled by .Fn ifioctl : .Pp -.Bl -tag -width ".Dv OSIOCGIFNETMASK" -offset indent -compact .It Dv SIOCGIFCONF -.It Dv OSIOCGIFCONF Get interface configuration. (No call-down to driver.) .Pp @@ -898,17 +896,6 @@ function is called to perform the operation; qq.v. 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 diff --git a/sys/emulation/linux/linux_ioctl.c b/sys/emulation/linux/linux_ioctl.c index 2041315..d2f9c10 100644 --- a/sys/emulation/linux/linux_ioctl.c +++ b/sys/emulation/linux/linux_ioctl.c @@ -1313,11 +1313,7 @@ static struct ioctl_map_range linux_ioctl_map_entries[] = { MAPPED_IOCTL_MAP(LINUX_SIOCATMARK, SIOCATMARK), MAPPED_IOCTL_IOWR(LINUX_SIOCGIFCONF, linux_ioctl_SIOCGIFCONF, struct ifconf), MAPPED_IOCTL_IOWR(LINUX_SIOCGIFFLAGS, linux_ioctl_SIOCGIFFLAGS, struct l_ifreq), - MAPPED_IOCTL_MAPF(LINUX_SIOCGIFADDR, OSIOCGIFADDR, linux_ioctl_map_ifname), MAPPED_IOCTL_MAPF(LINUX_SIOCSIFADDR, SIOCSIFADDR, linux_ioctl_map_ifname), - MAPPED_IOCTL_MAPF(LINUX_SIOCGIFDSTADDR, OSIOCGIFDSTADDR, linux_ioctl_map_ifname), - MAPPED_IOCTL_MAPF(LINUX_SIOCGIFBRDADDR, OSIOCGIFBRDADDR, linux_ioctl_map_ifname), - MAPPED_IOCTL_MAPF(LINUX_SIOCGIFNETMASK, OSIOCGIFNETMASK, linux_ioctl_map_ifname), /*MAPPED_IOCTL_IOx(LINUX_SIOCSIFNETMASK, x, x),*/ MAPPED_IOCTL_MAPF(LINUX_SIOCGIFMTU, SIOCGIFMTU, linux_ioctl_map_ifname), MAPPED_IOCTL_MAPF(LINUX_SIOCSIFMTU, SIOCSIFMTU, linux_ioctl_map_ifname), diff --git a/sys/net/if.c b/sys/net/if.c index c4cfa02..2e3a3af 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1560,7 +1560,6 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct ucred *cred) switch (cmd) { case SIOCGIFCONF: - case OSIOCGIFCONF: return (ifconf(cmd, data, cred)); default: break; @@ -1898,54 +1897,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct ucred *cred) error = EOPNOTSUPP; break; } -#ifndef COMPAT_43 error = so_pru_control_direct(so, cmd, data, ifp); -#else - 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; - break; - default: - break; - } - - error = so_pru_control_direct(so, cmd, data, ifp); - - switch (ocmd) { - case OSIOCGIFADDR: - case OSIOCGIFDSTADDR: - case OSIOCGIFBRDADDR: - case OSIOCGIFNETMASK: - *(u_short *)&ifr->ifr_addr = ifr->ifr_addr.sa_family; - break; - } -#endif /* COMPAT_43 */ if ((oif_flags ^ ifp->if_flags) & IFF_UP) { #ifdef INET6 @@ -2059,16 +2011,6 @@ ifconf(u_long cmd, caddr_t data, struct ucred *cred) prison_if(cred, sa)) 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; - error = copyout(&ifr, ifrp, sizeof ifr); - ifrp++; - } else -#endif if (sa->sa_len <= sizeof(*sa)) { ifr.ifr_addr = *sa; error = copyout(&ifr, ifrp, sizeof ifr); diff --git a/sys/net/tap/if_tap.c b/sys/net/tap/if_tap.c index 6194ade..b25449e 100644 --- a/sys/net/tap/if_tap.c +++ b/sys/net/tap/if_tap.c @@ -797,8 +797,7 @@ tapioctl(struct dev_ioctl_args *ap) ifp->if_flags = f | (ifp->if_flags & IFF_CANTCHANGE); break; - case OSIOCGIFADDR: /* get MAC address of the remote side */ - case SIOCGIFADDR: + case SIOCGIFADDR: /* get MAC address of the remote side */ bcopy(tp->ether_addr, data, sizeof(tp->ether_addr)); break; diff --git a/sys/sys/param.h b/sys/sys/param.h index 32d9b79..3298048 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -111,9 +111,10 @@ * 300705 - Removal of ATM support. * 300800 - 3.8 release * 300900 - 3.9 master + * 300901 - Removal of OSIOCG* ioctls */ #undef __DragonFly_version -#define __DragonFly_version 300900 /* propagated to newvers */ +#define __DragonFly_version 300901 /* propagated to newvers */ #include diff --git a/sys/sys/sockio.h b/sys/sys/sockio.h index 381f979..accd8a4 100644 --- a/sys/sys/sockio.h +++ b/sys/sys/sockio.h @@ -55,19 +55,14 @@ #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 */ #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 */ #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 */ #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 */ #define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */ -#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */ #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 */ -- 1.9.0