lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1736995236-23063-1-git-send-email-liyonglong@chinatelecom.cn>
Date: Thu, 16 Jan 2025 10:40:36 +0800
From: Yonglong Li <liyonglong@...natelecom.cn>
To: linux-kernel@...r.kernel.org
Cc: netdev@...r.kernel.org,
	davem@...emloft.net,
	dsahern@...nel.org,
	edumazet@...gle.com,
	kuba@...nel.org,
	liyonglong@...natelecom.cn
Subject: [PATCH] seg6: inherit inner IPv4 TTL on ip4ip6 encapsulation

inherit inner IPv4 TTL on ip4ip6 SHR encapsulation like as inherit 
inner hop_limit on ip6ip6 SHR encapsulation

Signed-off-by: Yonglong Li <liyonglong@...natelecom.cn>
---
 net/ipv6/seg6_iptunnel.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
index 098632a..2f1f9cf 100644
--- a/net/ipv6/seg6_iptunnel.c
+++ b/net/ipv6/seg6_iptunnel.c
@@ -160,7 +160,10 @@ int seg6_do_srh_encap(struct sk_buff *skb, struct ipv6_sr_hdr *osrh, int proto)
 		hdr->hop_limit = inner_hdr->hop_limit;
 	} else {
 		ip6_flow_hdr(hdr, 0, flowlabel);
-		hdr->hop_limit = ip6_dst_hoplimit(skb_dst(skb));
+		if (skb->protocol == htons(ETH_P_IP))
+			hdr->hop_limit = ((struct iphdr *)inner_hdr)->ttl;
+		else
+			hdr->hop_limit = ip6_dst_hoplimit(skb_dst(skb));
 
 		memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
 
@@ -249,7 +252,10 @@ static int seg6_do_srh_encap_red(struct sk_buff *skb,
 		hdr->hop_limit = inner_hdr->hop_limit;
 	} else {
 		ip6_flow_hdr(hdr, 0, flowlabel);
-		hdr->hop_limit = ip6_dst_hoplimit(skb_dst(skb));
+		if (skb->protocol == htons(ETH_P_IP))
+			hdr->hop_limit = ((struct iphdr *)inner_hdr)->ttl;
+		else
+			hdr->hop_limit = ip6_dst_hoplimit(skb_dst(skb));
 
 		memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
 		IP6CB(skb)->iif = skb->skb_iif;
-- 
1.8.3.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