Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
@@ -71,6 +71,7 @@ static u_int8_t live_capture = 0;
|
|||||||
static u_int8_t undetected_flows_deleted = 0;
|
static u_int8_t undetected_flows_deleted = 0;
|
||||||
FILE *csv_fp = NULL; /**< for CSV export */
|
FILE *csv_fp = NULL; /**< for CSV export */
|
||||||
static char* domain_to_check = NULL;
|
static char* domain_to_check = NULL;
|
||||||
|
static u_int8_t ignore_vlanid = 0;
|
||||||
/** User preferences **/
|
/** User preferences **/
|
||||||
u_int8_t enable_protocol_guess = 1, enable_payload_analyzer = 0, num_bin_clusters = 0;
|
u_int8_t enable_protocol_guess = 1, enable_payload_analyzer = 0, num_bin_clusters = 0;
|
||||||
u_int8_t verbose = 0, enable_joy_stats = 0;
|
u_int8_t verbose = 0, enable_joy_stats = 0;
|
||||||
@@ -484,6 +485,7 @@ static void help(u_int long_help) {
|
|||||||
" -U <num> | Max number of UDP processed packets before giving up [default: %u]\n"
|
" -U <num> | Max number of UDP processed packets before giving up [default: %u]\n"
|
||||||
" -D | Enable DoH traffic analysis based on content (no DPI)\n"
|
" -D | Enable DoH traffic analysis based on content (no DPI)\n"
|
||||||
" -x <domain> | Check domain name [Test only]\n"
|
" -x <domain> | Check domain name [Test only]\n"
|
||||||
|
" -I | Ignore VLAN id for flow hash calculation\n"
|
||||||
,
|
,
|
||||||
human_readeable_string_len,
|
human_readeable_string_len,
|
||||||
min_pattern_len, max_pattern_len, max_num_packets_per_flow, max_packet_payload_dissection,
|
min_pattern_len, max_pattern_len, max_num_packets_per_flow, max_packet_payload_dissection,
|
||||||
@@ -541,6 +543,7 @@ static struct option longopts[] = {
|
|||||||
{ "cpu-bind", required_argument, NULL, 'g'},
|
{ "cpu-bind", required_argument, NULL, 'g'},
|
||||||
{ "loops", required_argument, NULL, 'l'},
|
{ "loops", required_argument, NULL, 'l'},
|
||||||
{ "num-threads", required_argument, NULL, 'n'},
|
{ "num-threads", required_argument, NULL, 'n'},
|
||||||
|
{ "ignore-vlanid", no_argument, NULL, 'I'},
|
||||||
|
|
||||||
{ "protos", required_argument, NULL, 'p'},
|
{ "protos", required_argument, NULL, 'p'},
|
||||||
{ "capture-duration", required_argument, NULL, 's'},
|
{ "capture-duration", required_argument, NULL, 's'},
|
||||||
@@ -759,7 +762,7 @@ static void parseOptions(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while((opt = getopt_long(argc, argv, "b:e:c:C:dDf:g:i:hp:P:l:s:tu:v:V:n:Jrp:x:w:q0123:456:7:89:m:T:U:",
|
while((opt = getopt_long(argc, argv, "b:e:c:C:dDf:g:i:Ihp:P:l:s:tu:v:V:n:Jrp:x:w:q0123:456:7:89:m:T:U:",
|
||||||
longopts, &option_idx)) != EOF) {
|
longopts, &option_idx)) != EOF) {
|
||||||
#ifdef DEBUG_TRACE
|
#ifdef DEBUG_TRACE
|
||||||
if(trace) fprintf(trace, " #### -%c [%s] #### \n", opt, optarg ? optarg : "");
|
if(trace) fprintf(trace, " #### -%c [%s] #### \n", opt, optarg ? optarg : "");
|
||||||
@@ -788,6 +791,10 @@ static void parseOptions(int argc, char **argv) {
|
|||||||
_pcap_file[0] = optarg;
|
_pcap_file[0] = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'I':
|
||||||
|
ignore_vlanid = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
pcap_analysis_duration = atol(optarg);
|
pcap_analysis_duration = atol(optarg);
|
||||||
break;
|
break;
|
||||||
@@ -2019,6 +2026,7 @@ static void setupDetection(u_int16_t thread_id, pcap_t * pcap_handle) {
|
|||||||
prefs.num_roots = NUM_ROOTS;
|
prefs.num_roots = NUM_ROOTS;
|
||||||
prefs.max_ndpi_flows = MAX_NDPI_FLOWS;
|
prefs.max_ndpi_flows = MAX_NDPI_FLOWS;
|
||||||
prefs.quiet_mode = quiet_mode;
|
prefs.quiet_mode = quiet_mode;
|
||||||
|
prefs.ignore_vlanid = ignore_vlanid;
|
||||||
|
|
||||||
memset(&ndpi_thread_info[thread_id], 0, sizeof(ndpi_thread_info[thread_id]));
|
memset(&ndpi_thread_info[thread_id], 0, sizeof(ndpi_thread_info[thread_id]));
|
||||||
ndpi_thread_info[thread_id].workflow = ndpi_workflow_init(&prefs, pcap_handle);
|
ndpi_thread_info[thread_id].workflow = ndpi_workflow_init(&prefs, pcap_handle);
|
||||||
|
|||||||
@@ -779,7 +779,10 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow
|
|||||||
flow.protocol = iph->protocol, flow.vlan_id = vlan_id;
|
flow.protocol = iph->protocol, flow.vlan_id = vlan_id;
|
||||||
flow.src_ip = iph->saddr, flow.dst_ip = iph->daddr;
|
flow.src_ip = iph->saddr, flow.dst_ip = iph->daddr;
|
||||||
flow.src_port = htons(*sport), flow.dst_port = htons(*dport);
|
flow.src_port = htons(*sport), flow.dst_port = htons(*dport);
|
||||||
flow.hashval = hashval = flow.protocol + flow.vlan_id + flow.src_ip + flow.dst_ip + flow.src_port + flow.dst_port;
|
flow.hashval = hashval = flow.protocol + flow.src_ip + flow.dst_ip + flow.src_port + flow.dst_port;
|
||||||
|
if (workflow->prefs.ignore_vlanid == 0) {
|
||||||
|
flow.hashval += flow.vlan_id;
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
printf("hashval=%u [%u][%u][%u:%u][%u:%u]\n", hashval, flow.protocol, flow.vlan_id,
|
printf("hashval=%u [%u][%u][%u:%u][%u:%u]\n", hashval, flow.protocol, flow.vlan_id,
|
||||||
|
|||||||
@@ -264,6 +264,7 @@ typedef struct ndpi_stats {
|
|||||||
typedef struct ndpi_workflow_prefs {
|
typedef struct ndpi_workflow_prefs {
|
||||||
u_int8_t decode_tunnels;
|
u_int8_t decode_tunnels;
|
||||||
u_int8_t quiet_mode;
|
u_int8_t quiet_mode;
|
||||||
|
u_int8_t ignore_vlanid;
|
||||||
u_int32_t num_roots;
|
u_int32_t num_roots;
|
||||||
u_int32_t max_ndpi_flows;
|
u_int32_t max_ndpi_flows;
|
||||||
} ndpi_workflow_prefs_t;
|
} ndpi_workflow_prefs_t;
|
||||||
|
|||||||
Reference in New Issue
Block a user