if_spppsubr.c (88705) | if_spppsubr.c (88706) |
---|---|
1/* 2 * Synchronous PPP/Cisco link level subroutines. 3 * Keepalive protocol implemented in both Cisco and PPP modes. 4 * 5 * Copyright (C) 1994-1996 Cronyx Engineering Ltd. 6 * Author: Serge Vakulenko, <vak@cronyx.ru> 7 * 8 * Heavily revamped to conform to RFC 1661. 9 * Copyright (C) 1997, 2001 Joerg Wunsch. 10 * 11 * This software is distributed with NO WARRANTIES, not even the implied 12 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 * 14 * Authors grant any other persons or organisations permission to use 15 * or modify this software as long as this message is kept with the software, 16 * all derivative works or modified versions. 17 * 18 * From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997 19 * | 1/* 2 * Synchronous PPP/Cisco link level subroutines. 3 * Keepalive protocol implemented in both Cisco and PPP modes. 4 * 5 * Copyright (C) 1994-1996 Cronyx Engineering Ltd. 6 * Author: Serge Vakulenko, <vak@cronyx.ru> 7 * 8 * Heavily revamped to conform to RFC 1661. 9 * Copyright (C) 1997, 2001 Joerg Wunsch. 10 * 11 * This software is distributed with NO WARRANTIES, not even the implied 12 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 * 14 * Authors grant any other persons or organisations permission to use 15 * or modify this software as long as this message is kept with the software, 16 * all derivative works or modified versions. 17 * 18 * From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997 19 * |
20 * $FreeBSD: head/sys/net/if_spppsubr.c 88705 2001-12-30 17:00:32Z joerg $ | 20 * $FreeBSD: head/sys/net/if_spppsubr.c 88706 2001-12-30 17:12:28Z joerg $ |
21 */ 22 23#include <sys/param.h> 24 25#if defined(__FreeBSD__) && __FreeBSD__ >= 3 26#include "opt_inet.h" 27#include "opt_inet6.h" 28#include "opt_ipx.h" --- 2576 unchanged lines hidden (view full) --- 2605 /* Notify all NCPs. */ 2606 for (i = 0; i < IDX_COUNT; i++) 2607 if ((cps[i])->flags & CP_NCP) 2608 (cps[i])->Open(sp); 2609 } 2610 2611 /* Send Up events to all started protos. */ 2612 for (i = 0, mask = 1; i < IDX_COUNT; i++, mask <<= 1) | 21 */ 22 23#include <sys/param.h> 24 25#if defined(__FreeBSD__) && __FreeBSD__ >= 3 26#include "opt_inet.h" 27#include "opt_inet6.h" 28#include "opt_ipx.h" --- 2576 unchanged lines hidden (view full) --- 2605 /* Notify all NCPs. */ 2606 for (i = 0; i < IDX_COUNT; i++) 2607 if ((cps[i])->flags & CP_NCP) 2608 (cps[i])->Open(sp); 2609 } 2610 2611 /* Send Up events to all started protos. */ 2612 for (i = 0, mask = 1; i < IDX_COUNT; i++, mask <<= 1) |
2613 if (sp->lcp.protos & mask && ((cps[i])->flags & CP_LCP) == 0) | 2613 if ((sp->lcp.protos & mask) && ((cps[i])->flags & CP_LCP) == 0) |
2614 (cps[i])->Up(sp); 2615 2616 /* notify low-level driver of state change */ 2617 if (sp->pp_chg) 2618 sp->pp_chg(sp, (int)sp->pp_phase); 2619 2620 if (sp->pp_phase == PHASE_NETWORK) 2621 /* if no NCP is starting, close down */ --- 15 unchanged lines hidden (view full) --- 2637 2638 /* 2639 * Take upper layers down. We send the Down event first and 2640 * the Close second to prevent the upper layers from sending 2641 * ``a flurry of terminate-request packets'', as the RFC 2642 * describes it. 2643 */ 2644 for (i = 0, mask = 1; i < IDX_COUNT; i++, mask <<= 1) | 2614 (cps[i])->Up(sp); 2615 2616 /* notify low-level driver of state change */ 2617 if (sp->pp_chg) 2618 sp->pp_chg(sp, (int)sp->pp_phase); 2619 2620 if (sp->pp_phase == PHASE_NETWORK) 2621 /* if no NCP is starting, close down */ --- 15 unchanged lines hidden (view full) --- 2637 2638 /* 2639 * Take upper layers down. We send the Down event first and 2640 * the Close second to prevent the upper layers from sending 2641 * ``a flurry of terminate-request packets'', as the RFC 2642 * describes it. 2643 */ 2644 for (i = 0, mask = 1; i < IDX_COUNT; i++, mask <<= 1) |
2645 if (sp->lcp.protos & mask && ((cps[i])->flags & CP_LCP) == 0) { | 2645 if ((sp->lcp.protos & mask) && ((cps[i])->flags & CP_LCP) == 0) { |
2646 (cps[i])->Down(sp); 2647 (cps[i])->Close(sp); 2648 } 2649} 2650 2651static void 2652sppp_lcp_tls(struct sppp *sp) 2653{ --- 76 unchanged lines hidden (view full) --- 2730 * Check the open NCPs, return true if at least one NCP is open. 2731 */ 2732static int 2733sppp_ncp_check(struct sppp *sp) 2734{ 2735 int i, mask; 2736 2737 for (i = 0, mask = 1; i < IDX_COUNT; i++, mask <<= 1) | 2646 (cps[i])->Down(sp); 2647 (cps[i])->Close(sp); 2648 } 2649} 2650 2651static void 2652sppp_lcp_tls(struct sppp *sp) 2653{ --- 76 unchanged lines hidden (view full) --- 2730 * Check the open NCPs, return true if at least one NCP is open. 2731 */ 2732static int 2733sppp_ncp_check(struct sppp *sp) 2734{ 2735 int i, mask; 2736 2737 for (i = 0, mask = 1; i < IDX_COUNT; i++, mask <<= 1) |
2738 if (sp->lcp.protos & mask && (cps[i])->flags & CP_NCP) | 2738 if ((sp->lcp.protos & mask) && (cps[i])->flags & CP_NCP) |
2739 return 1; 2740 return 0; 2741} 2742 2743/* 2744 * Re-check the open NCPs and see if we should terminate the link. 2745 * Called by the NCPs during their tlf action handling. 2746 */ --- 2371 unchanged lines hidden (view full) --- 5118 5119 /* Notify NCPs now. */ 5120 for (i = 0; i < IDX_COUNT; i++) 5121 if ((cps[i])->flags & CP_NCP) 5122 (cps[i])->Open(sp); 5123 5124 /* Send Up events to all NCPs. */ 5125 for (i = 0, mask = 1; i < IDX_COUNT; i++, mask <<= 1) | 2739 return 1; 2740 return 0; 2741} 2742 2743/* 2744 * Re-check the open NCPs and see if we should terminate the link. 2745 * Called by the NCPs during their tlf action handling. 2746 */ --- 2371 unchanged lines hidden (view full) --- 5118 5119 /* Notify NCPs now. */ 5120 for (i = 0; i < IDX_COUNT; i++) 5121 if ((cps[i])->flags & CP_NCP) 5122 (cps[i])->Open(sp); 5123 5124 /* Send Up events to all NCPs. */ 5125 for (i = 0, mask = 1; i < IDX_COUNT; i++, mask <<= 1) |
5126 if (sp->lcp.protos & mask && ((cps[i])->flags & CP_NCP)) | 5126 if ((sp->lcp.protos & mask) && ((cps[i])->flags & CP_NCP)) |
5127 (cps[i])->Up(sp); 5128 5129 /* if no NCP is starting, all this was in vain, close down */ 5130 sppp_lcp_check_and_close(sp); 5131} 5132 5133 5134static const char * --- 185 unchanged lines hidden --- | 5127 (cps[i])->Up(sp); 5128 5129 /* if no NCP is starting, all this was in vain, close down */ 5130 sppp_lcp_check_and_close(sp); 5131} 5132 5133 5134static const char * --- 185 unchanged lines hidden --- |