!30 newip侵入式修改整改

Merge pull request !30 from dinocrisis511/master
This commit is contained in:
mamingshuai
2022-10-21 06:22:38 +00:00
committed by Gitee
22 changed files with 43 additions and 59 deletions
-1
View File
@@ -2,7 +2,6 @@
#
# Copyright (c) 2022 Huawei Device Co., Ltd.
#
# you can use it under the terms of the GPL V2 and the BSD2 license.
# See the LICENSE file in directory / of this repository for complete details.
#
+3 -3
View File
@@ -161,9 +161,9 @@ static inline bool tcp_nip_write_queue_empty(struct sock *sk)
/* connect */
int __tcp_nip_connect(struct sock *sk);
int tcp_newip_conn_request(struct request_sock_ops *rsk_ops,
const struct tcp_request_sock_ops *af_ops,
struct sock *sk, struct sk_buff *skb);
int _tcp_nip_conn_request(struct request_sock_ops *rsk_ops,
const struct tcp_request_sock_ops *af_ops,
struct sock *sk, struct sk_buff *skb);
struct sk_buff *tcp_nip_make_synack(
const struct sock *sk,
struct dst_entry *dst,
-25
View File
@@ -1,25 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (c) 2022 Huawei Device Co., Ltd.
#
# NewIP configuration
#
# NewIP as module will cause a CRASH if you try to unload it
menuconfig NEWIP
tristate "The NewIP protocol"
default n
help
Support for NewIP.
To compile this protocol support as a module, choose M here: the
module will be called NewIP.
if NEWIP
config NEWIP_FAST_KEEPALIVE
tristate "NewIP fast keepalive"
default n
help
Support for NewIP fast keepalive.
endif # NEWIP
+1 -1
View File
@@ -7,7 +7,7 @@
*
* Based on linux/net/ipv6/af_inet6.c
*/
#define pr_fmt(fmt) "NIP AF-NIET: " fmt
#define pr_fmt(fmt) "NIP: " fmt
#include <linux/module.h>
#include <linux/capability.h>
-20
View File
@@ -1,20 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (c) 2022 Huawei Device Co., Ltd.
#
# NewIP Hooks configuration
#
menu "NewIP Hooks"
config NEWIP_HOOKS
tristate "NewIP Hooks"
depends on VENDOR_HOOKS && NEWIP
default n
help
Enable NewIP hooks implemented as tracepoints
Allow NewIP modules to attach to tracepoint "hooks" defined via
DECLARE_TRACE or DECLARE_HOOK
endmenu
+2
View File
@@ -8,6 +8,8 @@
* Based on net/ipv6/icmp.c
* Based on net/ipv4/af_inet.c
*/
#define pr_fmt(fmt) "NIP-ICMP: " fmt
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/types.h>
@@ -11,6 +11,8 @@
*
* Based on net/ipv4/inet_connection_sock.c
*/
#define pr_fmt(fmt) "NIP: " fmt
#include <linux/module.h>
#include <linux/nip.h>
#include <linux/jhash.h>
+2
View File
@@ -15,6 +15,8 @@
* Based on include/net/ipv6.h
* Based on net/core/secure_seq.c
*/
#define pr_fmt(fmt) "NIP: " fmt
#include <linux/module.h>
#include <linux/random.h>
+2
View File
@@ -7,6 +7,8 @@
*
* Based on net/ipv6/addrconf.c
*/
#define pr_fmt(fmt) "NIP: " fmt
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/kernel.h>
+2
View File
@@ -7,6 +7,8 @@
*
* Based on net/ipv6/addrconf_core.c
*/
#define pr_fmt(fmt) "NIP: " fmt
#include <net/nip.h>
#include <net/nip_addrconf.h>
#include <net/ip.h>
+2
View File
@@ -7,6 +7,8 @@
*
* Based on net/ipv6/ip6_fib.c
*/
#define pr_fmt(fmt) "NIP: " fmt
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/net.h>
+2
View File
@@ -7,6 +7,8 @@
* Based on net/ipv6/fib_rules.c
* Based on net/ipv6/fib6_rules.c
*/
#define pr_fmt(fmt) "NIP: " fmt
#include <net/nip_fib.h>
#include <linux/netdevice.h>
#include <linux/notifier.h>
+2
View File
@@ -5,6 +5,8 @@
* Definitions for the NewIP Hooks Register module.
*/
#ifdef CONFIG_NEWIP_HOOKS
#define pr_fmt(fmt) "NIP: " fmt
#include <net/ninet_hashtables.h> /* ninet_ehashfn */
#include <trace/hooks/nip_hooks.h>
+3 -1
View File
@@ -7,6 +7,8 @@
*
* Based on net/ipv6/ip6_input.c
*/
#define pr_fmt(fmt) "NIP-INPUT: " fmt
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/socket.h>
@@ -50,7 +52,7 @@ static int nip_rcv_finish(struct sk_buff *skb)
if (net->ipv4.sysctl_ip_early_demux && !skb_dst(skb) && !skb->sk) {
const struct ninet_protocol *ipprot;
DEBUG("%s: try to early demux skb.", __func__);
DEBUG("%s: try to early demux skb, nexthdr=0x%x.", __func__, NIPCB(skb)->nexthdr);
ipprot = rcu_dereference(ninet_protos[NIPCB(skb)->nexthdr]);
if (ipprot)
edemux = READ_ONCE(ipprot->early_demux);
+2
View File
@@ -7,6 +7,8 @@
*
* Based on net/ipv6/ip6_output.c
*/
#define pr_fmt(fmt) "NIP-OUTPUT: " fmt
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/string.h>
+2
View File
@@ -10,6 +10,8 @@
*
* Based on net/ipv4/ip_sockglue.c
*/
#define pr_fmt(fmt) "NIP: " fmt
#include <linux/module.h>
#include <linux/types.h>
#include <linux/skbuff.h>
+2
View File
@@ -7,6 +7,8 @@
*
* Based on net/ipv6/ndisc.c
*/
#define pr_fmt(fmt) "NIP-ND: " fmt
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/types.h>
+2
View File
@@ -10,6 +10,8 @@
*
* Based on net/ipv6/protocol.c
*/
#define pr_fmt(fmt) "NIP: " fmt
#include <net/protocol.h>
#include <linux/module.h>
#include <linux/netdevice.h>
+2
View File
@@ -12,6 +12,8 @@
* Based on net/ipv4/route.c
* Based on net/ipv6/route.c
*/
#define pr_fmt(fmt) "NIP: " fmt
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/socket.h>
+5 -5
View File
@@ -512,8 +512,8 @@ void ninet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb)
*/
static int tcp_nip_conn_request(struct sock *sk, struct sk_buff *skb)
{
return tcp_newip_conn_request(&tcp_nip_request_sock_ops,
&tcp_request_sock_newip_ops, sk, skb);
return _tcp_nip_conn_request(&tcp_nip_request_sock_ops,
&tcp_request_sock_newip_ops, sk, skb);
}
/* Function
@@ -733,9 +733,9 @@ void tcp_nip_keepalive_enable(struct sock *sk)
return;
}
pr_crit("%s ok, HZ=%u, time/probes/intvl [%u, %u, %u]",
__func__, HZ, tp->keepalive_time, tp->keepalive_probes,
tp->keepalive_intvl);
DEBUG("%s ok, HZ=%u, time/probes/intvl [%u, %u, %u]",
__func__, HZ, tp->keepalive_time, tp->keepalive_probes,
tp->keepalive_intvl);
tp->nip_keepalive_enable = true;
#endif
}
+3 -3
View File
@@ -766,9 +766,9 @@ void tcp_nip_openreq_init_rwin(struct request_sock *req,
* sk: transmission control block.
* skb: Transfer control block buffer.
*/
int tcp_newip_conn_request(struct request_sock_ops *rsk_ops,
const struct tcp_request_sock_ops *af_ops,
struct sock *sk, struct sk_buff *skb)
int _tcp_nip_conn_request(struct request_sock_ops *rsk_ops,
const struct tcp_request_sock_ops *af_ops,
struct sock *sk, struct sk_buff *skb)
{
struct tcp_fastopen_cookie foc = { .len = -1 };
+2
View File
@@ -12,6 +12,8 @@
* Based on net/ipv4/udp.c
* Based on net/ipv6/udp.c
*/
#define pr_fmt(fmt) "NIP-UDP: " fmt
#include <linux/uaccess.h>
#include <linux/errno.h>
#include <linux/if_arp.h>