diff options
author | Weiping Pan <panweiping3@gmail.com> | 2011-12-01 15:47:06 +0000 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2012-01-11 10:31:07 -0800 |
commit | 0f98ee27faf8a6ec88bac804b19e79854ea0e0b8 (patch) | |
tree | 0bf052168a52160ca5476d8cf977d6b8caf408b1 /net | |
parent | b4758165fe80041d797687f58e94b08bfbae3fd4 (diff) |
ipv4: flush route cache after change accept_local
[ Upstream commit d01ff0a049f749e0bf10a35bb23edd012718c8c2 ]
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Change-Id: I4e1a937bf13f758c7be089f614e7e84bdafcc0af
Reviewed-on: http://git-master/r/74222
Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Diffstat (limited to 'net')
-rw-r--r-- | 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 80554bcfd979..76db59202f17 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -1496,7 +1496,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; @@ -1507,6 +1509,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; |