bundle.c (40622) | bundle.c (40665) |
---|---|
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.36 1998/10/22 02:32:48 brian Exp $ | 26 * $Id: bundle.c,v 1.37 1998/10/24 01:08:45 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> --- 945 unchanged lines hidden (view full) --- 980 memset(&rtmes, '\0', sizeof rtmes); 981 rtmes.m_rtm.rtm_version = RTM_VERSION; 982 rtmes.m_rtm.rtm_type = cmd; 983 rtmes.m_rtm.rtm_addrs = RTA_DST; 984 rtmes.m_rtm.rtm_seq = ++bundle->routing_seq; 985 rtmes.m_rtm.rtm_pid = getpid(); 986 rtmes.m_rtm.rtm_flags = RTF_UP | RTF_GATEWAY | RTF_STATIC; 987 | 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> --- 945 unchanged lines hidden (view full) --- 980 memset(&rtmes, '\0', sizeof rtmes); 981 rtmes.m_rtm.rtm_version = RTM_VERSION; 982 rtmes.m_rtm.rtm_type = cmd; 983 rtmes.m_rtm.rtm_addrs = RTA_DST; 984 rtmes.m_rtm.rtm_seq = ++bundle->routing_seq; 985 rtmes.m_rtm.rtm_pid = getpid(); 986 rtmes.m_rtm.rtm_flags = RTF_UP | RTF_GATEWAY | RTF_STATIC; 987 |
988 if (cmd == RTM_ADD || cmd == RTM_CHANGE) { 989 if (bundle->ncp.ipcp.cfg.sendpipe > 0) { 990 rtmes.m_rtm.rtm_rmx.rmx_sendpipe = bundle->ncp.ipcp.cfg.sendpipe; 991 rtmes.m_rtm.rtm_inits |= RTV_SPIPE; 992 } 993 if (bundle->ncp.ipcp.cfg.recvpipe > 0) { 994 rtmes.m_rtm.rtm_rmx.rmx_recvpipe = bundle->ncp.ipcp.cfg.recvpipe; 995 rtmes.m_rtm.rtm_inits |= RTV_RPIPE; 996 } 997 } 998 |
|
988 memset(&rtdata, '\0', sizeof rtdata); 989 rtdata.sin_len = sizeof rtdata; 990 rtdata.sin_family = AF_INET; 991 rtdata.sin_port = 0; 992 rtdata.sin_addr = dst; 993 994 cp = rtmes.m_space; 995 memcpy(cp, &rtdata, rtdata.sin_len); --- 31 unchanged lines hidden (view full) --- 1027 log_Printf(LogTCPIP, "bundle_SetRoute: Dst = %s\n", inet_ntoa(dst)); 1028 log_Printf(LogTCPIP, "bundle_SetRoute: Gateway = %s\n", inet_ntoa(gateway)); 1029 log_Printf(LogTCPIP, "bundle_SetRoute: Mask = %s\n", inet_ntoa(mask)); 1030failed: 1031 if (cmd == RTM_ADD && (rtmes.m_rtm.rtm_errno == EEXIST || 1032 (rtmes.m_rtm.rtm_errno == 0 && errno == EEXIST))) { 1033 if (!bang) { 1034 log_Printf(LogWARN, "Add route failed: %s already exists\n", | 999 memset(&rtdata, '\0', sizeof rtdata); 1000 rtdata.sin_len = sizeof rtdata; 1001 rtdata.sin_family = AF_INET; 1002 rtdata.sin_port = 0; 1003 rtdata.sin_addr = dst; 1004 1005 cp = rtmes.m_space; 1006 memcpy(cp, &rtdata, rtdata.sin_len); --- 31 unchanged lines hidden (view full) --- 1038 log_Printf(LogTCPIP, "bundle_SetRoute: Dst = %s\n", inet_ntoa(dst)); 1039 log_Printf(LogTCPIP, "bundle_SetRoute: Gateway = %s\n", inet_ntoa(gateway)); 1040 log_Printf(LogTCPIP, "bundle_SetRoute: Mask = %s\n", inet_ntoa(mask)); 1041failed: 1042 if (cmd == RTM_ADD && (rtmes.m_rtm.rtm_errno == EEXIST || 1043 (rtmes.m_rtm.rtm_errno == 0 && errno == EEXIST))) { 1044 if (!bang) { 1045 log_Printf(LogWARN, "Add route failed: %s already exists\n", |
1035 inet_ntoa(dst)); | 1046 dst.s_addr == 0 ? "default" : inet_ntoa(dst)); |
1036 result = 0; /* Don't add to our dynamic list */ 1037 } else { 1038 rtmes.m_rtm.rtm_type = cmd = RTM_CHANGE; 1039 if ((wb = ID0write(s, &rtmes, nb)) < 0) 1040 goto failed; 1041 } 1042 } else if (cmd == RTM_DELETE && 1043 (rtmes.m_rtm.rtm_errno == ESRCH || --- 181 unchanged lines hidden (view full) --- 1225 } else 1226 prompt_Printf(arg->prompt, "disabled\n"); 1227 prompt_Printf(arg->prompt, " MTU: "); 1228 if (arg->bundle->cfg.mtu) 1229 prompt_Printf(arg->prompt, "%d\n", arg->bundle->cfg.mtu); 1230 else 1231 prompt_Printf(arg->prompt, "unspecified\n"); 1232 | 1047 result = 0; /* Don't add to our dynamic list */ 1048 } else { 1049 rtmes.m_rtm.rtm_type = cmd = RTM_CHANGE; 1050 if ((wb = ID0write(s, &rtmes, nb)) < 0) 1051 goto failed; 1052 } 1053 } else if (cmd == RTM_DELETE && 1054 (rtmes.m_rtm.rtm_errno == ESRCH || --- 181 unchanged lines hidden (view full) --- 1236 } else 1237 prompt_Printf(arg->prompt, "disabled\n"); 1238 prompt_Printf(arg->prompt, " MTU: "); 1239 if (arg->bundle->cfg.mtu) 1240 prompt_Printf(arg->prompt, "%d\n", arg->bundle->cfg.mtu); 1241 else 1242 prompt_Printf(arg->prompt, "unspecified\n"); 1243 |
1244 prompt_Printf(arg->prompt, " sendpipe: "); 1245 if (arg->bundle->ncp.ipcp.cfg.sendpipe > 0) 1246 prompt_Printf(arg->prompt, "%ld\n", arg->bundle->ncp.ipcp.cfg.sendpipe); 1247 else 1248 prompt_Printf(arg->prompt, "unspecified\n"); 1249 prompt_Printf(arg->prompt, " recvpipe: "); 1250 if (arg->bundle->ncp.ipcp.cfg.recvpipe > 0) 1251 prompt_Printf(arg->prompt, "%ld\n", arg->bundle->ncp.ipcp.cfg.recvpipe); 1252 else 1253 prompt_Printf(arg->prompt, "unspecified\n"); 1254 |
|
1233 prompt_Printf(arg->prompt, " Sticky Routes: %s\n", 1234 optval(arg->bundle, OPT_SROUTES)); 1235 prompt_Printf(arg->prompt, " ID check: %s\n", 1236 optval(arg->bundle, OPT_IDCHECK)); 1237 prompt_Printf(arg->prompt, " Loopback: %s\n", 1238 optval(arg->bundle, OPT_LOOPBACK)); 1239 prompt_Printf(arg->prompt, " PasswdAuth: %s\n", 1240 optval(arg->bundle, OPT_PASSWDAUTH)); 1241 prompt_Printf(arg->prompt, " Proxy: %s\n", 1242 optval(arg->bundle, OPT_PROXY)); | 1255 prompt_Printf(arg->prompt, " Sticky Routes: %s\n", 1256 optval(arg->bundle, OPT_SROUTES)); 1257 prompt_Printf(arg->prompt, " ID check: %s\n", 1258 optval(arg->bundle, OPT_IDCHECK)); 1259 prompt_Printf(arg->prompt, " Loopback: %s\n", 1260 optval(arg->bundle, OPT_LOOPBACK)); 1261 prompt_Printf(arg->prompt, " PasswdAuth: %s\n", 1262 optval(arg->bundle, OPT_PASSWDAUTH)); 1263 prompt_Printf(arg->prompt, " Proxy: %s\n", 1264 optval(arg->bundle, OPT_PROXY)); |
1265 prompt_Printf(arg->prompt, " Proxyall: %s\n", 1266 optval(arg->bundle, OPT_PROXYALL)); |
|
1243 prompt_Printf(arg->prompt, " Throughput: %s\n", 1244 optval(arg->bundle, OPT_THROUGHPUT)); 1245 prompt_Printf(arg->prompt, " Utmp Logging: %s\n", 1246 optval(arg->bundle, OPT_UTMP)); 1247 prompt_Printf(arg->prompt, " Iface-Alias: %s\n", 1248 optval(arg->bundle, OPT_IFACEALIAS)); 1249 1250 return 0; --- 460 unchanged lines hidden --- | 1267 prompt_Printf(arg->prompt, " Throughput: %s\n", 1268 optval(arg->bundle, OPT_THROUGHPUT)); 1269 prompt_Printf(arg->prompt, " Utmp Logging: %s\n", 1270 optval(arg->bundle, OPT_UTMP)); 1271 prompt_Printf(arg->prompt, " Iface-Alias: %s\n", 1272 optval(arg->bundle, OPT_IFACEALIAS)); 1273 1274 return 0; --- 460 unchanged lines hidden --- |