-#elif defined(HAVE_BSD)
- // BSD route command is silly and doesn't accept an interface name as a destination.
- char gwstr[MAXNETSTR] = "";
- switch(subnet.type) {
+
+#elif defined(HAVE_WINDOWS)
+
+ if(*gateway_str) {
+ switch(subnet.type) {
+ case SUBNET_IPV4:
+ fprintf(out, "netsh interface ipv4 add route %s \"%%INTERFACE%%\" %s\n", subnet_str, gateway_str);
+ break;
+
+ case SUBNET_IPV6:
+ fprintf(out, "netsh interface ipv6 add route %s \"%%INTERFACE%%\" %s\n", subnet_str, gateway_str);
+ break;
+
+ case SUBNET_MAC:
+ default:
+ return;
+ }
+ } else {
+ switch(subnet.type) {
+ case SUBNET_IPV4:
+ fprintf(out, "netsh interface ipv4 add route %s \"%%INTERFACE%%\"\n", subnet_str);
+ break;
+
+ case SUBNET_IPV6:
+ fprintf(out, "netsh interface ipv6 add route %s \"%%INTERFACE%%\"\n", subnet_str);
+ break;
+
+ case SUBNET_MAC:
+ default:
+ return;
+ }
+ }
+
+#else // assume BSD
+
+ if(!*gateway_str) {
+ switch(subnet.type) {