Browse Source

improved icmp/forward descriptor structs and use -Wextra for all builds

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Toni Uhlig 3 years ago
parent
commit
1e8037d84d
4 changed files with 9 additions and 6 deletions
  1. 1 1
      src/Makefile.am
  2. 2 0
      src/options.c
  3. 4 5
      src/pdesc.h
  4. 2 0
      src/ptunnel.c

+ 1 - 1
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 =

+ 2 - 0
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))

+ 4 - 5
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;

+ 2 - 0
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;