From: Russ Combs Date: Wed, 4 Jun 2014 13:56:11 +0000 (-0400) Subject: moved Parameter* from deflt to range for list and table X-Git-Tag: 3.0.0-233~1506 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98ef91c6e0fbbf539cdef3784f074d15dda0b49d;p=thirdparty%2Fsnort3.git moved Parameter* from deflt to range for list and table --- diff --git a/ChangeLog b/ChangeLog index a6a64d452..6b1c181b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +85 +-- swapped use of range and deflt for PT_TABLE and PT_LIST Parameters + (Parameter* is now in range so that deflt may be used for tabl/list + defaults) + 84 -- pulled in latest codecs -- removed src/mempool/ diff --git a/src/framework/parameter.cc b/src/framework/parameter.cc index 421245e4b..1daea9038 100644 --- a/src/framework/parameter.cc +++ b/src/framework/parameter.cc @@ -283,7 +283,7 @@ bool Parameter::validate(Value& v) const { // bool values case PT_BOOL: - return valid_bool(v, range); + return valid_bool(v, (const char*)range); // num values case PT_PORT: @@ -291,31 +291,31 @@ bool Parameter::validate(Value& v) const return valid_int(v, "0:65535"); // if a range was given fall thru case PT_INT: - return valid_int(v, range); + return valid_int(v, (const char*)range); case PT_REAL: - return valid_real(v, range); + return valid_real(v, (const char*)range); // string values case PT_STRING: - return valid_string(v, range); + return valid_string(v, (const char*)range); case PT_SELECT: - return valid_select(v, range); + return valid_select(v, (const char*)range); case PT_MULTI: - return valid_multi(v, range); + return valid_multi(v, (const char*)range); case PT_ENUM: - return valid_enum(v, range); + return valid_enum(v, (const char*)range); // address values case PT_MAC: - return valid_mac(v, range); + return valid_mac(v, (const char*)range); case PT_IP4: - return valid_ip4(v, range); + return valid_ip4(v, (const char*)range); case PT_ADDR: - return valid_addr(v, range); + return valid_addr(v, (const char*)range); // list values case PT_BIT_LIST: - return valid_bit_list(v, range); + return valid_bit_list(v, (const char*)range); case PT_ADDR_LIST: return true; diff --git a/src/framework/parameter.h b/src/framework/parameter.h index dcb0f35e2..be3ac1aef 100644 --- a/src/framework/parameter.h +++ b/src/framework/parameter.h @@ -29,8 +29,8 @@ struct Parameter { enum Type { - PT_TABLE, // deflt is Parameter* - PT_LIST, // deflt is Parameter*, range is max + PT_TABLE, // range is Parameter*, deflt is TBD + PT_LIST, // range is Parameter*, deflt is TBD PT_BOOL, // if you are reading this, get more coffee PT_INT, // signed 64 bits or less determined by range PT_REAL, // double @@ -48,8 +48,8 @@ struct Parameter }; const char* name; Type type; - const char* range; - const void* deflt; // nullptr|const char*|const Parameter* + const void* range; // nullptr|const char*|const Parameter* + const char* deflt; const char* help; const char* get_type() const; diff --git a/src/main/modules.cc b/src/main/modules.cc index 3f86179ac..06b187459 100644 --- a/src/main/modules.cc +++ b/src/main/modules.cc @@ -325,7 +325,7 @@ static const Parameter profile_rule_params[] = "avg_ticks_per_match | avg_ticks_per_no_match", "avg_ticks", "sort by given field" }, - { "file", Parameter::PT_TABLE, nullptr, profile_file_params, + { "file", Parameter::PT_TABLE, profile_file_params, nullptr, "file config" }, { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr } @@ -340,7 +340,7 @@ static const Parameter profile_preproc_params[] = "checks | avg_ticks | total_ticks", "avg_ticks", "sort by given field" }, - { "file", Parameter::PT_TABLE, nullptr, profile_file_params, + { "file", Parameter::PT_TABLE, profile_file_params, nullptr, "file config" }, { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr } @@ -348,10 +348,10 @@ static const Parameter profile_preproc_params[] = static const Parameter profile_params[] = { - { "rules", Parameter::PT_TABLE, nullptr, profile_rule_params, + { "rules", Parameter::PT_TABLE, profile_rule_params, nullptr, "" }, - { "preprocs", Parameter::PT_TABLE, nullptr, profile_preproc_params, + { "preprocs", Parameter::PT_TABLE, profile_preproc_params, nullptr, "" }, { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr } @@ -652,7 +652,7 @@ static const Parameter output_params[] = { "log_ipv6_extra_data", Parameter::PT_BOOL, nullptr, "false", "log IPv6 source and destination addresses as unified2 extra data records" }, - { "event_trace", Parameter::PT_TABLE, nullptr, output_event_trace_params, + { "event_trace", Parameter::PT_TABLE, output_event_trace_params, nullptr, "" }, { "quiet", Parameter::PT_BOOL, nullptr, "false", @@ -1699,10 +1699,10 @@ static const Parameter binder_use_params[] = static const Parameter binder_params[] = { - { "when", Parameter::PT_TABLE, nullptr, binder_when_params, + { "when", Parameter::PT_TABLE, binder_when_params, nullptr, "match criteria" }, - { "use", Parameter::PT_TABLE, nullptr, binder_use_params, + { "use", Parameter::PT_TABLE, binder_use_params, nullptr, "target configuration" }, { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr } @@ -1826,7 +1826,7 @@ static const Parameter hosts_params[] = { "tcp_policy", Parameter::PT_ENUM, tcp_policies, "linux", "tcp reassembly policy" }, - { "services", Parameter::PT_LIST, nullptr, service_params, + { "services", Parameter::PT_LIST, service_params, nullptr, "list of service parameters" }, { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr } diff --git a/src/managers/module_manager.cc b/src/managers/module_manager.cc index e2b642f74..53e530bfe 100644 --- a/src/managers/module_manager.cc +++ b/src/managers/module_manager.cc @@ -192,7 +192,7 @@ static void dump_field(string& key, const char* pfx, const Parameter* p, bool li // we dump just one list entry if ( p->type == Parameter::PT_TABLE || p->type == Parameter::PT_LIST ) - dump_table(key, pfx, (Parameter*)p->deflt); + dump_table(key, pfx, (Parameter*)p->range); else if ( !pfx || !strncmp(key.c_str(), pfx, strlen(pfx)) ) { @@ -243,7 +243,7 @@ static const Parameter* get_params(string& sfx, const Parameter* p) p->type != Parameter::PT_LIST ) return p; - p = (const Parameter*)p->deflt; + p = (const Parameter*)p->range; return get_params(sfx, p); } diff --git a/src/network_inspectors/arp_spoof/arp_module.cc b/src/network_inspectors/arp_spoof/arp_module.cc index a53a6b7b5..d28e30982 100644 --- a/src/network_inspectors/arp_spoof/arp_module.cc +++ b/src/network_inspectors/arp_spoof/arp_module.cc @@ -52,7 +52,7 @@ static const Parameter arp_spoof_params[] = { "unicast", Parameter::PT_BOOL, nullptr, "false", "help" }, - { "hosts", Parameter::PT_LIST, nullptr, arp_spoof_hosts_params, + { "hosts", Parameter::PT_LIST, arp_spoof_hosts_params, nullptr, "help" }, { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr } diff --git a/src/network_inspectors/normalize/norm_module.cc b/src/network_inspectors/normalize/norm_module.cc index 67c514b6f..c85969155 100644 --- a/src/network_inspectors/normalize/norm_module.cc +++ b/src/network_inspectors/normalize/norm_module.cc @@ -135,10 +135,10 @@ static const Parameter norm_tcp_params[] = static const Parameter normalize_params[] = { - { "ip4", Parameter::PT_TABLE, nullptr, norm_ip4_params, + { "ip4", Parameter::PT_TABLE, norm_ip4_params, nullptr, "set ip4 normalization options" }, - { "tcp", Parameter::PT_TABLE, nullptr, norm_tcp_params, + { "tcp", Parameter::PT_TABLE, norm_tcp_params, nullptr, "set tcp normalization options" }, { "ip6", Parameter::PT_BOOL, nullptr, "false", diff --git a/src/service_inspectors/ftp_telnet/ftp_module.cc b/src/service_inspectors/ftp_telnet/ftp_module.cc index 4225b6a4f..f603130eb 100644 --- a/src/service_inspectors/ftp_telnet/ftp_module.cc +++ b/src/service_inspectors/ftp_telnet/ftp_module.cc @@ -51,7 +51,7 @@ static const Parameter ftp_client_params[] = { "bounce", Parameter::PT_BOOL, nullptr, "false", "check for bounces" }, - { "bounce_to", Parameter::PT_TABLE, nullptr, client_bounce_params, + { "bounce_to", Parameter::PT_TABLE, client_bounce_params, nullptr, "allow bounces to CIDRs / ports" }, { "ignore_telnet_erase_cmds", Parameter::PT_BOOL, nullptr, "false", @@ -269,7 +269,7 @@ static const Parameter ftp_directory_params[] = static const Parameter ftp_server_params[] = { - { "alt_max_param", Parameter::PT_LIST, nullptr, ftp_server_alt_max_params, + { "alt_max_param", Parameter::PT_LIST, ftp_server_alt_max_params, nullptr, "specify non-default maximum command lengths" }, { "chk_str_fmt", Parameter::PT_STRING, nullptr, nullptr, @@ -281,7 +281,7 @@ static const Parameter ftp_server_params[] = { "data_xfer_cmds", Parameter::PT_STRING, nullptr, nullptr, "check the formatting of the given commands" }, - { "directory_cmds", Parameter::PT_LIST, nullptr, ftp_directory_params, + { "directory_cmds", Parameter::PT_LIST, ftp_directory_params, nullptr, "specify command-response pairs" }, { "file_put_cmds", Parameter::PT_STRING, nullptr, nullptr, @@ -299,7 +299,7 @@ static const Parameter ftp_server_params[] = { "check_encrypted", Parameter::PT_BOOL, nullptr, "false", "check for end of encryption" }, - { "cmd_validity", Parameter::PT_LIST, nullptr, ftp_server_validity_params, + { "cmd_validity", Parameter::PT_LIST, ftp_server_validity_params, nullptr, "specify command formats" }, { "def_max_param_len", Parameter::PT_INT, "1:", "100", diff --git a/src/service_inspectors/http_inspect/hi_module.cc b/src/service_inspectors/http_inspect/hi_module.cc index dd068e980..990718f9f 100644 --- a/src/service_inspectors/http_inspect/hi_module.cc +++ b/src/service_inspectors/http_inspect/hi_module.cc @@ -70,7 +70,7 @@ static const Parameter hi_global_params[] = { "compress_depth", Parameter::PT_INT, "1:65535", "1460", "maximum amount of packet payload to decompress" }, - { "decode", Parameter::PT_TABLE, nullptr, hi_decode_params, + { "decode", Parameter::PT_TABLE, hi_decode_params, nullptr, "help" }, { "decompress_depth", Parameter::PT_INT, "1:65535", "2920", @@ -86,13 +86,13 @@ static const Parameter hi_global_params[] = { "memcap", Parameter::PT_INT, "2304:", "150994944", "limit of memory used for logging extra data" }, - //{ "mime", Parameter::PT_TABLE, nullptr, hi_mime_params, + //{ "mime", Parameter::PT_TABLE, hi_mime_params, nullptr, // "help" }, { "proxy_alert", Parameter::PT_BOOL, nullptr, "false", "alert on proxy usage for servers without allow_proxy_use" }, - { "unicode_map", Parameter::PT_TABLE, nullptr, hi_umap_params, + { "unicode_map", Parameter::PT_TABLE, hi_umap_params, nullptr, "help" }, { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr } @@ -292,7 +292,7 @@ static const Parameter hi_server_params[] = { "iis_unicode", Parameter::PT_BOOL, nullptr, "false", "enable unicode code point mapping using unicode_map settings" }, - { "iis_unicode_map", Parameter::PT_TABLE, nullptr, hi_umap_params, + { "iis_unicode_map", Parameter::PT_TABLE, hi_umap_params, nullptr, "help" }, { "inspect_gzip", Parameter::PT_BOOL, nullptr, "false", @@ -367,7 +367,7 @@ static const Parameter hi_server_params[] = { "u_encode", Parameter::PT_BOOL, nullptr, "false", "decode %uXXXX character sequences" }, - { "unicode_map", Parameter::PT_TABLE, nullptr, hi_umap_params, + { "unicode_map", Parameter::PT_TABLE, hi_umap_params, nullptr, "help" }, { "unlimited_decompress", Parameter::PT_INT, nullptr, "false", diff --git a/src/stream/base/stream_module.cc b/src/stream/base/stream_module.cc index dd2ad050d..3e4308009 100644 --- a/src/stream/base/stream_module.cc +++ b/src/stream/base/stream_module.cc @@ -61,16 +61,16 @@ static const Parameter proto_params[] = static const Parameter stream_params[] = { - { "icmp_cache", Parameter::PT_TABLE, nullptr, proto_params, + { "icmp_cache", Parameter::PT_TABLE, proto_params, nullptr, "configure icmp cache limits" }, - { "ip_cache", Parameter::PT_TABLE, nullptr, proto_params, + { "ip_cache", Parameter::PT_TABLE, proto_params, nullptr, "configure ip cache limits" }, - { "tcp_cache", Parameter::PT_TABLE, nullptr, proto_params, + { "tcp_cache", Parameter::PT_TABLE, proto_params, nullptr, "configure tcp cache limits" }, - { "udp_cache", Parameter::PT_TABLE, nullptr, proto_params, + { "udp_cache", Parameter::PT_TABLE, proto_params, nullptr, "configure udp cache limits" }, { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr } diff --git a/src/stream/ip/ip_defrag.cc b/src/stream/ip/ip_defrag.cc index 8589e82a9..f4d75dcdf 100644 --- a/src/stream/ip/ip_defrag.cc +++ b/src/stream/ip/ip_defrag.cc @@ -462,6 +462,7 @@ static inline void EventAnomScMinTTL(FragEngine*) t_stats.alerts++; } +#if 0 static int FragPolicyIdFromName(char *name) { if (!name) @@ -499,6 +500,7 @@ static int FragPolicyIdFromName(char *name) } return FRAG_POLICY_DEFAULT; } +#endif /** * Check to see if a FragTracker has timed out diff --git a/src/stream/tcp/tcp_module.cc b/src/stream/tcp/tcp_module.cc index db8f8f709..b6dc7730c 100644 --- a/src/stream/tcp/tcp_module.cc +++ b/src/stream/tcp/tcp_module.cc @@ -157,10 +157,10 @@ static const Parameter stream_tcp_params[] = { "show_rebuilt_packets", Parameter::PT_BOOL, nullptr, "false", "enable cmg like output of reassembled packets" }, - { "queue_limit", Parameter::PT_TABLE, nullptr, stream_queue_limit_params, + { "queue_limit", Parameter::PT_TABLE, stream_queue_limit_params, nullptr, "limit amount of segment data queued" }, - { "small_segments", Parameter::PT_TABLE, nullptr, stream_tcp_small_params, + { "small_segments", Parameter::PT_TABLE, stream_tcp_small_params, nullptr, "limit number of small segments queued" }, { "session_timeout", Parameter::PT_INT, "1:86400", "30",