From 98507cf4143816daf9a23773077f3fcaa9f7e0de Mon Sep 17 00:00:00 2001 From: Tobias Schlager Date: Thu, 12 Sep 2024 11:17:18 +0200 Subject: [PATCH] MT#55283 Honour the hosts IPv4 TTL and IPv6 hop limit This patch forces rtpengine to use the IPv4 TTL and IPv6 hop limits set on the host for proxied packets in kernel mode. Beforehand, the TTL was always set to a hardcoded value of 64. While this is the default almost everywhere, it may be desirable to be able to set a higher value. Especially when interfacing with complex carrier backbone networks. Closes #1860 Change-Id: I2ddf5752db541205d92f042db22eb738481e84a3 --- kernel-module/xt_RTPENGINE.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel-module/xt_RTPENGINE.c b/kernel-module/xt_RTPENGINE.c index 4b8537720..b00bf40fa 100644 --- a/kernel-module/xt_RTPENGINE.c +++ b/kernel-module/xt_RTPENGINE.c @@ -4988,6 +4988,9 @@ static int send_proxy_packet4(struct sk_buff *skb, struct re_address *src, struc if (!net) goto drop; + // honour the IPv4 TTL set via sysctl + ih->ttl = net->ipv4.sysctl_ip_default_ttl; + #if LINUX_VERSION_CODE >= KERNEL_VERSION(6,10,0) rt = ip_route_output(net, dst->u.ipv4, src->u.ipv4, tos, 0, 0); #else @@ -5078,6 +5081,9 @@ static int send_proxy_packet6(struct sk_buff *skb, struct re_address *src, struc if (!net) goto drop; + // honour the IPv6 hop limit set via sysctl + ih->hop_limit = net->ipv6.devconf_dflt->hop_limit; + memset(&fl6, 0, sizeof(fl6)); memcpy(&fl6.saddr, src->u.ipv6, sizeof(fl6.saddr)); memcpy(&fl6.daddr, dst->u.ipv6, sizeof(fl6.daddr));