natd.c (118873) | natd.c (120372) |
---|---|
1/* 2 * natd - Network Address Translation Daemon for FreeBSD. 3 * 4 * This software is provided free of charge, with no 5 * warranty of any kind, either expressed or implied. 6 * Use at your own risk. 7 * 8 * You may copy, modify and distribute this software (natd.c) freely. 9 * 10 * Ari Suutari <suutari@iki.fi> 11 */ 12 13#include <sys/cdefs.h> | 1/* 2 * natd - Network Address Translation Daemon for FreeBSD. 3 * 4 * This software is provided free of charge, with no 5 * warranty of any kind, either expressed or implied. 6 * Use at your own risk. 7 * 8 * You may copy, modify and distribute this software (natd.c) freely. 9 * 10 * Ari Suutari <suutari@iki.fi> 11 */ 12 13#include <sys/cdefs.h> |
14__FBSDID("$FreeBSD: head/sbin/natd/natd.c 118873 2003-08-13 13:16:19Z ru $"); | 14__FBSDID("$FreeBSD: head/sbin/natd/natd.c 120372 2003-09-23 07:41:55Z marcus $"); |
15 16#define SYSLOG_NAMES 17 18#include <sys/types.h> 19#include <sys/socket.h> 20#include <sys/sysctl.h> 21#include <sys/time.h> 22 --- 71 unchanged lines hidden (view full) --- 94static void SetupAddressRedirect (const char* parms); 95static void StrToAddr (const char* str, struct in_addr* addr); 96static u_short StrToPort (const char* str, const char* proto); 97static int StrToPortRange (const char* str, const char* proto, port_range *portRange); 98static int StrToProto (const char* str); 99static int StrToAddrAndPortRange (const char* str, struct in_addr* addr, char* proto, port_range *portRange); 100static void ParseArgs (int argc, char** argv); 101static void SetupPunchFW(const char *strValue); | 15 16#define SYSLOG_NAMES 17 18#include <sys/types.h> 19#include <sys/socket.h> 20#include <sys/sysctl.h> 21#include <sys/time.h> 22 --- 71 unchanged lines hidden (view full) --- 94static void SetupAddressRedirect (const char* parms); 95static void StrToAddr (const char* str, struct in_addr* addr); 96static u_short StrToPort (const char* str, const char* proto); 97static int StrToPortRange (const char* str, const char* proto, port_range *portRange); 98static int StrToProto (const char* str); 99static int StrToAddrAndPortRange (const char* str, struct in_addr* addr, char* proto, port_range *portRange); 100static void ParseArgs (int argc, char** argv); 101static void SetupPunchFW(const char *strValue); |
102static void SetupSkinnyPort(const char *strValue); |
|
102 103/* 104 * Globals. 105 */ 106 107static int verbose; 108static int background; 109static int running; --- 723 unchanged lines hidden (view full) --- 833 RedirectProto, 834 RedirectAddress, 835 ConfigFile, 836 DynamicMode, 837 ProxyRule, 838 LogDenied, 839 LogFacility, 840 PunchFW, | 103 104/* 105 * Globals. 106 */ 107 108static int verbose; 109static int background; 110static int running; --- 723 unchanged lines hidden (view full) --- 834 RedirectProto, 835 RedirectAddress, 836 ConfigFile, 837 DynamicMode, 838 ProxyRule, 839 LogDenied, 840 LogFacility, 841 PunchFW, |
842 SkinnyPort, |
|
841 LogIpfwDenied, 842 PidFile 843}; 844 845enum Param { 846 847 YesNo, 848 Numeric, --- 205 unchanged lines hidden (view full) --- 1054 { PunchFW, 1055 0, 1056 String, 1057 "basenumber:count", 1058 "punch holes in the firewall for incoming FTP/IRC DCC connections", 1059 "punch_fw", 1060 NULL }, 1061 | 843 LogIpfwDenied, 844 PidFile 845}; 846 847enum Param { 848 849 YesNo, 850 Numeric, --- 205 unchanged lines hidden (view full) --- 1056 { PunchFW, 1057 0, 1058 String, 1059 "basenumber:count", 1060 "punch holes in the firewall for incoming FTP/IRC DCC connections", 1061 "punch_fw", 1062 NULL }, 1063 |
1064 { SkinnyPort, 1065 0, 1066 String, 1067 "port", 1068 "set the TCP port for use with the Skinny Station protocol", 1069 "skinny_port", 1070 NULL }, 1071 |
|
1062 { LogIpfwDenied, 1063 0, 1064 YesNo, 1065 "[yes|no]", 1066 "log packets converted by natd, but denied by ipfw", 1067 "log_ipfw_denied", 1068 NULL }, 1069 --- 183 unchanged lines hidden (view full) --- 1253 errx(1, "Unknown log facility name: %s", strValue); 1254 1255 break; 1256 1257 case PunchFW: 1258 SetupPunchFW(strValue); 1259 break; 1260 | 1072 { LogIpfwDenied, 1073 0, 1074 YesNo, 1075 "[yes|no]", 1076 "log packets converted by natd, but denied by ipfw", 1077 "log_ipfw_denied", 1078 NULL }, 1079 --- 183 unchanged lines hidden (view full) --- 1263 errx(1, "Unknown log facility name: %s", strValue); 1264 1265 break; 1266 1267 case PunchFW: 1268 SetupPunchFW(strValue); 1269 break; 1270 |
1271 case SkinnyPort: 1272 SetupSkinnyPort(strValue); 1273 break; 1274 |
|
1261 case LogIpfwDenied: 1262 logIpfwDenied = yesNoValue;; 1263 break; 1264 1265 case PidFile: 1266 pidName = strdup (strValue); 1267 break; 1268 } --- 431 unchanged lines hidden (view full) --- 1700 unsigned int base, num; 1701 1702 if (sscanf(strValue, "%u:%u", &base, &num) != 2) 1703 errx(1, "punch_fw: basenumber:count parameter required"); 1704 1705 PacketAliasSetFWBase(base, num); 1706 (void)PacketAliasSetMode(PKT_ALIAS_PUNCH_FW, PKT_ALIAS_PUNCH_FW); 1707} | 1275 case LogIpfwDenied: 1276 logIpfwDenied = yesNoValue;; 1277 break; 1278 1279 case PidFile: 1280 pidName = strdup (strValue); 1281 break; 1282 } --- 431 unchanged lines hidden (view full) --- 1714 unsigned int base, num; 1715 1716 if (sscanf(strValue, "%u:%u", &base, &num) != 2) 1717 errx(1, "punch_fw: basenumber:count parameter required"); 1718 1719 PacketAliasSetFWBase(base, num); 1720 (void)PacketAliasSetMode(PKT_ALIAS_PUNCH_FW, PKT_ALIAS_PUNCH_FW); 1721} |
1722 1723static void 1724SetupSkinnyPort(const char *strValue) 1725{ 1726 unsigned int port; 1727 1728 if (sscanf(strValue, "%u", &port) != 1) 1729 errx(1, "skinny_port: port parameter required"); 1730 1731 PacketAliasSetSkinnyPort(port); 1732} |
|