Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/net/if_spppsubr.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/net/if_spppsubr.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.169.6.5 retrieving revision 1.170 diff -u -p -r1.169.6.5 -r1.170 --- src/sys/net/if_spppsubr.c 2018/03/08 13:22:25 1.169.6.5 +++ src/sys/net/if_spppsubr.c 2017/10/12 09:49:43 1.170 @@ -1,4 +1,4 @@ -/* $NetBSD: if_spppsubr.c,v 1.169.6.5 2018/03/08 13:22:25 martin Exp $ */ +/* $NetBSD: if_spppsubr.c,v 1.170 2017/10/12 09:49:43 knakahara Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.169.6.5 2018/03/08 13:22:25 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.170 2017/10/12 09:49:43 knakahara Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -416,9 +416,7 @@ static void sppp_notify_up(struct sppp * static void sppp_notify_down(struct sppp *); static void sppp_notify_tls_wlocked(struct sppp *); static void sppp_notify_tlf_wlocked(struct sppp *); -#ifdef INET6 static void sppp_notify_con_wlocked(struct sppp *); -#endif static void sppp_notify_con(struct sppp *); static void sppp_notify_chg_wlocked(struct sppp *); @@ -999,7 +997,7 @@ sppp_attach(struct ifnet *ifp) /* Initialize keepalive handler. */ if (! spppq) { - callout_init(&keepalive_ch, CALLOUT_MPSAFE); + callout_init(&keepalive_ch, 0); callout_reset(&keepalive_ch, hz * LCP_KEEPALIVE_INTERVAL, sppp_keepalive, NULL); } @@ -1073,7 +1071,6 @@ sppp_detach(struct ifnet *ifp) /* to avoid workqueue enqueued */ atomic_swap_uint(&sp->ipcp.update_addrs_enqueued, 1); - workqueue_wait(sp->ipcp.update_addrs_wq, &sp->ipcp.update_addrs_wk); workqueue_destroy(sp->ipcp.update_addrs_wq); pcq_destroy(sp->ipcp.update_addrs_q); @@ -2205,7 +2202,7 @@ sppp_lcp_init(struct sppp *sp) sp->lcp.max_terminate = 2; sp->lcp.max_configure = 10; sp->lcp.max_failure = 10; - callout_init(&sp->ch[IDX_LCP], CALLOUT_MPSAFE); + callout_init(&sp->ch[IDX_LCP], 0); } static void @@ -2967,9 +2964,9 @@ sppp_ipcp_init(struct sppp *sp) sp->fail_counter[IDX_IPCP] = 0; sp->pp_seq[IDX_IPCP] = 0; sp->pp_rseq[IDX_IPCP] = 0; - callout_init(&sp->ch[IDX_IPCP], CALLOUT_MPSAFE); + callout_init(&sp->ch[IDX_IPCP], 0); - error = workqueue_create(&sp->ipcp.update_addrs_wq, "ipcp_addr", + error = workqueue_create(&sp->ipcp.update_addrs_wq, "ipcp_update_addrs", sppp_update_ip_addrs_work, sp, PRI_SOFTNET, IPL_NET, 0); if (error) panic("%s: update_addrs workqueue_create failed (%d)\n", @@ -3526,7 +3523,7 @@ sppp_ipv6cp_init(struct sppp *sp) sp->fail_counter[IDX_IPV6CP] = 0; sp->pp_seq[IDX_IPV6CP] = 0; sp->pp_rseq[IDX_IPV6CP] = 0; - callout_init(&sp->ch[IDX_IPV6CP], CALLOUT_MPSAFE); + callout_init(&sp->ch[IDX_IPV6CP], 0); } static void @@ -4041,13 +4038,12 @@ static void sppp_ipv6cp_close(struct sppp *sp) { - KASSERT(SPPP_WLOCKED(sp)); + KASSERT(SPPPP_WLOKED(sp)); } static void -sppp_ipv6cp_TO(void *cookie) +sppp_ipv6cp_TO(void *sp) { - struct sppp *sp __diagused = cookie; KASSERT(SPPP_WLOCKED(sp)); } @@ -4464,7 +4460,7 @@ sppp_chap_init(struct sppp *sp) sp->fail_counter[IDX_CHAP] = 0; sp->pp_seq[IDX_CHAP] = 0; sp->pp_rseq[IDX_CHAP] = 0; - callout_init(&sp->ch[IDX_CHAP], CALLOUT_MPSAFE); + callout_init(&sp->ch[IDX_CHAP], 0); } static void @@ -4832,8 +4828,8 @@ sppp_pap_init(struct sppp *sp) sp->fail_counter[IDX_PAP] = 0; sp->pp_seq[IDX_PAP] = 0; sp->pp_rseq[IDX_PAP] = 0; - callout_init(&sp->ch[IDX_PAP], CALLOUT_MPSAFE); - callout_init(&sp->pap_my_to_ch, CALLOUT_MPSAFE); + callout_init(&sp->ch[IDX_PAP], 0); + callout_init(&sp->pap_my_to_ch, 0); } static void @@ -5220,8 +5216,6 @@ sppp_get_ip_addrs(struct sppp *sp, uint3 struct ifaddr *ifa; struct sockaddr_in *si, *sm; uint32_t ssrc, ddst; - int s; - struct psref psref; sm = NULL; ssrc = ddst = 0; @@ -5230,18 +5224,14 @@ sppp_get_ip_addrs(struct sppp *sp, uint3 * aliases don't make any sense on a p2p link anyway. */ si = 0; - s = pserialize_read_enter(); IFADDR_READER_FOREACH(ifa, ifp) { if (ifa->ifa_addr->sa_family == AF_INET) { si = (struct sockaddr_in *)ifa->ifa_addr; sm = (struct sockaddr_in *)ifa->ifa_netmask; - if (si) { - ifa_acquire(ifa, &psref); + if (si) break; - } } } - pserialize_read_exit(s); if (ifa) { if (si && si->sin_addr.s_addr) { ssrc = si->sin_addr.s_addr; @@ -5252,7 +5242,6 @@ sppp_get_ip_addrs(struct sppp *sp, uint3 si = (struct sockaddr_in *)ifa->ifa_dstaddr; if (si && si->sin_addr.s_addr) ddst = si->sin_addr.s_addr; - ifa_release(ifa, &psref); } if (dst) *dst = ntohl(ddst); @@ -5272,8 +5261,6 @@ sppp_set_ip_addrs_work(struct work *wk, uint32_t myaddr = 0, hisaddr = 0; int s; - IFNET_LOCK(ifp); - /* * Pick the first AF_INET address from the list, * aliases don't make any sense on a p2p link anyway. @@ -5337,8 +5324,6 @@ sppp_set_ip_addrs_work(struct work *wk, ifp->if_xname, ifp->if_mtu); } - IFNET_UNLOCK(ifp); - sppp_notify_con(sp); } @@ -5370,8 +5355,6 @@ sppp_clear_ip_addrs_work(struct work *wk struct sockaddr_in *si, *dest; int s; - IFNET_LOCK(ifp); - /* * Pick the first AF_INET address from the list, * aliases don't make any sense on a p2p link anyway. @@ -5421,8 +5404,6 @@ sppp_clear_ip_addrs_work(struct work *wk "%s: resetting MTU to %" PRIu64 " bytes\n", ifp->if_xname, ifp->if_mtu); } - - IFNET_UNLOCK(ifp); } static void @@ -5473,8 +5454,6 @@ sppp_get_ip6_addrs(struct sppp *sp, stru struct ifaddr *ifa; struct sockaddr_in6 *si, *sm; struct in6_addr ssrc, ddst; - int s; - struct psref psref; sm = NULL; memset(&ssrc, 0, sizeof(ssrc)); @@ -5484,19 +5463,13 @@ sppp_get_ip6_addrs(struct sppp *sp, stru * aliases don't make any sense on a p2p link anyway. */ si = 0; - s = pserialize_read_enter(); - IFADDR_READER_FOREACH(ifa, ifp) { + IFADDR_READER_FOREACH(ifa, ifp) if (ifa->ifa_addr->sa_family == AF_INET6) { si = (struct sockaddr_in6 *)ifa->ifa_addr; sm = (struct sockaddr_in6 *)ifa->ifa_netmask; - if (si && IN6_IS_ADDR_LINKLOCAL(&si->sin6_addr)) { - ifa_acquire(ifa, &psref); + if (si && IN6_IS_ADDR_LINKLOCAL(&si->sin6_addr)) break; - } } - } - pserialize_read_exit(s); - if (ifa) { if (si && !IN6_IS_ADDR_UNSPECIFIED(&si->sin6_addr)) { memcpy(&ssrc, &si->sin6_addr, sizeof(ssrc)); @@ -5509,7 +5482,6 @@ sppp_get_ip6_addrs(struct sppp *sp, stru si = (struct sockaddr_in6 *)ifa->ifa_dstaddr; if (si && !IN6_IS_ADDR_UNSPECIFIED(&si->sin6_addr)) memcpy(&ddst, &si->sin6_addr, sizeof(ddst)); - ifa_release(ifa, &psref); } if (dst) @@ -5537,10 +5509,6 @@ sppp_set_ip6_addr(struct sppp *sp, const STDDCL; struct ifaddr *ifa; struct sockaddr_in6 *sin6; - int s; - struct psref psref; - - IFNET_LOCK(ifp); /* * Pick the first link-local AF_INET6 address from the list, @@ -5548,19 +5516,15 @@ sppp_set_ip6_addr(struct sppp *sp, const */ sin6 = NULL; - s = pserialize_read_enter(); IFADDR_READER_FOREACH(ifa, ifp) { if (ifa->ifa_addr->sa_family == AF_INET6) { sin6 = (struct sockaddr_in6 *)ifa->ifa_addr; - if (sin6 && IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { - ifa_acquire(ifa, &psref); + if (sin6 && IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) break; - } } } - pserialize_read_exit(s); if (ifa && sin6) { @@ -5577,10 +5541,7 @@ sppp_set_ip6_addr(struct sppp *sp, const if (!error) { pfil_run_addrhooks(if_pfil, SIOCAIFADDR_IN6, ifa); } - ifa_release(ifa, &psref); } - - IFNET_UNLOCK(ifp); } #endif @@ -6257,7 +6218,6 @@ sppp_notify_con(struct sppp *sp) sp->pp_con(sp); } -#ifdef INET6 static void sppp_notify_con_wlocked(struct sppp *sp) { @@ -6269,7 +6229,6 @@ sppp_notify_con_wlocked(struct sppp *sp) SPPP_LOCK(sp, RW_WRITER); } -#endif static void sppp_notify_chg_wlocked(struct sppp *sp)