Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37838110
en ru br
ALT Linux repositórios
S:2.1.0-alt2
5.0: 1.0.4-alt1
4.1: 1.0.4-alt1
4.0: 1.0.4-alt1
3.0: 1.4a12-alt7

Group :: Monitoramento
RPM: traceroute

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: traceroute-2.1.0-alt2.patch
Download


 libsupp/clif.c           | 27 +++++++++++++++------------
 traceroute/as_lookups.c  |  6 +++---
 traceroute/mod-dccp.c    |  5 +++--
 traceroute/mod-icmp.c    |  9 +++++----
 traceroute/mod-raw.c     | 12 +++++++-----
 traceroute/mod-tcp.c     | 19 ++++++++++---------
 traceroute/mod-tcpconn.c | 11 +++++++----
 traceroute/mod-udp.c     |  7 ++++---
 traceroute/poll.c        | 11 ++++++-----
 traceroute/traceroute.8  |  6 +++---
 traceroute/traceroute.c  | 39 +++++++++++++++++++++------------------
 11 files changed, 84 insertions(+), 68 deletions(-)
diff --git a/libsupp/clif.c b/libsupp/clif.c
index 4ef20e4..3a4c076 100644
--- a/libsupp/clif.c
+++ b/libsupp/clif.c
@@ -33,7 +33,7 @@ static struct {
 	CLIF_option *option_list;
 	CLIF_argument *argument_list;
 	unsigned int parse_flags;
-} curr = { 0, };
+} curr;
 	
 
 static void err_report (const char *format, ...) {
@@ -780,8 +780,8 @@ static void box_output (int start, int left, int width, const char *str,
 	char buf[1024];
 	char spacer[128];	/*  assume it is enough   */
 
-	if (left > sizeof (spacer) - 2)  left = sizeof (spacer) - 2;
-	if (width > sizeof (buf) - 1)  width = sizeof (buf) - 1;
+	if (left > (int)sizeof (spacer) - 2)  left = sizeof (spacer) - 2;
+	if (width > (int)sizeof (buf) - 1)  width = sizeof (buf) - 1;
 
 	spacer[0] = '\n';
 	memset (spacer + 1, ' ', left);
@@ -907,7 +907,9 @@ void CLIF_print_options (const char *header,
 		if ((curr.parse_flags & CLIF_STRICT_EXCL) &&
 		    curr.option_list == option_list
 		)  fprintf (stderr, "Anyway `%s' must be specified.\n", excl);
-		else  /*  simple ordinary option, because excl_cnt == 1 ... */;
+		else {
+		    /*  simple ordinary option, because excl_cnt == 1 ... */;
+		}
 	    } else
 	        fprintf (stderr, "Only one of these may be specified:\n"
 				 "    %s\n", excl);
@@ -1055,8 +1057,9 @@ void CLIF_print_usage (const char *header, const char *progname,
 		if (optn->short_opt) {
 		    if (optn->arg_name) 
 			fprintf (stderr, " [ %s ]", show_short (optn));
-		    else
+		    else {
 			/*  already handled   */;
+		    }
 		} else
 		    fprintf (stderr, " [ %s ]", show_long (optn));
 	    }
@@ -1120,7 +1123,7 @@ int CLIF_current_help (void) {
 
 /*  Common useful option handlers.  */
 
-int CLIF_version_handler (CLIF_option *optn, char *arg) {
+int CLIF_version_handler (CLIF_option *optn, char *arg __attribute__ ((unused))) {
 
 	if (!optn->data)  return -1;
 
@@ -1130,7 +1133,7 @@ int CLIF_version_handler (CLIF_option *optn, char *arg) {
 }
 	
 
-int CLIF_set_flag (CLIF_option *optn, char *arg) {
+int CLIF_set_flag (CLIF_option *optn, char *arg __attribute__ ((unused))) {
 
 	if (!optn->data)  return -1;
 
@@ -1140,7 +1143,7 @@ int CLIF_set_flag (CLIF_option *optn, char *arg) {
 }
 
 
-int CLIF_unset_flag (CLIF_option *optn, char *arg) {
+int CLIF_unset_flag (CLIF_option *optn, char *arg __attribute__ ((unused))) {
 
 	if (!optn->data)  return -1;
 
@@ -1164,7 +1167,7 @@ int CLIF_set_string (CLIF_option *optn, char *arg) {
 	return  set_string (optn->data, arg);
 }
 
-int CLIF_arg_string (CLIF_argument *argm, char *arg, int index) {
+int CLIF_arg_string (CLIF_argument *argm, char *arg, int index __attribute__ ((unused))) {
 
 	return  set_string (argm->data, arg);
 }
@@ -1216,17 +1219,17 @@ int CLIF_set_double (CLIF_option *optn, char *arg) {
 	return  set_double (optn->data, arg);
 }
 
-int CLIF_arg_int (CLIF_argument *argm, char *arg, int index) {
+int CLIF_arg_int (CLIF_argument *argm, char *arg, int index __attribute__ ((unused))) {
 
 	return  set_int (argm->data, arg);
 }
 
-int CLIF_arg_uint (CLIF_argument *argm, char *arg, int index) {
+int CLIF_arg_uint (CLIF_argument *argm, char *arg, int index __attribute__ ((unused))) {
 
 	return  set_uint (argm->data, arg);
 }
 
-int CLIF_arg_double (CLIF_argument *argm, char *arg, int index) {
+int CLIF_arg_double (CLIF_argument *argm, char *arg, int index __attribute__ ((unused))) {
 
 	return  set_double (argm->data, arg);
 }
diff --git a/traceroute/as_lookups.c b/traceroute/as_lookups.c
index aedf7e1..5fb9382 100644
--- a/traceroute/as_lookups.c
+++ b/traceroute/as_lookups.c
@@ -22,8 +22,8 @@
 #define DEF_RADB_SERVICE	"nicname"
 
 
-static sockaddr_any ra_addr = {{ 0, }, };
-static char ra_buf[512] = { 0, };
+static sockaddr_any ra_addr;
+static char ra_buf[512];
 
 
 const char *get_as_path (const char *query) {
@@ -66,7 +66,7 @@ const char *get_as_path (const char *query) {
 		goto  err_sk;
 
 	n = snprintf (buf, sizeof (buf), "%s\r\n", query);
-	if (n >= sizeof (buf))  goto err_sk;
+	if (n >= (int) sizeof (buf))  goto err_sk;
 
 	if (write (sk, buf, n) < n)
 		goto err_sk;
diff --git a/traceroute/mod-dccp.c b/traceroute/mod-dccp.c
index 5d8518b..c985b41 100644
--- a/traceroute/mod-dccp.c
+++ b/traceroute/mod-dccp.c
@@ -228,8 +228,9 @@ static void dccp_send_probe (probe *pb, int ttl) {
 }
 
 
-static probe *dccp_check_reply (int sk, int err, sockaddr_any *from,
-						    char *buf, size_t len) {
+static probe *dccp_check_reply (int sk __attribute__ ((unused)),
+				int err, sockaddr_any *from,
+				char *buf, size_t len) {
 	probe *pb;
 	struct dccp_hdr *ndh = (struct dccp_hdr *) buf;
 	uint16_t sport, dport;
diff --git a/traceroute/mod-icmp.c b/traceroute/mod-icmp.c
index f46c808..a230102 100644
--- a/traceroute/mod-icmp.c
+++ b/traceroute/mod-icmp.c
@@ -19,7 +19,7 @@
 #include "traceroute.h"
 
 
-static sockaddr_any dest_addr = {{ 0, }, };
+static sockaddr_any dest_addr;
 static uint16_t seq = 1;
 static uint16_t ident = 0;
 
@@ -47,7 +47,7 @@ static CLIF_option icmp_options[] = {
 
 static int icmp_init (const sockaddr_any *dest,
 			    unsigned int port_seq, size_t *packet_len_p) {
-	int i;
+	unsigned int i;
 	int af = dest->sa.sa_family;
 	int protocol;
 
@@ -169,8 +169,9 @@ static void icmp_send_probe (probe *pb, int ttl) {
 }
 
 
-static probe *icmp_check_reply (int sk, int err, sockaddr_any *from,
-						    char *buf, size_t len) {
+static probe *icmp_check_reply (int sk __attribute__ ((unused)),
+		int err, sockaddr_any *from __attribute__ ((unused)),
+		char *buf, size_t len) {
 	int af = dest_addr.sa.sa_family;
 	int type;
 	uint16_t recv_id, recv_seq;
diff --git a/traceroute/mod-raw.c b/traceroute/mod-raw.c
index 26a6cec..41c8473 100644
--- a/traceroute/mod-raw.c
+++ b/traceroute/mod-raw.c
@@ -20,7 +20,7 @@
 #include "traceroute.h"
 
 
-static sockaddr_any dest_addr = {{ 0, }, };
+static sockaddr_any dest_addr;
 static int protocol = DEF_RAW_PROT;
 
 static char *data = NULL;
@@ -31,7 +31,7 @@ static int last_ttl = 0;
 static int seq = 0;
 
 
-static int set_protocol (CLIF_option *optn, char *arg) {
+static int set_protocol (CLIF_option *optn __attribute__ ((unused)), char *arg) {
 	char *q;
 
 	protocol = strtoul (arg, &q, 0);
@@ -56,7 +56,7 @@ static CLIF_option raw_options[] = {
 
 static int raw_init (const sockaddr_any *dest,
 			    unsigned int port_seq, size_t *packet_len_p) {
-	int i;
+	unsigned int i;
 	int af = dest->sa.sa_family;
 
 	dest_addr = *dest;
@@ -119,8 +119,10 @@ static void raw_send_probe (probe *pb, int ttl) {
 }
 
 
-static probe *raw_check_reply (int sk, int err, sockaddr_any *from,
-						    char *buf, size_t len) {
+static probe *raw_check_reply (int sk __attribute__ ((unused)),
+		int err, sockaddr_any *from,
+		char *buf __attribute__ ((unused)),
+		size_t len __attribute__ ((unused))) {
 	probe *pb;
 
 	if (!equal_addr (&dest_addr, from))
diff --git a/traceroute/mod-tcp.c b/traceroute/mod-tcp.c
index a6b9ffa..265ba95 100644
--- a/traceroute/mod-tcp.c
+++ b/traceroute/mod-tcp.c
@@ -27,7 +27,7 @@
 #endif
 
 
-static sockaddr_any dest_addr = {{ 0, }, };
+static sockaddr_any dest_addr;
 static unsigned int dest_port = 0;
 
 static int raw_sk = -1;
@@ -76,7 +76,7 @@ static struct {
 };
 
 static char *names_by_flags (unsigned int flags) {
-	int i;
+	unsigned int i;
 	char str[64];	/*  enough...  */
 	char *curr = str;
 	char *end = str + sizeof (str) / sizeof (*str);
@@ -95,8 +95,8 @@ static char *names_by_flags (unsigned int flags) {
 	return  strdup (str);
 }
 
-static int set_tcp_flag (CLIF_option *optn, char *arg) {
-	int i;
+static int set_tcp_flag (CLIF_option *optn, char *arg __attribute__ ((unused))) {
+	unsigned int i;
 
 	for (i = 0; i < sizeof (tcp_flags) / sizeof (*tcp_flags); i++) {
 	    if (!strcmp (optn->long_opt, tcp_flags[i].name)) {
@@ -108,7 +108,7 @@ static int set_tcp_flag (CLIF_option *optn, char *arg) {
 	return -1;
 }
 
-static int set_tcp_flags (CLIF_option *optn, char *arg) {
+static int set_tcp_flags (CLIF_option *optn __attribute__ ((unused)), char *arg) {
 	char *q;
 	unsigned long value;
 
@@ -119,7 +119,7 @@ static int set_tcp_flags (CLIF_option *optn, char *arg) {
 	return 0;
 }
 
-static int set_flag (CLIF_option *optn, char *arg) {
+static int set_flag (CLIF_option *optn, char *arg __attribute__ ((unused))) {
 
 	flags |= (unsigned long) optn->data;
 
@@ -318,7 +318,7 @@ static int tcp_init (const sockaddr_any *dest,
 	if (flags & TH_SYN) {
 	    *ptr++ = TCPOPT_MAXSEG;	/*  2   */
 	    *ptr++ = TCPOLEN_MAXSEG;	/*  4   */
-	    *((uint16_t *) ptr) = htons (mss ? mss : mtu);
+	    *((uint16_t *) ptr) = htons (mss ? (uint16_t) mss : (uint16_t) mtu);
 	    ptr += sizeof (uint16_t);
 	}
 
@@ -439,8 +439,9 @@ static void tcp_send_probe (probe *pb, int ttl) {
 }
 
 
-static probe *tcp_check_reply (int sk, int err, sockaddr_any *from,
-						    char *buf, size_t len) {
+static probe *tcp_check_reply (int sk __attribute__ ((unused)),
+		int err, sockaddr_any *from,
+		char *buf, size_t len) {
 	probe *pb;
 	struct tcphdr *tcp = (struct tcphdr *) buf;
 	uint16_t sport, dport;
diff --git a/traceroute/mod-tcpconn.c b/traceroute/mod-tcpconn.c
index d061b6d..529ce40 100644
--- a/traceroute/mod-tcpconn.c
+++ b/traceroute/mod-tcpconn.c
@@ -21,13 +21,14 @@
 #include "traceroute.h"
 
 
-static sockaddr_any dest_addr = {{ 0, }, };
+static sockaddr_any dest_addr;
 
 static int icmp_sk = -1;
 
 
 static int tcp_init (const sockaddr_any *dest,
-			    unsigned int port_seq, size_t *packet_len_p) {
+		unsigned int port_seq,
+		size_t *packet_len_p __attribute__ ((unused))) {
 	int af = dest->sa.sa_family;
 
 	dest_addr = *dest;
@@ -92,8 +93,10 @@ static void tcp_send_probe (probe *pb, int ttl) {
 }
 
 
-static probe *tcp_check_reply (int sk, int err, sockaddr_any *from,
-						    char *buf, size_t len) {
+static probe *tcp_check_reply (int sk __attribute__ ((unused)),
+		int err __attribute__ ((unused)),
+		sockaddr_any *from __attribute__ ((unused)),
+		char *buf, size_t len) {
 	int af = dest_addr.sa.sa_family;
 	int type, code, info;
 	probe *pb;
diff --git a/traceroute/mod-udp.c b/traceroute/mod-udp.c
index f3bdead..6bab88b 100644
--- a/traceroute/mod-udp.c
+++ b/traceroute/mod-udp.c
@@ -27,7 +27,7 @@
 #endif
 
 
-static sockaddr_any dest_addr = {{ 0, }, };
+static sockaddr_any dest_addr;
 static unsigned int curr_port = 0;
 static unsigned int protocol = IPPROTO_UDP;
 
@@ -36,7 +36,7 @@ static char *data = NULL;
 static size_t *length_p;
 
 static void fill_data (size_t *packet_len_p) {
-	int i;
+	unsigned int i;
 
 	length_p = packet_len_p;
 
@@ -165,7 +165,8 @@ static void udp_send_probe (probe *pb, int ttl) {
 
 
 static probe *udp_check_reply (int sk, int err, sockaddr_any *from,
-						    char *buf, size_t len) {
+		char *buf __attribute__ ((unused)),
+		size_t len __attribute__ ((unused))) {
 	probe *pb;
 
 	pb = probe_by_sk (sk);
diff --git a/traceroute/poll.c b/traceroute/poll.c
index 988c456..540c35a 100644
--- a/traceroute/poll.c
+++ b/traceroute/poll.c
@@ -20,7 +20,7 @@ static unsigned int num_polls = 0;
 
 
 void add_poll (int fd, int events) {
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < num_polls && pfd[i].fd > 0; i++) ;
 
@@ -35,7 +35,7 @@ void add_poll (int fd, int events) {
 
 
 void del_poll (int fd) {
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < num_polls && pfd[i].fd != fd; i++) ;
 
@@ -44,12 +44,12 @@ void del_poll (int fd) {
 
 
 static int cleanup_polls (void) {
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < num_polls && pfd[i].fd > 0; i++) ;
 
 	if (i < num_polls) {	/*  a hole have found   */
-	    int j;
+	    unsigned int j;
 
 	    for (j = i + 1; j < num_polls; j++) {
 		if (pfd[j].fd > 0) {
@@ -68,7 +68,8 @@ void do_poll (double timeout, void (*callback) (int fd, int revents)) {
 	int msecs = ceil (timeout * 1000);
 
 	while ((nfds = cleanup_polls ()) > 0) {
-	    int i, n;
+	    int n;
+	    unsigned int i;
 
 	    n = poll (pfd, nfds, msecs);
 
diff --git a/traceroute/traceroute.8 b/traceroute/traceroute.8
index 9c8d232..ce566c5 100644
--- a/traceroute/traceroute.8
+++ b/traceroute/traceroute.8
@@ -238,7 +238,7 @@ The optional
 (default 3.0) specifies a factor to multiply the round trip time of an already
 received response from the
 .B same
-hop. The resulting value is used as a timeout for the probe, instead of 
+hop. The resulting value is used as a timeout for the probe, instead of
 (but no more than)
 .IR max\fR.
 The optional
@@ -590,7 +590,7 @@ something is to use
 .B ping -R
 command (IPv4, and for nearest 8 hops only).
 .SH SEE ALSO
-.BR ping (8),
-.BR ping6 (8),
+.BR ping (1),
+.BR ping6 (1),
 .BR tcpdump (8),
 .BR netstat (8)
diff --git a/traceroute/traceroute.c b/traceroute/traceroute.c
index 4be9b24..78dd009 100644
--- a/traceroute/traceroute.c
+++ b/traceroute/traceroute.c
@@ -120,16 +120,16 @@ static double send_secs = DEF_SEND_SECS;
 static int mtudisc = 0;
 static int backward = 0;
 
-static sockaddr_any dst_addr = {{ 0, }, };
+static sockaddr_any dst_addr;
 static char *dst_name = NULL;
 static char *device = NULL;
-static sockaddr_any src_addr = {{ 0, }, };
+static sockaddr_any src_addr;
 static unsigned int src_port = 0;
 
 static const char *module = "default";
 static const tr_module *ops = NULL;
 
-static char *opts[16] = { NULL, };	/*  assume enough   */
+static char *opts[16];			/*  assume enough   */
 static unsigned int opts_idx = 1;	/*  first one reserved...   */
 
 
@@ -353,7 +353,7 @@ static void init_ip_options (void) {
 
 /*	Command line stuff	    */
 
-static int set_af (CLIF_option *optn, char *arg) {
+static int set_af (CLIF_option *optn, char *arg __attribute__ ((unused))) {
 	int vers = (long) optn->data;
 
 	if (vers == 4)  af = AF_INET;
@@ -364,7 +364,7 @@ static int set_af (CLIF_option *optn, char *arg) {
 	return 0;
 }
 
-static int add_gateway (CLIF_option *optn, char *arg) {
+static int add_gateway (CLIF_option *optn __attribute__ ((unused)), char *arg) {
 
 	if (num_gateways >= MAX_GATEWAYS_6) {	/*  127 > 8 ... :)   */
 		fprintf (stderr, "Too many gateways specified.");
@@ -378,7 +378,7 @@ static int add_gateway (CLIF_option *optn, char *arg) {
 	return 0;
 }
 
-static int set_source (CLIF_option *optn, char *arg) {
+static int set_source (CLIF_option *optn __attribute__ ((unused)), char *arg) {
 
 	return  getaddr (arg, &src_addr);
 }
@@ -398,7 +398,7 @@ static int set_port (CLIF_option *optn, char *arg) {
 	return 0;
 }
 
-static int set_module (CLIF_option *optn, char *arg) {
+static int set_module (CLIF_option *optn, char *arg __attribute__ ((unused))) {
 
 	module = (char *) optn->data;
 
@@ -406,7 +406,7 @@ static int set_module (CLIF_option *optn, char *arg) {
 }
 
 
-static int set_mod_option (CLIF_option *optn, char *arg) {
+static int set_mod_option (CLIF_option *optn __attribute__ ((unused)), char *arg) {
 
 	if (!strcmp (arg, "help")) {
 	    const tr_module *mod = tr_get_module (module);
@@ -444,7 +444,7 @@ static int set_raw (CLIF_option *optn, char *arg) {
 }
 
 
-static int set_wait_specs (CLIF_option *optn, char *arg) {
+static int set_wait_specs (CLIF_option *optn __attribute__ ((unused)), char *arg) {
 	char *p, *q;
 
 	here_factor = near_factor = 0;
@@ -464,7 +464,8 @@ static int set_wait_specs (CLIF_option *optn, char *arg) {
 }
 
 
-static int set_host (CLIF_argument *argm, char *arg, int index) {
+static int set_host (CLIF_argument *argm __attribute__ ((unused)), char *arg,
+		int index __attribute__ ((unused))) {
 
 	if (getaddr (arg, &dst_addr) < 0)
 		return -1;
@@ -678,7 +679,7 @@ int main (int argc, char *argv[]) {
 	    if (DEF_DATA_LEN >= ops->header_len)
 		    data_len = DEF_DATA_LEN - ops->header_len;
 	} else {
-	    if (packet_len >= header_len)
+	    if ((unsigned) packet_len >= header_len)
 		    data_len = packet_len - header_len;
 	}
 
@@ -776,7 +777,7 @@ static void print_probe (probe *pb) {
 
 		if (backward && pb->recv_ttl) {
 		    int hops = ttl2hops (pb->recv_ttl);
-		    if (hops != ttl)  printf (" '-%d'", hops);
+		    if (hops != (int) ttl)  printf (" '-%d'", hops);
 		}
 	    }
 	}
@@ -811,7 +812,8 @@ static double get_timeout (probe *pb) {
 
 	if (here_factor) {
 	    /*  check for already replied from the same hop   */
-	    int i, idx = (pb - probes);
+	    unsigned int i;
+	    int idx = (pb - probes);
 	    probe *p = &probes[idx - (idx % probes_per_hop)];
 
 	    for (i = 0; i < probes_per_hop; i++, p++) {
@@ -982,7 +984,7 @@ replace_by_final:
 
 
 probe *probe_by_seq (int seq) {
-	int n;
+	unsigned int n;
 
 	if (seq <= 0)  return NULL;
 
@@ -995,7 +997,7 @@ probe *probe_by_seq (int seq) {
 }
 
 probe *probe_by_sk (int sk) {
-	int n;
+	unsigned int n;
 
 	if (sk <= 0)  return NULL;
 
@@ -1023,7 +1025,8 @@ static void do_it (void) {
 
 
 	while (start < end) {
-	    int n, num = 0;
+	    int n;
+	    unsigned int num = 0;
 	    double next_time = 0;
 	    double now_time = get_time ();
 
@@ -1410,7 +1413,7 @@ void recv_reply (int sk, int err, check_reply_t check_reply) {
 	    struct iphdr *ip = (struct iphdr *) bufp;
 	    int hlen;
 
-	    if (n < sizeof (struct iphdr))  return;
+	    if ((unsigned) n < sizeof (struct iphdr))  return;
 
 	    hlen = ip->ihl << 2;
 	    if (n < hlen)  return;
@@ -1534,7 +1537,7 @@ void recv_reply (int sk, int err, check_reply_t check_reply) {
 	    int step;
 	    int offs = 128 - header_len;
 
-	    if (n > data_len)  step = 0;	/*  guaranteed at 128 ...  */
+	    if ((unsigned) n > data_len)  step = 0;	/*  guaranteed at 128 ...  */
 	    else
 		step = af == AF_INET ? 4 : 8;
 
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009