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/bundle.c 93418 2002-03-30 12:30:09Z brian $ |
27 */ 28 29#include <sys/param.h> 30#include <sys/socket.h> 31#include <netinet/in.h> 32#include <net/if.h> 33#include <net/if_tun.h> /* For TUNS* ioctls */ 34#include <net/route.h> --- 9 unchanged lines hidden (view full) --- 44#include <libutil.h> 45#endif 46#include <paths.h> 47#include <stdio.h> 48#include <stdlib.h> 49#include <string.h> 50#include <sys/uio.h> 51#include <sys/wait.h> |
52#include <termios.h> 53#include <unistd.h> 54 55#include "layer.h" 56#include "defs.h" 57#include "command.h" 58#include "mbuf.h" 59#include "log.h" --- 29 unchanged lines hidden (view full) --- 89#include "tun.h" 90#include "prompt.h" 91#include "chat.h" 92#include "cbcp.h" 93#include "datalink.h" 94#include "iface.h" 95#include "server.h" 96#include "probe.h" |
97#ifndef NODES |
98#include "mppe.h" 99#endif 100 101#define SCATTER_SEGMENTS 7 /* version, datalink, name, physical, 102 throughput, throughput, device */ 103 104#define SEND_MAXFD 3 /* Max file descriptors passed through 105 the local domain socket */ --- 18 unchanged lines hidden (view full) --- 124 return; 125 126 if (new <= PHASE_TERMINATE) 127 log_Printf(LogPHASE, "bundle: %s\n", PhaseNames[new]); 128 129 switch (new) { 130 case PHASE_DEAD: 131 bundle->phase = new; |
132#ifndef NODES |
133 MPPE_MasterKeyValid = 0; 134#endif 135 log_DisplayPrompts(); 136 break; 137 138 case PHASE_ESTABLISH: 139 bundle->phase = new; 140 break; --- 473 unchanged lines hidden (view full) --- 614bundle_DescriptorWrite(struct fdescriptor *d, struct bundle *bundle, 615 const fd_set *fdset) 616{ 617 struct datalink *dl; 618 int result = 0; 619 620 /* This is not actually necessary as struct mpserver doesn't Write() */ 621 if (descriptor_IsSet(&bundle->ncp.mp.server.desc, fdset)) |
622 if (descriptor_Write(&bundle->ncp.mp.server.desc, bundle, fdset) == 1) 623 result++; |
624 625 for (dl = bundle->links; dl; dl = dl->next) 626 if (descriptor_IsSet(&dl->desc, fdset)) |
627 switch (descriptor_Write(&dl->desc, bundle, fdset)) { 628 case -1: 629 datalink_ComeDown(dl, CLOSE_NORMAL); 630 break; 631 case 1: 632 result++; 633 } |
634 635 return result; 636} 637 638void 639bundle_LockTun(struct bundle *bundle) 640{ 641 FILE *lockfile; --- 59 unchanged lines hidden (view full) --- 701 break; 702 else if (errno == ENXIO || errno == ENOENT) { 703#if defined(__FreeBSD__) && !defined(NOKLDLOAD) 704 if (bundle.unit == minunit && !kldtried++) { 705 /* 706 * Attempt to load the tunnel interface KLD if it isn't loaded 707 * already. 708 */ |
709 loadmodules(LOAD_VERBOSLY, "if_tun", NULL); 710 continue; |
711 } 712#endif 713 if (errno != ENOENT || ++enoentcount > 2) { 714 err = errno; 715 break; 716 } 717 } else 718 err = errno; --- 1214 unchanged lines hidden --- |