Browse Source

Fixed #32

Minor help fixes
pull/33/head
Luca Deri 6 years ago
parent
commit
fcd5dc86a5
  1. 12
      CMakeLists.txt
  2. 5
      edge.c
  3. 8
      n2n.c

12
CMakeLists.txt

@ -102,25 +102,25 @@ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/supernode.1.gz
DEPENDS ${PROJECT_SOURCE_DIR}/supernode.1 DEPENDS ${PROJECT_SOURCE_DIR}/supernode.1
) )
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/n2n_v2.7.gz add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/n2n.7.gz
COMMAND gzip -c ${PROJECT_SOURCE_DIR}/n2n_v2.7 > ${PROJECT_BINARY_DIR}/doc/n2n_v2.7.gz COMMAND gzip -c ${PROJECT_SOURCE_DIR}/n2n.7 > ${PROJECT_BINARY_DIR}/doc/n2n.7.gz
DEPENDS ${PROJECT_SOURCE_DIR}/n2n_v2.7 DEPENDS ${PROJECT_SOURCE_DIR}/n2n.7
) )
add_custom_target(doc DEPENDS ${PROJECT_BINARY_DIR}/doc/edge.8.gz add_custom_target(doc DEPENDS ${PROJECT_BINARY_DIR}/doc/edge.8.gz
${PROJECT_BINARY_DIR}/doc/supernode.1.gz ${PROJECT_BINARY_DIR}/doc/supernode.1.gz
${PROJECT_BINARY_DIR}/doc/n2n_v2.7.gz ${PROJECT_BINARY_DIR}/doc/n2n.7.gz
) )
set_source_files_properties(${PROJECT_BINARY_DIR}/doc/edge.8.gz set_source_files_properties(${PROJECT_BINARY_DIR}/doc/edge.8.gz
${PROJECT_BINARY_DIR}/doc/supernode.1.gz ${PROJECT_BINARY_DIR}/doc/supernode.1.gz
${PROJECT_BINARY_DIR}/doc/n2n_v2.7.gz ${PROJECT_BINARY_DIR}/doc/n2n.7.gz
PROPERTIES GENERATED 1) PROPERTIES GENERATED 1)
install(FILES ${PROJECT_BINARY_DIR}/doc/edge.8.gz install(FILES ${PROJECT_BINARY_DIR}/doc/edge.8.gz
DESTINATION /usr/share/man8) DESTINATION /usr/share/man8)
install(FILES ${PROJECT_BINARY_DIR}/doc/supernode.1.gz install(FILES ${PROJECT_BINARY_DIR}/doc/supernode.1.gz
DESTINATION /usr/share/man1) DESTINATION /usr/share/man1)
install(FILES ${PROJECT_BINARY_DIR}/doc/n2n_v2.7.gz install(FILES ${PROJECT_BINARY_DIR}/doc/n2n.7.gz
DESTINATION /usr/share/man7) DESTINATION /usr/share/man7)
endif(DEFINED UNIX) endif(DEFINED UNIX)

5
edge.c

@ -212,7 +212,7 @@ static void help() {
printf("-r | Enable packet forwarding through n2n community.\n"); printf("-r | Enable packet forwarding through n2n community.\n");
printf("-E | Accept multicast MAC addresses (default=drop).\n"); printf("-E | Accept multicast MAC addresses (default=drop).\n");
printf("-v | Make more verbose. Repeat as required.\n"); printf("-v | Make more verbose. Repeat as required.\n");
printf("-t | Management UDP Port (for multiple edges on a machine).\n"); printf("-t <port> | Management UDP Port (for multiple edges on a machine).\n");
printf("\nEnvironment variables:\n"); printf("\nEnvironment variables:\n");
printf(" N2N_KEY | Encryption key (ASCII). Not with -K or -k.\n"); printf(" N2N_KEY | Encryption key (ASCII). Not with -K or -k.\n");
@ -736,8 +736,7 @@ int main(int argc, char* argv[]) {
eee.udp_mgmt_sock = open_socket(mgmt_port, 0 /* bind LOOPBACK */); eee.udp_mgmt_sock = open_socket(mgmt_port, 0 /* bind LOOPBACK */);
if(eee.udp_mgmt_sock < 0) { if(eee.udp_mgmt_sock < 0) {
traceEvent(TRACE_ERROR, "Failed to bind management UDP port %u", traceEvent(TRACE_ERROR, "Failed to bind management UDP port %u", mgmt_port);
(unsigned int)N2N_EDGE_MGMT_PORT);
return(-1); return(-1);
} }

8
n2n.c

@ -57,19 +57,15 @@ SOCKET open_socket(int local_port, int bind_any) {
memset(&local_address, 0, sizeof(local_address)); memset(&local_address, 0, sizeof(local_address));
local_address.sin_family = AF_INET; local_address.sin_family = AF_INET;
local_address.sin_port = htons(local_port); local_address.sin_port = htons(local_port);
local_address.sin_addr.s_addr = htonl(bind_any?INADDR_ANY:INADDR_LOOPBACK); local_address.sin_addr.s_addr = htonl(bind_any ? INADDR_ANY : INADDR_LOOPBACK);
if(bind(sock_fd,(struct sockaddr*) &local_address, sizeof(local_address)) == -1) { if(bind(sock_fd,(struct sockaddr*) &local_address, sizeof(local_address)) == -1) {
traceEvent(TRACE_ERROR, "Bind error [%s]\n", strerror(errno)); traceEvent(TRACE_ERROR, "Bind error on local port %u [%s]\n", local_port, strerror(errno));
return(-1); return(-1);
} }
return(sock_fd); return(sock_fd);
} }
int traceLevel = 2 /* NORMAL */; int traceLevel = 2 /* NORMAL */;
int useSyslog = 0, syslog_opened = 0; int useSyslog = 0, syslog_opened = 0;

Loading…
Cancel
Save