Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet6 simplify, and call the hooks after the address ...



details:   https://anonhg.NetBSD.org/src/rev/bf46a722ee82
branches:  trunk
changeset: 820221:bf46a722ee82
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jan 03 15:14:31 2017 +0000

description:
simplify, and call the hooks after the address has been deleted like we did
for the ipv4 case.

diffstat:

 sys/netinet6/in6.c |  13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diffs (54 lines):

diff -r 739b0e4d8adb -r bf46a722ee82 sys/netinet6/in6.c
--- a/sys/netinet6/in6.c        Tue Jan 03 15:12:25 2017 +0000
+++ b/sys/netinet6/in6.c        Tue Jan 03 15:14:31 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6.c,v 1.228 2016/12/31 09:41:05 ryo Exp $    */
+/*     $NetBSD: in6.c,v 1.229 2017/01/03 15:14:31 christos Exp $       */
 /*     $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $   */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.228 2016/12/31 09:41:05 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.229 2017/01/03 15:14:31 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -377,7 +377,6 @@
        struct sockaddr_in6 *sa6;
        int error, bound;
        struct psref psref;
-       bool run_hooks = false;
 
        switch (cmd) {
        case SIOCAADDRCTL_POLICY:
@@ -704,14 +703,16 @@
                 */
                if ((error = in6_update_ifa(ifp, ifra, ia, 0)) != 0)
                        break;
-               run_hooks = true;
+               pfil_run_addrhooks(if_pfil, cmd, &ia->ia_ifa);
                break;
        }
 
        case SIOCDIFADDR_IN6:
-               pfil_run_addrhooks(if_pfil, cmd, (struct ifaddr *)ia);
                ia6_release(ia, &psref);
+               ifaref(&ia->ia_ifa);
                in6_purgeaddr(&ia->ia_ifa);
+               pfil_run_addrhooks(if_pfil, cmd, &ia->ia_ifa);
+               ifafree(&ia->ia_ifa);
                ia = NULL;
                break;
 
@@ -719,8 +720,6 @@
                error = ENOTTY;
        }
 release:
-       if (run_hooks)
-               pfil_run_addrhooks(if_pfil, cmd, (struct ifaddr *)ia);
        ia6_release(ia, &psref);
 out:
        curlwp_bindx(bound);



Home | Main Index | Thread Index | Old Index