projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't tarpit localhost connections
[tinc]
/
src
/
ifconfig.c
diff --git
a/src/ifconfig.c
b/src/ifconfig.c
index
5f61461
..
d4f1386
100644
(file)
--- a/
src/ifconfig.c
+++ b/
src/ifconfig.c
@@
-1,6
+1,6
@@
/*
ifconfig.c -- Generate platform specific interface configuration commands
/*
ifconfig.c -- Generate platform specific interface configuration commands
- Copyright (C) 2016-201
7
Guus Sliepen <guus@tinc-vpn.org>
+ Copyright (C) 2016-201
8
Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-25,7
+25,7
@@
static long start;
static long start;
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
void ifconfig_header(FILE *out) {
fprintf(out, "#!/bin/sh\n");
start = ftell(out);
void ifconfig_header(FILE *out) {
fprintf(out, "#!/bin/sh\n");
start = ftell(out);
@@
-71,10
+71,12
@@
void ifconfig_dhcp(FILE *out) {
}
void ifconfig_dhcp6(FILE *out) {
}
void ifconfig_dhcp6(FILE *out) {
+ (void)out;
fprintf(stderr, "DHCPv6 requested, but not supported by tinc on this platform\n");
}
void ifconfig_slaac(FILE *out) {
fprintf(stderr, "DHCPv6 requested, but not supported by tinc on this platform\n");
}
void ifconfig_slaac(FILE *out) {
+ (void)out;
// It's the default?
}
// It's the default?
}
@@
-103,6
+105,7
@@
void ifconfig_address(FILE *out, const char *value) {
ipv6 = address;
break;
ipv6 = address;
break;
+ case SUBNET_MAC:
default:
return;
}
default:
return;
}
@@
-126,7
+129,7
@@
void ifconfig_address(FILE *out, const char *value) {
return;
}
return;
}
-#elif defined(HAVE_
MINGW) || defined(HAVE_CYGWIN
)
+#elif defined(HAVE_
WINDOWS
)
switch(address.type) {
case SUBNET_MAC:
switch(address.type) {
case SUBNET_MAC:
@@
-134,11
+137,11
@@
void ifconfig_address(FILE *out, const char *value) {
break;
case SUBNET_IPV4:
break;
case SUBNET_IPV4:
- fprintf(out, "netsh in
et
face ipv4 set address \"%%INTERFACE%%\" static %s\n", address_str);
+ fprintf(out, "netsh in
ter
face ipv4 set address \"%%INTERFACE%%\" static %s\n", address_str);
break;
case SUBNET_IPV6:
break;
case SUBNET_IPV6:
- fprintf(out, "netsh in
et
face ipv6 set address \"%%INTERFACE%%\" %s\n", address_str);
+ fprintf(out, "netsh in
ter
face ipv6 set address \"%%INTERFACE%%\" %s\n", address_str);
break;
default:
break;
default:
@@
-199,13
+202,14
@@
void ifconfig_route(FILE *out, const char *value) {
if(*gateway_str) {
switch(subnet.type) {
case SUBNET_IPV4:
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:
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;
break;
+ case SUBNET_MAC:
default:
return;
}
default:
return;
}
@@
-219,12
+223,13
@@
void ifconfig_route(FILE *out, const char *value) {
fprintf(out, "ip route add %s dev \"$INTERFACE\"\n", subnet_str);
break;
fprintf(out, "ip route add %s dev \"$INTERFACE\"\n", subnet_str);
break;
+ case SUBNET_MAC:
default:
return;
}
}
default:
return;
}
}
-#elif defined(HAVE_
MINGW) || defined(HAVE_CYGWIN
)
+#elif defined(HAVE_
WINDOWS
)
if(*gateway_str) {
switch(subnet.type) {
if(*gateway_str) {
switch(subnet.type) {
@@
-236,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;
fprintf(out, "netsh interface ipv6 add route %s \"%%INTERFACE%%\" %s\n", subnet_str, gateway_str);
break;
+ case SUBNET_MAC:
default:
return;
}
default:
return;
}
@@
-249,6
+255,7
@@
void ifconfig_route(FILE *out, const char *value) {
fprintf(out, "netsh interface ipv6 add route %s \"%%INTERFACE%%\"\n", subnet_str);
break;
fprintf(out, "netsh interface ipv6 add route %s \"%%INTERFACE%%\"\n", subnet_str);
break;
+ case SUBNET_MAC:
default:
return;
}
default:
return;
}
@@
-276,6
+283,7
@@
void ifconfig_route(FILE *out, const char *value) {
net2str(gateway_str, sizeof(gateway_str), &ipv6);
break;
net2str(gateway_str, sizeof(gateway_str), &ipv6);
break;
+ case SUBNET_MAC:
default:
return;
}
default:
return;
}
@@
-296,6
+304,7
@@
void ifconfig_route(FILE *out, const char *value) {
fprintf(out, "route add -inet6 %s %s\n", subnet_str, gateway_str);
break;
fprintf(out, "route add -inet6 %s %s\n", subnet_str, gateway_str);
break;
+ case SUBNET_MAC:
default:
return;
}
default:
return;
}