summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author杨威 <[email protected]>2023-01-31 19:08:03 +0800
committer杨威 <[email protected]>2023-01-31 19:08:03 +0800
commit5199cd01259bfde17356bdcfe19296e1888022fd (patch)
tree689f2bb8c81395cff2709b8ce835677ec25ea16d
parentc77d5f0d971d6e36721c77fc98763410b2d862a8 (diff)
✨ feat(adapt marsio4.6 service chain interface): fix TSG-13437
-rw-r--r--include/private/packet_io.h3
-rw-r--r--include/private/packet_io_internal.h4
-rw-r--r--include/private/sapp_mem.h2
-rw-r--r--include/private/stream_internal.h11
-rw-r--r--include/public/stream_inc/stream_control.h14
-rw-r--r--src/dealpkt/deal_tcp.c35
-rw-r--r--src/dealpkt/deal_udp.c53
-rw-r--r--src/dealpkt/plug_support.c111
-rw-r--r--src/dealpkt/stream_manage.c18
-rw-r--r--src/packet_io/packet_io_hook.c3
-rw-r--r--src/packet_io/packet_io_lib_load.c4
-rw-r--r--src/packet_io/packet_io_marsio.c153
-rw-r--r--src/packet_io/packet_io_pcap.c11
-rw-r--r--src/packet_io/sendpacket.c94
14 files changed, 460 insertions, 56 deletions
diff --git a/include/private/packet_io.h b/include/private/packet_io.h
index 68af527..8f6dd8e 100644
--- a/include/private/packet_io.h
+++ b/include/private/packet_io.h
@@ -118,6 +118,9 @@ typedef struct{
int (*dl_io_smart_offload)(int device_index, unsigned char *pkt_ptr, int pkt_len, unsigned char dir, int thread_num);
int (*dl_io_forward_rawpkt)(const raw_pkt_t *raw_pkt, int thread_seq);
void (*dl_io_free_rawpkt)(const raw_pkt_t *raw_pkt, int thread_seq);
+ struct rawpkt_metadata *(*dl_io_get1_rawpkt_meta)(const raw_pkt_t *raw_pkt);
+ void (*dl_io_free_rawpkt_meta)(struct rawpkt_metadata *);
+
}dl_io_fun_list_t;
/* ���º����������, ������ȷ���������������� */
diff --git a/include/private/packet_io_internal.h b/include/private/packet_io_internal.h
index a416aad..8cab102 100644
--- a/include/private/packet_io_internal.h
+++ b/include/private/packet_io_internal.h
@@ -251,6 +251,8 @@ void pcap_dl_io_device_alias_free(unsigned int target_id, char *dev_args);
extern int pcap_dl_io_smart_offload(int device_index, unsigned char *pkt_ptr, int pkt_len, unsigned char dir, int thread_num);
extern int pcap_dl_io_forward_rawpkt(const raw_pkt_t *raw_pkt, int thread_seq);
extern void pcap_dl_io_free_rawpkt(const raw_pkt_t *raw_pkt, int thread_seq);
+extern struct rawpkt_metadata *pcap_dl_io_get1_rawpkt_meta(const raw_pkt_t *raw_pkt);
+extern void pcap_dl_io_free_rawpkt_meta(struct rawpkt_metadata *);
/********************** pcap funcitons for dynamic link ***********************/
@@ -312,6 +314,8 @@ extern void marsio_dl_io_destroy(void);
extern int marsio_dl_io_smart_offload(int device_index, unsigned char *pkt_ptr, int pkt_len, unsigned char dir, int thread_num);
extern int marsio_dl_io_forward_rawpkt(const raw_pkt_t *raw_pkt, int thread_seq);
extern void marsio_dl_io_free_rawpkt(const raw_pkt_t *raw_pkt, int thread_seq);
+extern struct rawpkt_metadata *marsio_dl_io_get1_rawpkt_meta(const raw_pkt_t *raw_pkt);
+extern void marsio_dl_io_free_rawpkt_meta(struct rawpkt_metadata *);
/********************** marsio funcitons for dynamic link *********************/
diff --git a/include/private/sapp_mem.h b/include/private/sapp_mem.h
index e31fdd1..380d547 100644
--- a/include/private/sapp_mem.h
+++ b/include/private/sapp_mem.h
@@ -44,6 +44,8 @@ typedef enum{
SAPP_MEM_DYN_TCP_BRIDGE,
SAPP_MEM_DYN_UDP_BRIDGE,
SAPP_MEM_DYN_PADDR, /* 每层地址所占的内存, 就不分具体协议了, 太麻烦了!! */
+ SAPP_MEM_DYN_DETAIN_PKT,
+ SAPP_MEM_DYN_SID_LIST,
__SAPP_MEM_TYPE_MAX,
}sapp_mem_type_t;
diff --git a/include/private/stream_internal.h b/include/private/stream_internal.h
index e464d1a..53e640d 100644
--- a/include/private/stream_internal.h
+++ b/include/private/stream_internal.h
@@ -65,6 +65,10 @@ extern "C" {
#endif
struct detain_pkt;
+
+struct rawpkt_metadata;
+
+
/* ԭʼ���ṹ */
typedef struct {
unsigned int magic_num;
@@ -86,6 +90,9 @@ typedef struct {
unsigned char overlay_layer_bytes; /* ������װ�㳤��, ����vxlanģʽ����50�ֽ� */
char drop_current_pkt_flag; /* �������MSO_DROP_CURRENT_PKT���ö�����ǰ��, ÿ�δ�����Ҫ��� */
struct detain_pkt *d_pkt;
+ struct rawpkt_metadata *meta[2];// ���������metadata, �����ڵ���low_level_sendʱ, ���marsio 4.6����Ҫ����Ϣ.
+ struct segment_id_list *append_list;
+ struct segment_id_list *prepend_list;
}raw_pkt_t;
enum retained_rawpkt_mark
@@ -153,6 +160,7 @@ struct half_tcpstream
typedef struct {
const raw_pkt_t *raw_pkt_up;
const raw_pkt_t *raw_pkt_down;
+ struct rawpkt_metadata* meta[2];// ÿ������metadata������洢��polling_inject_context��, update_raw_pkt��������ʱ����������䵽���ص�rawpkt��
}polling_inject_context_t;
struct streaminfo_private
@@ -202,6 +210,9 @@ struct streaminfo_private
polling_inject_context_t *polling_inject_context;
+ struct segment_id_list *sid_append_list;
+ struct segment_id_list *sid_prepend_list;
+
/* ȫ����id, stream_index��ʷ���Ѿ���ʾ������Ψһid, �˴�Ҫ��֤��Ⱥ���л������ظ�, �����½�����;
��λ --- ��λ
1 | 12bit device_id | 8bit thread_id | 28bit timestamp in sec | 15bit sequence per thread
diff --git a/include/public/stream_inc/stream_control.h b/include/public/stream_inc/stream_control.h
index 1a9d8df..d6bfd9c 100644
--- a/include/public/stream_inc/stream_control.h
+++ b/include/public/stream_inc/stream_control.h
@@ -47,6 +47,8 @@ enum MESA_stream_opt{
MSO_HAVE_DUP_PKT, /* opt_val type must be int, value only be [0, 1, -2], if the current stream found duplicate packets ? 0:no; 1:yes; -2: not sure */
MSO_STREAM_LASTUPDATE_TIMESTAMP_MS,/* latest pkt arrive timestamp of this stream, opt_val type must be unsigned long long */
MSO_STREAM_TIMED,
+ MSO_STREAM_APPLEND_SEGMENT_ID_LIST,
+ MSO_STREAM_PREPLEND_SEGMENT_ID_LIST,
__MSO_MAX,
};
@@ -230,6 +232,18 @@ enum sapp_deploment_mode_t{
};
+#ifndef MAX_SID_NUM
+#define MAX_SID_NUM 8
+#endif
+struct segment_id_list
+{
+ unsigned short sid_list[MAX_SID_NUM];
+ unsigned int sz_sidlist;
+};
+
+int append_sid_to_rawpkt(const void *rawpkt, struct segment_id_list *sid_list);
+int prepend_sid_to_rawpkt(const void *rawpkt, struct segment_id_list *sid_list);
+
/*
plug call MESA_set_stream_opt() to set feature of specified stream.
diff --git a/src/dealpkt/deal_tcp.c b/src/dealpkt/deal_tcp.c
index e292270..56d09da 100644
--- a/src/dealpkt/deal_tcp.c
+++ b/src/dealpkt/deal_tcp.c
@@ -1433,7 +1433,18 @@ int tcp_free_stream(struct streamindex *pindex, const void *this_ip_hdr, const v
}
free_polling_inject_context(SAPP_MEM_DYN_TCP_POLLING_RAW_PKT, pstream_pr);
-
+
+ if(pstream_pr->sid_append_list){
+ sapp_mem_free(SAPP_MEM_DYN_SID_LIST, threadnum, pstream_pr->sid_append_list);
+ pstream_pr->sid_append_list = NULL;
+ }
+
+ if(pstream_pr->sid_prepend_list){
+ sapp_mem_free(SAPP_MEM_DYN_SID_LIST, threadnum, pstream_pr->sid_prepend_list);
+ pstream_pr->sid_prepend_list = NULL;
+ }
+
+
free_streamindex(threadnum,pindex);
return pkt_ret;
@@ -1569,6 +1580,17 @@ static int tcp_reset_stream(struct streamindex *pindex,const void *this_iphdr,
free_polling_inject_context(SAPP_MEM_DYN_TCP_POLLING_RAW_PKT, pstream_pr); //2020-06-08 lijia add, for memory leak
+ if(pstream_pr->sid_append_list){
+ sapp_mem_free(SAPP_MEM_DYN_SID_LIST, threadnum, pstream_pr->sid_append_list);
+ pstream_pr->sid_append_list = NULL;
+ }
+
+ if(pstream_pr->sid_prepend_list){
+ sapp_mem_free(SAPP_MEM_DYN_SID_LIST, threadnum, pstream_pr->sid_prepend_list);
+ pstream_pr->sid_prepend_list = NULL;
+ }
+
+
if (pstream_pr->timeout > link_default_nopkt_time)
{ /* ���Ӷ��г�ʱʱ��, ���ټ��� */
sapp_global_mthread[threadnum].tcp_stream_special_timeout_num--;
@@ -2858,6 +2880,17 @@ static int deal_tcp_stream(struct streamindex *pindex, const void *this_iphdr, s
return PASS;
}
+
+ if(pstream_pr->sid_append_list != NULL)
+ {
+ ((raw_pkt_t *)raw_pkt)->append_list=pstream_pr->sid_append_list;
+ }
+ if(pstream_pr->sid_prepend_list != NULL)
+ {
+ ((raw_pkt_t *)raw_pkt)->prepend_list=pstream_pr->sid_prepend_list;
+ }
+
+
/* 2014-10-11 lijia add, Fd������ƽ̨ʵ�� */
if(unlikely(pstream_pr->stream_killed_flag != 0)){
if((pdetail_pr->auto_remedy_flag != 0) && (tcplen > 0)){ /* ��ֹflood����, ֻ�д����ݵİ��ŷ�RST */
diff --git a/src/dealpkt/deal_udp.c b/src/dealpkt/deal_udp.c
index 7b24aeb..31a5e8f 100644
--- a/src/dealpkt/deal_udp.c
+++ b/src/dealpkt/deal_udp.c
@@ -316,8 +316,20 @@ void udp_free_stream(struct streamindex *pindex)
}
free_polling_inject_context(SAPP_MEM_DYN_UDP_POLLING_RAW_PKT, pstream_pr);
-
- free_streamindex(threadnum,pindex);
+
+ if (pstream_pr->sid_append_list)
+ {
+ sapp_mem_free(SAPP_MEM_DYN_SID_LIST, threadnum, pstream_pr->sid_append_list);
+ pstream_pr->sid_append_list = NULL;
+ }
+
+ if (pstream_pr->sid_prepend_list)
+ {
+ sapp_mem_free(SAPP_MEM_DYN_SID_LIST, threadnum, pstream_pr->sid_prepend_list);
+ pstream_pr->sid_prepend_list = NULL;
+ }
+
+ free_streamindex(threadnum,pindex);
}
//add by lqy 20130530
@@ -362,7 +374,20 @@ static int udp_reset_stream_bytime(struct streamindex *pindex)
project_requirement_destroy(SAPP_MEM_DYN_UDP_PROJECT, threadnum, pstream_pr->pproject);
stream_bridge_destroy_per_stream(SAPP_MEM_DYN_UDP_BRIDGE, pstream, pstream_pr->stream_bridge);
- pstream_pr->pproject = project_requirement_create(SAPP_MEM_DYN_UDP_PROJECT,threadnum);
+ free_polling_inject_context(SAPP_MEM_DYN_UDP_POLLING_RAW_PKT, pstream_pr); //2020-06-08 lijia add, for memory leak
+ if (pstream_pr->sid_append_list)
+ {
+ sapp_mem_free(SAPP_MEM_DYN_SID_LIST, threadnum, pstream_pr->sid_append_list);
+ pstream_pr->sid_append_list = NULL;
+ }
+
+ if (pstream_pr->sid_prepend_list)
+ {
+ sapp_mem_free(SAPP_MEM_DYN_SID_LIST, threadnum, pstream_pr->sid_prepend_list);
+ pstream_pr->sid_prepend_list = NULL;
+ }
+
+ pstream_pr->pproject = project_requirement_create(SAPP_MEM_DYN_UDP_PROJECT,threadnum);
pstream_pr->stream_bridge = stream_bridge_create_per_stream(SAPP_MEM_DYN_UDP_BRIDGE,threadnum);
/* 2015-12-28 lijia add, ������, ���������ڴ� */
@@ -627,7 +652,16 @@ int dealipv4udppkt(struct streamindex *pindex, const struct mesa_ip4_hdr * this_
return PASS;
}
- /* 2014-11-15 lijia add, for udp serial kill udp */
+ if (pstream_pr->sid_append_list != NULL)
+ {
+ ((raw_pkt_t *)raw_pkt)->append_list = pstream_pr->sid_append_list;
+ }
+ if (pstream_pr->sid_prepend_list != NULL)
+ {
+ ((raw_pkt_t *)raw_pkt)->prepend_list = pstream_pr->sid_prepend_list;
+ }
+
+ /* 2014-11-15 lijia add, for udp serial kill udp */
if(unlikely(a_index->stream.stream_killed_flag != 0)){
return DROP;
}
@@ -871,7 +905,16 @@ int dealipv6udppkt(struct streamindex *pindex,const struct mesa_ip6_hdr *a_packe
return PASS;
}
- /* 2014-11-15 lijia add, for udp serial kill udp */
+ if (pstream_pr->sid_append_list != NULL)
+ {
+ ((raw_pkt_t *)raw_pkt)->append_list = pstream_pr->sid_append_list;
+ }
+ if (pstream_pr->sid_prepend_list != NULL)
+ {
+ ((raw_pkt_t *)raw_pkt)->prepend_list = pstream_pr->sid_prepend_list;
+ }
+
+ /* 2014-11-15 lijia add, for udp serial kill udp */
if(unlikely(a_index->stream.stream_killed_flag != 0)){
return DROP;
}
diff --git a/src/dealpkt/plug_support.c b/src/dealpkt/plug_support.c
index 9152802..81fa943 100644
--- a/src/dealpkt/plug_support.c
+++ b/src/dealpkt/plug_support.c
@@ -32,24 +32,52 @@ struct detain_pkt* MESA_rawpkt_detain(const struct streaminfo *pstream, const vo
if(sapp_global_val->config.packet_io.depolyment_mode_bin != DEPOLYMENT_MODE_INLINE)return NULL;
- struct detain_pkt *d_pkt = ALLOC(struct detain_pkt, 1);
+ struct detain_pkt *d_pkt = sapp_mem_calloc(SAPP_MEM_DYN_DETAIN_PKT, pstream->threadnum, sizeof(struct detain_pkt));
d_pkt->original = rawpkt;
- memcpy(d_pkt, p_rawpkt, sizeof(raw_pkt_t));
+ memcpy(&d_pkt->replica, p_rawpkt, sizeof(raw_pkt_t));
+ d_pkt->replica.append_list=NULL;
+ d_pkt->replica.prepend_list=NULL;
+ if(p_rawpkt->append_list!= NULL && p_rawpkt->append_list->sz_sidlist > 0)
+ {
+ d_pkt->replica.append_list = sapp_mem_calloc(SAPP_MEM_DYN_DETAIN_PKT, pstream->threadnum, sizeof(unsigned short)*p_rawpkt->append_list->sz_sidlist);
+ memcpy(d_pkt->replica.append_list->sid_list, p_rawpkt->append_list->sid_list, sizeof(unsigned short)*p_rawpkt->append_list->sz_sidlist);
+ d_pkt->replica.append_list->sz_sidlist = p_rawpkt->append_list->sz_sidlist;
+ }
+ if(p_rawpkt->prepend_list!= NULL && p_rawpkt->prepend_list->sz_sidlist > 0)
+ {
+ d_pkt->replica.prepend_list = sapp_mem_calloc(SAPP_MEM_DYN_DETAIN_PKT, pstream->threadnum, sizeof(unsigned short)*p_rawpkt->prepend_list->sz_sidlist);
+ memcpy(d_pkt->replica.prepend_list->sid_list, p_rawpkt->prepend_list->sid_list, sizeof(unsigned short)*p_rawpkt->prepend_list->sz_sidlist);
+ d_pkt->replica.prepend_list->sz_sidlist = p_rawpkt->prepend_list->sz_sidlist;
+ }
p_rawpkt->d_pkt = d_pkt;
d_pkt->tid = pstream->threadnum;
return d_pkt;
}
+static void detain_pkt_mem_free(struct detain_pkt *pkt)
+{
+ if(pkt == NULL)return;
+ if(pkt->replica.append_list)
+ {
+ sapp_mem_free(SAPP_MEM_DYN_DETAIN_PKT, pkt->tid, pkt->replica.append_list);
+ }
+ if(pkt->replica.prepend_list)
+ {
+ sapp_mem_free(SAPP_MEM_DYN_DETAIN_PKT, pkt->tid, pkt->replica.prepend_list);
+ }
+ sapp_mem_free(SAPP_MEM_DYN_DETAIN_PKT, pkt->tid, pkt);
+}
+
int MESA_detain_pkt_forward(struct detain_pkt *pkt)
{
if(pkt->original == NULL) //original packet stack finished, being processed by all plugin;
{
- if(pkt->replica.__lib_raw_pkt_len > 0 && pkt->replica.__lib_raw_pkt_data&& pkt->replica.io_lib_pkt_reference)
+ if(pkt->replica.__lib_raw_pkt_len > 0 && pkt->replica.__lib_raw_pkt_data && pkt->replica.io_lib_pkt_reference)
{
dl_io_fun_list.dl_io_forward_rawpkt(&pkt->replica, pkt->tid);
}
- free(pkt);
+ detain_pkt_mem_free(pkt);
pkt = NULL;
}
else //still in original packet stack, need be processed by follow-up plugin, mark operation to replica;
@@ -67,11 +95,11 @@ void MESA_detain_pkt_free(struct detain_pkt *pkt)
{
if(pkt->original == NULL) //original packet stack finished, being processed by all plugin;
{
- if(pkt->replica.__lib_raw_pkt_len > 0 && pkt->replica.__lib_raw_pkt_data&& pkt->replica.io_lib_pkt_reference)
+ if(pkt->replica.__lib_raw_pkt_len > 0 && pkt->replica.__lib_raw_pkt_data && pkt->replica.io_lib_pkt_reference)
{
dl_io_fun_list.dl_io_free_rawpkt(&pkt->replica, pkt->tid);
}
- free(pkt);
+ detain_pkt_mem_free(pkt);
pkt = NULL;
}
@@ -109,7 +137,7 @@ int MESA_retain_pkt_update(const raw_pkt_t *p_raw_pkt, int pkt_ret)
{
update_ret = DROP;
}
- free(p_raw_pkt->d_pkt);
+ detain_pkt_mem_free(p_raw_pkt->d_pkt);
}
}
return update_ret;
@@ -883,7 +911,7 @@ int MESA_set_stream_opt(const struct streaminfo *pstream, enum MESA_stream_opt o
}
}
break;
- case (int)MSO_STREAM_TIMED:
+ case MSO_STREAM_TIMED:
{
if(sizeof(int) != opt_val_len){
sapp_runtime_log(RLOG_LV_INFO, "%s, MESA_set_stream_opt() MSO_TIMEOUT error:opt_val_len invalid, must be sizeof(short)\n",printaddr(&pstream->addr, pstream->threadnum));
@@ -905,7 +933,72 @@ int MESA_set_stream_opt(const struct streaminfo *pstream, enum MESA_stream_opt o
ret = 0;
}
break;
-
+ case MSO_STREAM_APPLEND_SEGMENT_ID_LIST:
+ {
+ if(sizeof(struct segment_id_list) != opt_val_len){
+ sapp_runtime_log(RLOG_LV_INFO, "%s, MESA_set_stream_opt() MSO_STREAM_APPLEND_SEGMENT_ID_LIST error:opt_val_len invalid, must be sizeof(struct segment_id_list)\n",printaddr(&pstream->addr, pstream->threadnum));
+ ret = -1;
+ break;
+ }
+ struct segment_id_list *set_sid_list = (struct segment_id_list *)opt_val;
+ struct streaminfo_private *pstream_pr=(struct streaminfo_private *)pstream;
+ if(pstream_pr->sid_append_list == NULL)
+ {
+ if(set_sid_list->sz_sidlist > 0)
+ {
+ pstream_pr->sid_append_list = (struct segment_id_list *)sapp_mem_calloc(SAPP_MEM_DYN_SID_LIST, pstream->threadnum, sizeof(struct segment_id_list));
+ memcpy(pstream_pr->sid_append_list->sid_list, set_sid_list->sid_list, set_sid_list->sz_sidlist*sizeof(unsigned short));
+ pstream_pr->sid_append_list->sz_sidlist = set_sid_list->sz_sidlist;
+ }
+ }
+ else
+ {
+ if(set_sid_list->sz_sidlist > 0)
+ {
+ memcpy(pstream_pr->sid_append_list->sid_list, set_sid_list->sid_list, set_sid_list->sz_sidlist*sizeof(unsigned short));
+ pstream_pr->sid_append_list->sz_sidlist = set_sid_list->sz_sidlist;
+ }
+ else
+ {
+ memset(pstream_pr->sid_append_list, 0, sizeof(struct segment_id_list));
+ }
+ }
+ ret = 0;
+ }
+ break;
+ case MSO_STREAM_PREPLEND_SEGMENT_ID_LIST:
+ {
+ if(sizeof(struct segment_id_list) != opt_val_len){
+ sapp_runtime_log(RLOG_LV_INFO, "%s, MESA_set_stream_opt() MSO_STREAM_APPLEND_SEGMENT_ID_LIST error:opt_val_len invalid, must be sizeof(struct segment_id_list)\n",printaddr(&pstream->addr, pstream->threadnum));
+ ret = -1;
+ break;
+ }
+ struct segment_id_list *set_sid_list = (struct segment_id_list *)opt_val;
+ struct streaminfo_private *pstream_pr=(struct streaminfo_private *)pstream;
+ if(pstream_pr->sid_prepend_list == NULL)
+ {
+ if(set_sid_list->sz_sidlist > 0)
+ {
+ pstream_pr->sid_prepend_list = (struct segment_id_list *)sapp_mem_calloc(SAPP_MEM_DYN_SID_LIST, pstream->threadnum, sizeof(struct segment_id_list));
+ memcpy(pstream_pr->sid_prepend_list->sid_list, set_sid_list->sid_list, set_sid_list->sz_sidlist*sizeof(unsigned short));
+ pstream_pr->sid_prepend_list->sz_sidlist = set_sid_list->sz_sidlist;
+ }
+ }
+ else
+ {
+ if(set_sid_list->sz_sidlist > 0)
+ {
+ memcpy(pstream_pr->sid_prepend_list->sid_list, set_sid_list->sid_list, set_sid_list->sz_sidlist*sizeof(unsigned short));
+ pstream_pr->sid_prepend_list->sz_sidlist = set_sid_list->sz_sidlist;
+ }
+ else
+ {
+ memset(pstream_pr->sid_prepend_list, 0, sizeof(struct segment_id_list));
+ }
+ }
+ ret = 0;
+ }
+ break;
default:
sapp_runtime_log(RLOG_LV_INFO, "%s, MESA_set_stream_opt() error: unsupport MESA_stream_opt type:%d!\n", printaddr(&pstream->addr, pstream->threadnum), (int)opt);
ret = -1;
diff --git a/src/dealpkt/stream_manage.c b/src/dealpkt/stream_manage.c
index 2506e5b..231e4dc 100644
--- a/src/dealpkt/stream_manage.c
+++ b/src/dealpkt/stream_manage.c
@@ -2372,7 +2372,6 @@ static inline raw_pkt_t *sapp_raw_pkt_dup(int mem_used_type, int thread_index, c
hdr_offset = (char *)raw_pkt->raw_pkt_data - (char *)raw_pkt->__lib_raw_pkt_data;
assert(hdr_offset <= 2048);
new_raw_pkt->raw_pkt_data = (char *)new_raw_pkt->__lib_raw_pkt_data + hdr_offset;
-
return new_raw_pkt;
}
@@ -2390,10 +2389,12 @@ int update_polling_inject_context(int mem_used_type,struct streaminfo_private *p
if((DIR_ROUTE_DOWN & pstream_pr->stream_public.routedir) == DIR_ROUTE_DOWN){
if(NULL == pstream_pr->polling_inject_context->raw_pkt_down){
pstream_pr->polling_inject_context->raw_pkt_down = sapp_raw_pkt_dup(mem_used_type,thread_index, raw_pkt);
+ pstream_pr->polling_inject_context->meta[1] = dl_io_fun_list.dl_io_get1_rawpkt_meta(raw_pkt);
}
}else{
if(NULL == pstream_pr->polling_inject_context->raw_pkt_up){
pstream_pr->polling_inject_context->raw_pkt_up = sapp_raw_pkt_dup(mem_used_type,thread_index, raw_pkt);
+ pstream_pr->polling_inject_context->meta[0] = dl_io_fun_list.dl_io_get1_rawpkt_meta(raw_pkt);
}
}
@@ -2419,8 +2420,10 @@ int save_polling_inject_context(int mem_used_type, struct streaminfo_private *ps
����������IJ���������private�ṹ��, ��������ԭʼ�� */
if((DIR_ROUTE_DOWN & pstream_pr->stream_public.routedir) == DIR_ROUTE_DOWN){
pstream_pr->polling_inject_context->raw_pkt_down = sapp_raw_pkt_dup(mem_used_type, thread_index, raw_pkt);
+ pstream_pr->polling_inject_context->meta[1] = dl_io_fun_list.dl_io_get1_rawpkt_meta(raw_pkt);
}else{
pstream_pr->polling_inject_context->raw_pkt_up = sapp_raw_pkt_dup(mem_used_type, thread_index, raw_pkt);
+ pstream_pr->polling_inject_context->meta[0] = dl_io_fun_list.dl_io_get1_rawpkt_meta(raw_pkt);
}
return 0;
@@ -2446,12 +2449,23 @@ void free_polling_inject_context(int mem_used_type, struct streaminfo_private *p
thread_index = pstream_pr->stream_public.threadnum;
if(pstream_pr->polling_inject_context->raw_pkt_up){
- sapp_raw_pkt_free(mem_used_type, thread_index, (raw_pkt_t *)pstream_pr->polling_inject_context->raw_pkt_up);
+
}
if(pstream_pr->polling_inject_context->raw_pkt_down){
sapp_raw_pkt_free(mem_used_type, thread_index, (raw_pkt_t *)pstream_pr->polling_inject_context->raw_pkt_down);
}
+ if(pstream_pr->polling_inject_context->meta[0]!=NULL)
+ {
+ dl_io_fun_list.dl_io_free_rawpkt_meta(pstream_pr->polling_inject_context->meta[0]);
+ pstream_pr->polling_inject_context->meta[0]=NULL;
+ }
+ if(pstream_pr->polling_inject_context->meta[1]!=NULL)
+ {
+ dl_io_fun_list.dl_io_free_rawpkt_meta(pstream_pr->polling_inject_context->meta[1]);
+ pstream_pr->polling_inject_context->meta[1]=NULL;
+ }
+
sapp_mem_free((sapp_mem_type_t)mem_used_type, thread_index, pstream_pr->polling_inject_context);
pstream_pr->polling_inject_context = NULL;
}
diff --git a/src/packet_io/packet_io_hook.c b/src/packet_io/packet_io_hook.c
index 112b98c..026132b 100644
--- a/src/packet_io/packet_io_hook.c
+++ b/src/packet_io/packet_io_hook.c
@@ -20,6 +20,7 @@ extern "C" {
extern unsigned int marsio_get_vlan_id_from_mbuff(void *pkt_reference);
extern int marsio_set_vlan_id_to_mbuff(void *pkt_reference, unsigned int vlan_id_host_order);
+extern void marsio_dl_io_set_rawpkt_meta(const raw_pkt_t *raw_pkt, void *send_pkt_io_reference, unsigned char route_dir);
extern int vxlan_packet_is_myself(const raw_pkt_t *rawpkt);
#if 0
static const sapp_vlan_flipping_map_t *vlan_flipping_get_opposite(int cori, unsigned short vlan_id)
@@ -281,6 +282,8 @@ int packet_io_hook_sendto(const raw_pkt_t *raw_pkt, unsigned char route_dir, cha
return ret;
}
+ marsio_dl_io_set_rawpkt_meta(raw_pkt, send_pkt_io_reference, route_dir);
+
if(OVERLAY_MODE_VXLAN == sapp_global_val->config.packet_io.packet_io_tunnel.overlay_mode_bin){
ret = packet_io_hook_output_vxlan((raw_pkt_t *)raw_pkt, (void *)send_pkt_data, route_dir);
}else if(OVERLAY_MODE_NONE == sapp_global_val->config.packet_io.packet_io_tunnel.overlay_mode_bin){
diff --git a/src/packet_io/packet_io_lib_load.c b/src/packet_io/packet_io_lib_load.c
index fcb19cb..bf0daa4 100644
--- a/src/packet_io/packet_io_lib_load.c
+++ b/src/packet_io/packet_io_lib_load.c
@@ -135,6 +135,8 @@ static int packet_io_lib_load_by_mode(int cap_mode, const char *no_use)
dl_io_fun_list_static_link[cap_mode].dl_io_smart_offload = pcap_dl_io_smart_offload;
dl_io_fun_list_static_link[cap_mode].dl_io_forward_rawpkt = pcap_dl_io_forward_rawpkt;
dl_io_fun_list_static_link[cap_mode].dl_io_free_rawpkt = pcap_dl_io_free_rawpkt;
+ dl_io_fun_list_static_link[cap_mode].dl_io_get1_rawpkt_meta = pcap_dl_io_get1_rawpkt_meta;
+ dl_io_fun_list_static_link[cap_mode].dl_io_free_rawpkt_meta = pcap_dl_io_free_rawpkt_meta;
}
#endif
@@ -167,6 +169,8 @@ static int packet_io_lib_load_by_mode(int cap_mode, const char *no_use)
dl_io_fun_list_static_link[CAP_MODEL_MARSIOV4].dl_io_smart_offload = marsio_dl_io_smart_offload;
dl_io_fun_list_static_link[CAP_MODEL_MARSIOV4].dl_io_forward_rawpkt = marsio_dl_io_forward_rawpkt;
dl_io_fun_list_static_link[CAP_MODEL_MARSIOV4].dl_io_free_rawpkt = marsio_dl_io_free_rawpkt;
+ dl_io_fun_list_static_link[CAP_MODEL_MARSIOV4].dl_io_get1_rawpkt_meta = marsio_dl_io_get1_rawpkt_meta;
+ dl_io_fun_list_static_link[CAP_MODEL_MARSIOV4].dl_io_free_rawpkt_meta = marsio_dl_io_free_rawpkt_meta;
}
#endif
diff --git a/src/packet_io/packet_io_marsio.c b/src/packet_io/packet_io_marsio.c
index 065c552..ac5a9fe 100644
--- a/src/packet_io/packet_io_marsio.c
+++ b/src/packet_io/packet_io_marsio.c
@@ -27,14 +27,20 @@ typedef struct{
struct mr_sendpath *sendpath_up, *sendpath_down; /* ����ģʽ��, ֱ��ʹ��sendpath_up; ͬʱ����˫��������ģʽ */
}marsio4_io_handle;
-/* for vlan flipping */
-#if 0
-enum mr_buff_metadata_type
+
+
+
+#ifndef MAX_METADATA_LEN
+#define MAX_METADATA_LEN 16
+#endif
+
+struct rawpkt_metadata
{
- MR_BUFF_REHASH_INDEX = 0,
- MR_BUFF_METADATA_VLAN_TCI = 1, /* int����, ������, host order */
+ enum mr_buff_metadata_type type;
+ char data[MAX_METADATA_LEN];
+ unsigned int sz_data;
+ struct segment_id_list raw_sid_list;
};
-#endif
extern int marsio_buff_get_metadata(marsio_buff_t *m, enum mr_buff_metadata_type type, void *data, unsigned int sz_data);
extern int marsio_buff_set_metadata(marsio_buff_t *m, enum mr_buff_metadata_type type, void *data, unsigned int sz_data);
@@ -103,6 +109,10 @@ int (*ptr_marsio_buff_set_metadata)(marsio_buff_t *m, enum mr_buff_metadata_type
int (*ptr_marsio_buff_unset_metadata)(marsio_buff_t *m, enum mr_buff_metadata_type type);
marsio_buff_t *(*ptr_marsio_buff_malloc_smartoffload)(struct mr_vdev *vdev, const char * pkt, unsigned int pkt_len);
+int (*ptr_marsio_buff_get_sid_list)(marsio_buff_t * m, uint16_t * out_slist, uint8_t sz_out_slist);
+int (*ptr_marsio_buff_set_sid_list)(marsio_buff_t * m, uint16_t * slist, uint8_t sz_slist);
+int (*ptr_marsio_buff_append_sid_list)(marsio_buff_t * m, uint16_t * slist, uint8_t sz_slist);
+int (*ptr_marsio_buff_prepend_sid_list)(marsio_buff_t * m, uint16_t * slist, uint8_t sz_slist);
static struct bpf_program MARSIO_BPF_FILTER[MAX_THREAD_NUM];
@@ -393,6 +403,20 @@ int marsio_dl_io_smart_offload(int device_index, unsigned char *pkt_ptr, int pkt
static int marsio4_pkt_forward(int tid, struct mr_sendpath * sendpath, marsio_buff_t * mbufs);
+
+static void marsio_update_sid_list(const raw_pkt_t *raw_pkt, void *send_pkt_io_reference)
+{
+ if(raw_pkt->append_list && ptr_marsio_buff_append_sid_list!= NULL)
+ {
+ ptr_marsio_buff_append_sid_list((marsio_buff_t *)send_pkt_io_reference, raw_pkt->append_list->sid_list, raw_pkt->append_list->sz_sidlist);
+ }
+ if(raw_pkt->prepend_list && ptr_marsio_buff_prepend_sid_list != NULL)
+ {
+ ptr_marsio_buff_prepend_sid_list((marsio_buff_t *)send_pkt_io_reference, raw_pkt->prepend_list->sid_list, raw_pkt->prepend_list->sz_sidlist);
+ }
+ return;
+}
+
int marsio_dl_io_forward_rawpkt(const raw_pkt_t *raw_pkt, int thread_seq)
{
if(raw_pkt == NULL && (thread_seq < 0 || thread_seq > get_thread_count()))
@@ -400,6 +424,7 @@ int marsio_dl_io_forward_rawpkt(const raw_pkt_t *raw_pkt, int thread_seq)
int ret = 0;
if(raw_pkt->io_lib_pkt_reference != NULL)
{
+ marsio_update_sid_list(raw_pkt, (void *)raw_pkt->io_lib_pkt_reference);
ret = marsio4_pkt_forward(thread_seq, g_mr4_sendpath_up_set[raw_pkt->device_index], (marsio_buff_t *)raw_pkt->io_lib_pkt_reference);
}
return ret;
@@ -413,6 +438,94 @@ void marsio_dl_io_free_rawpkt(const raw_pkt_t *raw_pkt, int thread_seq)
return;
}
+
+struct rawpkt_metadata *marsio_dl_io_get1_rawpkt_meta(const raw_pkt_t *raw_pkt)
+{
+ struct rawpkt_metadata *meta = NULL;
+ int ret = 0;
+ if(raw_pkt->io_lib_pkt_reference != NULL)
+ {
+ if (ptr_marsio_buff_get_sid_list != NULL || ptr_marsio_buff_get_metadata != NULL)
+ {
+ meta = (struct rawpkt_metadata *)calloc(sizeof(struct rawpkt_metadata), 1);
+ if (ptr_marsio_buff_get_metadata)
+ {
+ ret = ptr_marsio_buff_get_metadata((marsio_buff_t *)raw_pkt->io_lib_pkt_reference,
+ MR_BUFF_ROUTE_CTX, meta->data, meta->sz_data);
+ if (ret <= 0)
+ {
+ free(meta);
+ return NULL;
+ }
+ else
+ {
+ meta->sz_data = ret;
+ }
+ }
+ if (ptr_marsio_buff_get_sid_list)
+ {
+ ret = ptr_marsio_buff_get_sid_list((marsio_buff_t *)raw_pkt->io_lib_pkt_reference,
+ meta->raw_sid_list.sid_list, MAX_SID_NUM);
+ if (ret <= 0)
+ {
+ meta->raw_sid_list.sz_sidlist = 0;
+ }
+ else
+ {
+ meta->raw_sid_list.sz_sidlist = ret;
+ }
+ }
+ if (meta->sz_data == 0 && meta->raw_sid_list.sz_sidlist == 0)
+ {
+ free(meta);
+ meta = NULL;
+ }
+ }
+ }
+
+ return meta;
+}
+
+
+
+void marsio_dl_io_set_rawpkt_meta(const raw_pkt_t *raw_pkt, void *send_pkt_io_reference, unsigned char route_dir)
+{
+ if(raw_pkt->meta[0]!= NULL || (raw_pkt->meta[1]!= NULL))
+ {
+ struct rawpkt_metadata *snd_meta = NULL;
+ if(raw_pkt->meta[route_dir]!=NULL)
+ {
+ snd_meta=raw_pkt->meta[route_dir];
+ }
+ else // failover
+ {
+ snd_meta=raw_pkt->meta[route_dir^1];
+ }
+ if(ptr_marsio_buff_set_metadata)
+ {
+ ptr_marsio_buff_set_metadata((marsio_buff_t *)send_pkt_io_reference, snd_meta->type, (void *)snd_meta->data, snd_meta->sz_data);
+ }
+ if(ptr_marsio_buff_set_sid_list)
+ {
+ ptr_marsio_buff_set_sid_list((marsio_buff_t *)send_pkt_io_reference, snd_meta->raw_sid_list.sid_list, snd_meta->raw_sid_list.sz_sidlist);
+ }
+ marsio_update_sid_list(raw_pkt, send_pkt_io_reference);
+ }
+
+ return;
+}
+
+void marsio_dl_io_free_rawpkt_meta(struct rawpkt_metadata * meta)
+{
+ if(meta != NULL)
+ {
+ free(meta);
+ meta=NULL;
+ }
+ return;
+}
+
+
void *marsio_dl_io_get_send_handle(int thread_seq)
{
return (void *)&g_mario4_io_handle[thread_seq];
@@ -650,6 +763,7 @@ static int marsio4_process_packet(int tid, raw_pkt_t *raw_pkt)
/* NOTE:
MARSIO����ģʽ������, �����������հ�, ��Ҫͨ������������ע��,
*/
+ marsio_update_sid_list(raw_pkt, rx_buff[j]);
int ret = marsio4_pkt_forward(tid, g_mr4_sendpath_up_set[i], rx_buff[j]);
if (ret < 0)
{
@@ -989,6 +1103,33 @@ static int marsio_dl_get_function_entry(void)
sleep(1);
}
+ ptr_marsio_buff_get_sid_list = (int (*)(marsio_buff_t *m, uint16_t * out_slist, uint8_t sz_out_slist))dlsym(marsio_so_handle, "marsio_buff_get_sid_list");
+ if(NULL == ptr_marsio_buff_set_metadata){
+ printf("\033[33m[Error]dlsym function '%s' from '%s' failed!\033[0m\n", "marsio_buff_get_sid_list", ABBR_MARSIO_LIBRARY_FILE);
+ //return -1; /* Ϊ����ǰ����mrzcpd�ɰ�, �˴��Ȳ����ش���, ֻ��vlan_flipping��ʧЧ */
+ sleep(1);
+ }
+ ptr_marsio_buff_set_sid_list = (int (*)(marsio_buff_t *m, uint16_t * slist, uint8_t sz_slist))dlsym(marsio_so_handle, "marsio_buff_set_sid_list");
+ if(NULL == ptr_marsio_buff_set_metadata){
+ printf("\033[33m[Error]dlsym function '%s' from '%s' failed!\033[0m\n", "marsio_buff_set_sid_list", ABBR_MARSIO_LIBRARY_FILE);
+ //return -1; /* Ϊ����ǰ����mrzcpd�ɰ�, �˴��Ȳ����ش���, ֻ��vlan_flipping��ʧЧ */
+ sleep(1);
+ }
+
+ ptr_marsio_buff_append_sid_list = (int (*)(marsio_buff_t *m, uint16_t * slist, uint8_t sz_slist))dlsym(marsio_so_handle, "marsio_buff_append_sid_list");
+ if(NULL == ptr_marsio_buff_append_sid_list){
+ printf("\033[33m[Error]dlsym function '%s' from '%s' failed!\033[0m\n", "marsio_buff_append_sid_list", ABBR_MARSIO_LIBRARY_FILE);
+ //return -1; /* Ϊ����ǰ����mrzcpd�ɰ�, �˴��Ȳ����ش���, ֻ��vlan_flipping��ʧЧ */
+ sleep(1);
+ }
+
+ ptr_marsio_buff_prepend_sid_list = (int (*)(marsio_buff_t *m, uint16_t * slist, uint8_t sz_slist))dlsym(marsio_so_handle, "marsio_buff_prepend_sid_list");
+ if(NULL == ptr_marsio_buff_prepend_sid_list){
+ printf("\033[33m[Error]dlsym function '%s' from '%s' failed!\033[0m\n", "marsio_buff_prepend_sid_list", ABBR_MARSIO_LIBRARY_FILE);
+ //return -1; /* Ϊ����ǰ����mrzcpd�ɰ�, �˴��Ȳ����ش���, ֻ��vlan_flipping��ʧЧ */
+ sleep(1);
+ }
+
ptr_marsio_buff_unset_metadata = (int (*)(marsio_buff_t *m, enum mr_buff_metadata_type type))dlsym(marsio_so_handle, "marsio_buff_unset_metadata");
if(NULL == ptr_marsio_buff_unset_metadata){
printf("\033[33m[Error]dlsym function '%s' from '%s' failed!\033[0m\n", "marsio_buff_unset_metadata", ABBR_MARSIO_LIBRARY_FILE);
diff --git a/src/packet_io/packet_io_pcap.c b/src/packet_io/packet_io_pcap.c
index d6c743f..f4ee9de 100644
--- a/src/packet_io/packet_io_pcap.c
+++ b/src/packet_io/packet_io_pcap.c
@@ -750,6 +750,17 @@ void pcap_dl_io_free_rawpkt(const raw_pkt_t *raw_pkt, int thread_seq)
PCAP_FREE((void *)(raw_pkt->__lib_raw_pkt_data));
return;
}
+
+struct rawpkt_metadata *pcap_dl_io_get1_rawpkt_meta(const raw_pkt_t *raw_pkt)
+{
+ return NULL;
+}
+
+void pcap_dl_io_free_rawpkt_meta(struct rawpkt_metadata * meta)
+{
+ return;
+}
+
/************************ funcitons for dynamic link *************************/
diff --git a/src/packet_io/sendpacket.c b/src/packet_io/sendpacket.c
index 77bc886..d26b389 100644
--- a/src/packet_io/sendpacket.c
+++ b/src/packet_io/sendpacket.c
@@ -2443,43 +2443,62 @@ err:
return -1;
}
-
static raw_pkt_t *update_raw_pkt(struct streaminfo_private *stream_pr, uchar snd_dir, int *inject_dir_reverse)
{
- raw_pkt_t *inject_raw_pkt;
-
- if((stream_pr->packet_io_context != 0)
- || (0 == sapp_global_val->config.packet_io.polling_enabled)){
- /* �ڰ�����������, ����û�п���polling, do nothing */
- *inject_dir_reverse = ((snd_dir == stream_pr->stream_public.routedir) ? 0: 1);
- return (raw_pkt_t *)stream_pr->raw_pkt;
- }
-
- if((DIR_ROUTE_DOWN & snd_dir) == DIR_ROUTE_DOWN){
- inject_raw_pkt = (raw_pkt_t *)stream_pr->polling_inject_context->raw_pkt_down;
- if(inject_raw_pkt){
- *inject_dir_reverse = (((snd_dir & DIR_ROUTE_DOWN) == DIR_ROUTE_DOWN) ? 0: 1);
- }else{/* ���˻�û�յ�����,ʹ�öԶ����ݰ����챾�˵İ�,����ijЩ�ǶԳ�Э��,��GRE, MPLS��,��������! reverse��Ҫ���� */
- inject_raw_pkt = (raw_pkt_t *)stream_pr->polling_inject_context->raw_pkt_up;
- *inject_dir_reverse = (((snd_dir & DIR_ROUTE_DOWN) == DIR_ROUTE_DOWN) ? 1: 0);
- }
- }else{
- inject_raw_pkt = (raw_pkt_t *)stream_pr->polling_inject_context->raw_pkt_up;
- if(inject_raw_pkt){
- *inject_dir_reverse = (((snd_dir & DIR_ROUTE_DOWN) == DIR_ROUTE_DOWN) ? 1: 0);
- }else{/* ���˻�û�յ�����,ʹ�öԶ����ݰ����챾�˵İ�,����ijЩ�ǶԳ�Э��,��GRE, MPLS��,��������! reverse��Ҫ���� */
- inject_raw_pkt = (raw_pkt_t *)stream_pr->polling_inject_context->raw_pkt_down;
- *inject_dir_reverse = (((snd_dir & DIR_ROUTE_DOWN) == DIR_ROUTE_DOWN) ? 0: 1);
- }
- }
-
- if((NULL == inject_raw_pkt) || (RAW_PKT_MAGIC_NUM != inject_raw_pkt->magic_num)){
- return NULL;
- }
+ raw_pkt_t *inject_raw_pkt = NULL;
- return inject_raw_pkt;
-}
+ if (stream_pr->packet_io_context == 1)
+ {
+ /* �ڰ�����������, ����û�п���polling, do nothing */
+ *inject_dir_reverse = ((snd_dir == stream_pr->stream_public.routedir) ? 0 : 1);
+ inject_raw_pkt = (raw_pkt_t *)stream_pr->raw_pkt;
+ }
+ else if (stream_pr->polling_inject_context != NULL)
+ {
+ if ((DIR_ROUTE_DOWN & snd_dir) == DIR_ROUTE_DOWN)
+ {
+ inject_raw_pkt = (raw_pkt_t *)stream_pr->polling_inject_context->raw_pkt_down;
+ if (inject_raw_pkt)
+ {
+ *inject_dir_reverse = (((snd_dir & DIR_ROUTE_DOWN) == DIR_ROUTE_DOWN) ? 0 : 1);
+ }
+ else
+ { /* ���˻�û�յ�����,ʹ�öԶ����ݰ����챾�˵İ�,����ijЩ�ǶԳ�Э��,��GRE, MPLS��,��������!
+ reverse��Ҫ���� */
+ inject_raw_pkt = (raw_pkt_t *)stream_pr->polling_inject_context->raw_pkt_up;
+ *inject_dir_reverse = (((snd_dir & DIR_ROUTE_DOWN) == DIR_ROUTE_DOWN) ? 1 : 0);
+ }
+ }
+ else
+ {
+ inject_raw_pkt = (raw_pkt_t *)stream_pr->polling_inject_context->raw_pkt_up;
+ if (inject_raw_pkt)
+ {
+ *inject_dir_reverse = (((snd_dir & DIR_ROUTE_DOWN) == DIR_ROUTE_DOWN) ? 1 : 0);
+ }
+ else
+ { /* ���˻�û�յ�����,ʹ�öԶ����ݰ����챾�˵İ�,����ijЩ�ǶԳ�Э��,��GRE, MPLS��,��������!
+ reverse��Ҫ���� */
+ inject_raw_pkt = (raw_pkt_t *)stream_pr->polling_inject_context->raw_pkt_down;
+ *inject_dir_reverse = (((snd_dir & DIR_ROUTE_DOWN) == DIR_ROUTE_DOWN) ? 0 : 1);
+ }
+ }
+ }
+ else
+ ;
+ if ((NULL == inject_raw_pkt) || (RAW_PKT_MAGIC_NUM != inject_raw_pkt->magic_num))
+ {
+ return NULL;
+ }
+ if (stream_pr->polling_inject_context != NULL)
+ {
+ inject_raw_pkt->meta[0]=stream_pr->polling_inject_context->meta[0];
+ inject_raw_pkt->meta[1]=stream_pr->polling_inject_context->meta[1];
+ }
+
+ return inject_raw_pkt;
+}
static int __do_kill_tcp(struct streaminfo *stream, const void *ext_raw_pkt, int kill_num,
char *feedback_buf, int *feedback_buf_len)
@@ -3377,6 +3396,15 @@ int __sapp_inject_pkt(struct streaminfo *raw_stream, enum sapp_inject_opt sio,
return -1;
}
+ if(raw_stream_pr->sid_append_list != NULL)
+ {
+ ((raw_pkt_t *)raw_pkt)->append_list=raw_stream_pr->sid_append_list;
+ }
+ if(raw_stream_pr->sid_prepend_list != NULL)
+ {
+ ((raw_pkt_t *)raw_pkt)->prepend_list=raw_stream_pr->sid_prepend_list;
+ }
+
/* injectʹ�õ���routedir, �˴�ת����stream dir,
ע��: ��������Ķ������ܲ����ɵ�ǰ��������, ����kni, �Ǵ����������յ����ݰ�, ��ע����·��,
���ܴ�raw_pkt��raw_stream->routedir�жϷ���!!!!