Mod aaa-12 描述:增加pdeliv模块的单播接口给trace模块。

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

Signed-off-by: xusaiqun <xusaiqun@cmhi.chinamobile.com>
This commit is contained in:
xusaiqun 2019-06-26 00:26:25 -07:00
parent 3a73462e3c
commit 2c78856566
6 changed files with 171 additions and 14 deletions

View File

@ -0,0 +1,78 @@
# target name, the target name must have the same name of c source file
TARGET_NAME=pdeliv
# target
# for linux module driver: KO
# for application: EXE
# for dynamic library: DLL
TARGET_TYPE = EXE
# target object
# for application: APP
# for device driver: DRV
TARGET_OBJ = APP
# custom install dir
TARGET_BOX =
#debug mode or release mode
DEBUG = TRUE
PLAT_LINUX ?= TRUE
PLAT_ARM64 ?= TRUE
VPATH = ../user/pdeliv_u
# source code
# set the source file, don't used .o because of ...
COMMON_SRCS = pdelivery_main.c
# MRS Board Source Files
PLAT_LINUX_SRCS = $(COMMON_SRCS)
PLAT_ARM64_SRCS = $(COMMON_SRCS)
# gcc CFLAGS
PLAT_ARM64_CFLAGS := -I../../Common -I../user/netlink_uapi
PLAT_LINUX_CFLAGS := $(PLAT_ARM64_CFLAGS)
PLAT_ARM64_LDFLAGS :=
PLAT_LINUX_LDFLAGS := $(PLAT_ARM64_LDFLAGS)
ARM64_LIBS := ./pdeliv-rcvtest-arm64.so
LINUX_LIBS := ./pdeliv-rcvtest-linux.so
ifeq ($(PLAT_ARM64), TRUE)
DEPEND_LIB += ./debug/libnetlinku-arm64.so
USER_CLEAN_ITEMS += ./libnetlinku-arm64.so
endif
ifeq ($(PLAT_LINUX), TRUE)
DEPEND_LIB += ./debug/libnetlinku-linux.so
USER_CLEAN_ITEMS += ./libnetlinku-linux.so
endif
# this line must be at below of thus, because of...
include ../../Common/common.Makefile
ifneq ($(MAKECMDGOALS), clean)
ifneq ($(MAKECMDGOALS), cleanall)
ifneq ($(notdir $(DEPEND_LIB)), $(wildcard $(DEPEND_LIB)))
$(shell $(CP) $(DEPEND_LIB) ./)
endif
endif
endif
ifeq ($(MAKECMDGOALS), )
$(shell find ./ -name "$(TARGET)-*.ko" -delete)
else
ifeq ($(MAKECMDGOALS), all)
$(shell find ./ -name "$(TARGET)-*.ko" -delete)
endif
endif

View File

@ -0,0 +1,78 @@
# target name, the target name must have the same name of c source file
TARGET_NAME=pdeliv
# target
# for linux module driver: KO
# for application: EXE
# for dynamic library: DLL
TARGET_TYPE = EXE
# target object
# for application: APP
# for device driver: DRV
TARGET_OBJ = APP
# custom install dir
TARGET_BOX =
#debug mode or release mode
DEBUG = TRUE
PLAT_LINUX ?= TRUE
PLAT_ARM64 ?= TRUE
VPATH = ../user/pdeliv_u
# source code
# set the source file, don't used .o because of ...
COMMON_SRCS = pdelivery_main.c
# MRS Board Source Files
PLAT_LINUX_SRCS = $(COMMON_SRCS)
PLAT_ARM64_SRCS = $(COMMON_SRCS)
# gcc CFLAGS
PLAT_ARM64_CFLAGS := -I../../Common -I../user/netlink_uapi
PLAT_LINUX_CFLAGS := $(PLAT_ARM64_CFLAGS)
PLAT_ARM64_LDFLAGS :=
PLAT_LINUX_LDFLAGS := $(PLAT_ARM64_LDFLAGS)
ARM64_LIBS := ./pdeliv-rcvtest-arm64.so
LINUX_LIBS := ./pdeliv-rcvtest-linux.so
ifeq ($(PLAT_ARM64), TRUE)
DEPEND_LIB += ./debug/libnetlinku-arm64.so
USER_CLEAN_ITEMS += ./libnetlinku-arm64.so
endif
ifeq ($(PLAT_LINUX), TRUE)
DEPEND_LIB += ./debug/libnetlinku-linux.so
USER_CLEAN_ITEMS += ./libnetlinku-linux.so
endif
# this line must be at below of thus, because of...
include ../../Common/common.Makefile
ifneq ($(MAKECMDGOALS), clean)
ifneq ($(MAKECMDGOALS), cleanall)
ifneq ($(notdir $(DEPEND_LIB)), $(wildcard $(DEPEND_LIB)))
$(shell $(CP) $(DEPEND_LIB) ./)
endif
endif
endif
ifeq ($(MAKECMDGOALS), )
$(shell find ./ -name "$(TARGET)-*.ko" -delete)
else
ifeq ($(MAKECMDGOALS), all)
$(shell find ./ -name "$(TARGET)-*.ko" -delete)
endif
endif

