From: Li Wei <lw@cn.fujitsu.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>
Subject: [PATCH] ipv4: fix a bug in SRR option matching.
Date: Tue, 08 Nov 2011 15:56:40 +0800 [thread overview]
Message-ID: <4EB8E0B8.40500@cn.fujitsu.com> (raw)
Since commit 7be799a7 (ipv4: Remove rt->rt_dst reference from
ip_forward_options()) and commit 0374d9ce (ipv4: Kill spurious
write to iph->daddr in ip_forward_options()) we use iph->daddr
for SRR option matching and assume iph->daddr equals to rt->rt_dst,
Unfortunately skb_rtable(skb) has been updated in ip_options_rcv_srr()
for the nexthop in SRR option but iph->daddr *not* updated,
We should use the updated rt->rt_dst for SRR option matching
and update iph->daddr here.
Signed-off-by: Li Wei <lw@cn.fujitsu.com>
---
net/ipv4/ip_options.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
index ec93335..8dca67c 100644
--- a/net/ipv4/ip_options.c
+++ b/net/ipv4/ip_options.c
@@ -568,12 +568,13 @@ void ip_forward_options(struct sk_buff *skb)
) {
if (srrptr + 3 > srrspace)
break;
- if (memcmp(&ip_hdr(skb)->daddr, &optptr[srrptr-1], 4) == 0)
+ if (memcmp(&rt->rt_dst, &optptr[srrptr-1], 4) == 0)
break;
}
if (srrptr + 3 <= srrspace) {
opt->is_changed = 1;
ip_rt_get_source(&optptr[srrptr-1], skb, rt);
+ ip_hdr(skb)->daddr = rt->rt_dst;
optptr[2] = srrptr+4;
} else if (net_ratelimit())
printk(KERN_CRIT "ip_forward(): Argh! Destination lost!\n");
--
1.7.3.2
next reply other threads:[~2011-11-08 7:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-08 7:56 Li Wei [this message]
2011-11-08 17:06 ` [PATCH] ipv4: fix a bug in SRR option matching David Miller
2011-11-09 7:37 ` Li Wei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EB8E0B8.40500@cn.fujitsu.com \
--to=lw@cn.fujitsu.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.