summaryrefslogtreecommitdiff
path: root/entry
diff options
context:
space:
mode:
authorfumingwei <[email protected]>2020-12-04 17:21:50 +0800
committerfumingwei <[email protected]>2020-12-04 17:21:50 +0800
commit13e663f7f944257d15e53bb49929b0ff399a781b (patch)
treeaa9ad3815255b7040e0adf9be732049ba301d873 /entry
parent8b136892190adc813835fbcf360fd55c0c9308a4 (diff)
增加传输common_direction 的cmsg 给tfev20.12.01
Diffstat (limited to 'entry')
-rw-r--r--entry/src/kni_entry.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/entry/src/kni_entry.cpp b/entry/src/kni_entry.cpp
index 9a90d91..7757357 100644
--- a/entry/src/kni_entry.cpp
+++ b/entry/src/kni_entry.cpp
@@ -413,6 +413,39 @@ static int session_attribute_cmsg_set(struct kni_cmsg *cmsg, struct pme_info *pm
}
+static unsigned int get_stream_common_direction(struct streaminfo *stream)
+{
+ int i_or_e=0;
+ unsigned int direction=0;
+ i_or_e=MESA_dir_link_to_human(stream->routedir);
+ switch(stream->curdir)
+ {
+ case DIR_C2S:
+ if(i_or_e=='E' || i_or_e=='e')
+ {
+ direction='E';
+ }
+ else
+ {
+ direction='I';
+ }
+ break;
+ case DIR_S2C:
+ if(i_or_e=='E' || i_or_e=='e')
+ {
+ direction='I';
+ }
+ else
+ {
+ direction='E';
+ }
+ break;
+ default:
+ break;
+ }
+ return direction;
+}
+
static unsigned char* kni_cmsg_serialize_header_new(struct pme_info *pmeinfo, struct streaminfo *stream, struct pkt_info *pktinfo, uint16_t *len){
void *logger = g_kni_handle->local_logger;
uint16_t bufflen = 0, serialize_len = 0;
@@ -440,6 +473,7 @@ static unsigned char* kni_cmsg_serialize_header_new(struct pme_info *pmeinfo, st
char src_mac[6] = {0};
char dst_mac[6] = {0};
int policy_id;
+ unsigned int stream_common_direction;
switch(pmeinfo->protocol)
{
@@ -528,6 +562,11 @@ static unsigned char* kni_cmsg_serialize_header_new(struct pme_info *pmeinfo, st
goto error_out;
}
+ //common direction
+ stream_common_direction = get_stream_common_direction(stream);
+ ret = wrapped_kni_cmsg_set(cmsg, TFE_CMSG_COMMON_DIRECTION, (const unsigned char*)&stream_common_direction, sizeof(stream_common_direction), pmeinfo);
+ if(ret < 0) goto error_out;
+
//src mac
ret = get_rawpkt_opt_from_streaminfo(stream, RAW_PKT_GET_ORIGINAL_LOWEST_ETH_SMAC, src_mac);
if(ret < 0){