Index: netinet/in.c =================================================================== --- netinet/in.c (revision 194811) +++ netinet/in.c (working copy) @@ -306,6 +306,42 @@ break; } + switch (cmd) { + case SIOCAIFADDR: + printf("SIOCAIFADDR %s\n", ifp->if_xname); + break; + case SIOCSIFADDR: + printf("SIOCSIFADDR %s\n", ifp->if_xname); + break; + case SIOCSIFBRDADDR: + printf("SIOCSIFBRDADDR %s\n", ifp->if_xname); + break; + case SIOCSIFNETMASK: + printf("SIOCSIFNETMASK %s\n", ifp->if_xname); + break; + case SIOCSIFDSTADDR: + printf("SIOCSIFDSTADDR %s\n", ifp->if_xname); + break; + case SIOCDIFADDR: + printf("SIOCDIFADDR %s\n", ifp->if_xname); + break; + case SIOCGIFADDR: + printf("SIOCGIFADDR %s\n", ifp->if_xname); + break; + case SIOCGIFNETMASK: + printf("SIOCGIFNETMASK %s\n", ifp->if_xname); + break; + case SIOCGIFDSTADDR: + printf("SIOCGIFDSTADDR %s\n", ifp->if_xname); + break; + case SIOCGIFBRDADDR: + printf("SIOCGIFBRDADDR %s\n", ifp->if_xname); + break; + default: + printf("cmd %lu %s\n", cmd, ifp->if_xname); + break; + } + /* * Find address for this interface, if it exists. * Index: net/if.c =================================================================== --- net/if.c (revision 194821) +++ net/if.c (working copy) @@ -48,13 +48,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include #include #include #include @@ -1424,25 +1424,48 @@ void ifa_init(struct ifaddr *ifa) { + struct stack st; mtx_init(&ifa->ifa_mtx, "ifaddr", NULL, MTX_DEF); refcount_init(&ifa->ifa_refcnt, 1); + + stack_zero(&st); + stack_save(&st); + printf("ifa_init %p\n", ifa); + stack_print_short_ddb(&st); } void ifa_ref(struct ifaddr *ifa) { + struct stack st; refcount_acquire(&ifa->ifa_refcnt); + + stack_zero(&st); + stack_save(&st); + printf("ifa_ref %p (now %u)\n", ifa, ifa->ifa_refcnt); + stack_print_short_ddb(&st); } void ifa_free(struct ifaddr *ifa) { + struct stack st; + stack_zero(&st); + stack_save(&st); if (refcount_release(&ifa->ifa_refcnt)) { + printf("ifa_free %p (now %u, will free)\n", ifa, + ifa->ifa_refcnt); + stack_print_short_ddb(&st); + mtx_destroy(&ifa->ifa_mtx); free(ifa, M_IFADDR); + } else { + printf("ifa_free %p (now %u, won't free)\n", ifa, + ifa->ifa_refcnt); + stack_print_short_ddb(&st); } }