summaryrefslogtreecommitdiffstats
path: root/sys/netinet/in.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/in.c')
-rw-r--r--sys/netinet/in.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index be26ecd..9c44b87 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -315,6 +315,7 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
* Security checks before we get involved in any work.
*/
switch (cmd) {
+ case SIOCORDERIFADDR:
case SIOCAIFADDR:
if (td != NULL) {
error = priv_check(td, PRIV_NET_ADDIFADDR);
@@ -374,6 +375,7 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
error = 0;
switch (cmd) {
+ case SIOCORDERIFADDR:
case SIOCAIFADDR:
case SIOCDIFADDR:
if (ifra->ifra_addr.sin_family == AF_INET) {
@@ -399,10 +401,17 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
goto out;
}
}
- if (cmd == SIOCDIFADDR && ia == NULL) {
+ if ((cmd == SIOCDIFADDR || cmd == SIOCORDERIFADDR) && ia == NULL) {
error = EADDRNOTAVAIL;
goto out;
}
+ if (cmd == SIOCORDERIFADDR && ia != NULL) {
+ IF_ADDR_WLOCK(ifp);
+ TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link);
+ TAILQ_INSERT_AFTER(&ifp->if_addrhead, TAILQ_FIRST(&ifp->if_addrhead), &ia->ia_ifa, ifa_link);
+ IF_ADDR_WUNLOCK(ifp);
+ goto out;
+ }
if (ia == NULL) {
ia = (struct in_ifaddr *)
malloc(sizeof *ia, M_IFADDR, M_NOWAIT |
OpenPOWER on IntegriCloud