summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlijia <[email protected]>2021-08-19 11:14:16 +0800
committerlijia <[email protected]>2021-08-19 11:14:16 +0800
commit873ff9568fe4ef6ec28fa2afcc119a0f2b238298 (patch)
tree0c854ca4299405b0a56fd0aa2e6c9f28613fb5b4
parente396c8bbc9a21cb690b0adcc7d54a242613349ab (diff)
TSG-7467, v4.2版本不再需要mrtunnat, 原来通过marsio ctrlzone获取vxlan信息功能失效, 改成由sapp实现原有功能.
-rw-r--r--CMakeLists.txt2
-rw-r--r--include/private/sapp_private_api.h1
-rw-r--r--include/public/stream_inc/gdev_keepalive.h (renamed from include/private/gdev_keepalive.h)74
-rw-r--r--include/public/stream_inc/stream_control.h4
-rw-r--r--src/dealpkt/plug_support.c335
-rw-r--r--src/inner_plug/g_device_plug.cpp2
6 files changed, 199 insertions, 219 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fc2cc66..1dc7ac5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -212,6 +212,7 @@ install(FILES bin/etc/vlan_flipping_map.conf DESTINATION etc COMPONENT PROFILE)
install(FILES bin/etc/stream_compare_layer.conf DESTINATION etc COMPONENT PROFILE)
install(FILES bin/etc/necessary_plug_list.conf DESTINATION etc COMPONENT PROFILE)
install(FILES bin/etc/well_known_port.conf DESTINATION etc COMPONENT PROFILE)
+install(FILES bin/etc/vxlan_sport_service_map.conf DESTINATION etc COMPONENT PROFILE)
if(NOT ENABLE_STATIC_LINK)
@@ -266,6 +267,7 @@ install(FILES ${PROJECT_SOURCE_DIR}/include/public/stream_inc/stream_rawpkt.h DE
install(FILES ${PROJECT_SOURCE_DIR}/include/public/stream_inc/stream_tunnel.h DESTINATION /opt/MESA/include/MESA/stream_inc COMPONENT HEADER)
install(FILES ${PROJECT_SOURCE_DIR}/include/public/stream_inc/sapp_inject.h DESTINATION /opt/MESA/include/MESA/stream_inc COMPONENT HEADER)
install(FILES ${PROJECT_SOURCE_DIR}/include/public/stream_inc/stream_bridge.h DESTINATION /opt/MESA/include/MESA/stream_inc COMPONENT HEADER)
+install(FILES ${PROJECT_SOURCE_DIR}/include/public/stream_inc/gdev_keepalive.h DESTINATION /opt/MESA/include/MESA/stream_inc COMPONENT HEADER)
install(FILES ${CMAKE_BINARY_DIR}/test/libsapp_devel.a DESTINATION . COMPONENT HEADER)
install(FILES ${CMAKE_BINARY_DIR}/service/sapp.service DESTINATION /usr/lib/systemd/system/ COMPONENT PROFILE)
diff --git a/include/private/sapp_private_api.h b/include/private/sapp_private_api.h
index 1004d21..992487f 100644
--- a/include/private/sapp_private_api.h
+++ b/include/private/sapp_private_api.h
@@ -16,7 +16,6 @@
#include "private/mesa_net.h"
#include "private/sysinfo.h"
#include "private/g_device.h"
-#include "private/gdev_keepalive.h"
#include "private/stream_internal.h"
#include "private/iknow.h"
#include "private/project_requirement.h"
diff --git a/include/private/gdev_keepalive.h b/include/public/stream_inc/gdev_keepalive.h
index fc9a6a4..8211c40 100644
--- a/include/private/gdev_keepalive.h
+++ b/include/public/stream_inc/gdev_keepalive.h
@@ -1,37 +1,37 @@
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "stream_inc/stream_base.h"
-
-
-enum gdev_keepalive_opt_t{
- GDEV_KEEPALIVE_OPT_SERVICE_CTRL, /* ��������ij��ҵ����Ƿ񱣻� opt_val is struct gdev_keepalive_service_ctrl */
- GDEV_KEEPALIVE_OPT_GLOBAL_SWITCH, /* ȫ���Ա����, opt_val is int */
- GDEV_KEEPALIVE_OPT_RCV_PKT_PPS, /* �յ��ı��������/��, opt_val is long */
- GDEV_KEEPALIVE_OPT_SND_PKT_PPS, /* �յ��ı��������/��, opt_val is long */
-};
-
-struct gdev_keepalive_service_ctrl{
- int service_num; /* ҵ���, service number */
- int keepalive_switch; /* 1:����, enable keepalive; 0:������, disable keepalive */
-};
-
-
-int gdev_keepalive_set_opt(const SAPP_TLV_T *tlv_value);
-
-int gdev_keepalive_get_opt(SAPP_TLV_T *tlv_value);
-
-
-/* ��Դ�˿ڻ�ȡ��ǰ������ҵ��� */
-unsigned char vxlan_sport_map_to_service_id(unsigned short sport_host_order);
-
-/* ��vxlan_id��ȡ��ǰ������ҵ��� */
-unsigned char vxlan_id_map_to_service_id(int vxlan_id_host_order);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "stream_inc/stream_base.h"
+
+
+enum gdev_keepalive_opt_t{
+ GDEV_KEEPALIVE_OPT_SERVICE_CTRL, /* ��������ij��ҵ����Ƿ񱣻� opt_val is struct gdev_keepalive_service_ctrl */
+ GDEV_KEEPALIVE_OPT_GLOBAL_SWITCH, /* ȫ���Ա����, opt_val is int */
+ GDEV_KEEPALIVE_OPT_RCV_PKT_PPS, /* �յ��ı��������/��, opt_val is long */
+ GDEV_KEEPALIVE_OPT_SND_PKT_PPS, /* �յ��ı��������/��, opt_val is long */
+};
+
+struct gdev_keepalive_service_ctrl{
+ int service_num; /* ҵ���, service number */
+ int keepalive_switch; /* 1:����, enable keepalive; 0:������, disable keepalive */
+};
+
+
+int gdev_keepalive_set_opt(const SAPP_TLV_T *tlv_value);
+
+int gdev_keepalive_get_opt(SAPP_TLV_T *tlv_value);
+
+
+/* ��Դ�˿ڻ�ȡ��ǰ������ҵ��� */
+unsigned char vxlan_sport_map_to_service_id(unsigned short sport_host_order);
+
+/* ��vxlan_id��ȡ��ǰ������ҵ��� */
+unsigned char vxlan_id_map_to_service_id(int vxlan_id_host_order);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
diff --git a/include/public/stream_inc/stream_control.h b/include/public/stream_inc/stream_control.h
index 4686628..231386c 100644
--- a/include/public/stream_inc/stream_control.h
+++ b/include/public/stream_inc/stream_control.h
@@ -5,7 +5,7 @@
extern "C" {
#endif
-#define STREAM_CONTROL_H_VERSION (20210806)
+#define STREAM_CONTROL_H_VERSION (20210818)
#define TCP_CTEAT_LINK_BYSYN 0x01 /* for MESA_stream_opt->MSO_TCP_CREATE_LINK_MODE */
#define TCP_CTEAT_LINK_BYDATA 0x02 /* for MESA_stream_opt->MSO_TCP_CREATE_LINK_MODE */
@@ -29,7 +29,7 @@ enum MESA_stream_opt{
MSO_TCP_SYNACK_OPT, /* opt_val must be struct tcp_option **, opt_val_len [OUT} is struct tcp_option number, valid only if SYN/ACK packet is captured */
MSO_STREAM_TUNNEL_TYPE, /* opt_val must be unsigned short, refer to enum stream_carry_tunnel_t */
MSO_STREAM_CLOSE_REASON, /* opt_val type must be unsigned char, refer to stream_close_reason_t */
- MSO_STREAM_VXLAN_INFO, /* opt_val type must be struct vxlan_info */
+ MSO_STREAM_VXLAN_INFO, /* opt_val type must be struct vxlan_info, only support for MAC-in-MAC encapsulation in mirror mode */
MSO_TCPALL_VALID_AFTER_KILL, /* opt_val type must be unsigned char, value only be [0,1]; Warning, this option is obsolete, use MESA_rst_tcp() instead */
MSO_GLOBAL_STREAM_ID, /* opt_val type must be unsigned long long, is value-result argument, IN: device_id, value range[0, 4095]; OUT:global stream id */
MSO_DROP_STREAM, /* opt_val type must be int, value only be [0,1]; similar to DROPPKT, but effective scope is all subsequent packets of this stream. */
diff --git a/src/dealpkt/plug_support.c b/src/dealpkt/plug_support.c
index d3c9049..4340113 100644
--- a/src/dealpkt/plug_support.c
+++ b/src/dealpkt/plug_support.c
@@ -74,193 +74,22 @@ int get_opt_from_rawpkt(const void *voidpkt, int type, void *void_value)
}
break;
-#if IOMODE_MARSIO
- case RAW_PKT_GET_GDEV_IP:
- {
- if(CAP_MODEL_MARSIOV4 == g_packet_io_cap_mode){
- const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)ptr_marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
- ret = -1;
- break;
- }
- int *out_value = (int *)void_value;
- *out_value = mr_ctrlzone->g_device_in_addr;
- }else{
- sapp_log(20, 0, 20, "can't support option 'RAW_PKT_GET_GDEV_IP' in no marsio mode!");
- ret = -1;
- }
- }
- break;
-
- case RAW_PKT_GET_VXLAN_LOCAL_IP:
- {
- if(CAP_MODEL_MARSIOV4 == g_packet_io_cap_mode){
- const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)ptr_marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
- ret = -1;
- break;
- }
- int *out_value = (int *)void_value;
- *out_value = mr_ctrlzone->l_device_in_addr;
- }else{
- sapp_log(20, 0, 20, "can't support option 'RAW_PKT_GET_VXLAN_LOCAL_IP' in no marsio mode!");
- ret = -1;
- }
- }
- break;
-
-
- case RAW_PKT_GET_VXLAN_ID:
- {
- if(CAP_MODEL_MARSIOV4 == g_packet_io_cap_mode){
- const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)ptr_marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
- ret = -1;
- break;
- }
- int *out_value = (int *)void_value;
- *out_value = ntohl(mr_ctrlzone->g_device_linkpair);
- }else{
- sapp_log(20, 0, 20, "can't support option 'RAW_PKT_GET_VXLAN_ID' in no marsio mode!");
- ret = -1;
- }
- }
- break;
-
- case RAW_PKT_GET_VXLAN_VPNID:
- {
- if(CAP_MODEL_MARSIOV4 == g_packet_io_cap_mode){
- const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)ptr_marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
- ret = -1;
- break;
- }
- int *out_value = (int *)void_value;
- *out_value = ntohl(mr_ctrlzone->g_device_vpn_id);
- }else{
- sapp_log(20, 0, 20, "can't support option 'RAW_PKT_GET_VXLAN_VPNID' in no marsio mode!");
- ret = -1;
- }
- }
- break;
-
- case RAW_PKT_GET_VXLAN_SPORT:
- {
- if(CAP_MODEL_MARSIOV4 == g_packet_io_cap_mode){
- const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)ptr_marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
- ret = -1;
- break;
- }
- short *out_value = (short *)void_value;
- *out_value = mr_ctrlzone->l4_src_port;
- }else{
- sapp_log(20, 0, 20, "can't support option 'RAW_PKT_GET_VXLAN_SPORT' in no marsio mode!");
- ret = -1;
- }
- }
- break;
-
- case RAW_PKT_GET_VXLAN_ENCAP_TYPE:
- {
- if(CAP_MODEL_MARSIOV4 == g_packet_io_cap_mode){
- const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)ptr_marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
- ret = -1;
- break;
- }
- unsigned char *out_value = (unsigned char *)void_value;
- *out_value = mr_ctrlzone->__encap_type;
- }else{
- sapp_log(20, 0, 20, "can't support option 'RAW_PKT_GET_VXLAN_ENCAP_TYPE' in no marsio mode!");
- ret = -1;
- }
- }
- break;
-
- case RAW_PKT_GET_VXLAN_LINK_DIR:
- {
- if(CAP_MODEL_MARSIOV4 == g_packet_io_cap_mode){
- const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)ptr_marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
- ret = -1;
- break;
- }
- unsigned char *out_value = (unsigned char *)void_value;
- *out_value = mr_ctrlzone->route_dir;
- }else{
- sapp_log(20, 0, 20, "can't support option 'RAW_PKT_GET_VXLAN_LINK_DIR' in no marsio mode!");
- ret = -1;
- }
- }
- break;
-
- case RAW_PKT_GET_VXLAN_OUTER_GDEV_MAC:
- {
- if(CAP_MODEL_MARSIOV4 == g_packet_io_cap_mode){
- const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)ptr_marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
- ret = -1;
- break;
- }
- memcpy(void_value, mr_ctrlzone->g_device_mac, 6);
- }else{
- sapp_log(20, 0, 20, "can't support option 'RAW_PKT_GET_VXLAN_OUTER_GDEV_MAC' in no marsio mode!");
- ret = -1;
- }
- }
- break;
-
- case RAW_PKT_GET_VXLAN_OUTER_LOCAL_MAC:
- {
- if(CAP_MODEL_MARSIOV4 == g_packet_io_cap_mode){
- const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)ptr_marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
- ret = -1;
- break;
- }
- memcpy(void_value, mr_ctrlzone->l_device_mac, 6);
- }else{
- sapp_log(20, 0, 20, "can't support option 'RAW_PKT_GET_VXLAN_OUTER_LOCAL_MAC' in no marsio mode!");
- ret = -1;
- }
- }
- break;
-
case RAW_PKT_GET_VIRTUAL_LINK_ID:
{
- if(CAP_MODEL_MARSIOV4 == g_packet_io_cap_mode){
- const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)ptr_marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
- ret = -1;
- break;
- }
- unsigned long long *out_value = (unsigned long long *)void_value;
- *out_value = mr_ctrlzone->virtual_link_id;
- }else{
- sapp_log(20, 0, 20, "can't support option 'RAW_PKT_GET_VIRTUAL_LINK_ID' in no marsio mode!");
- ret = -1;
- }
+ /* from sapp v4.2, there is no mrtunnat module, so not support this option! */
+ sapp_log(20, 0, 20, "not support option 'RAW_PKT_GET_VIRTUAL_LINK_ID' in sappv4.2 and later!");
+ ret = -1;
}
break;
case RAW_PKT_GET_REHASH_INDEX:
{
- if(CAP_MODEL_MARSIOV4 == g_packet_io_cap_mode){
- const struct mr_tunnat_ctrlzone *mr_ctrlzone = (const struct mr_tunnat_ctrlzone *)ptr_marsio_buff_ctrlzone((marsio_buff_t *)rawpkt->io_lib_pkt_reference, 0); /* index */
- if(0 == (mr_ctrlzone->action & TUNNAT_CZ_ACTION_FORWARD)){/* ��vxlan��, �϶�û����Щѡ�� */
- ret = -1;
- break;
- }
- unsigned long long *out_value = (unsigned long long *)void_value;
- *out_value = mr_ctrlzone->rehash_index;
- }else{
- sapp_log(20, 0, 20, "can't support option 'RAW_PKT_GET_REHASH_INDEX' in no marsio mode!");
- ret = -1;
- }
+ /* from sapp v4.2, there is no mrtunnat module, so not support this option! */
+ sapp_log(20, 0, 20, "not support option 'RAW_PKT_GET_REHASH_INDEX' in sappv4.2 and later!");
+ ret = -1;
}
break;
-#endif
+
/* ���ڲ����ȡ��ײ���ʵmac��ַ, ����ʲôģʽ, ��û��mrtunnat, ������һ���ӿ� */
case RAW_PKT_GET_ORIGINAL_LOWEST_ETH_SMAC:
@@ -321,6 +150,7 @@ int get_opt_from_rawpkt(const void *voidpkt, int type, void *void_value)
break;
default:
+ sapp_runtime_log(RLOG_LV_FATAL, "get_opt_from_rawpkt(): not support option type: %d", type);
ret = -1;
break;
}
@@ -328,6 +158,136 @@ int get_opt_from_rawpkt(const void *voidpkt, int type, void *void_value)
return ret;
}
+
+
+static const struct streaminfo_private *offset_to_vxlan_layer(const struct streaminfo_private *pstream_pr)
+{
+ while(pstream_pr && (ADDR_TYPE_VXLAN != pstream_pr->stream_public.addr.addrtype)){
+ pstream_pr = pstream_pr->pfather_pr;
+ }
+
+ return pstream_pr;
+}
+
+
+static int get_vxlan_info_from_streaminfo(const struct streaminfo_private *pstream_pr, int type, void *void_value)
+{
+ int ret;
+ const struct streaminfo_private *vxlan_pstream_pr;
+ const raw_pkt_t *rawpkt;
+ const inline_vxlan_hdr_t *p_vxlan_hdr;
+
+ if(DEPOLYMENT_MODE_INLINE != g_topology_mode_raw){
+ sapp_runtime_log(RLOG_LV_INFO, "get_rawpkt_opt_from_streaminfo() error: can't support option type: %d in no inline mode!", type);
+ return -1;
+ }
+
+ vxlan_pstream_pr = offset_to_vxlan_layer(pstream_pr);
+ if(NULL == vxlan_pstream_pr){
+ sapp_runtime_log(RLOG_LV_FATAL, "get_rawpkt_opt_from_streaminfo() error, stream:%s not found vxlan layer!",
+ printaddr(&pstream_pr->stream_public.addr, pstream_pr->stream_public.threadnum));
+ return -1;
+ }
+
+ rawpkt = pstream_pr->raw_pkt;
+ p_vxlan_hdr = (inline_vxlan_hdr_t *)((char *)rawpkt->raw_pkt_data + vxlan_pstream_pr->offset_to_raw_pkt_hdr);
+
+ switch(type){
+ case RAW_PKT_GET_GDEV_IP:
+ {
+ const struct mesa_ip4_hdr *pip4_hdr;
+ const struct streaminfo_private *carry_vxlan_ip_layer = vxlan_pstream_pr->pfather_pr;
+ if(NULL == carry_vxlan_ip_layer){
+ return -1;
+ }
+
+ pip4_hdr = (struct mesa_ip4_hdr *)((char *)rawpkt->raw_pkt_data + carry_vxlan_ip_layer->offset_to_raw_pkt_hdr);
+ int *out_value = (int *)void_value;
+ *out_value = pip4_hdr->ip_src.s_addr;
+ }
+ break;
+
+ case RAW_PKT_GET_VXLAN_LOCAL_IP:
+ {
+ const struct mesa_ip4_hdr *pip4_hdr;
+ const struct streaminfo_private *carry_vxlan_ip_layer = vxlan_pstream_pr->pfather_pr;
+ if(NULL == carry_vxlan_ip_layer){
+ return -1;
+ }
+
+ pip4_hdr = (struct mesa_ip4_hdr *)((char *)rawpkt->raw_pkt_data + carry_vxlan_ip_layer->offset_to_raw_pkt_hdr);
+ int *out_value = (int *)void_value;
+ *out_value = pip4_hdr->ip_dst.s_addr;
+ }
+ break;
+
+ case RAW_PKT_GET_VXLAN_ID:
+ {
+ int *out_value = (int *)void_value;
+ *out_value = htonl((int)p_vxlan_hdr->link_id);
+ }
+ break;
+
+ case RAW_PKT_GET_VXLAN_VPNID:
+ {
+ int local_tmp_vpn_id;
+ local_tmp_vpn_id = ((int)p_vxlan_hdr->vlan_id_half_high << 4) | (int)p_vxlan_hdr->vlan_id_half_low;
+ int *out_value = (int *)void_value;
+ *out_value = htonl(local_tmp_vpn_id);
+ }
+ break;
+
+ case RAW_PKT_GET_VXLAN_SPORT:
+ {
+ const struct mesa_ip4_hdr *pip4_hdr;
+ const struct mesa_udp_hdr *pudp_hdr;
+ const struct streaminfo_private *carry_vxlan_ip_layer = vxlan_pstream_pr->pfather_pr;
+ if(NULL == carry_vxlan_ip_layer){
+ return -1;
+ }
+
+ pip4_hdr = (struct mesa_ip4_hdr *)((char *)rawpkt->raw_pkt_data + carry_vxlan_ip_layer->offset_to_raw_pkt_hdr);
+ pudp_hdr = (struct mesa_udp_hdr *)((char *)pip4_hdr + pip4_hdr->ip_hl*4);
+ unsigned short *out_value = (unsigned short *)void_value;
+ *out_value = pudp_hdr->uh_sport; /* ���հ��ĽǶ�����, src port��inline�豸��sport */
+ }
+ break;
+
+ case RAW_PKT_GET_VXLAN_ENCAP_TYPE:
+ {
+ char *out_value = (char *)void_value;
+ *out_value = p_vxlan_hdr->link_layer_type;
+ }
+ break;
+
+ case RAW_PKT_GET_VXLAN_LINK_DIR:
+ {
+ char *out_value = (char *)void_value;
+ *out_value = p_vxlan_hdr->dir;
+ }
+ break;
+
+ /* ���հ��ĽǶ�����, src host��inline�豸��mac */
+ case RAW_PKT_GET_VXLAN_OUTER_GDEV_MAC:
+ {
+ const struct mesa_ethernet_hdr *p_eth_hdr = (struct mesa_ethernet_hdr *)rawpkt->raw_pkt_data;
+ memcpy(void_value, p_eth_hdr->ether_shost, ETH_ALEN);
+ }
+ break;
+
+ /* ���հ��ĽǶ�����, dst host�DZ�����mac */
+ case RAW_PKT_GET_VXLAN_OUTER_LOCAL_MAC:
+ {
+ const struct mesa_ethernet_hdr *p_eth_hdr = (struct mesa_ethernet_hdr *)rawpkt->raw_pkt_data;
+ memcpy(void_value, p_eth_hdr->ether_dhost, ETH_ALEN);
+ }
+ break;
+ }
+
+ return ret;
+}
+
+
int get_rawpkt_opt_from_streaminfo(const struct streaminfo *pstream, int type, void *out_value)
{
int ret = -1;
@@ -349,6 +309,21 @@ int get_rawpkt_opt_from_streaminfo(const struct streaminfo *pstream, int type, v
}
return ret;
}
+
+ /* sappv4.2֮��, û��mrtunnat, �޷���ctrlzone��ȡ��Щvxlan��ص�ֵ, Ҫ��streaminfo->pfatherƫ�ƻ�ȡ */
+ switch(type){
+ case RAW_PKT_GET_GDEV_IP:
+ case RAW_PKT_GET_VXLAN_ID:
+ case RAW_PKT_GET_VXLAN_SPORT:
+ case RAW_PKT_GET_VXLAN_ENCAP_TYPE:
+ case RAW_PKT_GET_VXLAN_LINK_DIR:
+ case RAW_PKT_GET_VXLAN_OUTER_GDEV_MAC:
+ case RAW_PKT_GET_VXLAN_OUTER_LOCAL_MAC:
+ case RAW_PKT_GET_VXLAN_VPNID:
+ case RAW_PKT_GET_VXLAN_LOCAL_IP:
+ return get_vxlan_info_from_streaminfo(pstream_pr, type, out_value);
+ break;
+ }
return get_opt_from_rawpkt(pstream_pr->raw_pkt, type, out_value);
}
@@ -1294,6 +1269,10 @@ int MESA_get_stream_opt(const struct streaminfo *pstream, enum MESA_stream_opt o
break;
case MSO_STREAM_VXLAN_INFO:
+ if(DEPOLYMENT_MODE_MIRROR != g_topology_mode_raw){
+ sapp_runtime_log(RLOG_LV_INFO, "MESA_get_stream_opt() error: can't support option MSO_STREAM_VXLAN_INFO in no mirror mode!");
+ return -1;
+ }
if(*opt_val_len != sizeof(struct vxlan_info)){
return -1;
}
diff --git a/src/inner_plug/g_device_plug.cpp b/src/inner_plug/g_device_plug.cpp
index 4341ac2..7958207 100644
--- a/src/inner_plug/g_device_plug.cpp
+++ b/src/inner_plug/g_device_plug.cpp
@@ -15,7 +15,7 @@
#include "sapp_api.h"
#include "sapp_private_api.h"
-
+#include "stream_inc/gdev_keepalive.h"
#include "field_stat2.h"
#if IOMODE_MARSIO