Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 78337
b: refs/heads/master
c: c8fecf2
h: refs/heads/master
i:
  78335: f6319d2
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Jan 28, 2008
1 parent 3b7cf98 commit 0142ee9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 37 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 68dd299bc84dede6aef32e6f4777a676314f5d21
refs/heads/master: c8fecf2242a0ab7230210665986b8ef915e1ae9e
56 changes: 20 additions & 36 deletions trunk/net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,21 @@ static void addrconf_forward_change(void)
}
read_unlock(&dev_base_lock);
}

static void addrconf_fixup_forwarding(struct ctl_table *table, int *p, int old)
{
if (p == &ipv6_devconf_dflt.forwarding)
return;

if (p == &ipv6_devconf.forwarding) {
ipv6_devconf_dflt.forwarding = ipv6_devconf.forwarding;
addrconf_forward_change();
} else if ((!*p) ^ (!old))
dev_forward_change((struct inet6_dev *)table->extra1);

if (*p)
rt6_purge_dflt_routers();
}
#endif

/* Nobody refers to this ifaddr, destroy it */
Expand Down Expand Up @@ -3771,22 +3786,8 @@ int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp,

ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);

if (write && valp != &ipv6_devconf_dflt.forwarding) {
if (valp != &ipv6_devconf.forwarding) {
if ((!*valp) ^ (!val)) {
struct inet6_dev *idev = (struct inet6_dev *)ctl->extra1;
if (idev == NULL)
return ret;
dev_forward_change(idev);
}
} else {
ipv6_devconf_dflt.forwarding = ipv6_devconf.forwarding;
addrconf_forward_change();
}
if (*valp)
rt6_purge_dflt_routers();
}

if (write)
addrconf_fixup_forwarding(ctl, valp, val);
return ret;
}

Expand All @@ -3797,6 +3798,7 @@ static int addrconf_sysctl_forward_strategy(ctl_table *table,
void __user *newval, size_t newlen)
{
int *valp = table->data;
int val = *valp;
int new;

if (!newval || !newlen)
Expand All @@ -3821,26 +3823,8 @@ static int addrconf_sysctl_forward_strategy(ctl_table *table,
}
}

if (valp != &ipv6_devconf_dflt.forwarding) {
if (valp != &ipv6_devconf.forwarding) {
struct inet6_dev *idev = (struct inet6_dev *)table->extra1;
int changed;
if (unlikely(idev == NULL))
return -ENODEV;
changed = (!*valp) ^ (!new);
*valp = new;
if (changed)
dev_forward_change(idev);
} else {
*valp = new;
addrconf_forward_change();
}

if (*valp)
rt6_purge_dflt_routers();
} else
*valp = new;

*valp = new;
addrconf_fixup_forwarding(table, valp, val);
return 1;
}

Expand Down

0 comments on commit 0142ee9

Please sign in to comment.