Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Kernel v2.4.27-rc5 /net/ipv4/devinet.c

Filename:/net/ipv4/devinet.c
Lines Added:17
Lines Deleted:1
Also changed in: (Previous) 2.4.27-rc4  2.4.26  2.4.26-rc4  2.4.26-rc3  2.4.26-rc2  2.4.26-rc1 
(Following) 2.4.27-rc6  2.4.27  2.6.27-rc1  2.6.27-rc2  2.6.27-rc3  2.6.27-rc4 

Location
[  2.4.27-rc5
  [  net
    [  ipv4
       o  devinet.c

Patch

diff -Naur -p -X /home/marcelo/lib/dontdiff linux-2.4.26/net/ipv4/devinet.c linux-2.4.27-rc5/net/ipv4/devinet.c
--- linux-2.4.26/net/ipv4/devinet.c   2004-04-14 13:05:41.000000000 +0000
+++ linux-2.4.27-rc5/net/ipv4/devinet.c   2004-08-03 23:06:40.000000000 +0000
@@ -662,7 +662,23 @@ int devinet_ioctl(unsigned int cmd, void
          if (ifa->ifa_mask != sin->sin_addr.s_addr) {
             inet_del_ifa(in_dev, ifap, 0);
             ifa->ifa_mask = sin->sin_addr.s_addr;
-            ifa->ifa_prefixlen = inet_mask_len(ifa->ifa_mask);
+            ifa->ifa_prefixlen =
+               inet_mask_len(ifa->ifa_mask);
+
+            /* See if current broadcast address matches
+             * with current netmask, then recalculate
+             * the broadcast address. Otherwise it's a
+             * funny address, so don't touch it since
+             * the user seems to know what (s)he's doing...
+             */
+            if ((dev->flags & IFF_BROADCAST) &&
+                (ifa->ifa_prefixlen < 31) &&
+                (ifa->ifa_broadcast ==
+                 (ifa->ifa_local|~ifa->ifa_mask))) {
+               ifa->ifa_broadcast =
+                  (ifa->ifa_local |
+                   ~sin->sin_addr.s_addr);
+            }
             inet_insert_ifa(ifa);
          }
          break;


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.