Compilation fixes

This commit is contained in:
Luca Deri 2020-06-07 13:51:48 +02:00
parent c2626bae7c
commit bd49b4e3a3
2 changed files with 26 additions and 6 deletions

View File

@ -18,7 +18,10 @@
#include "n2n.h"
#include "lzoconf.h"
#ifdef HAVE_LIBZSTD
#include <zstd.h>
#endif
#ifdef WIN32
#include <process.h>
@ -163,7 +166,10 @@ const char* compression_str(uint8_t cmpr) {
switch(cmpr) {
case N2N_COMPRESSION_ID_NONE: return("none");
case N2N_COMPRESSION_ID_LZO: return("lzo1x");
#ifdef HAVE_LIBZSTD
case N2N_COMPRESSION_ID_ZSTD: return("zstd");
#endif
default: return("invalid");
};
}
@ -334,9 +340,21 @@ static uint8_t localhost_v6[IPV6_SIZE] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
* in the same supernode host.
*/
static int is_valid_peer_sock(const n2n_sock_t *sock) {
if(((sock->family == AF_INET) && (*((uint32_t*)sock->addr.v4) != htonl(localhost_v4)))
|| ((sock->family == AF_INET6) && memcmp(sock->addr.v6, localhost_v6, IPV6_SIZE)))
return(1);
switch(sock->family) {
case AF_INET:
{
uint32_t *a = (uint32_t*)sock->addr.v4;
if(*a != htonl(localhost_v4))
return(1);
}
break;
case AF_INET6:
if(memcmp(sock->addr.v6, localhost_v6, IPV6_SIZE))
return(1);
break;
}
return(0);
}
@ -2313,7 +2331,8 @@ static int edge_init_routes(n2n_edge_t *eee, n2n_route_t *routes, uint16_t num_r
*/
n2n_sock_t sn;
n2n_route_t custom_route;
uint32_t *a;
if(eee->sn_route_to_clean) {
traceEvent(TRACE_ERROR, "Only one default gateway route allowed");
return(-1);
@ -2332,7 +2351,8 @@ static int edge_init_routes(n2n_edge_t *eee, n2n_route_t *routes, uint16_t num_r
return(-1);
}
custom_route.net_addr = *((u_int32_t*)sn.addr.v4);
a = (u_int32_t*)sn.addr.v4;
custom_route.net_addr = *a;
custom_route.net_bitlen = 32;
custom_route.gateway = get_gateway_ip();

View File

@ -128,7 +128,7 @@ int main(int argc, char * argv[]) {
#ifdef N2N_HAVE_AES
run_transop_benchmark("transop_aes", &transop_aes_cbc, &conf, pktbuf);
#endif
#ifdef N2N_HAVE_AES
#ifdef HAVE_OPENSSL_1_1
run_transop_benchmark("transop_cc20", &transop_cc20, &conf, pktbuf);
#endif
run_transop_benchmark("transop_speck", &transop_speck, &conf, pktbuf);