Merge branch 'master' of git.komect.net:ISG/secogateway

This commit is contained in:
黄昕 2019-06-14 18:03:05 +08:00
commit d3bf061fd1
3 changed files with 18 additions and 5 deletions

View File

@ -3,14 +3,20 @@
#include "trace_def.h"
typedef enum {
REPLY_OP_NO_NEED = 0x0,
REPLY_OP_NEED
} reply_op_t;
enum {
TRACE_MSG_POLICY_REQ = 0x0,
TRACE_MSG_POLICY_REPLY
};
typedef struct _trace_hdr {
u32 ver;
u32 seq;
u32 ver;
u32 seq;
reply_op_t is_reply;
} trace_hdr_t;
typedef struct _trace_req {

View File

@ -49,6 +49,10 @@ static int trace_rcv_policy(struct sk_buff *skb, struct nlmsghdr *nlh)
return 1;
}
if (hdr->is_reply == REPLY_OP_NO_NEED) {
return 0;
}
reply_skb = nlmsg_new(TRACE_REPLY_SZ, GFP_KERNEL);
if (reply_skb == NULL) {
printk(KERN_ERR"Allocating skb memory is failure");

View File

@ -146,7 +146,7 @@ static void *cb_thread(void *arg)
}
static trace_ret_t cfg_channel_send(const uint32_t seq, const trace_policy_t *policy)
static trace_ret_t cfg_channel_send(const uint32_t seq, const trace_policy_t *policy, const reply_op_t is_reply)
{
char buf[TRACE_POLICY_BUF_SZ + 10];
struct nlmsghdr *hdr = (struct nlmsghdr *)buf;
@ -306,6 +306,7 @@ static trace_ret_t __policy_async_exec(const trace_policy_t *in,
void *tmp_arg;
struct sysinfo info;
uint32_t seq, i;
reply_op_t is_reply = REPLY_OP_NO_NEED;
seq = __sync_add_and_fetch(&g_sessionid, 1);
SYSLOG_DEBUG("The seq of the message is %u", seq);
@ -334,10 +335,12 @@ static trace_ret_t __policy_async_exec(const trace_policy_t *in,
if (cb_arg == NULL) {
SYSLOG_ERR("cbarg which is been added is failure");
goto END;
}
}
is_reply = REPLY_OP_NEED;
}
ret = cfg_channel_send(seq, in);
ret = cfg_channel_send(seq, in, is_reply);
if (ret != TRACE_SUCCESS) {
SYSLOG_ERR("Sending cfg is failure");
goto END;