Index: extensions/acl_wl/aw_tree.c
===================================================================
--- extensions/acl_wl/aw_tree.c	(revision 258)
+++ extensions/acl_wl/aw_tree.c	(revision 403)
@@ -88,5 +88,4 @@
 {
 	int i, l, prev_offset;
-	char * c;
 	
 	TRACE_ENTRY("%p %p", name, result);
Index: extensions/app_acct/acct_conf.y
===================================================================
--- extensions/app_acct/acct_conf.y	(revision 284)
+++ extensions/app_acct/acct_conf.y	(revision 403)
@@ -59,4 +59,7 @@
 int yyparse(char * conffile);
 
+/* The Lex parser prototype */
+int acct_conflex(YYSTYPE *lvalp, YYLTYPE *llocp);
+
 /* the global configuration */
 struct acct_conf * acct_config = NULL;
@@ -89,7 +92,8 @@
 	}
 
+	if (!TRACE_BOOL(FULL))
+		return 0;
+	
 	struct fd_list * li;
-	if (!TRACE_BOOL(FULL))
-		return;
 		
 	fd_log_debug("[app_acct] Configuration dump:\n");
@@ -110,4 +114,5 @@
 	}
 	fd_log_debug("[app_acct] Complete.\n");
+	return 0;
 }
 
Index: extensions/app_acct/acct_db.c
===================================================================
--- extensions/app_acct/acct_db.c	(revision 292)
+++ extensions/app_acct/acct_db.c	(revision 403)
@@ -64,5 +64,4 @@
 	size_t sql_allocd = 0; /* The malloc'd size of the buffer */
 	size_t sql_offset = 0; /* The actual data already written in this buffer */
-	size_t p;
 	int idx = 0;
 	PGresult * res;
Index: extensions/app_acct/app_acct.c
===================================================================
--- extensions/app_acct/app_acct.c	(revision 286)
+++ extensions/app_acct/app_acct.c	(revision 403)
@@ -48,9 +48,7 @@
 static int acct_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act)
 {
-	struct msg_hdr *hdr = NULL;
 	struct msg * m;
 	struct avp * a = NULL;
 	struct avp_hdr * art=NULL, *arn=NULL; /* We keep a pointer on the Accounting-Record-{Type, Number} AVPs from the query */
-	char * s;
 	struct acct_record_list rl;
 	
Index: extensions/app_radgw/md5.c
===================================================================
--- extensions/app_radgw/md5.c	(revision 254)
+++ extensions/app_radgw/md5.c	(revision 403)
@@ -7,6 +7,4 @@
  */
 #include "rgw_common.h"
-/* Forward declaration: */
-void md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac);
 /*********************************************************************************/
 
Index: extensions/app_radgw/md5.h
===================================================================
--- extensions/app_radgw/md5.h	(revision 254)
+++ extensions/app_radgw/md5.h	(revision 403)
@@ -4,6 +4,6 @@
  * It is redistributed under the terms of the BSD license, as allowed
  * by the original copyright reproduced bellow.
- *  The file has not been modified, except for this notice.
  */
+
 /*********************************************************************************/
 
@@ -41,3 +41,6 @@
 #endif /* CONFIG_CRYPTO_INTERNAL */
 
+ /* Forward declaration: */
+void md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac);
+
 #endif /* MD5_H */
Index: extensions/app_radgw/rgw.h
===================================================================
--- extensions/app_radgw/rgw.h	(revision 356)
+++ extensions/app_radgw/rgw.h	(revision 403)
@@ -102,6 +102,4 @@
 int rgw_clients_check_dup(struct rgw_radius_msg_meta **msg, struct rgw_client *cli);
 int rgw_clients_check_origin(struct rgw_radius_msg_meta *msg, struct rgw_client *cli);
-int rgw_clients_get_origin(struct rgw_client *cli, char **fqdn, char **realm);
-char * rgw_clients_id(struct rgw_client *cli);
 int rgw_client_finish_send(struct radius_msg ** msg, struct rgw_radius_msg_meta * req, struct rgw_client * cli);
 void rgw_clients_dispose(struct rgw_client ** ref);
