svn commit: r257761 - in head/sys: net netinet sys
Gleb Smirnoff
glebius at FreeBSD.org
Wed Nov 6 19:46:21 UTC 2013
Author: glebius
Date: Wed Nov 6 19:46:20 2013
New Revision: 257761
URL: http://svnweb.freebsd.org/changeset/base/257761
Log:
Provide compat layer for OSIOCAIFADDR.
Modified:
head/sys/net/if.h
head/sys/netinet/in.c
head/sys/sys/sockio.h
Modified: head/sys/net/if.h
==============================================================================
--- head/sys/net/if.h Wed Nov 6 19:35:06 2013 (r257760)
+++ head/sys/net/if.h Wed Nov 6 19:46:20 2013 (r257761)
@@ -412,6 +412,14 @@ struct ifaliasreq {
int ifra_vhid;
};
+/* 9.x compat */
+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/netinet/in.c
==============================================================================
--- head/sys/netinet/in.c Wed Nov 6 19:35:06 2013 (r257760)
+++ head/sys/netinet/in.c Wed Nov 6 19:46:20 2013 (r257761)
@@ -72,7 +72,7 @@ static int in_mask2len(struct in_addr *)
static void in_len2mask(struct in_addr *, int);
static int in_lifaddr_ioctl(struct socket *, u_long, caddr_t,
struct ifnet *, struct thread *);
-static int in_aifaddr_ioctl(caddr_t, struct ifnet *, struct thread *);
+static int in_aifaddr_ioctl(u_long, caddr_t, struct ifnet *, struct thread *);
static int in_difaddr_ioctl(caddr_t, struct ifnet *, struct thread *);
static void in_socktrim(struct sockaddr_in *);
@@ -259,9 +259,10 @@ in_control(struct socket *so, u_long cmd
error = in_difaddr_ioctl(data, ifp, td);
sx_xunlock(&in_control_sx);
return (error);
+ case OSIOCAIFADDR: /* 9.x compat */
case SIOCAIFADDR:
sx_xlock(&in_control_sx);
- error = in_aifaddr_ioctl(data, ifp, td);
+ error = in_aifaddr_ioctl(cmd, data, ifp, td);
sx_xunlock(&in_control_sx);
return (error);
case SIOCALIFADDR:
@@ -335,14 +336,14 @@ in_control(struct socket *so, u_long cmd
}
static int
-in_aifaddr_ioctl(caddr_t data, struct ifnet *ifp, struct thread *td)
+in_aifaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td)
{
const struct in_aliasreq *ifra = (struct in_aliasreq *)data;
const struct sockaddr_in *addr = &ifra->ifra_addr;
const struct sockaddr_in *broadaddr = &ifra->ifra_broadaddr;
const struct sockaddr_in *mask = &ifra->ifra_mask;
const struct sockaddr_in *dstaddr = &ifra->ifra_dstaddr;
- const int vhid = ifra->ifra_vhid;
+ const int vhid = (cmd == SIOCAIFADDR) ? ifra->ifra_vhid : 0;
struct ifaddr *ifa;
struct in_ifaddr *ia;
bool iaIsFirst;
Modified: head/sys/sys/sockio.h
==============================================================================
--- head/sys/sys/sockio.h Wed Nov 6 19:35:06 2013 (r257760)
+++ head/sys/sys/sockio.h Wed Nov 6 19:46:20 2013 (r257761)
@@ -68,7 +68,7 @@
#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 */
-/* OSIOCAIFADDR _IOW('i', 26, struct oifaliasreq) FreeBSD 9.x */
+#define 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