bundle.c (75212) | bundle.c (78410) |
---|---|
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 * $FreeBSD: head/usr.sbin/ppp/bundle.c 75212 2001-04-05 02:23:48Z brian $ | 26 * $FreeBSD: head/usr.sbin/ppp/bundle.c 78410 2001-06-18 14:59:36Z 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> --- 762 unchanged lines hidden (view full) --- 797 bundle.iface = NULL; 798 close(bundle.dev.fd); 799 return NULL; 800 } 801 802 log_Printf(LogPHASE, "Using interface: %s\n", ifname); 803 804 bundle.bandwidth = 0; | 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> --- 762 unchanged lines hidden (view full) --- 797 bundle.iface = NULL; 798 close(bundle.dev.fd); 799 return NULL; 800 } 801 802 log_Printf(LogPHASE, "Using interface: %s\n", ifname); 803 804 bundle.bandwidth = 0; |
805 bundle.mtu = 1500; | |
806 bundle.routing_seq = 0; 807 bundle.phase = PHASE_DEAD; 808 bundle.CleaningUp = 0; 809 bundle.NatEnabled = 0; 810 811 bundle.fsm.LayerStart = bundle_LayerStart; 812 bundle.fsm.LayerUp = bundle_LayerUp; 813 bundle.fsm.LayerDown = bundle_LayerDown; 814 bundle.fsm.LayerFinish = bundle_LayerFinish; 815 bundle.fsm.object = &bundle; 816 817 bundle.cfg.idle.timeout = NCP_IDLE_TIMEOUT; 818 bundle.cfg.idle.min_timeout = 0; 819 *bundle.cfg.auth.name = '\0'; 820 *bundle.cfg.auth.key = '\0'; 821 bundle.cfg.opt = OPT_SROUTES | OPT_IDCHECK | OPT_LOOPBACK | OPT_TCPMSSFIXUP | 822 OPT_THROUGHPUT | OPT_UTMP; 823 *bundle.cfg.label = '\0'; | 805 bundle.routing_seq = 0; 806 bundle.phase = PHASE_DEAD; 807 bundle.CleaningUp = 0; 808 bundle.NatEnabled = 0; 809 810 bundle.fsm.LayerStart = bundle_LayerStart; 811 bundle.fsm.LayerUp = bundle_LayerUp; 812 bundle.fsm.LayerDown = bundle_LayerDown; 813 bundle.fsm.LayerFinish = bundle_LayerFinish; 814 bundle.fsm.object = &bundle; 815 816 bundle.cfg.idle.timeout = NCP_IDLE_TIMEOUT; 817 bundle.cfg.idle.min_timeout = 0; 818 *bundle.cfg.auth.name = '\0'; 819 *bundle.cfg.auth.key = '\0'; 820 bundle.cfg.opt = OPT_SROUTES | OPT_IDCHECK | OPT_LOOPBACK | OPT_TCPMSSFIXUP | 821 OPT_THROUGHPUT | OPT_UTMP; 822 *bundle.cfg.label = '\0'; |
824 bundle.cfg.mtu = DEF_MTU; | |
825 bundle.cfg.ifqueue = DEF_IFQUEUE; 826 bundle.cfg.choked.timeout = CHOKED_TIMEOUT; 827 bundle.phys_type.all = type; 828 bundle.phys_type.open = 0; 829 bundle.upat = 0; 830 831 bundle.links = datalink_Create("deflink", &bundle, type); 832 if (bundle.links == NULL) { --- 258 unchanged lines hidden (view full) --- 1091 prompt_Printf(arg->prompt, ", min %ds", 1092 arg->bundle->cfg.idle.min_timeout); 1093 remaining = bundle_RemainingIdleTime(arg->bundle); 1094 if (remaining != -1) 1095 prompt_Printf(arg->prompt, " (%ds remaining)", remaining); 1096 prompt_Printf(arg->prompt, "\n"); 1097 } else 1098 prompt_Printf(arg->prompt, "disabled\n"); | 823 bundle.cfg.ifqueue = DEF_IFQUEUE; 824 bundle.cfg.choked.timeout = CHOKED_TIMEOUT; 825 bundle.phys_type.all = type; 826 bundle.phys_type.open = 0; 827 bundle.upat = 0; 828 829 bundle.links = datalink_Create("deflink", &bundle, type); 830 if (bundle.links == NULL) { --- 258 unchanged lines hidden (view full) --- 1089 prompt_Printf(arg->prompt, ", min %ds", 1090 arg->bundle->cfg.idle.min_timeout); 1091 remaining = bundle_RemainingIdleTime(arg->bundle); 1092 if (remaining != -1) 1093 prompt_Printf(arg->prompt, " (%ds remaining)", remaining); 1094 prompt_Printf(arg->prompt, "\n"); 1095 } else 1096 prompt_Printf(arg->prompt, "disabled\n"); |
1099 prompt_Printf(arg->prompt, " MTU: "); 1100 if (arg->bundle->cfg.mtu) 1101 prompt_Printf(arg->prompt, "%d\n", arg->bundle->cfg.mtu); 1102 else 1103 prompt_Printf(arg->prompt, "unspecified\n"); | |
1104 1105 prompt_Printf(arg->prompt, " sendpipe: "); 1106 if (arg->bundle->ncp.ipcp.cfg.sendpipe > 0) 1107 prompt_Printf(arg->prompt, "%-20ld", arg->bundle->ncp.ipcp.cfg.sendpipe); 1108 else 1109 prompt_Printf(arg->prompt, "unspecified "); 1110 prompt_Printf(arg->prompt, " recvpipe: "); 1111 if (arg->bundle->ncp.ipcp.cfg.recvpipe > 0) --- 709 unchanged lines hidden (view full) --- 1821 1822void 1823bundle_CalculateBandwidth(struct bundle *bundle) 1824{ 1825 struct datalink *dl; 1826 int sp; 1827 1828 bundle->bandwidth = 0; | 1097 1098 prompt_Printf(arg->prompt, " sendpipe: "); 1099 if (arg->bundle->ncp.ipcp.cfg.sendpipe > 0) 1100 prompt_Printf(arg->prompt, "%-20ld", arg->bundle->ncp.ipcp.cfg.sendpipe); 1101 else 1102 prompt_Printf(arg->prompt, "unspecified "); 1103 prompt_Printf(arg->prompt, " recvpipe: "); 1104 if (arg->bundle->ncp.ipcp.cfg.recvpipe > 0) --- 709 unchanged lines hidden (view full) --- 1814 1815void 1816bundle_CalculateBandwidth(struct bundle *bundle) 1817{ 1818 struct datalink *dl; 1819 int sp; 1820 1821 bundle->bandwidth = 0; |
1829 bundle->mtu = 0; | 1822 bundle->iface->mtu = 0; |
1830 for (dl = bundle->links; dl; dl = dl->next) 1831 if (dl->state == DATALINK_OPEN) { 1832 if ((sp = dl->mp.bandwidth) == 0 && 1833 (sp = physical_GetSpeed(dl->physical)) == 0) 1834 log_Printf(LogDEBUG, "%s: %s: Cannot determine bandwidth\n", 1835 dl->name, dl->physical->name.full); 1836 else 1837 bundle->bandwidth += sp; 1838 if (!bundle->ncp.mp.active) { | 1823 for (dl = bundle->links; dl; dl = dl->next) 1824 if (dl->state == DATALINK_OPEN) { 1825 if ((sp = dl->mp.bandwidth) == 0 && 1826 (sp = physical_GetSpeed(dl->physical)) == 0) 1827 log_Printf(LogDEBUG, "%s: %s: Cannot determine bandwidth\n", 1828 dl->name, dl->physical->name.full); 1829 else 1830 bundle->bandwidth += sp; 1831 if (!bundle->ncp.mp.active) { |
1839 bundle->mtu = dl->physical->link.lcp.his_mru; | 1832 bundle->iface->mtu = dl->physical->link.lcp.his_mru; |
1840 break; 1841 } 1842 } 1843 1844 if(bundle->bandwidth == 0) 1845 bundle->bandwidth = 115200; /* Shrug */ 1846 1847 if (bundle->ncp.mp.active) | 1833 break; 1834 } 1835 } 1836 1837 if(bundle->bandwidth == 0) 1838 bundle->bandwidth = 115200; /* Shrug */ 1839 1840 if (bundle->ncp.mp.active) |
1848 bundle->mtu = bundle->ncp.mp.peer_mrru; 1849 else if (!bundle->mtu) 1850 bundle->mtu = 1500; | 1841 bundle->iface->mtu = bundle->ncp.mp.peer_mrru; 1842 else if (!bundle->iface->mtu) 1843 bundle->iface->mtu = DEF_MRU; |
1851 1852#ifndef NORADIUS 1853 if (bundle->radius.valid && bundle->radius.mtu && | 1844 1845#ifndef NORADIUS 1846 if (bundle->radius.valid && bundle->radius.mtu && |
1854 bundle->radius.mtu < bundle->mtu) { | 1847 bundle->radius.mtu < bundle->iface->mtu) { |
1855 log_Printf(LogLCP, "Reducing MTU to radius value %lu\n", 1856 bundle->radius.mtu); | 1848 log_Printf(LogLCP, "Reducing MTU to radius value %lu\n", 1849 bundle->radius.mtu); |
1857 bundle->mtu = bundle->radius.mtu; | 1850 bundle->iface->mtu = bundle->radius.mtu; |
1858 } 1859#endif 1860 1861 tun_configure(bundle); 1862 1863 route_UpdateMTU(bundle); 1864} 1865 --- 72 unchanged lines hidden --- | 1851 } 1852#endif 1853 1854 tun_configure(bundle); 1855 1856 route_UpdateMTU(bundle); 1857} 1858 --- 72 unchanged lines hidden --- |