aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2020-03-14 18:44:39 +0100
committerToni Uhlig <matzeton@googlemail.com>2020-03-14 18:44:39 +0100
commit1e8037d84d01ef605b667f8db42f3c95831d7920 (patch)
tree0d1323c7b1ceaa461fc555010182747e1ff8fbb5
parentd727de62e14a48ef5da16d034549a76909303209 (diff)
improved icmp/forward descriptor structs and use -Wextra for all builds
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r--src/Makefile.am2
-rw-r--r--src/options.c2
-rw-r--r--src/pdesc.h9
-rw-r--r--src/ptunnel.c2
4 files changed, 9 insertions, 6 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 33ec531..5786a01 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,7 @@
bin_PROGRAMS = ptunnel-ng
man8_MANS = ptunnel-ng.8
-ptunnel_ng_CFLAGS = -Wall
+ptunnel_ng_CFLAGS = -Wall -Wextra
ptunnel_ng_LDADD =
CLEANFILES =
EXTTRA_DIST =
diff --git a/src/options.c b/src/options.c
index 69d842c..5f2de0f 100644
--- a/src/options.c
+++ b/src/options.c
@@ -262,6 +262,8 @@ static struct option long_options[] = {
static const void *get_default_optval(enum option_type opttype, const char *optname) {
+ (void) opttype;
+
for (unsigned i = 0; i < ARRAY_SIZE(long_options); ++i) {
if (strncmp(long_options[i].name, optname, BUFSIZ /* not optimal */) == 0 &&
strlen(long_options[i].name) == strlen(optname))
diff --git a/src/pdesc.h b/src/pdesc.h
index ec14787..49aa733 100644
--- a/src/pdesc.h
+++ b/src/pdesc.h
@@ -73,11 +73,11 @@
*/
typedef struct forward_desc_t {
/** ping_tunnel_pkt_t seq_no */
- int seq_no;
+ uint16_t seq_no;
/** length of data */
- int length;
+ uint16_t length;
/** amount of data not yet transferred */
- int remaining;
+ size_t remaining;
char data[0];
} forward_desc_t;
@@ -89,9 +89,8 @@ typedef struct forward_desc_t {
*/
typedef struct icmp_desc_t {
/** total length of ICMP packet, including ICMP header and ptunnel data. */
- int pkt_len;
+ uint16_t pkt_len;
double last_resend;
- int resend_count;
uint16_t seq_no;
uint16_t icmp_id;
icmp_echo_packet_t *pkt;
diff --git a/src/ptunnel.c b/src/ptunnel.c
index a8c0a40..8462758 100644
--- a/src/ptunnel.c
+++ b/src/ptunnel.c
@@ -428,6 +428,8 @@ int pt_create_udp_socket(int port) {
/* pt_proxy: This function does all the client and proxy stuff.
*/
void* pt_proxy(void *args) {
+ (void) args;
+
fd_set set;
struct timeval timeout;
int bytes;