Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sys/net Pull up following revision(s) (requested by joerg...
details: https://anonhg.NetBSD.org/src/rev/cddb45315b07
branches: netbsd-7
changeset: 799982:cddb45315b07
user: bouyer <bouyer%NetBSD.org@localhost>
date: Sun Sep 25 11:35:27 2016 +0000
description:
Pull up following revision(s) (requested by joerg in ticket #1254):
sys/net/if_spppsubr.c: revision 1.149
Report link state changes for sppp consumers. The link is considered up,
if the current phase is SPPP_PHASE_NETWORK, otherwise it is down. Useful
when using dhcpcd for DHCPv6 PD.
diffstat:
sys/net/if_spppsubr.c | 75 +++++++++++++++++++++-----------------------------
1 files changed, 31 insertions(+), 44 deletions(-)
diffs (152 lines):
diff -r 2f25f4978ff3 -r cddb45315b07 sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c Sun Sep 25 11:32:33 2016 +0000
+++ b/sys/net/if_spppsubr.c Sun Sep 25 11:35:27 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_spppsubr.c,v 1.130 2014/06/06 22:15:32 rmind Exp $ */
+/* $NetBSD: if_spppsubr.c,v 1.130.2.1 2016/09/25 11:35:27 bouyer Exp $ */
/*
* Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.130 2014/06/06 22:15:32 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.130.2.1 2016/09/25 11:35:27 bouyer Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -447,6 +447,27 @@
&chap, /* IDX_CHAP */
};
+static void
+sppp_change_phase(struct sppp *sp, int phase)
+{
+ STDDCL;
+
+ if (sp->pp_phase == phase)
+ return;
+
+ sp->pp_phase = phase;
+
+ if (phase == SPPP_PHASE_NETWORK)
+ if_link_state_change(ifp, LINK_STATE_UP);
+ else
+ if_link_state_change(ifp, LINK_STATE_DOWN);
+
+ if (debug)
+ {
+ log(LOG_INFO, "%s: phase %s\n", ifp->if_xname,
+ sppp_phase_name(sp->pp_phase));
+ }
+}
void spppattach(int);
void
@@ -2507,7 +2528,7 @@
static void
sppp_lcp_tlu(struct sppp *sp)
{
- STDDCL;
+ struct ifnet *ifp = &sp->pp_if;
int i;
uint32_t mask;
@@ -2524,15 +2545,9 @@
if ((sp->lcp.opts & (1 << LCP_OPT_AUTH_PROTO)) != 0 ||
(sp->pp_flags & PP_NEEDAUTH) != 0)
- sp->pp_phase = SPPP_PHASE_AUTHENTICATE;
+ sppp_change_phase(sp, SPPP_PHASE_AUTHENTICATE);
else
- sp->pp_phase = SPPP_PHASE_NETWORK;
-
- if (debug)
- {
- log(LOG_INFO, "%s: phase %s\n", ifp->if_xname,
- sppp_phase_name(sp->pp_phase));
- }
+ sppp_change_phase(sp, SPPP_PHASE_NETWORK);
/*
* Open all authentication protocols. This is even required
@@ -2569,17 +2584,10 @@
static void
sppp_lcp_tld(struct sppp *sp)
{
- STDDCL;
int i;
uint32_t mask;
- sp->pp_phase = SPPP_PHASE_TERMINATE;
-
- if (debug)
- {
- log(LOG_INFO, "%s: phase %s\n", ifp->if_xname,
- sppp_phase_name(sp->pp_phase));
- }
+ sppp_change_phase(sp, SPPP_PHASE_TERMINATE);
/*
* Take upper layers down. We send the Down event first and
@@ -2597,7 +2605,6 @@
static void
sppp_lcp_tls(struct sppp *sp)
{
- STDDCL;
if (sp->pp_max_auth_fail != 0 && sp->pp_auth_failures >= sp->pp_max_auth_fail) {
printf("%s: authentication failed %d times, not retrying again\n",
@@ -2606,13 +2613,7 @@
return;
}
- sp->pp_phase = SPPP_PHASE_ESTABLISH;
-
- if (debug)
- {
- log(LOG_INFO, "%s: phase %s\n", ifp->if_xname,
- sppp_phase_name(sp->pp_phase));
- }
+ sppp_change_phase(sp, SPPP_PHASE_ESTABLISH);
/* Notify lower layer if desired. */
if (sp->pp_tls)
@@ -2622,15 +2623,8 @@
static void
sppp_lcp_tlf(struct sppp *sp)
{
- STDDCL;
-
- sp->pp_phase = SPPP_PHASE_DEAD;
-
- if (debug)
- {
- log(LOG_INFO, "%s: phase %s\n", ifp->if_xname,
- sppp_phase_name(sp->pp_phase));
- }
+
+ sppp_change_phase(sp, SPPP_PHASE_DEAD);
/* Notify lower layer if desired. */
if (sp->pp_tlf)
@@ -5351,17 +5345,10 @@
static void
sppp_phase_network(struct sppp *sp)
{
- STDDCL;
int i;
uint32_t mask;
- sp->pp_phase = SPPP_PHASE_NETWORK;
-
- if (debug)
- {
- log(LOG_INFO, "%s: phase %s\n", ifp->if_xname,
- sppp_phase_name(sp->pp_phase));
- }
+ sppp_change_phase(sp, SPPP_PHASE_NETWORK);
/* Notify NCPs now. */
for (i = 0; i < IDX_COUNT; i++)
Home |
Main Index |
Thread Index |
Old Index