lib:socket: set defaults for linkspeed and capability in get_interfaces()
authorMichael Adam <obnox@samba.org>
Mon, 25 Jan 2016 02:38:31 +0000 (03:38 +0100)
committerMichael Adam <obnox@samba.org>
Tue, 26 Jan 2016 06:33:16 +0000 (07:33 +0100)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/socket/interfaces.c

index 3b15615b8d1c0be710df1078abe20b1af2a55262..e18fb07ffc19a4aa706fbf5063c72378069a2594 100644 (file)
@@ -24,6 +24,7 @@
 #include "system/network.h"
 #include "interfaces.h"
 #include "lib/util/tsort.h"
+#include "librpc/gen_ndr/ioctl.h"
 
 /****************************************************************************
  Create a struct sockaddr_storage with the netmask bits set to 1.
@@ -137,6 +138,7 @@ static int _get_interfaces(TALLOC_CTX *mem_ctx, struct iface_struct **pifaces)
        int count;
        int total = 0;
        size_t copy_size;
+       uint64_t if_speed = 1000 * 1000 * 1000; /* 1GBit */
 
        if (getifaddrs(&iflist) < 0) {
                return -1;
@@ -220,6 +222,9 @@ static int _get_interfaces(TALLOC_CTX *mem_ctx, struct iface_struct **pifaces)
                                "%s\n", ifptr->ifa_name, strerror(errno));
                }
 
+               ifaces[total].linkspeed = if_speed;
+               ifaces[total].capability = FSCTL_NET_IFACE_NONE_CAPABLE;
+
                if (strlcpy(ifaces[total].name, ifptr->ifa_name,
                        sizeof(ifaces[total].name)) >=
                                sizeof(ifaces[total].name)) {