bundle.c (37188) | bundle.c (37191) |
---|---|
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 * | 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 * $Id: bundle.c,v 1.24 1998/06/27 12:03:35 brian Exp $ | 26 * $Id: bundle.c,v 1.25 1998/06/27 12:03:46 brian Exp $ |
27 */ 28 29#include <sys/param.h> 30#include <sys/socket.h> 31#include <netinet/in.h> 32#include <net/if.h> 33#include <arpa/inet.h> 34#include <net/route.h> 35#include <net/if_dl.h> 36#include <netinet/in_systm.h> 37#include <netinet/ip.h> 38#include <sys/un.h> 39 | 27 */ 28 29#include <sys/param.h> 30#include <sys/socket.h> 31#include <netinet/in.h> 32#include <net/if.h> 33#include <arpa/inet.h> 34#include <net/route.h> 35#include <net/if_dl.h> 36#include <netinet/in_systm.h> 37#include <netinet/ip.h> 38#include <sys/un.h> 39 |
40#ifndef NOALIAS 41#include <alias.h> 42#endif |
|
40#include <errno.h> 41#include <fcntl.h> 42#include <paths.h> 43#include <signal.h> 44#include <stdio.h> 45#include <stdlib.h> 46#include <string.h> 47#include <sys/ioctl.h> --- 574 unchanged lines hidden (view full) --- 622 bundle->ncp.ipcp.my_ip.s_addr) { 623 /* we've been asked to send something addressed *to* us :( */ 624 if (Enabled(bundle, OPT_LOOPBACK)) { 625 pri = PacketCheck(bundle, tun.data, n, &bundle->filter.in); 626 if (pri >= 0) { 627 struct mbuf *bp; 628 629#ifndef NOALIAS | 43#include <errno.h> 44#include <fcntl.h> 45#include <paths.h> 46#include <signal.h> 47#include <stdio.h> 48#include <stdlib.h> 49#include <string.h> 50#include <sys/ioctl.h> --- 574 unchanged lines hidden (view full) --- 625 bundle->ncp.ipcp.my_ip.s_addr) { 626 /* we've been asked to send something addressed *to* us :( */ 627 if (Enabled(bundle, OPT_LOOPBACK)) { 628 pri = PacketCheck(bundle, tun.data, n, &bundle->filter.in); 629 if (pri >= 0) { 630 struct mbuf *bp; 631 632#ifndef NOALIAS |
630 if (alias_IsEnabled()) { 631 (*PacketAlias.In)(tun.data, sizeof tun.data); | 633 if (bundle->AliasEnabled) { 634 PacketAliasIn(tun.data, sizeof tun.data); |
632 n = ntohs(((struct ip *)tun.data)->ip_len); 633 } 634#endif 635 bp = mbuf_Alloc(n, MB_IPIN); 636 memcpy(MBUF_CTOP(bp), tun.data, n); 637 ip_Input(bundle, bp); 638 log_Printf(LogDEBUG, "Looped back packet addressed to myself\n"); 639 } --- 23 unchanged lines hidden (view full) --- 663 * device - breaking auto-dial. 664 */ 665 return; 666 } 667 668 pri = PacketCheck(bundle, tun.data, n, &bundle->filter.out); 669 if (pri >= 0) { 670#ifndef NOALIAS | 635 n = ntohs(((struct ip *)tun.data)->ip_len); 636 } 637#endif 638 bp = mbuf_Alloc(n, MB_IPIN); 639 memcpy(MBUF_CTOP(bp), tun.data, n); 640 ip_Input(bundle, bp); 641 log_Printf(LogDEBUG, "Looped back packet addressed to myself\n"); 642 } --- 23 unchanged lines hidden (view full) --- 666 * device - breaking auto-dial. 667 */ 668 return; 669 } 670 671 pri = PacketCheck(bundle, tun.data, n, &bundle->filter.out); 672 if (pri >= 0) { 673#ifndef NOALIAS |
671 if (alias_IsEnabled()) { 672 (*PacketAlias.Out)(tun.data, sizeof tun.data); | 674 if (bundle->AliasEnabled) { 675 PacketAliasOut(tun.data, sizeof tun.data); |
673 n = ntohs(((struct ip *)tun.data)->ip_len); 674 } 675#endif 676 ip_Enqueue(pri, tun.data, n); 677 } 678 } 679} 680 --- 129 unchanged lines hidden (view full) --- 810 } 811 log_Printf(LogPHASE, "Using interface: %s\n", bundle.ifp.Name); 812 813 bundle.ifp.Speed = 0; 814 815 bundle.routing_seq = 0; 816 bundle.phase = PHASE_DEAD; 817 bundle.CleaningUp = 0; | 676 n = ntohs(((struct ip *)tun.data)->ip_len); 677 } 678#endif 679 ip_Enqueue(pri, tun.data, n); 680 } 681 } 682} 683 --- 129 unchanged lines hidden (view full) --- 813 } 814 log_Printf(LogPHASE, "Using interface: %s\n", bundle.ifp.Name); 815 816 bundle.ifp.Speed = 0; 817 818 bundle.routing_seq = 0; 819 bundle.phase = PHASE_DEAD; 820 bundle.CleaningUp = 0; |
821 bundle.AliasEnabled = 0; |
|
818 819 bundle.fsm.LayerStart = bundle_LayerStart; 820 bundle.fsm.LayerUp = bundle_LayerUp; 821 bundle.fsm.LayerDown = bundle_LayerDown; 822 bundle.fsm.LayerFinish = bundle_LayerFinish; 823 bundle.fsm.object = &bundle; 824 825 bundle.cfg.idle_timeout = NCP_IDLE_TIMEOUT; --- 870 unchanged lines hidden --- | 822 823 bundle.fsm.LayerStart = bundle_LayerStart; 824 bundle.fsm.LayerUp = bundle_LayerUp; 825 bundle.fsm.LayerDown = bundle_LayerDown; 826 bundle.fsm.LayerFinish = bundle_LayerFinish; 827 bundle.fsm.object = &bundle; 828 829 bundle.cfg.idle_timeout = NCP_IDLE_TIMEOUT; --- 870 unchanged lines hidden --- |