Replace getrandom() with getentropy()
[tinc] / src / ifconfig.c
index 0bbbf82..d4f1386 100644 (file)
@@ -25,7 +25,7 @@
 
 static long start;
 
-#ifndef HAVE_MINGW
+#ifndef HAVE_WINDOWS
 void ifconfig_header(FILE *out) {
        fprintf(out, "#!/bin/sh\n");
        start = ftell(out);
@@ -105,6 +105,7 @@ void ifconfig_address(FILE *out, const char *value) {
                ipv6 = address;
                break;
 
+       case SUBNET_MAC:
        default:
                return;
        }
@@ -128,7 +129,7 @@ void ifconfig_address(FILE *out, const char *value) {
                return;
        }
 
-#elif defined(HAVE_MINGW)
+#elif defined(HAVE_WINDOWS)
 
        switch(address.type) {
        case SUBNET_MAC:
@@ -136,11 +137,11 @@ void ifconfig_address(FILE *out, const char *value) {
                break;
 
        case SUBNET_IPV4:
-               fprintf(out, "netsh inetface ipv4 set address \"%%INTERFACE%%\" static %s\n", address_str);
+               fprintf(out, "netsh interface ipv4 set address \"%%INTERFACE%%\" static %s\n", address_str);
                break;
 
        case SUBNET_IPV6:
-               fprintf(out, "netsh inetface ipv6 set address \"%%INTERFACE%%\" %s\n", address_str);
+               fprintf(out, "netsh interface ipv6 set address \"%%INTERFACE%%\" %s\n", address_str);
                break;
 
        default:
@@ -208,6 +209,7 @@ void ifconfig_route(FILE *out, const char *value) {
                        fprintf(out, "ip route add %s via %s dev \"$INTERFACE\" onlink\n", subnet_str, gateway_str);
                        break;
 
+               case SUBNET_MAC:
                default:
                        return;
                }
@@ -221,12 +223,13 @@ void ifconfig_route(FILE *out, const char *value) {
                        fprintf(out, "ip route add %s dev \"$INTERFACE\"\n", subnet_str);
                        break;
 
+               case SUBNET_MAC:
                default:
                        return;
                }
        }
 
-#elif defined(HAVE_MINGW)
+#elif defined(HAVE_WINDOWS)
 
        if(*gateway_str) {
                switch(subnet.type) {
@@ -238,6 +241,7 @@ void ifconfig_route(FILE *out, const char *value) {
                        fprintf(out, "netsh interface ipv6 add route %s \"%%INTERFACE%%\" %s\n", subnet_str, gateway_str);
                        break;
 
+               case SUBNET_MAC:
                default:
                        return;
                }
@@ -251,6 +255,7 @@ void ifconfig_route(FILE *out, const char *value) {
                        fprintf(out, "netsh interface ipv6 add route %s \"%%INTERFACE%%\"\n", subnet_str);
                        break;
 
+               case SUBNET_MAC:
                default:
                        return;
                }
@@ -278,6 +283,7 @@ void ifconfig_route(FILE *out, const char *value) {
                        net2str(gateway_str, sizeof(gateway_str), &ipv6);
                        break;
 
+               case SUBNET_MAC:
                default:
                        return;
                }
@@ -298,6 +304,7 @@ void ifconfig_route(FILE *out, const char *value) {
                fprintf(out, "route add -inet6 %s %s\n", subnet_str, gateway_str);
                break;
 
+       case SUBNET_MAC:
        default:
                return;
        }