mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-08 05:34:58 +02:00
xt_RAWNAT: skb writable part might not include whole L4 header (IPv4 case)
Consider TCP/IPv4 packet with IP options: sizeof(*iph) + sizeof(struct tcphdr) is not enough to include tcp checksum. It may hurt if this packet is fragmented. Therefore, we should use iph->ihl * 4 instead of sizeof(*iph). Signed-off-by: Dmitry Popov <dp@highloadlab.com>
This commit is contained in:

committed by
Jan Engelhardt

parent
3f04148501
commit
b70905e7cb
@@ -1,6 +1,8 @@
|
||||
|
||||
HEAD
|
||||
====
|
||||
Fixes:
|
||||
- xt_RAWNAT: ensure correct operation in the presence of IPv4 options
|
||||
|
||||
|
||||
v2.2 (2013-03-31)
|
||||
|
@@ -109,7 +109,7 @@ static void rawnat4_update_l4(struct sk_buff *skb, __be32 oldip, __be32 newip)
|
||||
|
||||
static unsigned int rawnat4_writable_part(const struct iphdr *iph)
|
||||
{
|
||||
unsigned int wlen = sizeof(*iph);
|
||||
unsigned int wlen = iph->ihl * 4;
|
||||
|
||||
switch (iph->protocol) {
|
||||
case IPPROTO_TCP:
|
||||
|
Reference in New Issue
Block a user