Cannot load xt_TPROXY

I am trying to run a certain proxy by following this guide.

I run into error when I configure the redirect rules for UDP. This is the error I get.

iptables-restore v1.8.3 (legacy): unknown option “–on-port”
Error occurred at line: 16
Try iptables-restore -h' or 'iptables-restore --help' for more information. ip6tables-restore v1.8.3 (legacy): unknown option "--on-port" Error occurred at line: 16 Try ip6tables-restore -h’ or ‘ip6tables-restore --help’ for more information.

On inspecting the kernel log I found these errors

[ 20.083616] 1.8.3-1: Unknown symbol udp4_lib_lookup (err 0)
[ 20.089967] xt_TPROXY: Unknown symbol udp6_lib_lookup (err 0)
.
.
[ 20.519800] kmodloader: 4 modules could not be probed
[ 20.525055] kmodloader: - nf_socket_ipv4 - 0
[ 20.529365] kmodloader: - nf_socket_ipv6 - 0
[ 20.533856] kmodloader: - xt_TPROXY - 0
[ 20.537756] kmodloader: dependency not loaded nf_socket_ipv4
[ 20.543476] kmodloader: dependency not loaded nf_socket_ipv6
[ 20.549167] kmodloader: - xt_socket - 2
[ 26.767325] xt_TPROXY: Unknown symbol udp4_lib_lookup (err 0)
[ 26.774015] xt_TPROXY: Unknown symbol udp6_lib_lookup (err 0)

How do I resolve this issue of not loading xt_TPROXY and other modules?

My guess is if these modules can be loaded then the error unknown option “–on-port” can be resolved and redirect rules can be set.

Device is running stock firmware version 3.200 on MT1300 and packages kmod-ipt-tproxy 4.14.195-1 & iptables-mod-tproxy 1.8.3-1 are already installed.

I have the same issue. It seems that xt_TPROXY module was compiled with wrong config.
Anyone have solutions?

I found the following code in udp.c in linux kernel source code.

#if IS_ENABLED(CONFIG_NETFILTER_XT_MATCH_SOCKET) || \
    IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TPROXY) || \
    IS_ENABLED(CONFIG_NF_SOCKET_IPV4)
struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
			     __be32 daddr, __be16 dport, int dif)
{
	struct sock *sk;

	sk = __udp4_lib_lookup(net, saddr, sport, daddr, dport,
			       dif, 0, &udp_table, NULL);
	if (sk && !refcount_inc_not_zero(&sk->sk_refcnt))
		sk = NULL;
	return sk;
}
EXPORT_SYMBOL_GPL(udp4_lib_lookup);
#endif

I guess configs was not enabled when building linux kernel, and I have to build my own system with these configs enabled.

Hi @hszhsh , I’m having the same problem today with 21.02.0 stable release, (no problem with rc3 before) could you share the path of the options you enabled?
thanks,
T