diff --git a/include/net/ip.h b/include/net/ip.h index cfc3dd5ff085d4523ef3ceddf58282857af0e8de..6ca64b3f32f3f31f88fb6b1f55c7d890197011a0 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -685,6 +685,12 @@ bool icmp_global_allow(void); extern int sysctl_icmp_msgs_per_sec; extern int sysctl_icmp_msgs_burst; +#ifdef CONFIG_ARCH_ASCEND +extern int sysctl_icmp_timestamp_enable; +#else +#define sysctl_icmp_timestamp_enable 1 +#endif + #ifdef CONFIG_PROC_FS int ip_misc_proc_init(void); #endif diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 0167e23d1c8faf6d404995f124ba754c6d9fb2db..308fe936638cf82c2576a55aedbb66de981e93c1 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -232,6 +232,9 @@ static inline void icmp_xmit_unlock(struct sock *sk) int sysctl_icmp_msgs_per_sec __read_mostly = 1000; int sysctl_icmp_msgs_burst __read_mostly = 50; +#ifdef CONFIG_ARCH_ASCEND +int sysctl_icmp_timestamp_enable __read_mostly; +#endif static struct { spinlock_t lock; @@ -959,6 +962,10 @@ static bool icmp_echo(struct sk_buff *skb) static bool icmp_timestamp(struct sk_buff *skb) { struct icmp_bxm icmp_param; + + if (!sysctl_icmp_timestamp_enable) + goto out_err; + /* * Too short. */ diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 4f1fa744d3c8e71a6f14edcbfd4310e4f6c1b26c..ca4d2fc5d326532f46f0747f99065d8350735a80 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -545,6 +545,16 @@ static struct ctl_table ipv4_table[] = { .proc_handler = proc_dointvec_minmax, .extra1 = &zero, }, +#ifdef CONFIG_ARCH_ASCEND + { + .procname = "icmp_timestamp_enable", + .data = &sysctl_icmp_timestamp_enable, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = &zero, + }, +#endif { .procname = "udp_mem", .data = &sysctl_udp_mem,