Mod aaa-12 描述:添加配置接收模块的头文件

RCA:
SOL:
修改人:xusaiqun
检视人:xusaiqun

Signed-off-by: xusaiqun <xusaiqun@cmhi.chinamobile.com>
This commit is contained in:
xusaiqun 2019-06-24 02:33:16 -07:00
parent effe617f56
commit 44420ea09e
7 changed files with 77 additions and 20 deletions

View File

@ -0,0 +1,14 @@
#ifndef CFGRCV_KINIT_H
#define CFGRCV_KINIT_H
#include "libnetlink_k.h"
extern int cfgnl_unicast(struct sk_buff *skb, u32 portid);
extern int cfg_msgtype_register( int msgtype,commnl_doit_func doit,
commnl_dumpit_func dumpit,commnl_calcit_func calcit);
extern int cfg_msgtype_unregister(int msgtype);
#endif

View File

@ -187,6 +187,7 @@ int debugfs_pkt_num_stati_witisend(struct netlinkk_cfg *g_nlcfg,
struct nlattr *rta;
char* load;
unsigned long fk_type;
struct netlink_debugfs * tmp_dfs = NULL;
pload = nlmsg_data(nlh);
rta = (struct nlattr *)pload;
@ -204,17 +205,30 @@ int debugfs_pkt_num_stati_witisend(struct netlinkk_cfg *g_nlcfg,
out_nlh = nlmsg_put(out_skb,nlh->nlmsg_pid, nlh->nlmsg_seq, 0x11, length, 0);
if (!out_nlh) goto failure;
nla_put_nohdr(out_skb, length, &(g_nlcfg->dfs));
nla_put_nohdr(out_skb, length, &((msg_process+fk_type)->dfs));
tmp_dfs = &((msg_process+fk_type)->dfs);
nla_put_nohdr(out_skb, length, &(g_nlcfg->dfs));
nla_put_nohdr(out_skb, length, tmp_dfs);
#if 1
printk("netlink total msg stats:\r\n");
printk(" rev_total = %d\n",g_nlcfg->dfs.rev_total);
printk(" rev_cb_sucess = %d\n",g_nlcfg->dfs.rev_cb_sucess);
printk(" rev_cb_fail = %d\n",g_nlcfg->dfs.rev_cb_fail);
printk(" rev_drop_total = %d\n",g_nlcfg->dfs.rev_drop_total);
printk(" rev_drop_nodoit = %d\n",g_nlcfg->dfs.rev_drop_nodoit);
printk(" send_succ = %d\n",g_nlcfg->dfs.send_succ);
printk(" send_fail = %d\n",g_nlcfg->dfs.send_fail);
printk("netlink msg stats:\r\n");
printk(" rev_total = %d\n",tmp_dfs->rev_total);
printk(" rev_cb_sucess = %d\n",tmp_dfs->rev_cb_sucess);
printk(" rev_cb_fail = %d\n",tmp_dfs->rev_cb_fail);
printk(" rev_drop_total = %d\n",tmp_dfs->rev_drop_total);
printk(" rev_drop_nodoit = %d\n",tmp_dfs->rev_drop_nodoit);
printk(" send_succ = %d\n",tmp_dfs->send_succ);
printk(" send_fail = %d\n",tmp_dfs->send_fail);
#if 0
printk("******************************cfg_rev_succ=%d****************\n",g_nlcfg->netlink_dfs.cfg_rev_succ);
printk("******************************cfg_rev_fail=%d****************\n",g_nlcfg->netlink_dfs.cfg_rev_fail);
printk("******************************pde_rev_succ=%d****************\n",g_nlcfg->netlink_dfs.pde_rev_succ);
printk("******************************pde_rev_fail=%d****************\n",g_nlcfg->netlink_dfs.pde_rev_fail);
printk("******************************pde_pkt_succ=%d****************\n",g_nlcfg->netlink_dfs.pde_pkt_succ);
printk("******************************pde_pkt_fail=%d****************\n",g_nlcfg->netlink_dfs.pde_pkt_fail);
#endif
printk("------------------debugfs_pkt_num_stati ack msg_type %d,seq=%d!\n",out_nlh->nlmsg_type,nlh->nlmsg_seq);

View File

@ -1,3 +1,6 @@
#ifndef LIBNETLINKK_K_H
#define LIBNETLINKK_K_H
#include <linux/module.h>
#include <linux/netlink.h>
#include <linux/netfilter.h>
@ -78,5 +81,5 @@ extern int debugfs_pkt_num_stati_witisend(struct netlinkk_cfg *g_nlcfg,
extern int nf_nlmsg_multicast(struct netlinkk_cfg *g_nlcfg, struct sk_buff *skb);
#endif

View File

@ -257,8 +257,15 @@ failure:
}
int pdeliv_unicast(struct sk_buff *skb, u32 portid)
{
return(commnl_unicast(g_nlcfg.sk, skb, portid));
}
EXPORT_SYMBOL_GPL(pdeliv_msgtype_register);
EXPORT_SYMBOL_GPL(pdeliv_msgtype_unregister);
EXPORT_SYMBOL_GPL(pdeliv_unicast);
module_init(pdelivery_init);

View File

@ -0,0 +1,16 @@
#ifndef CFGRCV_KINIT_H
#define CFGRCV_KINIT_H
#include "libnetlink_k.h"
extern int pdeliv_unicast(struct sk_buff *skb, u32 portid);
extern int pdeliv_msgtype_register( int msgtype,commnl_doit_func doit,
commnl_dumpit_func dumpit,commnl_calcit_func calcit);
extern int pdeliv_msgtype_unregister(int msgtype);
#endif

View File

@ -515,7 +515,7 @@ next:
/* check messages from kernel */
//nl_dump_ext_ack(h, errfn);
} else {
errno = -error;
//errno = -error;
//if (rtnl->proto != NETLINK_SOCK_DIAG && show_rtnl_err)
//rtnl_talk_error(h, err, errfn);
@ -533,7 +533,7 @@ next:
if (answer) {
*answer = (struct nlmsghdr *)buf;
return 0;
return 0;/*find the first onegive it to user.*/
}
fprintf(stderr, "Unexpected reply!!!\n");
@ -564,7 +564,7 @@ static int __commnl_talk(struct upmnl_handle *nl, struct nlmsghdr *n,
.iov_base = n,
.iov_len = n->nlmsg_len
};
return __commnl_talk_iov(nl, &iov, 1, answer, show_rtnl_err, errfn);
}
@ -586,7 +586,8 @@ int pdeliv_talk(int group,struct nlmsghdr *n, struct nlmsghdr **answer)
printf("pdeliv_talk faid,pdeliv netlink has not open.\r\n");
return -1;
}
printf("pdeliv_talk send msg type=%d,len=%d.\r\n",n->nlmsg_type,n->nlmsg_len);
return(commnl_talk(nl,n,answer));
}
@ -600,7 +601,8 @@ int commcfg_talk(struct nlmsghdr *n, struct nlmsghdr **answer)
printf("commcfg_talk faid,commcfg netlink has not open.\r\n");
return -1;
}
printf("commcfg_talk send msg type=%d,len=%d.\r\n",n->nlmsg_type,n->nlmsg_len);
return(commnl_talk(nl,n,answer));
}
@ -640,7 +642,7 @@ int conmnl_listen(struct upmnl_handle *nl,
char buf[16384];
char cmsgbuf[BUFSIZ];
printf("conmnl_listen begin.\r\n");
//printf("conmnl_listen begin.\r\n");
#if 0
if (nl->flags & RTNL_HANDLE_F_LISTEN_ALL_NSID) {
@ -654,7 +656,7 @@ int conmnl_listen(struct upmnl_handle *nl,
struct pdelivnl_ctrl_data ctrl;
struct cmsghdr *cmsg;
printf("pdelivnl_listen recvmsg....\r\n");
//printf("pdelivnl_listen recvmsg....\r\n");
iov.iov_len = sizeof(buf);
//status = recvmsg(nl->fd, &msg, MSG_WAITALL);
status = recvmsg(nl->fd, &msg, MSG_WAITFORONE);
@ -697,7 +699,7 @@ int conmnl_listen(struct upmnl_handle *nl,
#if 1
printf("pdelivnl_listen prase msg:\r\n");
//printf("pdelivnl_listen prase msg:\r\n");
for (h = (struct nlmsghdr *)buf; status >= sizeof(*h); ) {
int err;
int len = h->nlmsg_len;

View File

@ -1,3 +1,5 @@
#if 1
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -8,7 +10,6 @@
#include "libnetlinku.h"
#include "commuapinl.h"
#if 0
static int process_pkt(struct pdelivnl_ctrl_data *ctrl,