Index: extensions/app_radgw/rgw_clients.c
===================================================================
--- extensions/app_radgw/rgw_clients.c	(revision 395)
+++ extensions/app_radgw/rgw_clients.c	(revision 403)
@@ -189,5 +189,4 @@
 static int client_search(struct rgw_client ** res, struct sockaddr * ip_port )
 {
-	int ret = 0;
 	int cmp;
 	struct fd_list *ref = NULL;
@@ -301,5 +300,4 @@
 	for (idx = 0; idx < msg->radius.attr_used; idx++) {
 		struct radius_attr_hdr * attr = (struct radius_attr_hdr *)(msg->radius.buf + msg->radius.attr_pos[idx]);
-		unsigned char * attr_val = (unsigned char *)(attr + 1);
 		size_t attr_len = attr->length - sizeof(struct radius_attr_hdr);
 		
Index: extensions/app_radgw/rgw_common.h
===================================================================
--- extensions/app_radgw/rgw_common.h	(revision 356)
+++ extensions/app_radgw/rgw_common.h	(revision 403)
@@ -56,6 +56,8 @@
 /* This structure points to a RADIUS client description, the definition is not known to plugins */
 struct rgw_client;
-/* This function is required to be able to translate user paswords */
-int rgw_clients_getkey(struct rgw_client * cli, unsigned char **key, size_t *key_len);
+
+int    rgw_clients_getkey(struct rgw_client * cli, unsigned char **key, size_t *key_len);
+char * rgw_clients_id(struct rgw_client *cli);
+int    rgw_clients_get_origin(struct rgw_client *cli, char **fqdn, char **realm);
 
 /* Each plugin must provide the following structure. */
Index: extensions/app_radgw/rgw_conf.l
===================================================================
--- extensions/app_radgw/rgw_conf.l	(revision 258)
+++ extensions/app_radgw/rgw_conf.l	(revision 403)
@@ -136,5 +136,5 @@
 				}
 				
-				if (port = strchr(work, '[')) {
+				if ((port = strchr(work, '[')) != NULL) {
 					*port = '\0';
 					port++;
Index: extensions/app_radgw/rgw_plugins.c
===================================================================
--- extensions/app_radgw/rgw_plugins.c	(revision 356)
+++ extensions/app_radgw/rgw_plugins.c	(revision 403)
@@ -173,5 +173,4 @@
 {
 	struct plg_descr * new;
-	int ret = 0;
 	
 	TRACE_ENTRY("%p %p %d %p %zi", plgfile, conffile, type, codes_array, codes_sz);
Index: extensions/app_radgw/rgw_worker.c
===================================================================
--- extensions/app_radgw/rgw_worker.c	(revision 385)
+++ extensions/app_radgw/rgw_worker.c	(revision 403)
@@ -63,6 +63,4 @@
 static void * work_th(void * arg)
 {
-	char thname[10];
-	
 	TRACE_ENTRY("%p", arg);
 	
Index: extensions/app_radgw/rgwx_acct.c
===================================================================
--- extensions/app_radgw/rgwx_acct.c	(revision 376)
+++ extensions/app_radgw/rgwx_acct.c	(revision 403)
@@ -301,7 +301,7 @@
 	const char * prefix = "Diameter/";
 	size_t pref_len;
-	char * si = NULL;
+	uint8_t * si = NULL;
 	size_t si_len = 0;
-	char * un = NULL;
+	uint8_t * un = NULL;
 	size_t un_len = 0;
 	
@@ -357,5 +357,5 @@
 				if ((attr_len > pref_len ) && ! strncmp((char *)v, prefix, pref_len)) {
 					int i;
-					si = (char *)v + pref_len;
+					si = v + pref_len;
 					si_len = attr_len - pref_len;
 					TRACE_DEBUG(ANNOYING, "Found Class attribute with '%s' prefix (attr #%d), SI:'%.*s'.", prefix, idx, si_len, si);
@@ -369,5 +369,5 @@
 			case RADIUS_ATTR_USER_NAME:
 				if (attr_len) {
-					un = (char *)v;
+					un = v;
 					un_len = attr_len;
 					TRACE_DEBUG(ANNOYING, "Found a User-Name attribute: '%.*s'", un_len, un);
@@ -471,5 +471,5 @@
 	if (idx == 0) {
 		/* Not found in the User-Name => we use the local domain of this gateway */
-		value.os.data = fd_g_config->cnf_diamrlm;
+		value.os.data = (uint8_t *)fd_g_config->cnf_diamrlm;
 		value.os.len  = fd_g_config->cnf_diamrlm_len;
 	} else {
@@ -482,5 +482,5 @@
 	/* Create the Session-Id AVP if needed */
 	if (!*session) {
-		CHECK_FCT( fd_sess_fromsid ( si, si_len, session, NULL) );
+		CHECK_FCT( fd_sess_fromsid ( (char *)/* cast should be removed later */si, si_len, session, NULL) );
 		
 		TRACE_DEBUG(FULL, "[auth.rgwx] Translating new accounting message for session '%.*s'...", si_len, si);
Index: extensions/app_radgw/rgwx_auth.c
===================================================================
--- extensions/app_radgw/rgwx_auth.c	(revision 388)
+++ extensions/app_radgw/rgwx_auth.c	(revision 403)
@@ -236,13 +236,12 @@
 	const char * prefix = "Diameter/";
 	size_t pref_len;
-	char * dh = NULL;
+	uint8_t * dh = NULL;
 	size_t dh_len = 0;
-	char * dr = NULL;
+	uint8_t * dr = NULL;
 	size_t dr_len = 0;
-	char * si = NULL;
+	uint8_t * si = NULL;
 	size_t si_len = 0;
-	char * un = NULL;
+	uint8_t * un = NULL;
 	size_t un_len = 0;
-	uint32_t status_type;
 	size_t nattr_used = 0;
 	struct avp ** avp_tun = NULL, *avp = NULL;
@@ -316,5 +315,5 @@
 	for (idx = 0; idx < rad_req->attr_used; idx++) {
 		struct radius_attr_hdr * attr = (struct radius_attr_hdr *)(rad_req->buf + rad_req->attr_pos[idx]);
-		char * attr_val = (char *)(attr + 1);
+		uint8_t * attr_val = (uint8_t *)(attr + 1);
 		size_t attr_len = attr->length - sizeof(struct radius_attr_hdr);
 		
@@ -343,5 +342,5 @@
 			case RADIUS_ATTR_STATE:
 				if ((attr_len > pref_len + 5 /* for the '/'s and non empty strings */ ) 
-					&& ! strncmp(attr_val, prefix, pref_len)) { /* should we make it strncasecmp? */
+					&& ! memcmp(attr_val, prefix, pref_len)) {
 					int i, start;
 
@@ -376,5 +375,5 @@
 		
 			case RADIUS_ATTR_USER_NAME:
-				TRACE_DEBUG(ANNOYING, "Found a User-Name attribute: '%.*s'", attr_len, attr_len ? attr_val : "");
+				TRACE_DEBUG(ANNOYING, "Found a User-Name attribute: '%.*s'", attr_len, attr_len ? (char *)attr_val : "");
 				un = attr_val;
 				un_len = attr_len;
@@ -430,5 +429,5 @@
 		if (i <= 0) {
 			/* Not found in the User-Name => we use the local domain of this gateway */
-			value.os.data = fd_g_config->cnf_diamrlm;
+			value.os.data = (uint8_t *)fd_g_config->cnf_diamrlm;
 			value.os.len  = fd_g_config->cnf_diamrlm_len;
 		} else {
@@ -455,5 +454,5 @@
 		if (si_len) {
 			/* We already have the Session-Id, just use it */
-			CHECK_FCT( fd_sess_fromsid ( si, si_len, session, NULL) );
+			CHECK_FCT( fd_sess_fromsid ( (char *) /* this cast will be removed later */ si, si_len, session, NULL) );
 		} else {
 			/* Create a new Session-Id string */
@@ -544,5 +543,5 @@
 		if (got_empty_eap) {
 			value.os.len = 0;
-			value.os.data = "";
+			value.os.data = (uint8_t *)"";
 		} else {
 			CHECK_MALLOC( value.os.data = radius_msg_get_eap(rad_req, &value.os.len) );
@@ -1066,5 +1065,6 @@
 	struct avp *avp, *next, *avp_x, *avp_y, *asid, *aoh;
 	struct avp_hdr *ahdr, *sid, *oh;
-	char buf[254]; /* to store some attributes values (with final '\0') */
+	uint8_t buf[254]; /* to store some attributes values (with final '\0') */
+	size_t sz;
 	int ta_set = 0;
 	int no_str = 0; /* indicate if an STR is required for this server */
@@ -1189,20 +1189,20 @@
 	/* Now, save the session-id and eventually server info in a STATE or CLASS attribute */
 	if ((*rad_fw)->hdr->code == RADIUS_CODE_ACCESS_CHALLENGE) {
-		if (sizeof(buf) < snprintf(buf, sizeof(buf), "Diameter/%.*s/%.*s/%.*s", 
-				oh->avp_value->os.len,  oh->avp_value->os.data,
-				ahdr->avp_value->os.len,  ahdr->avp_value->os.data,
-				sid->avp_value->os.len, sid->avp_value->os.data)) {
+		if (sizeof(buf) < (sz = snprintf((char *)buf, sizeof(buf), "Diameter/%.*s/%.*s/%.*s", 
+				oh->avp_value->os.len,  (char *)oh->avp_value->os.data,
+				ahdr->avp_value->os.len,  (char *)ahdr->avp_value->os.data,
+				sid->avp_value->os.len, (char *)sid->avp_value->os.data))) {
 			TRACE_DEBUG(INFO, "Data truncated in State attribute: %s", buf);
 		}
-		CONV2RAD_STR(RADIUS_ATTR_STATE, buf, strlen(buf), 0);
+		CONV2RAD_STR(RADIUS_ATTR_STATE, buf, sz, 0);
 	}
 
 	if ((*rad_fw)->hdr->code == RADIUS_CODE_ACCESS_ACCEPT) {
 		/* Add the Session-Id */
-		if (sizeof(buf) < snprintf(buf, sizeof(buf), "Diameter/%.*s", 
-				sid->avp_value->os.len, sid->avp_value->os.data)) {
+		if (sizeof(buf) < (sz = snprintf((char *)buf, sizeof(buf), "Diameter/%.*s", 
+				sid->avp_value->os.len, sid->avp_value->os.data))) {
 			TRACE_DEBUG(INFO, "Data truncated in Class attribute: %s", buf);
 		}
-		CONV2RAD_STR(RADIUS_ATTR_CLASS, buf, strlen(buf), 0);
+		CONV2RAD_STR(RADIUS_ATTR_CLASS, buf, sz, 0);
 	}
 	
@@ -1587,5 +1587,5 @@
 							CHECK_FCT( fd_msg_avp_hdr ( inavp, &ahdr ) );
 							
-							if (ahdr->avp_flags & AVP_FLAG_VENDOR == 0) {
+							if ( ! (ahdr->avp_flags & AVP_FLAG_VENDOR)) {
 								switch (ahdr->avp_code) {
 									case DIAM_ATTR_TUNNEL_TYPE:
@@ -1634,5 +1634,4 @@
 											size_t pos;
 											int i;
-											size_t buflen;
 											uint8_t * secret;	/* S */
 											size_t secret_len;
@@ -1653,5 +1652,5 @@
 											
 											/* The plain text string P */
-											CHECK_PARAM(ahdr->avp_value->os.len < 240);
+											CHECK_PARAMS(ahdr->avp_value->os.len < 240);
 											buf[3] = ahdr->avp_value->os.len;
 											memcpy(&buf[4], ahdr->avp_value->os.data, ahdr->avp_value->os.len);
@@ -1817,9 +1816,9 @@
 		/* Add the auth-application-id required for STR, or 0 if no STR is required */
 		CHECK_FCT( fd_msg_hdr( *diam_ans, &hdr ) );
-		if (sizeof(buf) < snprintf(buf, sizeof(buf), CLASS_AAI_PREFIX "%u", 
-				no_str ? 0 : hdr->msg_appl)) {
+		if (sizeof(buf) < (sz = snprintf((char *)buf, sizeof(buf), CLASS_AAI_PREFIX "%u", 
+				no_str ? 0 : hdr->msg_appl))) {
 			TRACE_DEBUG(INFO, "Data truncated in Class attribute: %s", buf);
 		}
-		CONV2RAD_STR(RADIUS_ATTR_CLASS, buf, strlen(buf), 0);
+		CONV2RAD_STR(RADIUS_ATTR_CLASS, buf, sz, 0);
 	}
 	
Index: extensions/app_radgw/rgwx_echodrop.c
===================================================================
--- extensions/app_radgw/rgwx_echodrop.c	(revision 356)
+++ extensions/app_radgw/rgwx_echodrop.c	(revision 403)
@@ -240,5 +240,4 @@
 static int ed_diam_ans( struct rgwp_config * cs, struct session * session, struct msg ** diam_ans, struct radius_msg ** rad_fw, struct rgw_client * cli, int * stateful )
 {
-	int ret;
 	struct fd_list * list = NULL;
 	
@@ -265,5 +264,4 @@
 	while (! FD_IS_LIST_EMPTY(list) ) {
 		struct ed_saved_attribute * esa = (struct ed_saved_attribute *)(list->next);
-		struct radius_attr_hdr * rc;
 		
 		fd_list_unlink(&esa->chain);
Index: extensions/app_radgw/rgwx_echodrop.y
===================================================================
--- extensions/app_radgw/rgwx_echodrop.y	(revision 270)
+++ extensions/app_radgw/rgwx_echodrop.y	(revision 403)
@@ -53,4 +53,12 @@
 #include "rgwx_echodrop.h"
 #include "rgwx_echodrop.tab.h"	/* bison is not smart enough to define the YYLTYPE before including this code, so... */
+
+
+/* Forward declaration */
+int yyparse(char * conffile, struct rgwp_config *cs);
+
+/* The Lex parser prototype */
+int rgwx_echodroplex(YYSTYPE *lvalp, YYLTYPE *llocp);
+
 
 /* Parse the configuration file */
Index: extensions/rt_default/rtd_rules.c
===================================================================
--- extensions/rt_default/rtd_rules.c	(revision 258)
+++ extensions/rt_default/rtd_rules.c	(revision 403)
@@ -307,5 +307,5 @@
 }
 
-/* Search in list (targets or rules) the next matching item for string str(len). Returned in next_match, or *next_match == NULL if no more match. Re-enter with same next_match for the next one. */
+/* Search in list (targets or rules) the next matching item for octet string str(len). Returned in next_match, or *next_match == NULL if no more match. Re-enter with same next_match for the next one. */
 static int get_next_match(struct fd_list * list, char * str, size_t len, struct fd_list ** next_match)
 {
@@ -577,5 +577,5 @@
 						r = NULL;
 						do {
-							CHECK_FCT ( get_next_match( &target->rules[j], parsed_msg_avp[j].avp->os.data, parsed_msg_avp[j].avp->os.len, (void *)&r) );
+							CHECK_FCT ( get_next_match( &target->rules[j], (char *) /* is this cast safe? */ parsed_msg_avp[j].avp->os.data, parsed_msg_avp[j].avp->os.len, (void *)&r) );
 							if (!r)
 								break;
Index: extensions/test_app/ta_cli.c
===================================================================
--- extensions/test_app/ta_cli.c	(revision 258)
+++ extensions/test_app/ta_cli.c	(revision 403)
@@ -168,5 +168,5 @@
 		CHECK_FCT_DO( fd_sess_getsid ( sess, &sid ), goto out );
 		CHECK_FCT_DO( fd_msg_avp_new ( ta_sess_id, 0, &avp ), goto out );
-		val.os.data = sid;
+		val.os.data = (uint8_t *)sid;
 		val.os.len  = strlen(sid);
 		CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out );
Index: extensions/test_app/ta_serv.c
===================================================================
--- extensions/test_app/ta_serv.c	(revision 258)
+++ extensions/test_app/ta_serv.c	(revision 403)
@@ -57,5 +57,4 @@
 	struct msg *ans, *qry;
 	struct avp * a;
-	union avp_value val;
 	
 	TRACE_ENTRY("%p %p %p %p", msg, avp, sess, act);
@@ -66,8 +65,8 @@
 	/* Value of Origin-Host */
 	fprintf(stderr, "ECHO Test-Request received from ");
-	CHECK_FCT_DO( fd_msg_search_avp ( *msg, ta_origin_host, &a), return );
+	CHECK_FCT( fd_msg_search_avp ( *msg, ta_origin_host, &a) );
 	if (a) {
 		struct avp_hdr * hdr;
-		CHECK_FCT_DO( fd_msg_avp_hdr( a, &hdr ), return );
+		CHECK_FCT( fd_msg_avp_hdr( a, &hdr ) );
 		fprintf(stderr, "'%.*s'", hdr->avp_value->os.len, hdr->avp_value->os.data);
 	} else {
Index: freeDiameter/cnxctx.c
===================================================================
--- freeDiameter/cnxctx.c	(revision 402)
+++ freeDiameter/cnxctx.c	(revision 403)
@@ -162,6 +162,4 @@
 #else /* DISABLE_SCTP */
 	struct cnxctx * cnx = NULL;
-	sSS dummy;
-	sSA * sa = (sSA *) &dummy;
 
 	TRACE_ENTRY("%hu %p", port, ep_list);
@@ -224,5 +222,4 @@
 	socklen_t ss_len = sizeof(ss);
 	int cli_sock = 0;
-	struct fd_endpoint * ep;
 
 	TRACE_ENTRY("%p", serv);
@@ -988,5 +985,6 @@
 int fd_tls_verify_credentials(gnutls_session_t session, struct cnxctx * conn, int verbose)
 {
-	int ret, i;
+	int i;
+	unsigned int gtret;
 	const gnutls_datum_t *cert_list;
 	unsigned int cert_list_size;
@@ -1018,12 +1016,4 @@
 				fd_log_debug("\t - TLS/IA session\n");
 				break;
-
-
-			#ifdef ENABLE_SRP
-			case GNUTLS_CRD_SRP:
-				fd_log_debug("\t - SRP session with username %s\n",
-					gnutls_srp_server_get_username (session));
-				break;
-			#endif
 
 			case GNUTLS_CRD_PSK:
@@ -1049,4 +1039,15 @@
 						gnutls_dh_get_prime_bits (session));
 				}
+				break;
+				
+			case GNUTLS_CRD_SRP:
+				fd_log_debug("\t - SRP session with username %s\n",
+					gnutls_srp_server_get_username (session));
+				break;
+
+			default:
+				fd_log_debug("\t - Different type of credentials for the session (%d).\n", cred);
+				break;
+
 		}
 
@@ -1073,17 +1074,17 @@
 	
 	/* First, use built-in verification */
-	CHECK_GNUTLS_DO( gnutls_certificate_verify_peers2 (session, &ret), return EINVAL );
-	if (ret) {
+	CHECK_GNUTLS_DO( gnutls_certificate_verify_peers2 (session, &gtret), return EINVAL );
+	if (gtret) {
 		if (TRACE_BOOL(INFO)) {
 			fd_log_debug("TLS: Remote certificate invalid on socket %d (Remote: '%s')(Connection: '%s') :\n", conn->cc_socket, conn->cc_remid, conn->cc_id);
-			if (ret & GNUTLS_CERT_INVALID)
+			if (gtret & GNUTLS_CERT_INVALID)
 				fd_log_debug(" - The certificate is not trusted (unknown CA? expired?)\n");
-			if (ret & GNUTLS_CERT_REVOKED)
+			if (gtret & GNUTLS_CERT_REVOKED)
 				fd_log_debug(" - The certificate has been revoked.\n");
-			if (ret & GNUTLS_CERT_SIGNER_NOT_FOUND)
+			if (gtret & GNUTLS_CERT_SIGNER_NOT_FOUND)
 				fd_log_debug(" - The certificate hasn't got a known issuer.\n");
-			if (ret & GNUTLS_CERT_SIGNER_NOT_CA)
+			if (gtret & GNUTLS_CERT_SIGNER_NOT_CA)
 				fd_log_debug(" - The certificate signer is not a CA, or uses version 1, or 3 without basic constraints.\n");
-			if (ret & GNUTLS_CERT_INSECURE_ALGORITHM)
+			if (gtret & GNUTLS_CERT_INSECURE_ALGORITHM)
 				fd_log_debug(" - The certificate signature uses a weak algorithm.\n");
 		}
Index: freeDiameter/cnxctx.h
===================================================================
--- freeDiameter/cnxctx.h	(revision 378)
+++ freeDiameter/cnxctx.h	(revision 403)
@@ -109,6 +109,6 @@
 int fd_sctp_get_remote_ep(int sock, struct fd_list * list);
 int fd_sctp_get_str_info( int sock, uint16_t *in, uint16_t *out, sSS *primary );
-int fd_sctp_sendstr(int sock, uint16_t strid, uint8_t * buf, size_t len, int * cc_closing);
-int fd_sctp_recvmeta(int sock, uint16_t * strid, uint8_t ** buf, size_t * len, int *event, int * cc_closing);
+int fd_sctp_sendstr(int sock, uint16_t strid, uint8_t * buf, size_t len, uint32_t * cc_closing);
+int fd_sctp_recvmeta(int sock, uint16_t * strid, uint8_t ** buf, size_t * len, int *event, uint32_t * cc_closing);
 
 /* TLS over SCTP (multi-stream) */
@@ -137,6 +137,4 @@
 #endif /* DISABLE_SCTP */
 
-/* UDP */
-int fd_cnx_get_local_eps(struct fd_list * list);
 
 #endif /* _CNXCTX_H */
Index: freeDiameter/config.c
===================================================================
--- freeDiameter/config.c	(revision 309)
+++ freeDiameter/config.c	(revision 403)
@@ -97,5 +97,4 @@
 		fd_log_debug("  Local endpoints ........ : Default (use all available)\n");
 	} else {
-		struct fd_list * li = fd_g_config->cnf_endpoints.next;
 		fd_log_debug("  Local endpoints ........ : \n");
 		fd_ep_dump( 29, &fd_g_config->cnf_endpoints );
Index: freeDiameter/fD.h
===================================================================
--- freeDiameter/fD.h	(revision 378)
+++ freeDiameter/fD.h	(revision 403)
@@ -327,4 +327,5 @@
 int		fd_cnx_getTLS(struct cnxctx * conn);
 int             fd_cnx_getcred(struct cnxctx * conn, const gnutls_datum_t **cert_list, unsigned int *cert_list_size);
+int 		fd_cnx_get_local_eps(struct fd_list * list);
 int             fd_cnx_getremoteeps(struct cnxctx * conn, struct fd_list * eps);
 char *          fd_cnx_getremoteid(struct cnxctx * conn);
Index: freeDiameter/p_ce.c
===================================================================
--- freeDiameter/p_ce.c	(revision 378)
+++ freeDiameter/p_ce.c	(revision 403)
@@ -309,5 +309,6 @@
 				
 				/* We check that the value matches what we know, otherwise disconnect the peer */
-				if (strncasecmp(hdr->avp_value->os.data, peer->p_hdr.info.pi_diamid, hdr->avp_value->os.len)) {
+				/* here also, using strcasecmp on (supposed) UTF8 data might be bad idea... to be improved */
+				if (strncasecmp((char *)hdr->avp_value->os.data, peer->p_hdr.info.pi_diamid, hdr->avp_value->os.len)) {
 					TRACE_DEBUG(INFO, "Received a message with Origin-Host set to '%.*s' while expecting '%s'\n", 
 							hdr->avp_value->os.len, hdr->avp_value->os.data, peer->p_hdr.info.pi_diamid);
Index: freeDiameter/p_dp.c
===================================================================
--- freeDiameter/p_dp.c	(revision 258)
+++ freeDiameter/p_dp.c	(revision 403)
@@ -48,9 +48,9 @@
 		int delay = peer->p_hdr.info.config.pic_tctimer ?: fd_g_config->cnf_timer_tc;
 		
-		CHECK_FCT_DO( fd_msg_search_avp ( *msg, fd_dict_avp_DC, &dc ), return );
+		CHECK_FCT( fd_msg_search_avp ( *msg, fd_dict_avp_DC, &dc ));
 		if (dc) {
 			/* Check the value is consistent with the saved one */
 			struct avp_hdr * hdr;
-			CHECK_FCT_DO(  fd_msg_avp_hdr( dc, &hdr ), return  );
+			CHECK_FCT(  fd_msg_avp_hdr( dc, &hdr )  );
 			if (hdr->avp_value == NULL) {
 				/* This is a sanity check */
Index: freeDiameter/p_psm.c
===================================================================
--- freeDiameter/p_psm.c	(revision 378)
+++ freeDiameter/p_psm.c	(revision 403)
@@ -689,4 +689,7 @@
 				CHECK_FCT_DO( fd_p_ce_process_receiver(peer), goto psm_end );
 				goto psm_loop;
+			
+			default:
+				ASSERT(0); /* implementation problem, we did not foresee this case? */
 		}
 	}
Index: freeDiameter/peers.c
===================================================================
--- freeDiameter/peers.c	(revision 391)
+++ freeDiameter/peers.c	(revision 403)
@@ -224,5 +224,4 @@
 {
 	struct fd_peer *p;
-	void * t;
 	
 	TRACE_ENTRY("%p", ptr);
@@ -429,5 +428,6 @@
 	for (li = fd_g_peers.next; li != &fd_g_peers; li = li->next) {
 		peer = (struct fd_peer *)li;
-		int cmp = strncasecmp( avp_hdr->avp_value->os.data, peer->p_hdr.info.pi_diamid, avp_hdr->avp_value->os.len );
+		/* It is probably unwise to use strcasecmp on UTF8 data... To be improved! */
+		int cmp = strncasecmp( (char *)avp_hdr->avp_value->os.data, peer->p_hdr.info.pi_diamid, avp_hdr->avp_value->os.len );
 		if (cmp > 0)
 			continue;
Index: freeDiameter/routing_dispatch.c
===================================================================
--- freeDiameter/routing_dispatch.c	(revision 258)
+++ freeDiameter/routing_dispatch.c	(revision 403)
@@ -269,5 +269,6 @@
 			if (dh 
 				&& (dh->os.len == strlen(peer->p_hdr.info.pi_diamid)) 
-				&& (strncasecmp(peer->p_hdr.info.pi_diamid, dh->os.data, dh->os.len) == 0)) {
+				/* Here again we use strncasecmp on UTF8 data... This should probably be changed. */
+				&& (strncasecmp(peer->p_hdr.info.pi_diamid, (char *)dh->os.data, dh->os.len) == 0)) {
 				/* The candidate is the Destination-Host */
 				c->score += FD_SCORE_FINALDEST;
@@ -275,5 +276,6 @@
 				if (dr  && peer->p_hdr.info.runtime.pir_realm 
 					&& (dr->os.len == strlen(peer->p_hdr.info.runtime.pir_realm)) 
-					&& (strncasecmp(peer->p_hdr.info.runtime.pir_realm, dr->os.data, dr->os.len) == 0)) {
+					/* Yet another case where we use strncasecmp on UTF8 data... Hmmm :-( */
+					&& (strncasecmp(peer->p_hdr.info.runtime.pir_realm, (char *)dr->os.data, dr->os.len) == 0)) {
 					/* The candidate's realm matchs the Destination-Realm */
 					c->score += FD_SCORE_REALM;
@@ -355,5 +357,5 @@
 static int process_decorated_NAI(union avp_value * un, union avp_value * dr)
 {
-	int i, at_idx = 0, sep_idx = 0;
+	int at_idx = 0, sep_idx = 0;
 	unsigned char * old_un;
 	TRACE_ENTRY("%p %p", un, dr);
@@ -365,5 +367,5 @@
 	/* Search the positions of the first '!' and the '@' in the string */
 	nai_get_indexes(un, &sep_idx, &at_idx);
-	CHECK_PARAMS( 0 < sep_idx < at_idx < un->os.len);
+	CHECK_PARAMS( (0 < sep_idx) && (sep_idx < at_idx) && (at_idx < un->os.len));
 	
 	/* Create the new User-Name value */
Index: freeDiameter/sctp.c
===================================================================
--- freeDiameter/sctp.c	(revision 378)
+++ freeDiameter/sctp.c	(revision 403)
@@ -997,5 +997,5 @@
 
 /* Send a buffer over a specified stream */
-int fd_sctp_sendstr(int sock, uint16_t strid, uint8_t * buf, size_t len, int * cc_status)
+int fd_sctp_sendstr(int sock, uint16_t strid, uint8_t * buf, size_t len, uint32_t * cc_status)
 {
 	struct msghdr mhdr;
@@ -1054,5 +1054,5 @@
 
 /* Receive the next data from the socket, or next notification */
-int fd_sctp_recvmeta(int sock, uint16_t * strid, uint8_t ** buf, size_t * len, int *event, int * cc_status)
+int fd_sctp_recvmeta(int sock, uint16_t * strid, uint8_t ** buf, size_t * len, int *event, uint32_t * cc_status)
 {
 	ssize_t 		 ret = 0;
Index: freeDiameter/sctps.c
===================================================================
--- freeDiameter/sctps.c	(revision 401)
+++ freeDiameter/sctps.c	(revision 403)
@@ -620,5 +620,5 @@
 	/* End all TLS sessions, in series (not as efficient as paralel, but simpler) */
 	for (i = 1; i < conn->cc_sctp_para.pairs; i++) {
-		if (!conn->cc_status & CC_STATUS_ERROR) {
+		if ( ! (conn->cc_status & CC_STATUS_ERROR)) {
 			CHECK_GNUTLS_DO( gnutls_bye(conn->cc_sctps_data.array[i].session, GNUTLS_SHUT_WR), fd_cnx_markerror(conn) );
 		}
Index: freeDiameter/tests/testappacct.c
===================================================================
--- freeDiameter/tests/testappacct.c	(revision 355)
+++ freeDiameter/tests/testappacct.c	(revision 403)
@@ -89,7 +89,8 @@
 {
 	extern PGconn *conn; /* in acct_db.c */
+	extern int fd_ext_init(int major, int minor, char * conffile); /* defined in include's extension.h */
+	extern void fd_ext_fini(void); /* defined in the extension itself */
 	struct msg * msg;
 	char * sess_bkp;
-	struct dict_object * session_id = NULL;
 	
 	/* First, initialize the daemon modules */
Index: freeDiameter/tests/testcnx.c
===================================================================
--- freeDiameter/tests/testcnx.c	(revision 393)
+++ freeDiameter/tests/testcnx.c	(revision 403)
@@ -531,14 +531,14 @@
 int main(int argc, char *argv[])
 {
-	gnutls_datum_t ca 		= { ca_data, 		sizeof(ca_data) 	  };
-	gnutls_datum_t server_cert 	= { server_cert_data, 	sizeof(server_cert_data)  };
-	gnutls_datum_t server_priv 	= { server_priv_data, 	sizeof(server_priv_data)  };
-	gnutls_datum_t client_cert	= { client_cert_data, 	sizeof(client_cert_data)  };
-	gnutls_datum_t client_priv 	= { client_priv_data, 	sizeof(client_priv_data)  };
-	gnutls_datum_t expired_cert 	= { expired_cert_data, 	sizeof(expired_cert_data) };
-	gnutls_datum_t expired_priv 	= { expired_priv_data, 	sizeof(expired_priv_data) };
-	gnutls_datum_t notrust_ca 	= { notrust_ca_data, 	sizeof(notrust_ca_data)   };
-	gnutls_datum_t notrust_cert 	= { notrust_cert_data, 	sizeof(notrust_cert_data) };
-	gnutls_datum_t notrust_priv 	= { notrust_priv_data, 	sizeof(notrust_priv_data) };
+	gnutls_datum_t ca 		= { (uint8_t *)ca_data, 		sizeof(ca_data) 	  };
+	gnutls_datum_t server_cert 	= { (uint8_t *)server_cert_data, 	sizeof(server_cert_data)  };
+	gnutls_datum_t server_priv 	= { (uint8_t *)server_priv_data, 	sizeof(server_priv_data)  };
+	gnutls_datum_t client_cert	= { (uint8_t *)client_cert_data, 	sizeof(client_cert_data)  };
+	gnutls_datum_t client_priv 	= { (uint8_t *)client_priv_data, 	sizeof(client_priv_data)  };
+	gnutls_datum_t expired_cert 	= { (uint8_t *)expired_cert_data, 	sizeof(expired_cert_data) };
+	gnutls_datum_t expired_priv 	= { (uint8_t *)expired_priv_data, 	sizeof(expired_priv_data) };
+	gnutls_datum_t notrust_ca 	= { (uint8_t *)notrust_ca_data, 	sizeof(notrust_ca_data)   };
+	gnutls_datum_t notrust_cert 	= { (uint8_t *)notrust_cert_data, 	sizeof(notrust_cert_data) };
+	gnutls_datum_t notrust_priv 	= { (uint8_t *)notrust_priv_data, 	sizeof(notrust_priv_data) };
 	
 	struct cnxctx * listener;
@@ -635,6 +635,6 @@
 		/* Create the instance */
 		CHECK( 0, fd_msg_avp_new ( model, 0, &oh ) );
-		value.os.data = "Client.side";
-		value.os.len = strlen(value.os.data);
+		value.os.data = (uint8_t *)"Client.side";
+		value.os.len = strlen((char *)value.os.data);
 		CHECK( 0, fd_msg_avp_setvalue ( oh, &value ) );
 		
@@ -1385,5 +1385,4 @@
 		const gnutls_datum_t *cert_list;
 		unsigned int cert_list_size;
-		struct fd_list local, remote;
 		struct fifo * myfifo = NULL;
 		struct timespec now;
@@ -1502,5 +1501,4 @@
 		const gnutls_datum_t *cert_list;
 		unsigned int cert_list_size;
-		struct fd_list local, remote;
 		struct fifo * myfifo = NULL;
 		struct timespec now;
Index: freeDiameter/tests/testdict.c
===================================================================
--- freeDiameter/tests/testdict.c	(revision 10)
+++ freeDiameter/tests/testdict.c	(revision 403)
@@ -55,5 +55,4 @@
 	/* Test creating and searching all types of objects */
 	{
-		enum dict_object_type type;
 		struct dict_object * obj1 = NULL;
 		struct dict_object * obj2 = NULL;
Index: freeDiameter/tests/testmesg.c
===================================================================
--- freeDiameter/tests/testmesg.c	(revision 114)
+++ freeDiameter/tests/testmesg.c	(revision 403)
@@ -1021,9 +1021,7 @@
 			struct dict_object * cmd_model = NULL;
 			struct msg         * msg = NULL;
-			struct dict_object * avp_model = NULL;
 			struct avp         * avp = NULL;
 			union avp_value      value;
 			struct avp         * avpi = NULL;
-			struct avp         * avpch = NULL;
 			struct avp_hdr     * avpdata = NULL;
 			struct msg_hdr     * msgdata = NULL;
Index: freeDiameter/tests/tests.h
===================================================================
--- freeDiameter/tests/tests.h	(revision 297)
+++ freeDiameter/tests/tests.h	(revision 403)
@@ -42,4 +42,5 @@
 #define _TESTS_H
 
+#include "libfD.h"
 #include "fD.h"
 
Index: freeDiameter/tests/testsess.c
===================================================================
--- freeDiameter/tests/testsess.c	(revision 340)
+++ freeDiameter/tests/testsess.c	(revision 403)
@@ -236,5 +236,4 @@
 		struct mystate * ms[6], *tms;
 		int freed[6];
-		int i;
 		struct timespec timeout;
 		
Index: include/freeDiameter/freeDiameter.h
===================================================================
--- include/freeDiameter/freeDiameter.h	(revision 336)
+++ include/freeDiameter/freeDiameter.h	(revision 403)
@@ -704,4 +704,5 @@
 int fd_ep_filter( struct fd_list * list, uint32_t flags );
 int fd_ep_filter_family( struct fd_list * list, int af );
+int fd_ep_filter_list( struct fd_list * list, struct fd_list * exclude_list );
 int fd_ep_clearflags( struct fd_list * list, uint32_t flags );
 void fd_ep_dump_one( char * prefix, struct fd_endpoint * ep, char * suffix );
Index: libfreeDiameter/rt_data.c
===================================================================
--- libfreeDiameter/rt_data.c	(revision 258)
+++ libfreeDiameter/rt_data.c	(revision 403)
@@ -223,5 +223,5 @@
 	fd_rtd_candidate_del(rtd, sentto, 0);
 	if (origin)
-		fd_rtd_candidate_del(rtd, origin, originsz);
+		fd_rtd_candidate_del(rtd, (char *)origin, originsz);
 	
 	/* Done! */
Index: libfreeDiameter/sessions.c
===================================================================
--- libfreeDiameter/sessions.c	(revision 340)
+++ libfreeDiameter/sessions.c	(revision 403)
@@ -297,5 +297,4 @@
 			for (li_st = sess->states.next; li_st != &sess->states; li_st = li_st->next) {
 				struct state * st = (struct state *)(li_st->o);
-				char * sid_cpy;
 				/* The list is ordered */
 				if (st->hdl->id < del->id)
@@ -334,5 +333,4 @@
 	char * sid = NULL;
 	size_t sidlen;
-	uint32_t hash;
 	struct session * sess;
 	struct fd_list * li;