View File

@ -36,7 +36,7 @@ int set_user_policy()
commnl_addattr_l(&req.n, sizeof(req), POLICYCONFA_SRCIP, debug, debug_len);
/*发送组装好的netlink消息*/
if (pdeliv_talk(1, &req.n, NULL) < 0)
if (pdeliv_talk(0, &req.n, NULL) < 0)
{
return -2;
}
@ -63,7 +63,7 @@ int main( int argc, char **argv)
printf("cfgchannel main begin:\r\n");
/*创建通道*/
ret = pdelivnl_open();
ret = pdelivnl_open(0);
if(ret < 0)
{
printf("pdelivnl_open fail,exit.\r\n");
@ -79,7 +79,7 @@ int main( int argc, char **argv)
}
/*关闭netlink通道*/
pdelivnl_close();
pdelivnl_close(0);
printf("cfgchannel main exit!\r\n");
return 0;

View File

@ -293,14 +293,15 @@ void commcfgnl_close()
return;
}
int pdelivnl_open()
int pdelivnl_open(unsigned int group)
{
return commnl_open_byproto(PDNLGRP_ALLRAW, NETLINK_PDELIVERY);
return commnl_open_byproto(group, NETLINK_PDELIVERY);
}
void pdelivnl_close()
void pdelivnl_close(unsigned int group)
{
commnl_close(PDNLGRP_ALLRAW,NETLINK_PDELIVERY);
commnl_close(group,NETLINK_PDELIVERY);
return;
}
@ -769,7 +770,7 @@ int pdeliv_main(pdelivnl_listen_filter_t process_pkt)
printf("pdeliv_main begin:\r\n");
/*创建通道*/
ret = pdelivnl_open();
ret = pdelivnl_open(PDNLGRP_ALLRAW);
if(ret < 0)
{
printf("pdelivnl_open fail,exit.\r\n");
@ -781,7 +782,7 @@ int pdeliv_main(pdelivnl_listen_filter_t process_pkt)
/*关闭netlink通道*/
pdelivnl_close();
pdelivnl_close(PDNLGRP_ALLRAW);
printf("pdeliv_main exit!\r\n");
return 0;

View File

@ -114,8 +114,8 @@ void commcfgnl_close();
/*输出参数: struct upmnl_handle * upmh ,存放创建的通道相关信息。*/
/*返回值0通道创建成果< 0,失败 */
/****************************************************************/
int pdelivnl_open();
void pdelivnl_close();
int pdelivnl_open(unsigned int group);
void pdelivnl_close(unsigned int group);
//int upnl_dump_type(struct upmnl_handle *upmh, unsigned int type);

View File

@ -51,7 +51,7 @@ int set_pdeliv_debug_waitack(unsigned char * msgtype)
commnl_addattr_l(&req.n, sizeof(req), NLDEBUG_MSG_TYPE, msgtype, debug_len);
/*发送组装好的netlink消息*/
if (pdeliv_talk(1, &req.n, answer) < 0)
if (pdeliv_talk(0, &req.n, answer) < 0)
{
printf("set_user_policy_waitack rcv ack msg faild.\r\n");
return -2;
@ -110,7 +110,7 @@ int main( int argc, char **argv)
}
/*创建通道*/
ret = pdelivnl_open();
ret = pdelivnl_open(0);
if(ret < 0)
{
printf("pdelivnl_open fail,exit.\r\n");
@ -126,7 +126,7 @@ int main( int argc, char **argv)
}
/*关闭netlink通道*/
pdelivnl_close();
pdelivnl_close(0);
printf("cfgchannel main exit!\r\n");
return 0;