if_spppsubr.c (96349) | if_spppsubr.c (102412) |
---|---|
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 96349 2002-05-10 12:48:09Z joerg $ | 20 * $FreeBSD: head/sys/net/if_spppsubr.c 102412 2002-08-25 13:23:09Z charnier $ |
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" --- 1131 unchanged lines hidden (view full) --- 1160 switch (cmd) { 1161 case SIOCAIFADDR: 1162 case SIOCSIFDSTADDR: 1163 break; 1164 1165 case SIOCSIFADDR: 1166 /* set the interface "up" when assigning an IP address */ 1167 ifp->if_flags |= IFF_UP; | 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" --- 1131 unchanged lines hidden (view full) --- 1160 switch (cmd) { 1161 case SIOCAIFADDR: 1162 case SIOCSIFDSTADDR: 1163 break; 1164 1165 case SIOCSIFADDR: 1166 /* set the interface "up" when assigning an IP address */ 1167 ifp->if_flags |= IFF_UP; |
1168 /* fall through... */ | 1168 /* FALLTHROUGH */ |
1169 1170 case SIOCSIFFLAGS: 1171 going_up = ifp->if_flags & IFF_UP && 1172 (ifp->if_flags & IFF_RUNNING) == 0; 1173 going_down = (ifp->if_flags & IFF_UP) == 0 && 1174 ifp->if_flags & IFF_RUNNING; 1175 1176 newmode = ifp->if_flags & IFF_PASSIVE; --- 314 unchanged lines hidden (view full) --- 1491 0, 0); 1492 return; 1493 } 1494 rv = (cp->RCR)(sp, h, len); 1495 switch (sp->state[cp->protoidx]) { 1496 case STATE_OPENED: 1497 (cp->tld)(sp); 1498 (cp->scr)(sp); | 1169 1170 case SIOCSIFFLAGS: 1171 going_up = ifp->if_flags & IFF_UP && 1172 (ifp->if_flags & IFF_RUNNING) == 0; 1173 going_down = (ifp->if_flags & IFF_UP) == 0 && 1174 ifp->if_flags & IFF_RUNNING; 1175 1176 newmode = ifp->if_flags & IFF_PASSIVE; --- 314 unchanged lines hidden (view full) --- 1491 0, 0); 1492 return; 1493 } 1494 rv = (cp->RCR)(sp, h, len); 1495 switch (sp->state[cp->protoidx]) { 1496 case STATE_OPENED: 1497 (cp->tld)(sp); 1498 (cp->scr)(sp); |
1499 /* fall through... */ | 1499 /* FALLTHROUGH */ |
1500 case STATE_ACK_SENT: 1501 case STATE_REQ_SENT: 1502 /* 1503 * sppp_cp_change_state() have the side effect of 1504 * restarting the timeouts. We want to avoid that 1505 * if the state don't change, otherwise we won't 1506 * ever timeout and resend a configuration request 1507 * that got lost. --- 47 unchanged lines hidden (view full) --- 1555 case STATE_STOPPING: 1556 break; 1557 case STATE_REQ_SENT: 1558 sp->rst_counter[cp->protoidx] = sp->lcp.max_configure; 1559 sppp_cp_change_state(cp, sp, STATE_ACK_RCVD); 1560 break; 1561 case STATE_OPENED: 1562 (cp->tld)(sp); | 1500 case STATE_ACK_SENT: 1501 case STATE_REQ_SENT: 1502 /* 1503 * sppp_cp_change_state() have the side effect of 1504 * restarting the timeouts. We want to avoid that 1505 * if the state don't change, otherwise we won't 1506 * ever timeout and resend a configuration request 1507 * that got lost. --- 47 unchanged lines hidden (view full) --- 1555 case STATE_STOPPING: 1556 break; 1557 case STATE_REQ_SENT: 1558 sp->rst_counter[cp->protoidx] = sp->lcp.max_configure; 1559 sppp_cp_change_state(cp, sp, STATE_ACK_RCVD); 1560 break; 1561 case STATE_OPENED: 1562 (cp->tld)(sp); |
1563 /* fall through */ | 1563 /* FALLTHROUGH */ |
1564 case STATE_ACK_RCVD: 1565 (cp->scr)(sp); 1566 sppp_cp_change_state(cp, sp, STATE_REQ_SENT); 1567 break; 1568 case STATE_ACK_SENT: 1569 sp->rst_counter[cp->protoidx] = sp->lcp.max_configure; 1570 sppp_cp_change_state(cp, sp, STATE_OPENED); 1571 if (debug) --- 38 unchanged lines hidden (view full) --- 1610 * next configuration request. 1611 */ 1612 if (sp->pp_loopcnt) 1613 break; 1614 (cp->scr)(sp); 1615 break; 1616 case STATE_OPENED: 1617 (cp->tld)(sp); | 1564 case STATE_ACK_RCVD: 1565 (cp->scr)(sp); 1566 sppp_cp_change_state(cp, sp, STATE_REQ_SENT); 1567 break; 1568 case STATE_ACK_SENT: 1569 sp->rst_counter[cp->protoidx] = sp->lcp.max_configure; 1570 sppp_cp_change_state(cp, sp, STATE_OPENED); 1571 if (debug) --- 38 unchanged lines hidden (view full) --- 1610 * next configuration request. 1611 */ 1612 if (sp->pp_loopcnt) 1613 break; 1614 (cp->scr)(sp); 1615 break; 1616 case STATE_OPENED: 1617 (cp->tld)(sp); |
1618 /* fall through */ | 1618 /* FALLTHROUGH */ |
1619 case STATE_ACK_RCVD: 1620 sppp_cp_change_state(cp, sp, STATE_REQ_SENT); 1621 (cp->scr)(sp); 1622 break; 1623 case STATE_CLOSING: 1624 case STATE_STOPPING: 1625 break; 1626 default: --- 5 unchanged lines hidden (view full) --- 1632 } 1633 break; 1634 1635 case TERM_REQ: 1636 switch (sp->state[cp->protoidx]) { 1637 case STATE_ACK_RCVD: 1638 case STATE_ACK_SENT: 1639 sppp_cp_change_state(cp, sp, STATE_REQ_SENT); | 1619 case STATE_ACK_RCVD: 1620 sppp_cp_change_state(cp, sp, STATE_REQ_SENT); 1621 (cp->scr)(sp); 1622 break; 1623 case STATE_CLOSING: 1624 case STATE_STOPPING: 1625 break; 1626 default: --- 5 unchanged lines hidden (view full) --- 1632 } 1633 break; 1634 1635 case TERM_REQ: 1636 switch (sp->state[cp->protoidx]) { 1637 case STATE_ACK_RCVD: 1638 case STATE_ACK_SENT: 1639 sppp_cp_change_state(cp, sp, STATE_REQ_SENT); |
1640 /* fall through */ | 1640 /* FALLTHROUGH */ |
1641 case STATE_CLOSED: 1642 case STATE_STOPPED: 1643 case STATE_CLOSING: 1644 case STATE_STOPPING: 1645 case STATE_REQ_SENT: 1646 sta: 1647 /* Send Terminate-Ack packet. */ 1648 if (debug) --- 348 unchanged lines hidden (view full) --- 1997 case STATE_STOPPED: 1998 sppp_cp_change_state(cp, sp, STATE_CLOSED); 1999 break; 2000 case STATE_STOPPING: 2001 sppp_cp_change_state(cp, sp, STATE_CLOSING); 2002 break; 2003 case STATE_OPENED: 2004 (cp->tld)(sp); | 1641 case STATE_CLOSED: 1642 case STATE_STOPPED: 1643 case STATE_CLOSING: 1644 case STATE_STOPPING: 1645 case STATE_REQ_SENT: 1646 sta: 1647 /* Send Terminate-Ack packet. */ 1648 if (debug) --- 348 unchanged lines hidden (view full) --- 1997 case STATE_STOPPED: 1998 sppp_cp_change_state(cp, sp, STATE_CLOSED); 1999 break; 2000 case STATE_STOPPING: 2001 sppp_cp_change_state(cp, sp, STATE_CLOSING); 2002 break; 2003 case STATE_OPENED: 2004 (cp->tld)(sp); |
2005 /* fall through */ | 2005 /* FALLTHROUGH */ |
2006 case STATE_REQ_SENT: 2007 case STATE_ACK_RCVD: 2008 case STATE_ACK_SENT: 2009 sp->rst_counter[cp->protoidx] = sp->lcp.max_terminate; 2010 sppp_cp_send(sp, cp->proto, TERM_REQ, 2011 ++sp->pp_seq[cp->protoidx], 0, 0); 2012 sppp_cp_change_state(cp, sp, STATE_CLOSING); 2013 break; --- 2139 unchanged lines hidden (view full) --- 4153 break; 4154 } 4155 else 4156 /* TO+ (or TO*) event */ 4157 switch (sp->state[IDX_CHAP]) { 4158 case STATE_OPENED: 4159 /* TO* event */ 4160 sp->rst_counter[IDX_CHAP] = sp->lcp.max_configure; | 2006 case STATE_REQ_SENT: 2007 case STATE_ACK_RCVD: 2008 case STATE_ACK_SENT: 2009 sp->rst_counter[cp->protoidx] = sp->lcp.max_terminate; 2010 sppp_cp_send(sp, cp->proto, TERM_REQ, 2011 ++sp->pp_seq[cp->protoidx], 0, 0); 2012 sppp_cp_change_state(cp, sp, STATE_CLOSING); 2013 break; --- 2139 unchanged lines hidden (view full) --- 4153 break; 4154 } 4155 else 4156 /* TO+ (or TO*) event */ 4157 switch (sp->state[IDX_CHAP]) { 4158 case STATE_OPENED: 4159 /* TO* event */ 4160 sp->rst_counter[IDX_CHAP] = sp->lcp.max_configure; |
4161 /* fall through */ | 4161 /* FALLTHROUGH */ |
4162 case STATE_REQ_SENT: 4163 chap.scr(sp); 4164 /* sppp_cp_change_state() will restart the timer */ 4165 sppp_cp_change_state(&chap, sp, STATE_REQ_SENT); 4166 break; 4167 } 4168 4169 splx(s); --- 1205 unchanged lines hidden --- | 4162 case STATE_REQ_SENT: 4163 chap.scr(sp); 4164 /* sppp_cp_change_state() will restart the timer */ 4165 sppp_cp_change_state(&chap, sp, STATE_REQ_SENT); 4166 break; 4167 } 4168 4169 splx(s); --- 1205 unchanged lines hidden --- |