mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-10 23:20:05 +00:00
act_nat: fix the wrong checksum when addr isn't in old_addr/mask
fix the wrong checksum when addr isn't in old_addr/mask For TCP and UDP packets, when addr isn't in old_addr/mask we don't do SNAT or DNAT, and we should not update layer 4 checksum. Signed-off-by: Changli Gao <xiaosuo@gmail.com> ---- net/sched/act_nat.c | 4 ++++ 1 file changed, 4 insertions(+) Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e3fe8558c7
commit
33c29dde7d
@ -159,6 +159,9 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
|
|||||||
iph->daddr = new_addr;
|
iph->daddr = new_addr;
|
||||||
|
|
||||||
csum_replace4(&iph->check, addr, new_addr);
|
csum_replace4(&iph->check, addr, new_addr);
|
||||||
|
} else if ((iph->frag_off & htons(IP_OFFSET)) ||
|
||||||
|
iph->protocol != IPPROTO_ICMP) {
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ihl = iph->ihl * 4;
|
ihl = iph->ihl * 4;
|
||||||
@ -247,6 +250,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
return action;
|
return action;
|
||||||
|
|
||||||
drop:
|
drop:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user