diff options
author | glebius <glebius@FreeBSD.org> | 2013-11-06 19:46:20 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2013-11-06 19:46:20 +0000 |
commit | 1dbe9493b0e886302320923ffb8f5b383fa1c051 (patch) | |
tree | a801334d11c7ffe5d6d6c6fac69e89361cbd3f85 | |
parent | 76003cfce074b32de486462b6b70cd73cec3ccd7 (diff) | |
download | FreeBSD-src-1dbe9493b0e886302320923ffb8f5b383fa1c051.zip FreeBSD-src-1dbe9493b0e886302320923ffb8f5b383fa1c051.tar.gz |
Provide compat layer for OSIOCAIFADDR.
-rw-r--r-- | sys/net/if.h | 8 | ||||
-rw-r--r-- | sys/netinet/in.c | 9 | ||||
-rw-r--r-- | sys/sys/sockio.h | 2 |
3 files changed, 14 insertions, 5 deletions
diff --git a/sys/net/if.h b/sys/net/if.h index cb101d2..3f20940 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -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 */ diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 6829e0f..94314ca 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -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, caddr_t data, struct ifnet *ifp, 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, caddr_t data, struct ifnet *ifp, } 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; diff --git a/sys/sys/sockio.h b/sys/sys/sockio.h index 3b51f31..388ace3 100644 --- a/sys/sys/sockio.h +++ b/sys/sys/sockio.h @@ -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 */ |