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 4241169724d2faae1282376c896377e4aac3e674..0000000000000000000000000000000000000000 --- 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 be2ee00d5bc19baf8bab12809687930bcdcd7877..7d55621c599c7c49b6fab1a1a9803c6d83cd8f02 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 6512d09524254e24a0aaa367f717abd15e5ba05a..ab53eb219c7a2354bc980ac850d69ab600180c44 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 0667eba12facdb262d3a16dd87fc5f65e113531e..9439f88109cfec9eee2eebda5c747d02f2f57131 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 62e5a04a535040ef46707d4790267a2fadd37b6b..0000000000000000000000000000000000000000 --- 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 17a986e43b54c05055b7676a292ea6bae3830306..0000000000000000000000000000000000000000 --- 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 1abb565b67cae72bd5a5543534b2838dff600d23..8cc6dd58629f28939f7c1fe285231830db67386b 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; }