summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlijia <[email protected]>2019-04-09 18:29:33 +0800
committerlijia <[email protected]>2019-04-09 18:29:33 +0800
commitab1766f3f10dccabdbf087e9cde43ab5c923a516 (patch)
tree9a302f37821f72ae8f702c1798aaa5513eb77eea
parente8a8b9b390052dd59a7b7773c67a4c7997ab75d2 (diff)
adjust allot device.
-rw-r--r--dealpkt/deal_ethernet.c10
-rw-r--r--dealpkt/deal_ipv4.c1
-rw-r--r--dealpkt/deal_vlan.c8
-rw-r--r--dealpkt/plug_support.c18
-rw-r--r--include/stream_internal.h1
-rw-r--r--inner_plug/sapp_assistant.cpp13
-rw-r--r--packet_io/packet_io_marsio.c3
7 files changed, 34 insertions, 20 deletions
diff --git a/dealpkt/deal_ethernet.c b/dealpkt/deal_ethernet.c
index c5d632f..03da217 100644
--- a/dealpkt/deal_ethernet.c
+++ b/dealpkt/deal_ethernet.c
@@ -55,6 +55,7 @@ int eth_entry(struct streaminfo_private *fstream_pr, const void *this_layer_hdr,
if(NET_CONN_SERIAL_GDEV == g_topology_mode){
if(unlikely(sapp_identify_broad_multicast_pkt(this_layer_hdr, raw_pkt) != 0)){
+ g_SysInputInfo[thread_num][COUNTER_DROP_PKT]++;
return DROP;
}
}
@@ -147,8 +148,13 @@ int eth_entry(struct streaminfo_private *fstream_pr, const void *this_layer_hdr,
g_SysInputInfo[thread_num][PKT_UNKNOWN]++;
g_SysInputInfo[thread_num][PKT_UNKNOWN_LEN] += raw_pkt->raw_pkt_len;
if(NET_CONN_SERIAL_GDEV == g_topology_mode){
- /* GDEVģʽ��, ʲôʱ�򶼲�Ӧ�ðѲ���ʶ�İ���ת����ȥ, ���߷��ְ�SPT������Э����ע��ȥ, ����������� */
- ret = DROP;
+ if(sapp_identify_tunnel_inner_pkt(raw_pkt) != 0){
+ ret = PASS;
+ }else{
+ /* GDEVģʽ��, ʲôʱ�򶼲�Ӧ�ðѷ������ڲ���ʶ�İ���ת����ȥ, ���߷��ְ�SPT������Э����ע��ȥ, ����������� */
+ g_SysInputInfo[thread_num][COUNTER_DROP_PKT]++;
+ ret = DROP;
+ }
}else{
ret = PASS;
}
diff --git a/dealpkt/deal_ipv4.c b/dealpkt/deal_ipv4.c
index 92d696d..2ed66be 100644
--- a/dealpkt/deal_ipv4.c
+++ b/dealpkt/deal_ipv4.c
@@ -630,6 +630,7 @@ int ipv4_entry(struct streaminfo_private *pfstream_pr, const void *this_layer_da
}
*/
if(is_multicast_addr_v4(ntohl(a_packet->ip_dst.s_addr))){
+ g_SysInputInfo[thread_num][COUNTER_DROP_PKT]++;
return DROP;
}
}
diff --git a/dealpkt/deal_vlan.c b/dealpkt/deal_vlan.c
index a7cc602..3d90c59 100644
--- a/dealpkt/deal_vlan.c
+++ b/dealpkt/deal_vlan.c
@@ -93,8 +93,12 @@ int vlan_8021q_entry(struct streaminfo_private *pfstream_pr,const void *this_lay
default:
if(NET_CONN_SERIAL_GDEV == g_topology_mode){
- /* GDEVģʽ��, ʲôʱ�򶼲�Ӧ�ðѲ���ʶ�İ���ת����ȥ, ���߷��ְ�SPT������Э����ע��ȥ, ����������� */
- ret = DROP;
+ if(sapp_identify_tunnel_inner_pkt(raw_pkt) != 0){
+ ret = PASS;
+ }else{
+ /* GDEVģʽ��, ʲôʱ�򶼲�Ӧ�ðѲ���ʶ�İ���ת����ȥ, ���߷��ְ�SPT������Э����ע��ȥ, ����������� */
+ ret = DROP;
+ }
}else{
ret = PASS;
}
diff --git a/dealpkt/plug_support.c b/dealpkt/plug_support.c
index 7fa9428..e68a2a6 100644
--- a/dealpkt/plug_support.c
+++ b/dealpkt/plug_support.c
@@ -95,7 +95,7 @@ int get_opt_from_rawpkt(const void *voidpkt, int type, void *void_value)
case RAW_PKT_GET_GDEV_IP:
{
const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(mr_ctrlzone->__encap_len <= 0){/* ��vxlan��, �϶�û����Щѡ�� */
+ if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
ret = -1;
break;
}
@@ -108,7 +108,7 @@ int get_opt_from_rawpkt(const void *voidpkt, int type, void *void_value)
case RAW_PKT_GET_VXLAN_ID:
{
const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(mr_ctrlzone->__encap_len <= 0){/* ��vxlan��, �϶�û����Щѡ�� */
+ if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
ret = -1;
break;
}
@@ -123,7 +123,7 @@ int get_opt_from_rawpkt(const void *voidpkt, int type, void *void_value)
case RAW_PKT_GET_VXLAN_SPORT:
{
const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(mr_ctrlzone->__encap_len <= 0){/* ��vxlan��, �϶�û����Щѡ�� */
+ if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
ret = -1;
break;
}
@@ -135,7 +135,7 @@ int get_opt_from_rawpkt(const void *voidpkt, int type, void *void_value)
case RAW_PKT_GET_VXLAN_ENCAP_TYPE:
{
const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(mr_ctrlzone->__encap_len <= 0){/* ��vxlan��, �϶�û����Щѡ�� */
+ if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
ret = -1;
break;
}
@@ -147,7 +147,7 @@ int get_opt_from_rawpkt(const void *voidpkt, int type, void *void_value)
case RAW_PKT_GET_VXLAN_LINK_DIR:
{
const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(mr_ctrlzone->__encap_len <= 0){/* ��vxlan��, �϶�û����Щѡ�� */
+ if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
ret = -1;
break;
}
@@ -159,7 +159,7 @@ int get_opt_from_rawpkt(const void *voidpkt, int type, void *void_value)
case RAW_PKT_GET_VXLAN_OUTER_GDEV_MAC:
{
const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(mr_ctrlzone->__encap_len <= 0){/* ��vxlan��, �϶�û����Щѡ�� */
+ if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
ret = -1;
break;
}
@@ -170,7 +170,7 @@ int get_opt_from_rawpkt(const void *voidpkt, int type, void *void_value)
case RAW_PKT_GET_VXLAN_OUTER_LOCAL_MAC:
{
const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(mr_ctrlzone->__encap_len <= 0){/* ��vxlan��, �϶�û����Щѡ�� */
+ if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
ret = -1;
break;
}
@@ -181,7 +181,7 @@ int get_opt_from_rawpkt(const void *voidpkt, int type, void *void_value)
case RAW_PKT_GET_VIRTUAL_LINK_ID:
{
const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(mr_ctrlzone->virtual_link_id <= 0){/* ��vxlan��, �϶�û����Щѡ�� */
+ if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
ret = -1;
break;
}
@@ -192,7 +192,7 @@ int get_opt_from_rawpkt(const void *voidpkt, int type, void *void_value)
case RAW_PKT_GET_REHASH_INDEX:
{
const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(mr_ctrlzone->rehash_index <= 0){/* ��vxlan��, �϶�û����Щѡ�� */
+ if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
ret = -1;
break;
}
diff --git a/include/stream_internal.h b/include/stream_internal.h
index 4654be1..6da2923 100644
--- a/include/stream_internal.h
+++ b/include/stream_internal.h
@@ -314,6 +314,7 @@ char biz_retval_to_platform(char biz_ret);
char plat_state_to_biz(char plat_state);
void idle_polling_call(int thread_seq);
int sapp_identify_broad_multicast_pkt(const void *this_layer_data, const raw_pkt_t *raw_pkt);
+int sapp_identify_tunnel_inner_pkt(const raw_pkt_t *raw_pkt);
int sapp_assistant_init(void);
static inline long long sapp_get_cpu_cycle(void)
diff --git a/inner_plug/sapp_assistant.cpp b/inner_plug/sapp_assistant.cpp
index ffa65f4..9ad1dd1 100644
--- a/inner_plug/sapp_assistant.cpp
+++ b/inner_plug/sapp_assistant.cpp
@@ -82,21 +82,22 @@ static int sapp_identify_broad_multicast_init(void)
return 0;
}
-static int sapp_identify_datalink_mode_is_eth(const raw_pkt_t *raw_pkt)
+/* ʶ���Ƿ������ڲ����ݰ� , �����ڵİ�Ӧ��������ת��/��ע */
+int sapp_identify_tunnel_inner_pkt(const raw_pkt_t *raw_pkt)
{
#if IOMODE_MARSIO
if(CAP_MODEL_MARSIOV4 == g_packet_io_cap_mode){
const struct mr_tunnat_ctrlzone *mr_ctzone;
if(dl_marsio_buff_ctrlzone){
mr_ctzone = (const struct mr_tunnat_ctrlzone *)((*dl_marsio_buff_ctrlzone)((void *)raw_pkt->io_lib_pkt_reference, 0));
- if(mr_ctzone->__encap_len > 0){
- return 0;
+ if(mr_ctzone->action & TUNNAT_CZ_ACTION_FORWARD){
+ return 1;
}
}
}
#endif
- return 1;
+ return 0;
}
int sapp_identify_broad_multicast_pkt(const void *this_layer_data, const raw_pkt_t *raw_pkt)
@@ -104,7 +105,7 @@ int sapp_identify_broad_multicast_pkt(const void *this_layer_data, const raw_pkt
const struct mesa_ethernet_hdr *p_eth_hdr = (const struct mesa_ethernet_hdr *)this_layer_data;
unsigned short eth_type = p_eth_hdr->ether_type; /* ʹ��������ֱ���ж�, ����ÿ�ζ�����ntohs() */
- if(sapp_identify_datalink_mode_is_eth(raw_pkt) == 0){
+ if(sapp_identify_tunnel_inner_pkt(raw_pkt) != 0){
return 0;
}
@@ -114,7 +115,7 @@ int sapp_identify_broad_multicast_pkt(const void *this_layer_data, const raw_pkt
return 1;
}
}else{
- /* 2017-10-10 lijia add, �鲥MAC��ַ, ͨ��Ϊ�������ڿ��������ݰ�, ��LLMNR, SPT��Э��, һ�����账�� */
+ /* 2017-10-10 lijia add, �鲥MAC��ַ, ͨ��Ϊ�������ڿ��������ݰ�, ��LLMNR, STP��Э��, һ�����账�� */
if((p_eth_hdr->ether_dhost[0] & 0x01) == 0x01){
return 1;
}
diff --git a/packet_io/packet_io_marsio.c b/packet_io/packet_io_marsio.c
index 4271020..794d8db 100644
--- a/packet_io/packet_io_marsio.c
+++ b/packet_io/packet_io_marsio.c
@@ -444,7 +444,8 @@ static int marsio4_pkt_forward(int tid, marsio_buff_t * mbufs)
/* ������ȡ, ���������������, vxlan��������װģʽ����ʹ��, Ҫ��ÿ��mbuf�жϵײ��װģʽ */
- if(ctrl_zone->__encap_len > 0){ /* 2018-06-01, marsio vxlan mode, ��vxlan��װ�İ����ܻ�ע */
+ //if(ctrl_zone->__encap_len > 0){ /* 2018-06-01, marsio vxlan mode, ��vxlan��װ�İ����ܻ�ע */
+ if(ctrl_zone->action & TUNNAT_CZ_ACTION_FORWARD){ /* 20190409 lijia modify, tunnel mode, ��������װ�İ����ܻ�ע */
/* vxlan��װ�ڲ�����ת���������κβ���, ֱ�ӵ���marsio_send_burst, ��marsio�������� */
ctrl_zone->action = TUNNAT_CZ_ACTION_FORWARD;
marsio_buff_ctrlzone_set(mbufs, 0, ctrl_zone, sizeof(struct mr_tunnat_ctrlzone));