From: Weiping Pan <panweiping3@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Weiping Pan <panweiping3@gmail.com>,
"David S. Miller" <davem@davemloft.net> (maintainer:NETWORKING
[IPv4/...),
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> (maintainer:NETWORKING
[IPv4/...),
James Morris <jmorris@namei.org> (maintainer:NETWORKING
[IPv4/...),
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
(maintainer:NETWORKING [IPv4/...),
Patrick McHardy <kaber@trash.net> (maintainer:NETWORKING
[IPv4/...),
netdev@vger.kernel.org (open list:NETWORKING [IPv4/...),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] ipv4: flush route cache after change accept_local
Date: Fri, 2 Dec 2011 09:47:06 +0800 [thread overview]
Message-ID: <ea4d82977e7726dccd8e8f8e65c7fb523668100e.1322790334.git.panweiping3@gmail.com> (raw)
In-Reply-To: <20111201.125200.1219939487021672308.davem@davemloft.net>
After reset ipv4_devconf->data[IPV4_DEVCONF_ACCEPT_LOCAL] to 0,
we should flush route cache, or it will continue receive packets with local
source address, which should be dropped.
Signed-off-by: Weiping Pan <panweiping3@gmail.com>
---
net/ipv4/devinet.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index c6b5092..65f01dc 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1490,7 +1490,9 @@ static int devinet_conf_proc(ctl_table *ctl, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos)
{
+ int old_value = *(int *)ctl->data;
int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
+ int new_value = *(int *)ctl->data;
if (write) {
struct ipv4_devconf *cnf = ctl->extra1;
@@ -1501,6 +1503,9 @@ static int devinet_conf_proc(ctl_table *ctl, int write,
if (cnf == net->ipv4.devconf_dflt)
devinet_copy_dflt_conf(net, i);
+ if (i == IPV4_DEVCONF_ACCEPT_LOCAL - 1)
+ if ((new_value == 0) && (old_value != 0))
+ rt_cache_flush(net, 0);
}
return ret;
--
1.7.4
next prev parent reply other threads:[~2011-12-02 1:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-01 11:47 [PATCH net] " Weiping Pan
2011-12-01 17:52 ` David Miller
2011-12-02 1:47 ` Weiping Pan [this message]
2011-12-02 2:46 ` [PATCH] " David Miller
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=ea4d82977e7726dccd8e8f8e65c7fb523668100e.1322790334.git.panweiping3@gmail.com \
--to=panweiping3@gmail.com \
--cc=davem@davemloft.net \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®