ntop / n2n

Peer-to-peer VPN
GNU General Public License v3.0
6.22k stars 935 forks source link

There is a warning when compiling on Linux #1125

Closed galaxyskyknight closed 1 year ago

galaxyskyknight commented 1 year ago

both happened on Debian & Ubuntu

root@Supernode:~/n2n-3.0# make clean
autoreconf -if
./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for ar... ar
checking for windres... no
configure: creating ./config.status
config.status: creating config.mak
config.status: creating include/config.h
rm -f src/edge.o src/supernode.o src/example_edge_embed.o src/example_edge_embed_quick_edge_init.o src/example_sn_embed.o
rm -rf src/aes.o src/auth.o src/cc20.o src/curve25519.o src/edge_management.o src/edge_utils.o src/edge_utils_win32.o src/header_encryption.o src/hexdump.o src/json.o src/management.o src/minilzo.o src/n2n.o src/n2n_port_mapping.o src/n2n_regex.o src/network_traffic_filter.o src/pearson.o src/random_numbers.o src/sn_management.o src/sn_selection.o src/sn_utils.o src/speck.o src/tf.o src/transform_aes.o src/transform_cc20.o src/transform_lzo.o src/transform_null.o src/transform_speck.o src/transform_tf.o src/transform_zstd.o src/tuntap_freebsd.o src/tuntap_linux.o src/tuntap_netbsd.o src/tuntap_osx.o src/wire.o  libn2n.a edge supernode example_edge_embed_quick_edge_init example_edge_embed example_sn_embed edge.8.gz supernode.1.gz n2n.7.gz coverage/ *.dSYM *~
rm -f tests/*.out src/*.gcno src/*.gcda
for dir in tools; do make -C $dir clean; done
make[1]: Entering directory '/root/n2n-3.0/tools'
rm -rf n2n-benchmark n2n-keygen n2n-route n2n-portfwd n2n-decode *.o *.dSYM *~
rm -f tests-compress tests-elliptic tests-hashing tests-transform tests-wire tests-auth *.gcno *.gcda
make[1]: Leaving directory '/root/n2n-3.0/tools'

root@Supernode:~/n2n-3.0# ./autogen.sh
Wait please...

root@Supernode:~/n2n-3.0# ./configure --enable-pthread --enable-miniupnp --enable-natpmp --enable-cap --enable-pcap CFLAGS="-O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING"
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for ar... ar
checking for windres... no
checking for upnpDiscover in -lminiupnpc... yes
checking for initnatpmp in -lnatpmp... yes
checking for pcap_open_live in -lpcap... yes
checking for pcap_set_immediate_mode in -lpcap... yes
checking for cap_get_proc in -lcap... yes
checking for pthread_mutex_trylock in -lpthread... yes
configure: creating ./config.status
config.status: creating config.mak
config.status: creating include/config.h

root@Supernode:~/n2n-3.0# make all
Build for version: 3.1.1-173-g21ac30c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/edge.o src/edge.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/aes.o src/aes.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/auth.o src/auth.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/cc20.o src/cc20.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/curve25519.o src/curve25519.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/edge_management.o src/edge_management.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/edge_utils.o src/edge_utils.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/edge_utils_win32.o src/edge_utils_win32.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/header_encryption.o src/header_encryption.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/hexdump.o src/hexdump.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/json.o src/json.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/management.o src/management.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/minilzo.o src/minilzo.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/n2n.o src/n2n.c
src/n2n.c: In function ‘resolve_thread’:
src/n2n.c:350:9: warning: implicit declaration of function ‘pthread_mutex_lock’ [-Wimplicit-function-declaration]
         pthread_mutex_lock(&param->access);
         ^~~~~~~~~~~~~~~~~~
src/n2n.c:380:9: warning: implicit declaration of function ‘pthread_mutex_unlock’ [-Wimplicit-function-declaration]
         pthread_mutex_unlock(&param->access);
         ^~~~~~~~~~~~~~~~~~~~
src/n2n.c: In function ‘resolve_create_thread’:
src/n2n.c:416:11: warning: implicit declaration of function ‘pthread_create’; did you mean ‘timer_create’? [-Wimplicit-function-declaration]
     ret = pthread_create(&((*param)->id), NULL, resolve_thread, (void *)*param);
           ^~~~~~~~~~~~~~
           timer_create
src/n2n.c:422:5: warning: implicit declaration of function ‘pthread_mutex_init’ [-Wimplicit-function-declaration]
     pthread_mutex_init(&((*param)->access), NULL);
     ^~~~~~~~~~~~~~~~~~
src/n2n.c: In function ‘resolve_cancel_thread’:
src/n2n.c:434:5: warning: implicit declaration of function ‘pthread_cancel’; did you mean ‘SYS_io_cancel’? [-Wimplicit-function-declaration]
     pthread_cancel(param->id);
     ^~~~~~~~~~~~~~
     SYS_io_cancel
src/n2n.c: In function ‘resolve_check’:
src/n2n.c:456:12: warning: implicit declaration of function ‘pthread_mutex_trylock’ [-Wimplicit-function-declaration]
         if(pthread_mutex_trylock(&param->access) == 0) {
            ^~~~~~~~~~~~~~~~~~~~~
src/n2n.c:742:45: warning: ‘]:’ directive output may be truncated writing 2 bytes into a region of size between 0 and 63 [-Wformat-truncation=]
         snprintf(out, N2N_SOCKBUF_SIZE, "[%s]:%hu", tmp[0] ? tmp : "", sock->port);
                                             ^~
src/n2n.c:742:41: note: using the range [0, 65535] for directive argument
         snprintf(out, N2N_SOCKBUF_SIZE, "[%s]:%hu", tmp[0] ? tmp : "", sock->port);
                                         ^~~~~~~~~~
src/n2n.c:742:9: note: ‘snprintf’ output between 5 and 72 bytes into a destination of size 64
         snprintf(out, N2N_SOCKBUF_SIZE, "[%s]:%hu", tmp[0] ? tmp : "", sock->port);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/n2n.c: In function ‘sock_to_cstr’:
src/n2n.c:742:45: warning: ‘]:’ directive output may be truncated writing 2 bytes into a region of size between 0 and 63 [-Wformat-truncation=]
         snprintf(out, N2N_SOCKBUF_SIZE, "[%s]:%hu", tmp[0] ? tmp : "", sock->port);
                                             ^~
src/n2n.c:742:41: note: using the range [0, 65535] for directive argument
         snprintf(out, N2N_SOCKBUF_SIZE, "[%s]:%hu", tmp[0] ? tmp : "", sock->port);
                                         ^~~~~~~~~~
src/n2n.c:742:9: note: ‘snprintf’ output between 5 and 72 bytes into a destination of size 64
         snprintf(out, N2N_SOCKBUF_SIZE, "[%s]:%hu", tmp[0] ? tmp : "", sock->port);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/n2n_port_mapping.o src/n2n_port_mapping.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/n2n_regex.o src/n2n_regex.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/network_traffic_filter.o src/network_traffic_filter.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/pearson.o src/pearson.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/random_numbers.o src/random_numbers.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/sn_management.o src/sn_management.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/sn_selection.o src/sn_selection.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/sn_utils.o src/sn_utils.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/speck.o src/speck.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/tf.o src/tf.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/transform_aes.o src/transform_aes.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/transform_cc20.o src/transform_cc20.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/transform_lzo.o src/transform_lzo.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/transform_null.o src/transform_null.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/transform_speck.o src/transform_speck.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/transform_tf.o src/transform_tf.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/transform_zstd.o src/transform_zstd.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/tuntap_freebsd.o src/tuntap_freebsd.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/tuntap_linux.o src/tuntap_linux.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/tuntap_netbsd.o src/tuntap_netbsd.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/tuntap_osx.o src/tuntap_osx.c
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/wire.o src/wire.c
ar rcs libn2n.a src/aes.o src/auth.o src/cc20.o src/curve25519.o src/edge_management.o src/edge_utils.o src/edge_utils_win32.o src/header_encryption.o src/hexdump.o src/json.o src/management.o src/minilzo.o src/n2n.o src/n2n_port_mapping.o src/n2n_regex.o src/network_traffic_filter.o src/pearson.o src/random_numbers.o src/sn_management.o src/sn_selection.o src/sn_utils.o src/speck.o src/tf.o src/transform_aes.o src/transform_cc20.o src/transform_lzo.o src/transform_null.o src/transform_speck.o src/transform_tf.o src/transform_zstd.o src/tuntap_freebsd.o src/tuntap_linux.o src/tuntap_netbsd.o src/tuntap_osx.o src/wire.o
gcc -pthread -L.  src/edge.o libn2n.a   -ln2n -lcap -lpcap -lnatpmp -lminiupnpc  -o src/edge
cp src/edge edge
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/supernode.o src/supernode.c
gcc -pthread -L.  src/supernode.o libn2n.a   -ln2n -lcap -lpcap -lnatpmp -lminiupnpc  -o src/supernode
cp src/supernode supernode
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/example_edge_embed_quick_edge_init.o src/example_edge_embed_quick_edge_init.c
gcc -pthread -L.  src/example_edge_embed_quick_edge_init.o libn2n.a   -ln2n -lcap -lpcap -lnatpmp -lminiupnpc  -o src/example_edge_embed_quick_edge_init
cp src/example_edge_embed_quick_edge_init example_edge_embed_quick_edge_init
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/example_edge_embed.o src/example_edge_embed.c
gcc -pthread -L.  src/example_edge_embed.o libn2n.a   -ln2n -lcap -lpcap -lnatpmp -lminiupnpc  -o src/example_edge_embed
cp src/example_edge_embed example_edge_embed
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/example_sn_embed.o src/example_sn_embed.c
gcc -pthread -L.  src/example_sn_embed.o libn2n.a   -ln2n -lcap -lpcap -lnatpmp -lminiupnpc  -o src/example_sn_embed
cp src/example_sn_embed example_sn_embed
gzip -n -c edge.8 > edge.8.gz
gzip -n -c supernode.1 > supernode.1.gz
gzip -n -c n2n.7 > n2n.7.gz
make -C tools
make[1]: Entering directory '/root/n2n-3.0/tools'
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3   -c -o n2n-benchmark.o n2n-benchmark.c
gcc -pthread -L. -L..  n2n-benchmark.o   -ln2n -lcap -lpcap -lnatpmp -lminiupnpc  -o n2n-benchmark
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3   -c -o n2n-keygen.o n2n-keygen.c
gcc -pthread -L. -L..  n2n-keygen.o   -ln2n -lcap -lpcap -lnatpmp -lminiupnpc  -o n2n-keygen
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3   -c -o n2n-route.o n2n-route.c
gcc -pthread -L. -L..  n2n-route.o   -ln2n -lcap -lpcap -lnatpmp -lminiupnpc  -o n2n-route
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3   -c -o n2n-portfwd.o n2n-portfwd.c
gcc -pthread -L. -L..  n2n-portfwd.o   -ln2n -lcap -lpcap -lnatpmp -lminiupnpc  -o n2n-portfwd
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3 n2n-decode.c -pthread -L. -L..  -ln2n -lcap -lpcap -lnatpmp -lminiupnpc  -lpcap -o n2n-decode
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3  -pthread -L. -L..  tests-compress.c   -ln2n -lcap -lpcap -lnatpmp -lminiupnpc  -o tests-compress
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3  -pthread -L. -L..  tests-elliptic.c   -ln2n -lcap -lpcap -lnatpmp -lminiupnpc  -o tests-elliptic
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3  -pthread -L. -L..  tests-hashing.c   -ln2n -lcap -lpcap -lnatpmp -lminiupnpc  -o tests-hashing
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3  -pthread -L. -L..  tests-transform.c   -ln2n -lcap -lpcap -lnatpmp -lminiupnpc  -o tests-transform
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3  -pthread -L. -L..  tests-wire.c   -ln2n -lcap -lpcap -lnatpmp -lminiupnpc  -o tests-wire
gcc -O3 -march=native -U__RDSEED__ -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3  -pthread -L. -L..  tests-auth.c   -ln2n -lcap -lpcap -lnatpmp -lminiupnpc  -o tests-auth
make[1]: Leaving directory '/root/n2n-3.0/tools'
hamishcoleman commented 1 year ago

Yeah, I saw that after I did some refactoring, but I hadnt got around to looking closely.

If you think those warnings are bad, dont look at the windows compile outputs :-(