merged with guus/1.1
This commit is contained in:
commit
350e2d2d15
16 changed files with 93 additions and 111 deletions
|
@ -198,18 +198,19 @@ static bool setup_device(void) {
|
||||||
|
|
||||||
// Guess what the corresponding interface is called
|
// Guess what the corresponding interface is called
|
||||||
|
|
||||||
char *realname;
|
char *realname = NULL;
|
||||||
|
|
||||||
#if defined(HAVE_FDEVNAME)
|
#if defined(HAVE_FDEVNAME)
|
||||||
realname = fdevname(device_fd) ? : device;
|
realname = fdevname(device_fd);
|
||||||
#elif defined(HAVE_DEVNAME)
|
#elif defined(HAVE_DEVNAME)
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
if(!fstat(device_fd, &buf))
|
if(!fstat(device_fd, &buf))
|
||||||
realname = devname(buf.st_rdev, S_IFCHR) ? : device;
|
realname = devname(buf.st_rdev, S_IFCHR);
|
||||||
#else
|
|
||||||
realname = device;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(!realname)
|
||||||
|
realname = device;
|
||||||
|
|
||||||
if(!get_config_string(lookup_config(config_tree, "Interface"), &iface))
|
if(!get_config_string(lookup_config(config_tree, "Interface"), &iface))
|
||||||
iface = xstrdup(strrchr(realname, '/') ? strrchr(realname, '/') + 1 : realname);
|
iface = xstrdup(strrchr(realname, '/') ? strrchr(realname, '/') + 1 : realname);
|
||||||
else if(strcmp(iface, strrchr(realname, '/') ? strrchr(realname, '/') + 1 : realname))
|
else if(strcmp(iface, strrchr(realname, '/') ? strrchr(realname, '/') + 1 : realname))
|
||||||
|
|
|
@ -81,42 +81,36 @@ void sc_reduce(unsigned char *s) {
|
||||||
s14 -= s23 * 997805;
|
s14 -= s23 * 997805;
|
||||||
s15 += s23 * 136657;
|
s15 += s23 * 136657;
|
||||||
s16 -= s23 * 683901;
|
s16 -= s23 * 683901;
|
||||||
s23 = 0;
|
|
||||||
s10 += s22 * 666643;
|
s10 += s22 * 666643;
|
||||||
s11 += s22 * 470296;
|
s11 += s22 * 470296;
|
||||||
s12 += s22 * 654183;
|
s12 += s22 * 654183;
|
||||||
s13 -= s22 * 997805;
|
s13 -= s22 * 997805;
|
||||||
s14 += s22 * 136657;
|
s14 += s22 * 136657;
|
||||||
s15 -= s22 * 683901;
|
s15 -= s22 * 683901;
|
||||||
s22 = 0;
|
|
||||||
s9 += s21 * 666643;
|
s9 += s21 * 666643;
|
||||||
s10 += s21 * 470296;
|
s10 += s21 * 470296;
|
||||||
s11 += s21 * 654183;
|
s11 += s21 * 654183;
|
||||||
s12 -= s21 * 997805;
|
s12 -= s21 * 997805;
|
||||||
s13 += s21 * 136657;
|
s13 += s21 * 136657;
|
||||||
s14 -= s21 * 683901;
|
s14 -= s21 * 683901;
|
||||||
s21 = 0;
|
|
||||||
s8 += s20 * 666643;
|
s8 += s20 * 666643;
|
||||||
s9 += s20 * 470296;
|
s9 += s20 * 470296;
|
||||||
s10 += s20 * 654183;
|
s10 += s20 * 654183;
|
||||||
s11 -= s20 * 997805;
|
s11 -= s20 * 997805;
|
||||||
s12 += s20 * 136657;
|
s12 += s20 * 136657;
|
||||||
s13 -= s20 * 683901;
|
s13 -= s20 * 683901;
|
||||||
s20 = 0;
|
|
||||||
s7 += s19 * 666643;
|
s7 += s19 * 666643;
|
||||||
s8 += s19 * 470296;
|
s8 += s19 * 470296;
|
||||||
s9 += s19 * 654183;
|
s9 += s19 * 654183;
|
||||||
s10 -= s19 * 997805;
|
s10 -= s19 * 997805;
|
||||||
s11 += s19 * 136657;
|
s11 += s19 * 136657;
|
||||||
s12 -= s19 * 683901;
|
s12 -= s19 * 683901;
|
||||||
s19 = 0;
|
|
||||||
s6 += s18 * 666643;
|
s6 += s18 * 666643;
|
||||||
s7 += s18 * 470296;
|
s7 += s18 * 470296;
|
||||||
s8 += s18 * 654183;
|
s8 += s18 * 654183;
|
||||||
s9 -= s18 * 997805;
|
s9 -= s18 * 997805;
|
||||||
s10 += s18 * 136657;
|
s10 += s18 * 136657;
|
||||||
s11 -= s18 * 683901;
|
s11 -= s18 * 683901;
|
||||||
s18 = 0;
|
|
||||||
carry6 = (s6 + (1 << 20)) >> 21;
|
carry6 = (s6 + (1 << 20)) >> 21;
|
||||||
s7 += carry6;
|
s7 += carry6;
|
||||||
s6 -= shl64(carry6, 21);
|
s6 -= shl64(carry6, 21);
|
||||||
|
@ -156,35 +150,30 @@ void sc_reduce(unsigned char *s) {
|
||||||
s8 -= s17 * 997805;
|
s8 -= s17 * 997805;
|
||||||
s9 += s17 * 136657;
|
s9 += s17 * 136657;
|
||||||
s10 -= s17 * 683901;
|
s10 -= s17 * 683901;
|
||||||
s17 = 0;
|
|
||||||
s4 += s16 * 666643;
|
s4 += s16 * 666643;
|
||||||
s5 += s16 * 470296;
|
s5 += s16 * 470296;
|
||||||
s6 += s16 * 654183;
|
s6 += s16 * 654183;
|
||||||
s7 -= s16 * 997805;
|
s7 -= s16 * 997805;
|
||||||
s8 += s16 * 136657;
|
s8 += s16 * 136657;
|
||||||
s9 -= s16 * 683901;
|
s9 -= s16 * 683901;
|
||||||
s16 = 0;
|
|
||||||
s3 += s15 * 666643;
|
s3 += s15 * 666643;
|
||||||
s4 += s15 * 470296;
|
s4 += s15 * 470296;
|
||||||
s5 += s15 * 654183;
|
s5 += s15 * 654183;
|
||||||
s6 -= s15 * 997805;
|
s6 -= s15 * 997805;
|
||||||
s7 += s15 * 136657;
|
s7 += s15 * 136657;
|
||||||
s8 -= s15 * 683901;
|
s8 -= s15 * 683901;
|
||||||
s15 = 0;
|
|
||||||
s2 += s14 * 666643;
|
s2 += s14 * 666643;
|
||||||
s3 += s14 * 470296;
|
s3 += s14 * 470296;
|
||||||
s4 += s14 * 654183;
|
s4 += s14 * 654183;
|
||||||
s5 -= s14 * 997805;
|
s5 -= s14 * 997805;
|
||||||
s6 += s14 * 136657;
|
s6 += s14 * 136657;
|
||||||
s7 -= s14 * 683901;
|
s7 -= s14 * 683901;
|
||||||
s14 = 0;
|
|
||||||
s1 += s13 * 666643;
|
s1 += s13 * 666643;
|
||||||
s2 += s13 * 470296;
|
s2 += s13 * 470296;
|
||||||
s3 += s13 * 654183;
|
s3 += s13 * 654183;
|
||||||
s4 -= s13 * 997805;
|
s4 -= s13 * 997805;
|
||||||
s5 += s13 * 136657;
|
s5 += s13 * 136657;
|
||||||
s6 -= s13 * 683901;
|
s6 -= s13 * 683901;
|
||||||
s13 = 0;
|
|
||||||
s0 += s12 * 666643;
|
s0 += s12 * 666643;
|
||||||
s1 += s12 * 470296;
|
s1 += s12 * 470296;
|
||||||
s2 += s12 * 654183;
|
s2 += s12 * 654183;
|
||||||
|
@ -277,7 +266,6 @@ void sc_reduce(unsigned char *s) {
|
||||||
s3 -= s12 * 997805;
|
s3 -= s12 * 997805;
|
||||||
s4 += s12 * 136657;
|
s4 += s12 * 136657;
|
||||||
s5 -= s12 * 683901;
|
s5 -= s12 * 683901;
|
||||||
s12 = 0;
|
|
||||||
carry0 = s0 >> 21;
|
carry0 = s0 >> 21;
|
||||||
s1 += carry0;
|
s1 += carry0;
|
||||||
s0 -= shl64(carry0, 21);
|
s0 -= shl64(carry0, 21);
|
||||||
|
@ -543,42 +531,36 @@ void sc_muladd(unsigned char *s, const unsigned char *a, const unsigned char *b,
|
||||||
s14 -= s23 * 997805;
|
s14 -= s23 * 997805;
|
||||||
s15 += s23 * 136657;
|
s15 += s23 * 136657;
|
||||||
s16 -= s23 * 683901;
|
s16 -= s23 * 683901;
|
||||||
s23 = 0;
|
|
||||||
s10 += s22 * 666643;
|
s10 += s22 * 666643;
|
||||||
s11 += s22 * 470296;
|
s11 += s22 * 470296;
|
||||||
s12 += s22 * 654183;
|
s12 += s22 * 654183;
|
||||||
s13 -= s22 * 997805;
|
s13 -= s22 * 997805;
|
||||||
s14 += s22 * 136657;
|
s14 += s22 * 136657;
|
||||||
s15 -= s22 * 683901;
|
s15 -= s22 * 683901;
|
||||||
s22 = 0;
|
|
||||||
s9 += s21 * 666643;
|
s9 += s21 * 666643;
|
||||||
s10 += s21 * 470296;
|
s10 += s21 * 470296;
|
||||||
s11 += s21 * 654183;
|
s11 += s21 * 654183;
|
||||||
s12 -= s21 * 997805;
|
s12 -= s21 * 997805;
|
||||||
s13 += s21 * 136657;
|
s13 += s21 * 136657;
|
||||||
s14 -= s21 * 683901;
|
s14 -= s21 * 683901;
|
||||||
s21 = 0;
|
|
||||||
s8 += s20 * 666643;
|
s8 += s20 * 666643;
|
||||||
s9 += s20 * 470296;
|
s9 += s20 * 470296;
|
||||||
s10 += s20 * 654183;
|
s10 += s20 * 654183;
|
||||||
s11 -= s20 * 997805;
|
s11 -= s20 * 997805;
|
||||||
s12 += s20 * 136657;
|
s12 += s20 * 136657;
|
||||||
s13 -= s20 * 683901;
|
s13 -= s20 * 683901;
|
||||||
s20 = 0;
|
|
||||||
s7 += s19 * 666643;
|
s7 += s19 * 666643;
|
||||||
s8 += s19 * 470296;
|
s8 += s19 * 470296;
|
||||||
s9 += s19 * 654183;
|
s9 += s19 * 654183;
|
||||||
s10 -= s19 * 997805;
|
s10 -= s19 * 997805;
|
||||||
s11 += s19 * 136657;
|
s11 += s19 * 136657;
|
||||||
s12 -= s19 * 683901;
|
s12 -= s19 * 683901;
|
||||||
s19 = 0;
|
|
||||||
s6 += s18 * 666643;
|
s6 += s18 * 666643;
|
||||||
s7 += s18 * 470296;
|
s7 += s18 * 470296;
|
||||||
s8 += s18 * 654183;
|
s8 += s18 * 654183;
|
||||||
s9 -= s18 * 997805;
|
s9 -= s18 * 997805;
|
||||||
s10 += s18 * 136657;
|
s10 += s18 * 136657;
|
||||||
s11 -= s18 * 683901;
|
s11 -= s18 * 683901;
|
||||||
s18 = 0;
|
|
||||||
carry6 = (s6 + (1 << 20)) >> 21;
|
carry6 = (s6 + (1 << 20)) >> 21;
|
||||||
s7 += carry6;
|
s7 += carry6;
|
||||||
s6 -= shl64(carry6, 21);
|
s6 -= shl64(carry6, 21);
|
||||||
|
@ -618,35 +600,30 @@ void sc_muladd(unsigned char *s, const unsigned char *a, const unsigned char *b,
|
||||||
s8 -= s17 * 997805;
|
s8 -= s17 * 997805;
|
||||||
s9 += s17 * 136657;
|
s9 += s17 * 136657;
|
||||||
s10 -= s17 * 683901;
|
s10 -= s17 * 683901;
|
||||||
s17 = 0;
|
|
||||||
s4 += s16 * 666643;
|
s4 += s16 * 666643;
|
||||||
s5 += s16 * 470296;
|
s5 += s16 * 470296;
|
||||||
s6 += s16 * 654183;
|
s6 += s16 * 654183;
|
||||||
s7 -= s16 * 997805;
|
s7 -= s16 * 997805;
|
||||||
s8 += s16 * 136657;
|
s8 += s16 * 136657;
|
||||||
s9 -= s16 * 683901;
|
s9 -= s16 * 683901;
|
||||||
s16 = 0;
|
|
||||||
s3 += s15 * 666643;
|
s3 += s15 * 666643;
|
||||||
s4 += s15 * 470296;
|
s4 += s15 * 470296;
|
||||||
s5 += s15 * 654183;
|
s5 += s15 * 654183;
|
||||||
s6 -= s15 * 997805;
|
s6 -= s15 * 997805;
|
||||||
s7 += s15 * 136657;
|
s7 += s15 * 136657;
|
||||||
s8 -= s15 * 683901;
|
s8 -= s15 * 683901;
|
||||||
s15 = 0;
|
|
||||||
s2 += s14 * 666643;
|
s2 += s14 * 666643;
|
||||||
s3 += s14 * 470296;
|
s3 += s14 * 470296;
|
||||||
s4 += s14 * 654183;
|
s4 += s14 * 654183;
|
||||||
s5 -= s14 * 997805;
|
s5 -= s14 * 997805;
|
||||||
s6 += s14 * 136657;
|
s6 += s14 * 136657;
|
||||||
s7 -= s14 * 683901;
|
s7 -= s14 * 683901;
|
||||||
s14 = 0;
|
|
||||||
s1 += s13 * 666643;
|
s1 += s13 * 666643;
|
||||||
s2 += s13 * 470296;
|
s2 += s13 * 470296;
|
||||||
s3 += s13 * 654183;
|
s3 += s13 * 654183;
|
||||||
s4 -= s13 * 997805;
|
s4 -= s13 * 997805;
|
||||||
s5 += s13 * 136657;
|
s5 += s13 * 136657;
|
||||||
s6 -= s13 * 683901;
|
s6 -= s13 * 683901;
|
||||||
s13 = 0;
|
|
||||||
s0 += s12 * 666643;
|
s0 += s12 * 666643;
|
||||||
s1 += s12 * 470296;
|
s1 += s12 * 470296;
|
||||||
s2 += s12 * 654183;
|
s2 += s12 * 654183;
|
||||||
|
@ -739,7 +716,6 @@ void sc_muladd(unsigned char *s, const unsigned char *a, const unsigned char *b,
|
||||||
s3 -= s12 * 997805;
|
s3 -= s12 * 997805;
|
||||||
s4 += s12 * 136657;
|
s4 += s12 * 136657;
|
||||||
s5 -= s12 * 683901;
|
s5 -= s12 * 683901;
|
||||||
s12 = 0;
|
|
||||||
carry0 = s0 >> 21;
|
carry0 = s0 >> 21;
|
||||||
s1 += carry0;
|
s1 += carry0;
|
||||||
s0 -= shl64(carry0, 21);
|
s0 -= shl64(carry0, 21);
|
||||||
|
|
|
@ -104,13 +104,6 @@ void ifconfig_address(FILE *out, const char *value) {
|
||||||
case SUBNET_IPV6: fprintf(out, "ip addr replace %s dev \"$INTERFACE\"\n", address_str); break;
|
case SUBNET_IPV6: fprintf(out, "ip addr replace %s dev \"$INTERFACE\"\n", address_str); break;
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
#elif defined(HAVE_BSD)
|
|
||||||
switch(address.type) {
|
|
||||||
case SUBNET_MAC: fprintf(out, "ifconfig \"$INTERFACE\" link %s\n", address_str); break;
|
|
||||||
case SUBNET_IPV4: fprintf(out, "ifconfig \"$INTERFACE\" %s\n", address_str); break;
|
|
||||||
case SUBNET_IPV6: fprintf(out, "ifconfig \"$INTERFACE\" inet6 %s\n", address_str); break;
|
|
||||||
default: return;
|
|
||||||
}
|
|
||||||
#elif defined(HAVE_MINGW) || defined(HAVE_CYGWIN)
|
#elif defined(HAVE_MINGW) || defined(HAVE_CYGWIN)
|
||||||
switch(address.type) {
|
switch(address.type) {
|
||||||
case SUBNET_MAC: fprintf(out, "ip link set \"$INTERFACE\" address %s\n", address_str); break;
|
case SUBNET_MAC: fprintf(out, "ip link set \"$INTERFACE\" address %s\n", address_str); break;
|
||||||
|
@ -118,6 +111,13 @@ void ifconfig_address(FILE *out, const char *value) {
|
||||||
case SUBNET_IPV6: fprintf(out, "netsh inetface ipv6 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); break;
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
|
#else // assume BSD
|
||||||
|
switch(address.type) {
|
||||||
|
case SUBNET_MAC: fprintf(out, "ifconfig \"$INTERFACE\" link %s\n", address_str); break;
|
||||||
|
case SUBNET_IPV4: fprintf(out, "ifconfig \"$INTERFACE\" %s\n", address_str); break;
|
||||||
|
case SUBNET_IPV6: fprintf(out, "ifconfig \"$INTERFACE\" inet6 %s\n", address_str); break;
|
||||||
|
default: return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,8 +152,21 @@ void ifconfig_route(FILE *out, const char *value) {
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(HAVE_BSD)
|
#elif defined(HAVE_MINGW) || defined(HAVE_CYGWIN)
|
||||||
// BSD route command is silly and doesn't accept an interface name as a destination.
|
if(*gateway_str) {
|
||||||
|
switch(subnet.type) {
|
||||||
|
case SUBNET_IPV4: fprintf(out, "netsh inetface 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); break;
|
||||||
|
default: return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch(subnet.type) {
|
||||||
|
case SUBNET_IPV4: fprintf(out, "netsh inetface ipv4 add route %s \"%%INTERFACE%%\"\n", subnet_str); break;
|
||||||
|
case SUBNET_IPV6: fprintf(out, "netsh inetface ipv6 add route %s \"%%INTERFACE%%\"\n", subnet_str); break;
|
||||||
|
default: return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else // assume BSD
|
||||||
if(!*gateway_str) {
|
if(!*gateway_str) {
|
||||||
switch(subnet.type) {
|
switch(subnet.type) {
|
||||||
case SUBNET_IPV4:
|
case SUBNET_IPV4:
|
||||||
|
@ -180,19 +193,5 @@ void ifconfig_route(FILE *out, const char *value) {
|
||||||
case SUBNET_IPV6: fprintf(out, "route add -inet6 %s %s\n", subnet_str, gateway_str); break;
|
case SUBNET_IPV6: fprintf(out, "route add -inet6 %s %s\n", subnet_str, gateway_str); break;
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
#elif defined(HAVE_MINGW) || defined(HAVE_CYGWIN)
|
|
||||||
if(*gateway_str) {
|
|
||||||
switch(subnet.type) {
|
|
||||||
case SUBNET_IPV4: fprintf(out, "netsh inetface 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); break;
|
|
||||||
default: return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch(subnet.type) {
|
|
||||||
case SUBNET_IPV4: fprintf(out, "netsh inetface ipv4 add route %s \"%%INTERFACE%%\"\n", subnet_str); break;
|
|
||||||
case SUBNET_IPV6: fprintf(out, "netsh inetface ipv6 add route %s \"%%INTERFACE%%\"\n", subnet_str); break;
|
|
||||||
default: return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
10
src/info.c
10
src/info.c
|
@ -72,7 +72,7 @@ static int info_node(int fd, const char *item) {
|
||||||
long int last_state_change = 0;
|
long int last_state_change = 0;
|
||||||
|
|
||||||
while(recvline(fd, line, sizeof line)) {
|
while(recvline(fd, line, sizeof line)) {
|
||||||
int n = sscanf(line, "%d %d %s %s %s port %s %d %d %d %d %x %"PRIx32" %s %s %d %hd %hd %hd %ld", &code, &req, node, id, host, port, &cipher, &digest, &maclength, &compression, &options, &status_union.raw, nexthop, via, &distance, &pmtu, &minmtu, &maxmtu, &last_state_change);
|
int n = sscanf(line, "%d %d %4095s %4095s %4095s port %4095s %d %d %d %d %x %"PRIx32" %4095s %4095s %d %hd %hd %hd %ld", &code, &req, node, id, host, port, &cipher, &digest, &maclength, &compression, &options, &status_union.raw, nexthop, via, &distance, &pmtu, &minmtu, &maxmtu, &last_state_change);
|
||||||
|
|
||||||
if(n == 2)
|
if(n == 2)
|
||||||
break;
|
break;
|
||||||
|
@ -94,7 +94,7 @@ static int info_node(int fd, const char *item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
while(recvline(fd, line, sizeof line)) {
|
while(recvline(fd, line, sizeof line)) {
|
||||||
if(sscanf(line, "%d %d %s", &code, &req, node) == 2)
|
if(sscanf(line, "%d %d %4095s", &code, &req, node) == 2)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ static int info_node(int fd, const char *item) {
|
||||||
printf("Edges: ");
|
printf("Edges: ");
|
||||||
sendline(fd, "%d %d %s", CONTROL, REQ_DUMP_EDGES, item);
|
sendline(fd, "%d %d %s", CONTROL, REQ_DUMP_EDGES, item);
|
||||||
while(recvline(fd, line, sizeof line)) {
|
while(recvline(fd, line, sizeof line)) {
|
||||||
int n = sscanf(line, "%d %d %s %s", &code, &req, from, to);
|
int n = sscanf(line, "%d %d %4095s %4095s", &code, &req, from, to);
|
||||||
if(n == 2)
|
if(n == 2)
|
||||||
break;
|
break;
|
||||||
if(n != 4) {
|
if(n != 4) {
|
||||||
|
@ -177,7 +177,7 @@ static int info_node(int fd, const char *item) {
|
||||||
printf("Subnets: ");
|
printf("Subnets: ");
|
||||||
sendline(fd, "%d %d %s", CONTROL, REQ_DUMP_SUBNETS, item);
|
sendline(fd, "%d %d %s", CONTROL, REQ_DUMP_SUBNETS, item);
|
||||||
while(recvline(fd, line, sizeof line)) {
|
while(recvline(fd, line, sizeof line)) {
|
||||||
int n = sscanf(line, "%d %d %s %s", &code, &req, subnet, from);
|
int n = sscanf(line, "%d %d %4095s %4095s", &code, &req, subnet, from);
|
||||||
if(n == 2)
|
if(n == 2)
|
||||||
break;
|
break;
|
||||||
if(n != 4) {
|
if(n != 4) {
|
||||||
|
@ -212,7 +212,7 @@ static int info_subnet(int fd, const char *item) {
|
||||||
|
|
||||||
sendline(fd, "%d %d %s", CONTROL, REQ_DUMP_SUBNETS, item);
|
sendline(fd, "%d %d %s", CONTROL, REQ_DUMP_SUBNETS, item);
|
||||||
while(recvline(fd, line, sizeof line)) {
|
while(recvline(fd, line, sizeof line)) {
|
||||||
int n = sscanf(line, "%d %d %s %s", &code, &req, netstr, owner);
|
int n = sscanf(line, "%d %d %4095s %4095s", &code, &req, netstr, owner);
|
||||||
if(n == 2)
|
if(n == 2)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -252,14 +252,14 @@ int cmd_invite(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a daemon is running, ensure no other nodes know about this name
|
// If a daemon is running, ensure no other nodes know about this name
|
||||||
bool found = false;
|
|
||||||
if(connect_tincd(false)) {
|
if(connect_tincd(false)) {
|
||||||
|
bool found = false;
|
||||||
sendline(fd, "%d %d", CONTROL, REQ_DUMP_NODES);
|
sendline(fd, "%d %d", CONTROL, REQ_DUMP_NODES);
|
||||||
|
|
||||||
while(recvline(fd, line, sizeof line)) {
|
while(recvline(fd, line, sizeof line)) {
|
||||||
char node[4096];
|
char node[4096];
|
||||||
int code, req;
|
int code, req;
|
||||||
if(sscanf(line, "%d %d %s", &code, &req, node) != 3)
|
if(sscanf(line, "%d %d %4095s", &code, &req, node) != 3)
|
||||||
break;
|
break;
|
||||||
if(!strcmp(node, argv[1]))
|
if(!strcmp(node, argv[1]))
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -686,7 +686,7 @@ make_names:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy the safe variable to the right config file
|
// Copy the safe variable to the right config file
|
||||||
fprintf(variables[i].type & VAR_HOST ? fh : f, "%s = %s\n", l, value);
|
fprintf((variables[i].type & VAR_HOST) ? fh : f, "%s = %s\n", l, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
@ -1048,7 +1048,7 @@ next:
|
||||||
char hisname[4096] = "";
|
char hisname[4096] = "";
|
||||||
int code, hismajor, hisminor = 0;
|
int code, hismajor, hisminor = 0;
|
||||||
|
|
||||||
if(!recvline(sock, line, sizeof line) || sscanf(line, "%d %s %d.%d", &code, hisname, &hismajor, &hisminor) < 3 || code != 0 || hismajor != PROT_MAJOR || !check_id(hisname) || !recvline(sock, line, sizeof line) || !rstrip(line) || sscanf(line, "%d ", &code) != 1 || code != ACK || strlen(line) < 3) {
|
if(!recvline(sock, line, sizeof line) || sscanf(line, "%d %4095s %d.%d", &code, hisname, &hismajor, &hisminor) < 3 || code != 0 || hismajor != PROT_MAJOR || !check_id(hisname) || !recvline(sock, line, sizeof line) || !rstrip(line) || sscanf(line, "%d ", &code) != 1 || code != ACK || strlen(line) < 3) {
|
||||||
fprintf(stderr, "Cannot read greeting from peer\n");
|
fprintf(stderr, "Cannot read greeting from peer\n");
|
||||||
closesocket(sock);
|
closesocket(sock);
|
||||||
goto next;
|
goto next;
|
||||||
|
|
|
@ -210,7 +210,7 @@ static void timeout_handler(void *data) {
|
||||||
|
|
||||||
// timeout during ping
|
// timeout during ping
|
||||||
if(c->status.pinged) {
|
if(c->status.pinged) {
|
||||||
logger(DEBUG_CONNECTIONS, LOG_INFO, "%s (%s) didn't respond to PING in %ld seconds", c->name, c->hostname, (long)now.tv_sec - c->last_ping_time.tv_sec);
|
logger(DEBUG_CONNECTIONS, LOG_INFO, "%s (%s) didn't respond to PING in %ld seconds", c->name, c->hostname, (long)(now.tv_sec - c->last_ping_time.tv_sec));
|
||||||
terminate_connection(c, c->edge);
|
terminate_connection(c, c->edge);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ bool cipher_encrypt(cipher_t *cipher, const void *indata, size_t inlen, void *ou
|
||||||
int len, pad;
|
int len, pad;
|
||||||
if(EVP_EncryptInit_ex(cipher->ctx, NULL, NULL, NULL, NULL)
|
if(EVP_EncryptInit_ex(cipher->ctx, NULL, NULL, NULL, NULL)
|
||||||
&& EVP_EncryptUpdate(cipher->ctx, (unsigned char *)outdata, &len, indata, inlen)
|
&& EVP_EncryptUpdate(cipher->ctx, (unsigned char *)outdata, &len, indata, inlen)
|
||||||
&& EVP_EncryptFinal(cipher->ctx, (unsigned char *)outdata + len, &pad)) {
|
&& EVP_EncryptFinal_ex(cipher->ctx, (unsigned char *)outdata + len, &pad)) {
|
||||||
if(outlen) *outlen = len + pad;
|
if(outlen) *outlen = len + pad;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ bool cipher_decrypt(cipher_t *cipher, const void *indata, size_t inlen, void *ou
|
||||||
int len, pad;
|
int len, pad;
|
||||||
if(EVP_DecryptInit_ex(cipher->ctx, NULL, NULL, NULL, NULL)
|
if(EVP_DecryptInit_ex(cipher->ctx, NULL, NULL, NULL, NULL)
|
||||||
&& EVP_DecryptUpdate(cipher->ctx, (unsigned char *)outdata, &len, indata, inlen)
|
&& EVP_DecryptUpdate(cipher->ctx, (unsigned char *)outdata, &len, indata, inlen)
|
||||||
&& EVP_DecryptFinal(cipher->ctx, (unsigned char *)outdata + len, &pad)) {
|
&& EVP_DecryptFinal_ex(cipher->ctx, (unsigned char *)outdata + len, &pad)) {
|
||||||
if(outlen) *outlen = len + pad;
|
if(outlen) *outlen = len + pad;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -370,7 +370,7 @@ bool ans_key_h(connection_t *c, const char *request) {
|
||||||
char key[MAX_STRING_SIZE];
|
char key[MAX_STRING_SIZE];
|
||||||
char address[MAX_STRING_SIZE] = "";
|
char address[MAX_STRING_SIZE] = "";
|
||||||
char port[MAX_STRING_SIZE] = "";
|
char port[MAX_STRING_SIZE] = "";
|
||||||
int cipher, digest, maclength, compression, keylen;
|
int cipher, digest, maclength, compression;
|
||||||
node_t *from, *to;
|
node_t *from, *to;
|
||||||
|
|
||||||
if(sscanf(request, "%*d "MAX_STRING" "MAX_STRING" "MAX_STRING" %d %d %d %d "MAX_STRING" "MAX_STRING,
|
if(sscanf(request, "%*d "MAX_STRING" "MAX_STRING" "MAX_STRING" %d %d %d %d "MAX_STRING" "MAX_STRING,
|
||||||
|
@ -508,7 +508,7 @@ bool ans_key_h(connection_t *c, const char *request) {
|
||||||
|
|
||||||
/* Process key */
|
/* Process key */
|
||||||
|
|
||||||
keylen = hex2bin(key, key, sizeof key);
|
int keylen = hex2bin(key, key, sizeof key);
|
||||||
|
|
||||||
if(keylen != (from->outcipher ? cipher_keylength(from->outcipher) : 1)) {
|
if(keylen != (from->outcipher ? cipher_keylength(from->outcipher) : 1)) {
|
||||||
logger(DEBUG_ALWAYS, LOG_ERR, "Node %s (%s) uses wrong keylength!", from->name, from->hostname);
|
logger(DEBUG_ALWAYS, LOG_ERR, "Node %s (%s) uses wrong keylength!", from->name, from->hostname);
|
||||||
|
|
|
@ -64,7 +64,7 @@ static void putenv(const char *p) {}
|
||||||
static void unputenv(const char *p) {}
|
static void unputenv(const char *p) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const int min_env_size;
|
static const int min_env_size = 10;
|
||||||
|
|
||||||
int environment_add(environment_t *env, const char *format, ...) {
|
int environment_add(environment_t *env, const char *format, ...) {
|
||||||
if(env->n >= env->size) {
|
if(env->n >= env->size) {
|
||||||
|
@ -95,7 +95,7 @@ void environment_update(environment_t *env, int pos, const char *format, ...) {
|
||||||
void environment_init(environment_t *env) {
|
void environment_init(environment_t *env) {
|
||||||
env->n = 0;
|
env->n = 0;
|
||||||
env->size = min_env_size;
|
env->size = min_env_size;
|
||||||
env->entries = 0; //xzalloc(env->size * sizeof *env->entries);
|
env->entries = xzalloc(env->size * sizeof *env->entries);
|
||||||
|
|
||||||
if(netname)
|
if(netname)
|
||||||
environment_add(env, "NETNAME=%s", netname);
|
environment_add(env, "NETNAME=%s", netname);
|
||||||
|
|
|
@ -512,7 +512,7 @@ bool recvline(int fd, char *line, size_t len) {
|
||||||
char *newline = NULL;
|
char *newline = NULL;
|
||||||
|
|
||||||
if(!fd)
|
if(!fd)
|
||||||
abort();
|
return false;
|
||||||
|
|
||||||
while(!(newline = memchr(buffer, '\n', blen))) {
|
while(!(newline = memchr(buffer, '\n', blen))) {
|
||||||
int result = recv(fd, buffer + blen, sizeof buffer - blen, 0);
|
int result = recv(fd, buffer + blen, sizeof buffer - blen, 0);
|
||||||
|
@ -802,7 +802,7 @@ bool connect_tincd(bool verbose) {
|
||||||
char data[4096];
|
char data[4096];
|
||||||
int version;
|
int version;
|
||||||
|
|
||||||
if(!recvline(fd, line, sizeof line) || sscanf(line, "%d %s %d", &code, data, &version) != 3 || code != 0) {
|
if(!recvline(fd, line, sizeof line) || sscanf(line, "%d %4095s %d", &code, data, &version) != 3 || code != 0) {
|
||||||
if(verbose)
|
if(verbose)
|
||||||
fprintf(stderr, "Cannot read greeting from control socket: %s\n", sockstrerror(sockerrno));
|
fprintf(stderr, "Cannot read greeting from control socket: %s\n", sockstrerror(sockerrno));
|
||||||
close(fd);
|
close(fd);
|
||||||
|
@ -951,11 +951,11 @@ static int cmd_stop(int argc, char *argv[]) {
|
||||||
if(!connect_tincd(true)) {
|
if(!connect_tincd(true)) {
|
||||||
if(pid) {
|
if(pid) {
|
||||||
if(kill(pid, SIGTERM)) {
|
if(kill(pid, SIGTERM)) {
|
||||||
fprintf(stderr, "Could not send TERM signal to process with PID %u: %s\n", pid, strerror(errno));
|
fprintf(stderr, "Could not send TERM signal to process with PID %d: %s\n", pid, strerror(errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "Sent TERM signal to process with PID %u.\n", pid);
|
fprintf(stderr, "Sent TERM signal to process with PID %d.\n", pid);
|
||||||
waitpid(pid, NULL, 0);
|
waitpid(pid, NULL, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1031,7 +1031,6 @@ static int dump_invitations(void) {
|
||||||
FILE *f = fopen(fname, "r");
|
FILE *f = fopen(fname, "r");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
fprintf(stderr, "Cannot open %s: %s\n", fname, strerror(errno));
|
fprintf(stderr, "Cannot open %s: %s\n", fname, strerror(errno));
|
||||||
fclose(f);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1120,7 +1119,7 @@ static int cmd_dump(int argc, char *argv[]) {
|
||||||
|
|
||||||
while(recvline(fd, line, sizeof line)) {
|
while(recvline(fd, line, sizeof line)) {
|
||||||
char node1[4096], node2[4096];
|
char node1[4096], node2[4096];
|
||||||
int n = sscanf(line, "%d %d %s %s", &code, &req, node1, node2);
|
int n = sscanf(line, "%d %d %4095s %4095s", &code, &req, node1, node2);
|
||||||
if(n == 2) {
|
if(n == 2) {
|
||||||
if(do_graph && req == REQ_DUMP_NODES)
|
if(do_graph && req == REQ_DUMP_NODES)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1152,7 +1151,7 @@ static int cmd_dump(int argc, char *argv[]) {
|
||||||
|
|
||||||
switch(req) {
|
switch(req) {
|
||||||
case REQ_DUMP_NODES: {
|
case REQ_DUMP_NODES: {
|
||||||
int n = sscanf(line, "%*d %*d %s %s %s port %s %d %d %d %d %x %x %s %s %d %hd %hd %hd %ld", node, id, host, port, &cipher, &digest, &maclength, &compression, &options, &status_int, nexthop, via, &distance, &pmtu, &minmtu, &maxmtu, &last_state_change);
|
int n = sscanf(line, "%*d %*d %4095s %4095s %4095s port %4095s %d %d %d %d %x %x %4095s %4095s %d %hd %hd %hd %ld", node, id, host, port, &cipher, &digest, &maclength, &compression, &options, &status_int, nexthop, via, &distance, &pmtu, &minmtu, &maxmtu, &last_state_change);
|
||||||
if(n != 17) {
|
if(n != 17) {
|
||||||
fprintf(stderr, "Unable to parse node dump from tincd: %s\n", line);
|
fprintf(stderr, "Unable to parse node dump from tincd: %s\n", line);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1182,7 +1181,7 @@ static int cmd_dump(int argc, char *argv[]) {
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case REQ_DUMP_EDGES: {
|
case REQ_DUMP_EDGES: {
|
||||||
int n = sscanf(line, "%*d %*d %s %s %s port %s %s port %s %x %d %d", from, to, host, port, local_host, local_port, &options, &weight, &avg_rtt);
|
int n = sscanf(line, "%*d %*d %4095s %4095s %4095s port %4095s %4095s port %4095s %x %d %d", from, to, host, port, local_host, local_port, &options, &weight, &avg_rtt);
|
||||||
if(n != 9) {
|
if(n != 9) {
|
||||||
fprintf(stderr, "Unable to parse edge dump from tincd.\n");
|
fprintf(stderr, "Unable to parse edge dump from tincd.\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1200,7 +1199,7 @@ static int cmd_dump(int argc, char *argv[]) {
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case REQ_DUMP_SUBNETS: {
|
case REQ_DUMP_SUBNETS: {
|
||||||
int n = sscanf(line, "%*d %*d %s %s", subnet, node);
|
int n = sscanf(line, "%*d %*d %4095s %4095s", subnet, node);
|
||||||
if(n != 2) {
|
if(n != 2) {
|
||||||
fprintf(stderr, "Unable to parse subnet dump from tincd.\n");
|
fprintf(stderr, "Unable to parse subnet dump from tincd.\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1209,7 +1208,7 @@ static int cmd_dump(int argc, char *argv[]) {
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case REQ_DUMP_CONNECTIONS: {
|
case REQ_DUMP_CONNECTIONS: {
|
||||||
int n = sscanf(line, "%*d %*d %s %s port %s %x %d %x", node, host, port, &options, &socket, &status_int);
|
int n = sscanf(line, "%*d %*d %4095s %4095s port %4095s %x %d %x", node, host, port, &options, &socket, &status_int);
|
||||||
if(n != 6) {
|
if(n != 6) {
|
||||||
fprintf(stderr, "Unable to parse connection dump from tincd.\n");
|
fprintf(stderr, "Unable to parse connection dump from tincd.\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -2250,7 +2249,7 @@ static int cmd_import(int argc, char *argv[]) {
|
||||||
bool firstline = true;
|
bool firstline = true;
|
||||||
|
|
||||||
while(fgets(buf, sizeof buf, in)) {
|
while(fgets(buf, sizeof buf, in)) {
|
||||||
if(sscanf(buf, "Name = %s", name) == 1) {
|
if(sscanf(buf, "Name = %4095s", name) == 1) {
|
||||||
firstline = false;
|
firstline = false;
|
||||||
|
|
||||||
if(!check_id(name)) {
|
if(!check_id(name)) {
|
||||||
|
@ -2743,7 +2742,7 @@ static char *complete_info(const char *text, int state) {
|
||||||
|
|
||||||
while(recvline(fd, line, sizeof line)) {
|
while(recvline(fd, line, sizeof line)) {
|
||||||
char item[4096];
|
char item[4096];
|
||||||
int n = sscanf(line, "%d %d %s", &code, &req, item);
|
int n = sscanf(line, "%d %d %4095s", &code, &req, item);
|
||||||
if(n == 2) {
|
if(n == 2) {
|
||||||
i++;
|
i++;
|
||||||
if(i >= 2)
|
if(i >= 2)
|
||||||
|
@ -2847,8 +2846,6 @@ static int cmd_shell(int argc, char *argv[]) {
|
||||||
|
|
||||||
while(p && *p) {
|
while(p && *p) {
|
||||||
if(nargc >= maxargs) {
|
if(nargc >= maxargs) {
|
||||||
fprintf(stderr, "next %p '%s', p %p '%s'\n", next, next, p, p);
|
|
||||||
abort();
|
|
||||||
maxargs *= 2;
|
maxargs *= 2;
|
||||||
nargv = xrealloc(nargv, maxargs * sizeof *nargv);
|
nargv = xrealloc(nargv, maxargs * sizeof *nargv);
|
||||||
}
|
}
|
||||||
|
|
35
src/top.c
35
src/top.c
|
@ -92,7 +92,7 @@ static bool update(int fd) {
|
||||||
ns->known = false;
|
ns->known = false;
|
||||||
|
|
||||||
while(recvline(fd, line, sizeof line)) {
|
while(recvline(fd, line, sizeof line)) {
|
||||||
int n = sscanf(line, "%d %d %s %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64" %d", &code, &req, name, &in_packets, &in_bytes, &out_packets, &out_bytes, (int *)&myself);
|
int n = sscanf(line, "%d %d %4095s %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64, &code, &req, name, &in_packets, &in_bytes, &out_packets, &out_bytes);
|
||||||
|
|
||||||
if(n == 2)
|
if(n == 2)
|
||||||
return true;
|
return true;
|
||||||
|
@ -161,40 +161,47 @@ static int cmpu64(uint64_t a, uint64_t b) {
|
||||||
static int sortfunc(const void *a, const void *b) {
|
static int sortfunc(const void *a, const void *b) {
|
||||||
const nodestats_t *na = *(const nodestats_t **)a;
|
const nodestats_t *na = *(const nodestats_t **)a;
|
||||||
const nodestats_t *nb = *(const nodestats_t **)b;
|
const nodestats_t *nb = *(const nodestats_t **)b;
|
||||||
|
int result;
|
||||||
|
|
||||||
switch(sortmode) {
|
switch(sortmode) {
|
||||||
case 1:
|
case 1:
|
||||||
if(cumulative)
|
if(cumulative)
|
||||||
return -cmpu64(na->in_packets, nb->in_packets) ?: na->i - nb->i;
|
result = -cmpu64(na->in_packets, nb->in_packets);
|
||||||
else
|
else
|
||||||
return -cmpfloat(na->in_packets_rate, nb->in_packets_rate) ?: na->i - nb->i;
|
result = -cmpfloat(na->in_packets_rate, nb->in_packets_rate);
|
||||||
case 2:
|
case 2:
|
||||||
if(cumulative)
|
if(cumulative)
|
||||||
return -cmpu64(na->in_bytes, nb->in_bytes) ?: na->i - nb->i;
|
result = -cmpu64(na->in_bytes, nb->in_bytes);
|
||||||
else
|
else
|
||||||
return -cmpfloat(na->in_bytes_rate, nb->in_bytes_rate) ?: na->i - nb->i;
|
result = -cmpfloat(na->in_bytes_rate, nb->in_bytes_rate);
|
||||||
case 3:
|
case 3:
|
||||||
if(cumulative)
|
if(cumulative)
|
||||||
return -cmpu64(na->out_packets, nb->out_packets) ?: na->i - nb->i;
|
result = -cmpu64(na->out_packets, nb->out_packets);
|
||||||
else
|
else
|
||||||
return -cmpfloat(na->out_packets_rate, nb->out_packets_rate) ?: na->i - nb->i;
|
result = -cmpfloat(na->out_packets_rate, nb->out_packets_rate);
|
||||||
case 4:
|
case 4:
|
||||||
if(cumulative)
|
if(cumulative)
|
||||||
return -cmpu64(na->out_bytes, nb->out_bytes) ?: na->i - nb->i;
|
result = -cmpu64(na->out_bytes, nb->out_bytes);
|
||||||
else
|
else
|
||||||
return -cmpfloat(na->out_bytes_rate, nb->out_bytes_rate) ?: na->i - nb->i;
|
result = -cmpfloat(na->out_bytes_rate, nb->out_bytes_rate);
|
||||||
case 5:
|
case 5:
|
||||||
if(cumulative)
|
if(cumulative)
|
||||||
return -cmpu64(na->in_packets + na->out_packets, nb->in_packets + nb->out_packets) ?: na->i - nb->i;
|
result = -cmpu64(na->in_packets + na->out_packets, nb->in_packets + nb->out_packets);
|
||||||
else
|
else
|
||||||
return -cmpfloat(na->in_packets_rate + na->out_packets_rate, nb->in_packets_rate + nb->out_packets_rate) ?: na->i - nb->i;
|
result = -cmpfloat(na->in_packets_rate + na->out_packets_rate, nb->in_packets_rate + nb->out_packets_rate);
|
||||||
case 6:
|
case 6:
|
||||||
if(cumulative)
|
if(cumulative)
|
||||||
return -cmpu64(na->in_bytes + na->out_bytes, nb->in_bytes + nb->out_bytes) ?: na->i - nb->i;
|
result = -cmpu64(na->in_bytes + na->out_bytes, nb->in_bytes + nb->out_bytes);
|
||||||
else
|
else
|
||||||
return -cmpfloat(na->in_bytes_rate + na->out_bytes_rate, nb->in_bytes_rate + nb->out_bytes_rate) ?: na->i - nb->i;
|
result = -cmpfloat(na->in_bytes_rate + na->out_bytes_rate, nb->in_bytes_rate + nb->out_bytes_rate);
|
||||||
default:
|
default:
|
||||||
return strcmp(na->name, nb->name) ?: na->i - nb->i;
|
result = strcmp(na->name, nb->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(result)
|
||||||
|
return result;
|
||||||
|
else
|
||||||
|
return na->i - nb->i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void redraw(void) {
|
static void redraw(void) {
|
||||||
|
|
|
@ -5,4 +5,6 @@
|
||||||
# Just test whether the executables work
|
# Just test whether the executables work
|
||||||
$tincd --help
|
$tincd --help
|
||||||
$tinc --help
|
$tinc --help
|
||||||
|
if [ -e $sptps_test ]; then
|
||||||
$sptps_test --help
|
$sptps_test --help
|
||||||
|
fi
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
pong.c -- ICMP echo reply generator
|
pong.c -- ICMP echo reply generator
|
||||||
Copyright (C) 2013 Guus Sliepen <guus@tinc-vpn.org>
|
Copyright (C) 2013-2017 Guus Sliepen <guus@tinc-vpn.org>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
#include "../src/system.h"
|
#include "../src/system.h"
|
||||||
|
|
||||||
|
#include "../src/ethernet.h"
|
||||||
|
|
||||||
uint8_t mymac[6] = {6, 5, 5, 6, 5, 5};
|
uint8_t mymac[6] = {6, 5, 5, 6, 5, 5};
|
||||||
|
|
||||||
static ssize_t do_arp(uint8_t *buf, ssize_t len, struct sockaddr_in *in) {
|
static ssize_t do_arp(uint8_t *buf, ssize_t len, struct sockaddr_in *in) {
|
||||||
|
@ -152,7 +154,7 @@ int main(int argc, char *argv[]) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Multicast for address family %hx unsupported\n", ai->ai_family);
|
fprintf(stderr, "Multicast for address family %x unsupported\n", ai->ai_family);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,8 @@ echo bar-started >>$OUT
|
||||||
# Stop server node
|
# Stop server node
|
||||||
|
|
||||||
$tinc $c1 stop
|
$tinc $c1 stop
|
||||||
|
sleep 1
|
||||||
|
$tinc $c2 stop
|
||||||
|
|
||||||
# Check if the script output is what is expected
|
# Check if the script output is what is expected
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
. ./testlib.sh
|
. ./testlib.sh
|
||||||
|
|
||||||
|
# Skip this test if we did not compile sptps_test
|
||||||
|
|
||||||
|
test -e $sptps_test || exit 77
|
||||||
|
|
||||||
# Generate keys
|
# Generate keys
|
||||||
|
|
||||||
mkdir -p $d1
|
mkdir -p $d1
|
||||||
|
|
|
@ -9,18 +9,10 @@ sptps_keypair=../src/sptps_keypair
|
||||||
|
|
||||||
# Test directories
|
# Test directories
|
||||||
|
|
||||||
case "$_" in
|
scriptname=`basename $0`
|
||||||
/*)
|
d1=$PWD/$scriptname.1
|
||||||
d1=$_.1
|
d2=$PWD/$scriptname.2
|
||||||
d2=$_.2
|
d3=$PWD/$scriptname.3
|
||||||
d3=$_.3
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
d1=$PWD/$_.1
|
|
||||||
d2=$PWD/$_.2
|
|
||||||
d3=$PWD/$_.3
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Default arguments for both tinc and tincd
|
# Default arguments for both tinc and tincd
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue