Skip to content

Commit d01ff0a

Browse files
Peter Pan(潘卫平)davem330
authored andcommitted
ipv4: flush route cache after change accept_local
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>
1 parent 1ee5fa1 commit d01ff0a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎net/ipv4/devinet.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,7 +1490,9 @@ static int devinet_conf_proc(ctl_table *ctl, int write,
14901490
void __user *buffer,
14911491
size_t *lenp, loff_t *ppos)
14921492
{
1493+
int old_value = *(int *)ctl->data;
14931494
int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
1495+
int new_value = *(int *)ctl->data;
14941496

14951497
if (write) {
14961498
struct ipv4_devconf *cnf = ctl->extra1;
@@ -1501,6 +1503,9 @@ static int devinet_conf_proc(ctl_table *ctl, int write,
15011503

15021504
if (cnf == net->ipv4.devconf_dflt)
15031505
devinet_copy_dflt_conf(net, i);
1506+
if (i == IPV4_DEVCONF_ACCEPT_LOCAL - 1)
1507+
if ((new_value == 0) && (old_value != 0))
1508+
rt_cache_flush(net, 0);
15041509
}
15051510

15061511
return ret;

0 commit comments

Comments
 (0)