static subnet_t ipv4, ipv6;
void ifconfig_address(FILE *out, const char *value) {
- subnet_t address = {};
+ subnet_t address = {0};
char address_str[MAXNETSTR];
if(!str2net(&address, value) || !net2str(address_str, sizeof(address_str), &address)) {
break;
case SUBNET_IPV4:
- fprintf(out, "netsh inetface ipv4 set address \"$INTERFACE\" static %s\n", address_str);
+ fprintf(out, "netsh inetface ipv4 set address \"%%INTERFACE%%\" static %s\n", address_str);
break;
case SUBNET_IPV6:
- fprintf(out, "netsh inetface ipv6 set address \"$INTERFACE\" static %s\n", address_str);
+ fprintf(out, "netsh inetface ipv6 set address \"%%INTERFACE%%\" %s\n", address_str);
break;
default:
}
void ifconfig_route(FILE *out, const char *value) {
- subnet_t subnet = {}, gateway = {};
+ subnet_t subnet = {0}, gateway = {0};
char subnet_str[MAXNETSTR] = "", gateway_str[MAXNETSTR] = "";
char *sep = strchr(value, ' ');
if(*gateway_str) {
switch(subnet.type) {
case SUBNET_IPV4:
- fprintf(out, "ip route add %s via %s dev \"$INTERFACE\"\n", subnet_str, gateway_str);
+ fprintf(out, "ip route add %s via %s dev \"$INTERFACE\" onlink\n", subnet_str, gateway_str);
break;
case SUBNET_IPV6:
- fprintf(out, "ip route add %s via %s dev \"$INTERFACE\"\n", subnet_str, gateway_str);
+ fprintf(out, "ip route add %s via %s dev \"$INTERFACE\" onlink\n", subnet_str, gateway_str);
break;
default:
if(*gateway_str) {
switch(subnet.type) {
case SUBNET_IPV4:
- fprintf(out, "netsh inetface ipv4 add route %s \"%%INTERFACE%%\" %s\n", subnet_str, gateway_str);
+ fprintf(out, "netsh interface ipv4 add route %s \"%%INTERFACE%%\" %s\n", subnet_str, gateway_str);
break;
case SUBNET_IPV6:
- fprintf(out, "netsh inetface ipv6 add route %s \"%%INTERFACE%%\" %s\n", subnet_str, gateway_str);
+ fprintf(out, "netsh interface ipv6 add route %s \"%%INTERFACE%%\" %s\n", subnet_str, gateway_str);
break;
default:
} else {
switch(subnet.type) {
case SUBNET_IPV4:
- fprintf(out, "netsh inetface ipv4 add route %s \"%%INTERFACE%%\"\n", subnet_str);
+ fprintf(out, "netsh interface ipv4 add route %s \"%%INTERFACE%%\"\n", subnet_str);
break;
case SUBNET_IPV6:
- fprintf(out, "netsh inetface ipv6 add route %s \"%%INTERFACE%%\"\n", subnet_str);
+ fprintf(out, "netsh interface ipv6 add route %s \"%%INTERFACE%%\"\n", subnet_str);
break;
default: