net/sched: act_nat: fix inner IP header checksum in ICMP error packets
Subsystems (4)
PATCH 1/1 net/sched: act_nat: fix inner IP header checksum in ICMP error packets
Update the inner IP header checksum when rewriting addresses inside ICMP error payloads, matching netfilter's nf_nat_ipv4_manip_pkt() behavior.
--- net/sched/act_nat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/sched/act_nat.c +3 -1
@@ -242,7 +242,9 @@ TC_INDIRECT_SCOPE int tcf_nat_act(struct sk_buff *skb, new_addr &= mask; new_addr |= addr & ~mask; -/* XXX Fix up the inner checksums. */ +/* Update inner IP header checksum after address rewrite */ +csum_replace4 (&iph->check, addr, new_addr); +if (egress) iph->daddr = new_addr;else
Signature · 1 line
2.53.0
Quoted 17 lines · David Carlier
Update the inner IP header checksum when rewriting addresses inside ICMP error payloads, matching netfilter's
nf_nat_ipv4_manip_pkt()behavior.Fixes b4219952356b ("[PKT_SCHED]: Add stateless NAT")Signed-off-by David Carlier <[email protected]>--- net/sched/act_nat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)net/sched/act_nat.c +0
-0
net/sched/act_nat.c TC_INDIRECT_SCOPE int tcf_nat_act(struct sk_buff *skb, · line 247
Quoted 7 lines
net/sched/act_nat.c +3
-1@@ -242,7 +242,9 @@ TC_INDIRECT_SCOPE int tcf_nat_act(struct sk_buff *skb, new_addr &= mask; new_addr |= addr & ~mask; -/* XXX Fix up the inner checksums. */ +/* Update inner IP header checksum after address rewrite */ +csum_replace4 (&iph->check, addr, new_addr); +
~20 years old code, are we sure this fix is needed? How was this patch was tested?
A selftest would be great.
Hi eric,
Quoted 30 lines · Eric Dumazet
Quoted 17 lines · David Carlier
Update the inner IP header checksum when rewriting addresses inside ICMP error payloads, matching netfilter's
nf_nat_ipv4_manip_pkt()behavior.Fixes b4219952356b ("[PKT_SCHED]: Add stateless NAT")Signed-off-by David Carlier <[email protected]>--- net/sched/act_nat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)net/sched/act_nat.c +0
-0net/sched/act_nat.c TC_INDIRECT_SCOPE int tcf_nat_act(struct sk_buff *skb, · line 247
Quoted 7 lines
net/sched/act_nat.c +3
-1@@ -242,7 +242,9 @@ TC_INDIRECT_SCOPE int tcf_nat_act(struct sk_buff *skb, new_addr &= mask; new_addr |= addr & ~mask; -/* XXX Fix up the inner checksums. */ +/* Update inner IP header checksum after address rewrite */ +csum_replace4 (&iph->check, addr, new_addr); +~20 years old code, are we sure this fix is needed? How was this patch was tested?
Quoted 1 line
A selftest would be great.
Ok sounds fair