mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 02:50:43 +00:00
[IPV4]: Fix setting broadcast for SIOCSIFNETMASK
Fix setting of the broadcast address when the netmask is set via SIOCSIFNETMASK in Linux 2.6. The code wanted the old value of ifa->ifa_mask but used it after it had already been overwritten with the new value. Signed-off-by: David Engel <gigem@comcast.net> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
parent
95df1c04ab
commit
dcab5e1eec
1 changed files with 2 additions and 1 deletions
|
@ -715,6 +715,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg)
|
|||
break;
|
||||
ret = 0;
|
||||
if (ifa->ifa_mask != sin->sin_addr.s_addr) {
|
||||
u32 old_mask = ifa->ifa_mask;
|
||||
inet_del_ifa(in_dev, ifap, 0);
|
||||
ifa->ifa_mask = sin->sin_addr.s_addr;
|
||||
ifa->ifa_prefixlen = inet_mask_len(ifa->ifa_mask);
|
||||
|
@ -728,7 +729,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg)
|
|||
if ((dev->flags & IFF_BROADCAST) &&
|
||||
(ifa->ifa_prefixlen < 31) &&
|
||||
(ifa->ifa_broadcast ==
|
||||
(ifa->ifa_local|~ifa->ifa_mask))) {
|
||||
(ifa->ifa_local|~old_mask))) {
|
||||
ifa->ifa_broadcast = (ifa->ifa_local |
|
||||
~sin->sin_addr.s_addr);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue