Merge branches 'master' and 'suser_to_priv'
[dragonfly.git] / sys / netinet6 / in6.c
index b5413da..ef148f6 100644 (file)
@@ -395,6 +395,14 @@ in6_control(struct socket *so, u_long cmd, caddr_t data,
                return (mrt6_ioctl(cmd, data));
        }
 
+       switch(cmd) {
+       case SIOCAADDRCTL_POLICY:
+       case SIOCDADDRCTL_POLICY:
+               if (!privileged)
+                       return (EPERM);
+               return (in6_src_ioctl(cmd, data));
+       }
+
        if (ifp == NULL)
                return (EOPNOTSUPP);
 
@@ -612,9 +620,14 @@ in6_control(struct socket *so, u_long cmd, caddr_t data,
 
        case SIOCAIFADDR_IN6:
        {
-               int i, error = 0;
+               int i, error = 0, iaIsNew;
                struct nd_prefix pr0, *pr;
 
+               if (ia != NULL)
+                       iaIsNew = 0;
+               else
+                       iaIsNew = 1;
+
                /*
                 * first, make or update the interface address structure,
                 * and link it to the list.
@@ -709,8 +722,11 @@ in6_control(struct socket *so, u_long cmd, caddr_t data,
                         */
                        pfxlist_onlink_check();
                }
-               if (error == 0 && ia)
-                       EVENTHANDLER_INVOKE(ifaddr_event, ifp);
+               if (error == 0 && ia) {
+                       EVENTHANDLER_INVOKE(ifaddr_event, ifp,
+                       iaIsNew ? IFADDR_EVENT_ADD : IFADDR_EVENT_CHANGE,
+                       &ia->ia_ifa);
+               }
                break;
        }
 
@@ -756,9 +772,10 @@ in6_control(struct socket *so, u_long cmd, caddr_t data,
                        pr->ndpr_expire = 1; /* XXX: just for expiration */
                }
 
-         purgeaddr:
+purgeaddr:
+               EVENTHANDLER_INVOKE(ifaddr_event, ifp, IFADDR_EVENT_DELETE,
+                                   &ia->ia_ifa);
                in6_purgeaddr(&ia->ia_ifa);
-               EVENTHANDLER_INVOKE(ifaddr_event, ifp);
                break;
        }