Deleted Added
sdiff udiff text old ( 91623 ) new ( 93418 )
full compact
1/*-
2 * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/usr.sbin/ppp/datalink.c 93418 2002-03-30 12:30:09Z brian $
27 */
28
29#include <sys/param.h>
30#include <netinet/in.h>
31#include <netinet/in_systm.h>
32#include <netinet/ip.h>
33#include <sys/socket.h>
34#include <sys/un.h>

--- 449 unchanged lines hidden (view full) ---

484 case DATALINK_CLOSED:
485 case DATALINK_OPENING:
486 break;
487
488 case DATALINK_HANGUP:
489 case DATALINK_DIAL:
490 case DATALINK_LOGOUT:
491 case DATALINK_LOGIN:
492 if ((result = descriptor_Write(&dl->chat.desc, bundle, fdset)) == -1) {
493 datalink_ComeDown(dl, CLOSE_NORMAL);
494 result = 0;
495 }
496 break;
497
498 case DATALINK_READY:
499 case DATALINK_LCP:
500 case DATALINK_AUTH:
501 case DATALINK_CBCP:
502 case DATALINK_OPEN:
503 if (descriptor_IsSet(&dl->chap.desc, fdset))
504 switch (descriptor_Write(&dl->chap.desc, bundle, fdset)) {
505 case -1:
506 datalink_ComeDown(dl, CLOSE_NORMAL);
507 break;
508 case 1:
509 result++;
510 }
511 if (descriptor_IsSet(&dl->physical->desc, fdset))
512 switch (descriptor_Write(&dl->physical->desc, bundle, fdset)) {
513 case -1:
514 datalink_ComeDown(dl, CLOSE_NORMAL);
515 break;
516 case 1:
517 result++;
518 }
519 break;
520 }
521
522 return result;
523}
524
525void
526datalink_ComeDown(struct datalink *dl, int how)
527{
528 int stayonline;
529
530 if (how == CLOSE_LCP)
531 datalink_DontHangup(dl);
532 else if (how == CLOSE_STAYDOWN)
533 datalink_StayDown(dl);

--- 936 unchanged lines hidden ---