tolerate additional IPv4 address now available for gnunet.org
[oweals/gnunet.git] / src / util / win.c
index 88543de7b50cd0f6b50107f23549d7c2f688a0f1..ad6275cc4363848aadce09e5140a177bf6151abb 100644 (file)
@@ -2,20 +2,20 @@
      This file is part of GNUnet.
      Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 GNUnet e.V.
 
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
      WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
+     Affero General Public License for more details.
+    
+     You should have received a copy of the GNU Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-     Boston, MA 02110-1301, USA.
+     SPDX-License-Identifier: AGPL3.0-or-later
 */
 
 /**
@@ -500,7 +500,7 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
 
       if (!use_enum2)
       {
-        memcpy (&r->address, unicast->Address.lpSockaddr,
+        GNUNET_memcpy (&r->address, unicast->Address.lpSockaddr,
             unicast->Address.iSockaddrLength);
         memset (&r->mask, 0, sizeof (struct sockaddr));
         mask_length = ((IP_ADAPTER_UNICAST_ADDRESS_VISTA *) unicast)->
@@ -520,7 +520,7 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
           struct sockaddr_in6 *b = (struct sockaddr_in6 *) &r->broadcast;
           for (i = 0; i < mask_length; i++)
             ((unsigned char *) &m->sin6_addr)[i / 8] |= 0x80 >> (i % 8);
-          memcpy (&r->broadcast, &r->address, unicast->Address.iSockaddrLength);
+          GNUNET_memcpy (&r->broadcast, &r->address, unicast->Address.iSockaddrLength);
           for (i = mask_length; i < 128; i++)
             ((unsigned char *) &b->sin6_addr)[i / 8] |= 0x80 >> (i % 8);
         }
@@ -534,14 +534,13 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
           for (i = 0; !found && i < interfaces4_len / sizeof (INTERFACE_INFO); i++)
           {
             struct sockaddr_in *m = (struct sockaddr_in *) &r->mask;
-            if (memcpy (&interfaces4[i].iiAddress.Address,
+            GNUNET_memcpy (&interfaces4[i].iiAddress.Address,
                 unicast->Address.lpSockaddr,
-                unicast->Address.iSockaddrLength) != 0)
-              continue;
+                unicast->Address.iSockaddrLength);
             found = 1;
-            memcpy (&r->address, &interfaces4[i].iiAddress.Address,
+            GNUNET_memcpy (&r->address, &interfaces4[i].iiAddress.Address,
                 sizeof (struct sockaddr_in));
-            memcpy (&r->mask, &interfaces4[i].iiNetmask.Address,
+            GNUNET_memcpy (&r->mask, &interfaces4[i].iiNetmask.Address,
                 sizeof (struct sockaddr_in));
             for (mask_length = 0;
                 ((unsigned char *) &m->sin_addr)[mask_length / 8] &
@@ -557,12 +556,11 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
               interfaces6 != NULL && !found && i < interfaces6->iAddressCount;
               i++)
           {
-            if (memcpy (interfaces6->Address[i].lpSockaddr,
+            GNUNET_memcpy (interfaces6->Address[i].lpSockaddr,
                 unicast->Address.lpSockaddr,
-                unicast->Address.iSockaddrLength) != 0)
-              continue;
+                unicast->Address.iSockaddrLength);
             found = 1;
-            memcpy (&r->address, interfaces6->Address[i].lpSockaddr,
+            GNUNET_memcpy (&r->address, interfaces6->Address[i].lpSockaddr,
                 sizeof (struct sockaddr_in6));
             /* TODO: Find a way to reliably get network mask for IPv6 on XP */
             memset (&r->mask, 0, sizeof (struct sockaddr));
@@ -582,7 +580,7 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
          * falling under netmask to 1,
          * so we get, 192.168.0.255 from, say, 192.168.0.43 with mask == 24.
          */
-        memcpy (&r->broadcast, &r->address, unicast->Address.iSockaddrLength);
+        GNUNET_memcpy (&r->broadcast, &r->address, unicast->Address.iSockaddrLength);
         for (i = mask_length; i < 32; i++)
           ((unsigned char *) &m->sin_addr)[i / 8] |= 0x80 >> (i % 8);
         r->flags |= ENUMNICS3_BCAST_OK;