增加重复流量识别与过滤.

This commit is contained in:
lijia
2021-03-30 17:32:52 +08:00
parent a5b2326a34
commit 4ef2936f42
2 changed files with 7 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
#ifndef _MESA_PKT_DUMP_H_ #ifndef _MESA_PKT_DUMP_H_
#define _MESA_PKT_DUMP_H_ 1 #define _MESA_PKT_DUMP_H_ 1
#define MESA_PKT_DUM_H_VER (20201102) #define MESA_PKT_DUM_H_VER (20210330)
/* /*
<09><><EFBFBD><EFBFBD>DPDK-3.0, PFRINGģʽ<C4A3><CABD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>ʱ, ͨ<><CDA8>ƽ̨ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD>. <09><><EFBFBD><EFBFBD>DPDK-3.0, PFRINGģʽ<C4A3><CABD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>ʱ, ͨ<><CDA8>ƽ̨ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD>.
@@ -16,6 +16,7 @@ enum _pkt_classify{
PKT_CLASSIFY_INJECT = 0x04, /* DMAC ascii<69><69>ֵ: J */ PKT_CLASSIFY_INJECT = 0x04, /* DMAC ascii<69><69>ֵ: J */
PKT_CLASSIFY_DROP = 0x08, /* DMAC ascii<69><69>ֵ: D */ PKT_CLASSIFY_DROP = 0x08, /* DMAC ascii<69><69>ֵ: D */
PKT_CLASSIFY_ERROR = 0x10, /* DMAC ascii<69><69>ֵ: E */ PKT_CLASSIFY_ERROR = 0x10, /* DMAC ascii<69><69>ֵ: E */
PKT_CLASSIFY_REPEAT = 0x20, /* DMAC ascii<69><69>ֵ: R */
}; };
enum pkt_dump_opt_t{ enum pkt_dump_opt_t{

View File

@@ -1382,6 +1382,9 @@ static short get_pkt_classify_optarg(const char *optarg)
pkt_classify_flag |= PKT_CLASSIFY_DROP; pkt_classify_flag |= PKT_CLASSIFY_DROP;
else if (strcasecmp(section, "error") == 0) else if (strcasecmp(section, "error") == 0)
pkt_classify_flag |= PKT_CLASSIFY_ERROR; pkt_classify_flag |= PKT_CLASSIFY_ERROR;
else if (strcasecmp(section, "repeat") == 0)
pkt_classify_flag |= PKT_CLASSIFY_REPEAT;
else else
{ {
return 0; return 0;
@@ -1931,7 +1934,7 @@ main(int argc, char **argv)
pkt_classify_flag = get_pkt_classify_optarg(optarg); pkt_classify_flag = get_pkt_classify_optarg(optarg);
if(pkt_classify_flag == 0) if(pkt_classify_flag == 0)
{ {
error("unknown classify `%s', must be in|forward|inject|drop|error", optarg); error("unknown classify `%s', must be in|forward|inject|drop|error|repeat", optarg);
} }
break; break;
case OPTION_PKT_CLASSIFY_WATERMARK: case OPTION_PKT_CLASSIFY_WATERMARK:
@@ -3336,7 +3339,7 @@ print_usage(void)
(void)fprintf(stderr, (void)fprintf(stderr,
"\t\t[ --vlan-as-mac-in-mac ] force VLAN to be analysed as MAC-IN-MAC format.\n"); "\t\t[ --vlan-as-mac-in-mac ] force VLAN to be analysed as MAC-IN-MAC format.\n");
(void)fprintf(stderr, (void)fprintf(stderr,
"\t\t[ --classify in|forward|inject|drop|error ]. specify packet capture classifier by direction and operation\n"); "\t\t[ --classify in|forward|inject|drop|error|repeat ]. specify packet capture classifier by direction and operation\n");
(void)fprintf(stderr, (void)fprintf(stderr,
"\t\t[ --enable_classify_watermark ]. enable record classify type in src mac address\n"); "\t\t[ --enable_classify_watermark ]. enable record classify type in src mac address\n");
#endif #endif