bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] pfinet: configure_dev does not initialize the ifa correctly


From: Neal H Walfield
Subject: [PATCH] pfinet: configure_dev does not initialize the ifa correctly
Date: Wed, 18 Jul 2001 16:17:06 +0200
User-agent: Mutt/1.3.18i

configure_device does not initialize the ifa correctly.  It sets it to
zero and INADDR_NONE != 0.  This problem is exposed when setting the
address, the peer and the gateway one after another (i.e. via ioctls or
using fsysopts).

2001-07-14  Neal H Walfield  <neal@cs.uml.edu>

        * linux-src/net/ipv4/devinit.c (configure_device):  If we are
        setting the peer on an IFF_POINTOPOINT link, we must force the
        metmask to 255.255.255.255.  (the ifa is initialized to all
        zeros, thus, if we did `settrans -ac /tmp/foo /hurd/pfinet -i
        tun0; fsysopts /tmp/foo -a 1.2; fsysopts /tmp/foo -p 1.3', the
        netmask is 0.0.0.0 and is impossible to change.

Index: linux-src/net/ipv4/devinet.c
===================================================================
RCS file: /home/neal/cvs/hurd/pfinet/linux-src/net/ipv4/devinet.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 devinet.c
--- linux-src/net/ipv4/devinet.c        2001/07/08 23:40:38     1.1.1.1
+++ linux-src/net/ipv4/devinet.c        2001/07/15 13:36:56
@@ -419,6 +419,11 @@ configure_device (struct device *dev,
       if (!ifa)
        return ENOBUFS;
       memcpy (ifa->ifa_label, dev->name, IFNAMSIZ);
+
+      ifa->ifa_address = INADDR_NONE;
+      ifa->ifa_mask = INADDR_NONE;
+      ifa->ifa_broadcast = INADDR_NONE;
+      ifa->ifa_local = INADDR_NONE;
     }
 
   if (addr != INADDR_NONE)
@@ -435,7 +440,7 @@ configure_device (struct device *dev,
   if (peer != INADDR_NONE && (dev->flags & IFF_POINTOPOINT))
     {
       ifa->ifa_prefixlen = 32;
-      if (netmask != INADDR_NONE)
+      if (netmask != INADDR_NONE && !(dev->flags & IFF_POINTOPOINT))
        ifa->ifa_mask = netmask;
       else
        ifa->ifa_mask = inet_make_mask(32);

Attachment: pgpv4ai9lGUdh.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]