From bbf1147c02364a0065b6fee32ece82c4eab54b96 Mon Sep 17 00:00:00 2001 From: liangbotong <2285836142@qq.com> Date: Thu, 5 Jan 2023 15:49:38 +0800 Subject: [PATCH] =?UTF-8?q?newip=E5=86=85=E6=A0=B8=E6=8F=92=E6=A1=A9?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E8=B0=83=E6=95=B4=20(=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E8=BD=AC=E7=A7=BB=E8=87=B3kernel=5Flinux=5F5?= =?UTF-8?q?.10)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liangbotong --- src/linux/include/trace/hooks/nip_hooks.h | 37 ----------------------- src/linux/net/newip/Makefile | 2 -- src/linux/net/newip/af_ninet.c | 2 +- src/linux/net/newip/hooks/Kconfig | 3 +- src/linux/net/newip/hooks/Makefile | 10 ------ src/linux/net/newip/hooks/nip_hooks.c | 14 --------- src/linux/net/newip/nip_hooks_register.c | 16 +++++----- 7 files changed, 11 insertions(+), 73 deletions(-) delete mode 100644 src/linux/include/trace/hooks/nip_hooks.h delete mode 100644 src/linux/net/newip/hooks/Makefile delete mode 100644 src/linux/net/newip/hooks/nip_hooks.c diff --git a/src/linux/include/trace/hooks/nip_hooks.h b/src/linux/include/trace/hooks/nip_hooks.h deleted file mode 100644 index 4241169..0000000 --- a/src/linux/include/trace/hooks/nip_hooks.h +++ /dev/null @@ -1,37 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * NewIP Hooks - * - * Copyright (c) 2022 Huawei Device Co., Ltd. - */ -#ifdef CONFIG_NEWIP_HOOKS - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM nip_hooks /* Header file name */ -#define TRACE_INCLUDE_PATH trace/hooks /* Header file directory */ - -/* Header files prevent duplicate definitions */ -#if !defined(_TRACE_HOOK_NIP_H) || defined(TRACE_HEADER_MULTI_READ) -#define _TRACE_HOOK_NIP_H -#include -#include - -struct net; -struct nip_addr; -DECLARE_HOOK(ninet_ehashfn_hook, - TP_PROTO(const struct sock *sk, u32 *ret), - TP_ARGS(sk, ret) -); - -struct net_device; -DECLARE_HOOK(ninet_gifconf_hook, - TP_PROTO(struct net_device *dev, char __user *buf, int len, int size, int *ret), - TP_ARGS(dev, buf, len, size, ret) -); -#endif /* end of _TRACE_HOOK_NIP_H */ - -/* This part must be outside protection */ -#include - -#endif /* end of CONFIG_NEWIP_HOOKS */ - diff --git a/src/linux/net/newip/Makefile b/src/linux/net/newip/Makefile index be2ee00..7d55621 100644 --- a/src/linux/net/newip/Makefile +++ b/src/linux/net/newip/Makefile @@ -13,5 +13,3 @@ newip-objs += tcp_nip.o ninet_connection_sock.o ninet_hashtables.o tcp_nip_outpu newip-objs += nip_hooks_register.o -# net/newip/hooks/Makefile -obj-$(CONFIG_NEWIP) += hooks/ diff --git a/src/linux/net/newip/af_ninet.c b/src/linux/net/newip/af_ninet.c index 6512d09..ab53eb2 100644 --- a/src/linux/net/newip/af_ninet.c +++ b/src/linux/net/newip/af_ninet.c @@ -47,7 +47,7 @@ #include #ifdef CONFIG_NEWIP_HOOKS -#include +#include #include "nip_hooks_register.h" #endif #include "tcp_nip_parameter.h" diff --git a/src/linux/net/newip/hooks/Kconfig b/src/linux/net/newip/hooks/Kconfig index 0667eba..9439f88 100644 --- a/src/linux/net/newip/hooks/Kconfig +++ b/src/linux/net/newip/hooks/Kconfig @@ -3,7 +3,8 @@ # config NEWIP_HOOKS - def_bool NEWIP + bool "NEWIP HOOKS" + default n depends on VENDOR_HOOKS && NEWIP help Enable NewIP hooks implemented as tracepoints diff --git a/src/linux/net/newip/hooks/Makefile b/src/linux/net/newip/hooks/Makefile deleted file mode 100644 index 62e5a04..0000000 --- a/src/linux/net/newip/hooks/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (c) 2022 Huawei Device Co., Ltd. -# -# Makefile for NewIP Hooks -# - -ccflags-y += -I$(src) # needed for trace events - -obj-$(CONFIG_NEWIP_HOOKS) += nip_hooks.o diff --git a/src/linux/net/newip/hooks/nip_hooks.c b/src/linux/net/newip/hooks/nip_hooks.c deleted file mode 100644 index 17a986e..0000000 --- a/src/linux/net/newip/hooks/nip_hooks.c +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * - * NewIP Hooks - */ -#define CREATE_TRACE_POINTS -#include -#include - -#ifdef CONFIG_NEWIP_HOOKS -EXPORT_TRACEPOINT_SYMBOL_GPL(ninet_ehashfn_hook); -EXPORT_TRACEPOINT_SYMBOL_GPL(ninet_gifconf_hook); -#endif diff --git a/src/linux/net/newip/nip_hooks_register.c b/src/linux/net/newip/nip_hooks_register.c index 1abb565..8cc6dd5 100644 --- a/src/linux/net/newip/nip_hooks_register.c +++ b/src/linux/net/newip/nip_hooks_register.c @@ -9,17 +9,17 @@ #include /* ninet_ehashfn */ #include -#include +#include #include "tcp_nip_parameter.h" -void ninet_ehashfn_hook(void *data, const struct sock *sk, u32 *ret) +void vendor_ninet_ehashfn(void *data, const struct sock *sk, u32 *ret) { *ret = ninet_ehashfn(sock_net(sk), &sk->sk_nip_rcv_saddr, sk->sk_num, &sk->sk_nip_daddr, sk->sk_dport); } -void ninet_gifconf_hook(void *data, struct net_device *dev, - char __user *buf, int len, int size, int *ret) +void vendor_ninet_gifconf(void *data, struct net_device *dev, + char __user *buf, int len, int size, int *ret) { if (*ret >= 0) { int done = ninet_gifconf(dev, buf + *ret, len - *ret, size); @@ -35,15 +35,15 @@ int ninet_hooks_register(void) { int ret; - ret = register_trace_ninet_ehashfn_hook(&ninet_ehashfn_hook, NULL); + ret = register_trace_vendor_ninet_ehashfn(&vendor_ninet_ehashfn, NULL); if (ret) { - nip_dbg("failed to register to ninet_ehashfn_hook"); + nip_dbg("failed to register to vendor_ninet_ehashfn"); return -1; } - ret = register_trace_ninet_gifconf_hook(&ninet_gifconf_hook, NULL); + ret = register_trace_vendor_ninet_gifconf(&vendor_ninet_gifconf, NULL); if (ret) { - nip_dbg("failed to register to ninet_gifconf_hook"); + nip_dbg("failed to register to vendor_ninet_gifconf"); return -1; } -- Gitee