Cleanup GCC4 warnings about signedness.
diff --git a/include/rt_names.h b/include/rt_names.h
index 249231e..2d9ef10 100644
--- a/include/rt_names.h
+++ b/include/rt_names.h
@@ -21,7 +21,7 @@
 const char * ll_type_n2a(int type, char *buf, int len);
 
 const char *ll_addr_n2a(unsigned char *addr, int alen, int type, char *buf, int blen);
-int ll_addr_a2n(unsigned char *lladdr, int len, char *arg);
+int ll_addr_a2n(char *lladdr, int len, char *arg);
 
 const char * ll_proto_n2a(unsigned short id, char *buf, int len);
 int ll_proto_a2n(unsigned short *id, char *buf);
diff --git a/include/utils.h b/include/utils.h
index 1e3dc28..a78ae03 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -86,8 +86,8 @@
 extern int get_u8(__u8 *val, const char *arg, int base);
 extern int get_s8(__s8 *val, const char *arg, int base);
 
-extern __u8* hexstring_n2a(const __u8 *str, int len, __u8 *buf, int blen);
-extern __u8* hexstring_a2n(const __u8 *str, __u8 *buf, int blen);
+extern char* hexstring_n2a(const __u8 *str, int len, char *buf, int blen);
+extern __u8* hexstring_a2n(const char *str, __u8 *buf, int blen);
 
 extern const char *format_host(int af, int len, const void *addr, 
 			       char *buf, int buflen);
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index e8405f7..8e90c70 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -524,7 +524,7 @@
 			if (filter.family == AF_UNSPEC)
 				filter.family = filter.pfx.family;
 		} else if (strcmp(*argv, "scope") == 0) {
-			int scope = 0;
+			unsigned scope = 0;
 			NEXT_ARG();
 			filter.scopemask = -1;
 			if (rtnl_rtscope_a2n(&scope, *argv)) {
@@ -801,7 +801,7 @@
 			addattr_l(&req.n, sizeof(req), IFA_ANYCAST, &addr.data, addr.bytelen);
 			any_len = addr.bytelen;
 		} else if (strcmp(*argv, "scope") == 0) {
-			int scope = 0;
+			unsigned scope = 0;
 			NEXT_ARG();
 			if (rtnl_rtscope_a2n(&scope, *argv))
 				invarg(*argv, "invalid scope value.");
diff --git a/ip/iplink.c b/ip/iplink.c
index 520280e..77b1eea 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -178,7 +178,7 @@
 {
 	struct ifreq ifr;
 	struct sockaddr_ll me;
-	int alen;
+	socklen_t alen;
 	int s;
 
 	s = socket(PF_PACKET, SOCK_DGRAM, 0);
diff --git a/ip/ipmaddr.c b/ip/ipmaddr.c
index 1cdab0b..e6bd625 100644
--- a/ip/ipmaddr.c
+++ b/ip/ipmaddr.c
@@ -298,7 +298,8 @@
 				usage();
 			if (ifr.ifr_hwaddr.sa_data[0])
 				duparg("address", *argv);
-			if (ll_addr_a2n(ifr.ifr_hwaddr.sa_data, 14, *argv) < 0) {
+			if (ll_addr_a2n(ifr.ifr_hwaddr.sa_data, 
+					14, *argv) < 0) {
 				fprintf(stderr, "Error: \"%s\" is not a legal ll address.\n", *argv);
 				exit(1);
 			}
diff --git a/ip/iproute.c b/ip/iproute.c
index 5101178..2629842 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -726,7 +726,7 @@
 				invarg("\"metric\" value is invalid\n", *argv);
 			addattr32(&req.n, sizeof(req), RTA_PRIORITY, metric);
 		} else if (strcmp(*argv, "scope") == 0) {
-			int scope = 0;
+			__u32 scope = 0;
 			NEXT_ARG();
 			if (rtnl_rtscope_a2n(&scope, *argv))
 				invarg("invalid \"scope\" value\n", *argv);
@@ -831,14 +831,14 @@
 			nhs_ok = 1;
 			break;
 		} else if (matches(*argv, "protocol") == 0) {
-			int prot;
+			__u32 prot;
 			NEXT_ARG();
 			if (rtnl_rtprot_a2n(&prot, *argv))
 				invarg("\"protocol\" value is invalid\n", *argv);
 			req.r.rtm_protocol = prot;
 			proto_ok =1;
 		} else if (matches(*argv, "table") == 0) {
-			int tid;
+			__u32 tid;
 			NEXT_ARG();
 			if (rtnl_rttable_a2n(&tid, *argv))
 				invarg("\"table\" value is invalid\n", *argv);
@@ -1012,7 +1012,7 @@
 
 	while (argc > 0) {
 		if (matches(*argv, "table") == 0) {
-			int tid;
+			__u32 tid;
 			NEXT_ARG();
 			if (rtnl_rttable_a2n(&tid, *argv)) {
 				if (strcmp(*argv, "all") == 0) {
@@ -1038,7 +1038,7 @@
 			filter.tos = tos;
 			filter.tosmask = -1;
 		} else if (matches(*argv, "protocol") == 0) {
-			int prot = 0;
+			__u32 prot = 0;
 			NEXT_ARG();
 			filter.protocolmask = -1;
 			if (rtnl_rtprot_a2n(&prot, *argv)) {
@@ -1049,7 +1049,7 @@
 			}
 			filter.protocol = prot;
 		} else if (matches(*argv, "scope") == 0) {
-			int scope = 0;
+			__u32 scope = 0;
 			NEXT_ARG();
 			filter.scopemask = -1;
 			if (rtnl_rtscope_a2n(&scope, *argv)) {
diff --git a/ip/iprule.c b/ip/iprule.c
index 764edc8..0ad0d36 100644
--- a/ip/iprule.c
+++ b/ip/iprule.c
@@ -256,7 +256,7 @@
 			addattr32(&req.n, sizeof(req), RTA_FLOW, realm);
 		} else if (matches(*argv, "table") == 0 ||
 			   strcmp(*argv, "lookup") == 0) {
-			int tid;
+			__u32 tid;
 			NEXT_ARG();
 			if (rtnl_rttable_a2n(&tid, *argv))
 				invarg("invalid table ID\n", *argv);
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 6ec2509..f7e8905 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -32,7 +32,7 @@
 
 int rtnl_open_byproto(struct rtnl_handle *rth, unsigned subscriptions, int protocol)
 {
-	int addr_len;
+	socklen_t addr_len;
 	int sndbuf = 32768;
 	int rcvbuf = 32768;
 
diff --git a/lib/ll_addr.c b/lib/ll_addr.c
index ea3d660..581487d 100644
--- a/lib/ll_addr.c
+++ b/lib/ll_addr.c
@@ -53,7 +53,8 @@
 	return buf;
 }
 
-int ll_addr_a2n(unsigned char *lladdr, int len, char *arg)
+/*NB: lladdr is char * (rather than u8 *) because sa_data is char * (1003.1g) */
+int ll_addr_a2n(char *lladdr, int len, char *arg)
 {
 	if (strchr(arg, '.')) {
 		inet_prefix pfx;
diff --git a/lib/utils.c b/lib/utils.c
index 5954502..7d336eb 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -240,7 +240,7 @@
 				dst->bitlen = 32;
 		}
 		if (slash) {
-			if (get_integer(&plen, slash+1, 0) || plen > dst->bitlen) {
+			if (get_unsigned(&plen, slash+1, 0) || plen > dst->bitlen) {
 				err = -1;
 				goto done;
 			}
@@ -504,9 +504,9 @@
 }
 
 
-__u8* hexstring_n2a(const __u8 *str, int len, __u8 *buf, int blen)
+char *hexstring_n2a(const __u8 *str, int len, char *buf, int blen)
 {
-	__u8 *ptr = buf;
+	char *ptr = buf;
 	int i;
 
 	for (i=0; i<len; i++) {
@@ -523,7 +523,7 @@
 	return buf;
 }
 
-__u8* hexstring_a2n(const __u8 *str, __u8 *buf, int blen)
+__u8* hexstring_a2n(const char *str, __u8 *buf, int blen)
 {
 	int cnt = 0;
 
diff --git a/misc/arpd.c b/misc/arpd.c
index 85b2a1c..4fd226e 100644
--- a/misc/arpd.c
+++ b/misc/arpd.c
@@ -180,7 +180,7 @@
 {
 	struct ifreq ifr;
 	struct sockaddr_in dst;
-	int len;
+	socklen_t len;
 	unsigned char buf[256];
 	struct arphdr *ah = (struct arphdr*)buf;
 	unsigned char *p = (unsigned char *)(ah+1);
@@ -228,8 +228,7 @@
 	memcpy(p, &addr, 4);
 	p+=4;
 
-	len = sendto(pset[0].fd, buf, p-buf, 0, (struct sockaddr*)&sll, sizeof(sll));
-	if (len < 0)
+	if (sendto(pset[0].fd, buf, p-buf, 0, (struct sockaddr*)&sll, sizeof(sll)) < 0)
 		return -1;
 	stats.probes_sent++;
 	return 0;
@@ -480,13 +479,14 @@
 {
 	unsigned char buf[1024];
 	struct sockaddr_ll sll;
-	int sll_len = sizeof(sll);
+	socklen_t sll_len = sizeof(sll);
 	struct arphdr *a = (struct arphdr*)buf;
 	struct dbkey key;
 	DBT dbkey, dbdat;
 	int n;
 
-	n = recvfrom(pset[0].fd, buf, sizeof(buf), MSG_DONTWAIT, (struct sockaddr*)&sll, &sll_len);
+	n = recvfrom(pset[0].fd, buf, sizeof(buf), MSG_DONTWAIT, 
+		     (struct sockaddr*)&sll, &sll_len);
 	if (n < 0) {
 		if (errno != EINTR && errno != EAGAIN)
 			syslog(LOG_ERR, "recvfrom: %m");
@@ -708,6 +708,7 @@
 				fprintf(stderr, "Invalid IP address: \"%s\"\n", ipbuf);
 				goto do_abort;
 			}
+
 			dbdat.data = hexstring_a2n(macbuf, b1, 6);
 			if (dbdat.data == NULL)
 				goto do_abort;
@@ -730,7 +731,7 @@
 			struct dbkey *key = dbkey.data; 
 			if (handle_if(key->iface)) {
 				if (!IS_NEG(dbdat.data)) {
-					__u8 b1[18];
+					char b1[18];
 					printf("%-8d %-15s %s\n",
 					       key->iface,
 					       inet_ntoa(*(struct in_addr*)&key->addr),
diff --git a/tc/m_ematch.c b/tc/m_ematch.c
index d02733c..37ef045 100644
--- a/tc/m_ematch.c
+++ b/tc/m_ematch.c
@@ -120,6 +120,7 @@
 	}
 
 	err = -ENOENT;
+	*dst = 0;
 out:
 	fclose(fd);
 	return err;
diff --git a/tc/m_ematch.h b/tc/m_ematch.h
index 72437ca..67db751 100644
--- a/tc/m_ematch.h
+++ b/tc/m_ematch.h
@@ -10,7 +10,7 @@
 
 struct bstr
 {
-	unsigned char	*data;
+	char	*data;
 	unsigned int	len;
 	int		quoted;
 	struct bstr	*next;
@@ -53,7 +53,7 @@
 	int d = b->len - len;
 
 	if (d == 0)
-		return strncmp((char *) b->data, text, len);
+		return strncmp(b->data, text, len);
 
 	return d;
 }
@@ -77,7 +77,7 @@
 static inline void bstr_print(FILE *fd, struct bstr *b, int ascii)
 {
 	int i;
-	char *s = (char *) b->data;
+	char *s = b->data;
 
 	if (ascii)
 		for (i = 0; i < b->len; i++)
diff --git a/tc/m_pedit.c b/tc/m_pedit.c
index 5031c62..acfa581 100644
--- a/tc/m_pedit.c
+++ b/tc/m_pedit.c
@@ -238,9 +238,11 @@
 		return -1;
 
 	if (TINT == type)
-		return get_integer(val, *argv, 0);
+		return get_integer((int *) val, *argv, 0);
+
 	if (TU32 == type)
 		return get_u32(val, *argv, 0);
+
 	if (TIPV4 == type) {
 		inet_prefix addr;
 		if (get_prefix_1(&addr, *argv, AF_INET)) {
diff --git a/tc/q_cbq.c b/tc/q_cbq.c
index 40c0228..a456eda 100644
--- a/tc/q_cbq.c
+++ b/tc/q_cbq.c
@@ -70,7 +70,7 @@
 			}
 		} else if (strcmp(*argv, "ewma") == 0) {
 			NEXT_ARG();
-			if (get_unsigned(&ewma_log, *argv, 0)) {
+			if (get_integer(&ewma_log, *argv, 0)) {
 				explain1("ewma");
 				return -1;
 			}
@@ -236,7 +236,7 @@
 			lss.change |= TCF_CBQ_LSS_FLAGS;
 		} else if (strcmp(*argv, "ewma") == 0) {
 			NEXT_ARG();
-			if (get_u32(&ewma_log, *argv, 0)) {
+			if (get_integer(&ewma_log, *argv, 0)) {
 				explain1("ewma");
 				return -1;
 			}
diff --git a/tc/tc.c b/tc/tc.c
index 31e9fa3..f122143 100644
--- a/tc/tc.c
+++ b/tc/tc.c
@@ -244,7 +244,7 @@
 	
 	while ((cp = strstr(*linep, "\\\n")) != NULL) {
 		char *line1 = NULL;
-		ssize_t len1 = 0;
+		size_t len1 = 0;
 		size_t cc1;
 
 		if ((cc1 = getline(&line1, &len1, in)) < 0) {