Commit f07a514b authored by Zhengchao Shao's avatar Zhengchao Shao
Browse files

tcp: fix compilation issue when CONFIG_SYSCTL is disabled

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8Y7PX


CVE: NA

--------------------------------

The following error is reported when the kernel is compiled with
CONFIG_SYSCTL disabled:
   aarch64-linux-ld: net/ipv4/inet_hashtables.o: in function `__inet_hash_connect':
   inet_hashtables.c:(.text+0x3564): undefined reference to `sysctl_local_port_allocation'
   aarch64-linux-ld: net/ipv4/inet_hashtables.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `sysctl_local_port_allocation' which may bind externally can not be used when making a shared object; recompile with -fPIC
>> inet_hashtables.c:(.text+0x3564): dangerous relocation: unsupported relocation
   aarch64-linux-ld: inet_hashtables.c:(.text+0x3568): undefined reference to `sysctl_local_port_allocation'
   aarch64-linux-ld: inet_hashtables.c:(.text+0x3580): undefined reference to `sysctl_local_port_allocation'
When CONFIG_SYSCTL is disabled, sysctl_local_port_allocation is
undefined.

Fixes: 208a7204 ("tcp/dccp: Add another way to allocate local ports in connect()")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202401180939.2N529UUe-lkp@intel.com/


Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
parent 61a1dd4f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@
#include <net/tcp.h>
#include <net/sock_reuseport.h>

int sysctl_local_port_allocation = 0;

u32 inet_ehashfn(const struct net *net, const __be32 laddr,
		 const __u16 lport, const __be32 faddr,
		 const __be16 fport)
+0 −1
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ static unsigned long ip_ping_group_range_min[] = { 0, 0 };
static unsigned long ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX };
static u32 u32_max_div_HZ = UINT_MAX / HZ;
static int one_day_secs = 24 * 3600;
int sysctl_local_port_allocation;
static u32 fib_multipath_hash_fields_all_mask __maybe_unused =
	FIB_MULTIPATH_HASH_FIELD_ALL_MASK;
static unsigned int tcp_child_ehash_entries_max = 16 * 1024 * 1024;