From 67be58f6ea817974d82ba04febbccdfe9edaad13 Mon Sep 17 00:00:00 2001 From: luwenpeng Date: Thu, 29 Jul 2021 11:29:11 +0800 Subject: [PATCH] =?UTF-8?q?TSG-7234=20=E8=B0=83=E6=95=B4Proxy=E7=9A=84?= =?UTF-8?q?=E8=A7=A3=E5=AF=86=E6=B5=81=E9=87=8F=E8=BD=AC=E5=8F=91=E7=9A=84?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=EF=BC=8C=E4=BB=A5=E9=80=82=E9=85=8DTSG-9140?= =?UTF-8?q?=E4=B8=8B=E8=A7=A3=E5=AF=86=E6=B5=81=E9=87=8F=E8=BD=AC=E5=8F=91?= =?UTF-8?q?=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/tfe/tfe.conf | 1 + plugin/business/traffic-mirror/include/traffic_mirror.h | 1 + plugin/business/traffic-mirror/src/entry.cpp | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/conf/tfe/tfe.conf b/conf/tfe/tfe.conf index 123117c..e5ca8ea 100644 --- a/conf/tfe/tfe.conf +++ b/conf/tfe/tfe.conf @@ -150,6 +150,7 @@ enable=1 device=eth4 # 0:TRAFFIC_MIRROR_ETHDEV_AF_PACKET; 1:TRAFFIC_MIRROR_ETHDEV_MARSIO type=1 +default_vlan_id_for_mac=0 table_info=resource/pangu/table_info_traffic_mirror.conf stat_file=log/traffic_mirror.status diff --git a/plugin/business/traffic-mirror/include/traffic_mirror.h b/plugin/business/traffic-mirror/include/traffic_mirror.h index d9828e1..b8d3f8a 100644 --- a/plugin/business/traffic-mirror/include/traffic_mirror.h +++ b/plugin/business/traffic-mirror/include/traffic_mirror.h @@ -23,6 +23,7 @@ struct traffic_mirror_instance void * logger; unsigned int enable; unsigned int nr_threads; + unsigned int default_vlan_id_for_mac; Maat_feather_t maat_feather; int policy_table_id; diff --git a/plugin/business/traffic-mirror/src/entry.cpp b/plugin/business/traffic-mirror/src/entry.cpp index 50b336d..1066d1a 100644 --- a/plugin/business/traffic-mirror/src/entry.cpp +++ b/plugin/business/traffic-mirror/src/entry.cpp @@ -286,7 +286,7 @@ void profile_table_ex_data_new_cb(int table_id, const char * key, const char * t } ex_data->ether_addrs[iter] = ether_addr_aton; - ex_data->vlans[iter] = 0; + ex_data->vlans[iter] = instance->default_vlan_id_for_mac; iter++; } @@ -451,6 +451,7 @@ static int traffic_mirror_ethdev_init(struct traffic_mirror_instance * instance) return -1; } + MESA_load_profile_uint_def(profile, "traffic_mirror", "default_vlan_id_for_mac", &(instance->default_vlan_id_for_mac), 0); unsigned int device_type; MESA_load_profile_uint_def(profile, "traffic_mirror", "type", &device_type, TRAFFIC_MIRROR_ETHDEV_AF_PACKET);