Fix various compiler warnings throughout the code

Mostly signed/unsigned and typecasting issues

Taken from http://sourceforge.net/tracker/index.php?func=detail&aid=1811517&group_id=68956&atid=522957
diff --git a/sgsnemu/cmdline.ggo b/sgsnemu/cmdline.ggo
index a000748..0c1b06c 100644
--- a/sgsnemu/cmdline.ggo
+++ b/sgsnemu/cmdline.ggo
@@ -40,8 +40,8 @@
 option  "ipdown"       - "Script to run after link-down"  string no
 
 option  "pinghost"     - "Ping remote host"               string no
-option  "pingrate"     - "Number of ping req per second"  int default="1" no
-option  "pingsize"     - "Number of ping data bytes"      int default="56" no
-option  "pingcount"    - "Number of ping req to send"     int default="0" no
+option  "pingrate"     - "Number of ping req per second"  unsigned int default="1" no
+option  "pingsize"     - "Number of ping data bytes"      unsigned int default="56" no
+option  "pingcount"    - "Number of ping req to send"     unsigned int default="0" no
 option  "pingquiet"    - "Do not print ping packet info"  flag off
 
diff --git a/sgsnemu/cmdline.h b/sgsnemu/cmdline.h
index c462ef0..834d73c 100644
--- a/sgsnemu/cmdline.h
+++ b/sgsnemu/cmdline.h
@@ -45,9 +45,9 @@
   char * ipup_arg;	/* Script to run after link-up.  */
   char * ipdown_arg;	/* Script to run after link-down.  */
   char * pinghost_arg;	/* Ping remote host.  */
-  int pingrate_arg;	/* Number of ping req per second (default='1').  */
-  int pingsize_arg;	/* Number of ping data bytes (default='56').  */
-  int pingcount_arg;	/* Number of ping req to send (default='0').  */
+  unsigned int pingrate_arg;	/* Number of ping req per second (default='1').  */
+  unsigned int pingsize_arg;	/* Number of ping data bytes (default='56').  */
+  unsigned int pingcount_arg;	/* Number of ping req to send (default='0').  */
   int pingquiet_flag;	/* Do not print ping packet info (default=off).  */
 
   int help_given ;	/* Whether help was given.  */
diff --git a/sgsnemu/ippool.c b/sgsnemu/ippool.c
index 35b14a3..fa3d8af 100644
--- a/sgsnemu/ippool.c
+++ b/sgsnemu/ippool.c
@@ -23,7 +23,7 @@
 
 
 int ippool_printaddr(struct ippool_t *this) {
-  int n;
+  unsigned int n;
   printf("ippool_printaddr\n");
   printf("Firstdyn %d\n", this->firstdyn - this->member);
   printf("Lastdyn %d\n",  this->lastdyn - this->member);
@@ -110,7 +110,7 @@
   unsigned int a1, a2, a3, a4;
   unsigned int m1, m2, m3, m4;
   int c;
-  unsigned int m;
+  int m;
   int masklog;
 
   c = sscanf(pool, "%u.%u.%u.%u/%u.%u.%u.%u",
@@ -167,8 +167,8 @@
   struct in_addr stataddr;
   struct in_addr statmask;
   unsigned int m;
-  unsigned int listsize;
-  unsigned int dynsize;
+  int listsize;
+  int dynsize;
   unsigned int statsize;
 
   if (!allowdyn) {
diff --git a/sgsnemu/ippool.h b/sgsnemu/ippool.h
index fe9f90c..02691a6 100644
--- a/sgsnemu/ippool.h
+++ b/sgsnemu/ippool.h
@@ -37,13 +37,13 @@
 struct ippoolm_t;                /* Forward declaration */
 
 struct ippool_t {
-  int listsize;                  /* Total number of addresses */
+  unsigned int listsize;                  /* Total number of addresses */
   int allowdyn;                  /* Allow dynamic IP address allocation */
   int allowstat;                 /* Allow static IP address allocation */
   struct in_addr stataddr;       /* Static address range network address */
   struct in_addr statmask;       /* Static address range network mask */
   struct ippoolm_t *member;      /* Listsize array of members */
-  int hashsize;                  /* Size of hash table */
+  unsigned int hashsize;                  /* Size of hash table */
   int hashlog;                   /* Log2 size of hash table */
   int hashmask;                  /* Bitmask for calculating hash */
   struct ippoolm_t **hash;       /* Hashsize array of pointer to member */
diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c
index 2100c3a..7a3a700 100644
--- a/sgsnemu/sgsnemu.c
+++ b/sgsnemu/sgsnemu.c
@@ -210,7 +210,7 @@
   struct gengetopt_args_info args_info;
 
   struct hostent *host;
-  int n;
+  unsigned int n;
 
   if (cmdline_parser (argc, argv, &args_info) != 0)
     return -1;
@@ -560,7 +560,7 @@
 
 
 int encaps_printf(struct pdp_t *pdp, void *pack, unsigned len) {
-  int i;
+  unsigned int i;
   printf("The packet looks like this:\n");
   for( i=0; i<len; i++) {
     printf("%02x ", (unsigned char)*(char *)(pack+i));
@@ -606,10 +606,10 @@
 }
 
 int msisdn_add(struct ul16_t *src, struct ul16_t *dst, int add) {
-  int n;
+  unsigned int n;
   uint64_t i64 = 0;
   uint8_t msa[sizeof(i64) * 3]; /* Allocate 3 digits per octet (0..255) */
-  int msalen = 0;
+  unsigned int msalen = 0;
 
   /* Convert to uint64_t from ul16_t format (most significant digit first) */
   /* ul16_t format always starts with 0x91 to indicate international format */
@@ -805,13 +805,13 @@
 
 /* Create a new ping packet and send it off to peer. */
 int create_ping(void *gsn, struct pdp_t *pdp,
-		struct in_addr *dst, int seq, int datasize) {
+		struct in_addr *dst, int seq, unsigned int datasize) {
 
   struct ip_ping pack;
   uint16_t *p = (uint16_t *) &pack;
   uint8_t  *p8 = (uint8_t *) &pack;
   struct in_addr src;
-  int n;
+  unsigned int n;
   long int sum = 0;
   int count = 0;
 
diff --git a/sgsnemu/syserr.c b/sgsnemu/syserr.c
index e0ebc3a..002d8c3 100644
--- a/sgsnemu/syserr.c
+++ b/sgsnemu/syserr.c
@@ -41,7 +41,7 @@
   va_list args;
   char buf[SYSERR_MSGSIZE];
   char buf2[SYSERR_MSGSIZE];
-  int n;
+  unsigned int n;
   int pos;
   
   va_start(args, fmt);
diff --git a/sgsnemu/tun.c b/sgsnemu/tun.c
index 365aec0..1cc706b 100644
--- a/sgsnemu/tun.c
+++ b/sgsnemu/tun.c
@@ -243,7 +243,7 @@
   } req;
   
   struct sockaddr_nl local;
-  int addr_len;
+  socklen_t addr_len;
   int fd;
   int status;