Index: libfdcore/endpoints.c
===================================================================
--- libfdcore/endpoints.c	(revision 1119)
+++ libfdcore/endpoints.c	(revision 1122)
@@ -94,5 +94,5 @@
 			return 0;
 	}
-
+	
 	/* remove the ACCEPTALL flag */
 	flags &= ~EP_ACCEPTALL;
@@ -135,6 +135,8 @@
 			break;
 		}
-		if (*ep_port < *port)
-			continue;
+		if (*ep_port < *port) {
+			cmp = -1;
+			continue;
+		}
 		if (*ep_port > *port)
 			cmp = 1;
@@ -217,5 +219,6 @@
 	while ((li_out != list) && (li_ex != exclude_list)) {
 		int cmp;
-
+		in_port_t * port_out, *port_ex;
+		
 		out = (struct fd_endpoint *)li_out;
 		ex = (struct fd_endpoint *)li_ex;
@@ -235,7 +238,11 @@
 			case AF_INET:
 				cmp = memcmp(&out->sin.sin_addr, &ex->sin.sin_addr, sizeof(struct in_addr));
+				port_out = &out->sin.sin_port;
+				port_ex = &ex->sin.sin_port;
 				break;
 			case AF_INET6:
 				cmp = memcmp(&out->sin6.sin6_addr, &ex->sin6.sin6_addr, sizeof(struct in6_addr));
+				port_out = &out->sin6.sin6_port;
+				port_ex = &ex->sin6.sin6_port;
 				break;
 			default:
@@ -250,4 +257,15 @@
 			li_ex = li_ex->next;
 			continue;
+		}
+		
+		if (port_out && (*port_out != 0) && (*port_ex != 0)) {
+			if (*port_out < *port_ex) {
+				li_out = li_out->next;
+				continue;
+			}
+			if (*port_out > *port_ex) {
+				li_ex = li_ex->next;
+				continue;
+			}
 		}
 	
@@ -298,5 +316,5 @@
 	}
 	
-	CHECK_MALLOC_DO( fd_sa_dump_node_serv( FD_DUMP_STD_PARAMS, &ep->sa, NI_NUMERICHOST | NI_NUMERICSERV ), return NULL);
+	CHECK_MALLOC_DO( fd_sa_dump( FD_DUMP_STD_PARAMS, &ep->sa, NI_NUMERICHOST | NI_NUMERICSERV ), return NULL);
 	CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "{%s%s%s%s%s}",
 				(ep->flags & EP_FL_CONF) 	? "C" : "-",
Index: libfdcore/p_ce.c
===================================================================
--- libfdcore/p_ce.c	(revision 1119)
+++ libfdcore/p_ce.c	(revision 1122)
@@ -110,5 +110,4 @@
 	for (li = fd_g_config->cnf_endpoints.next; li != &fd_g_config->cnf_endpoints; li = li->next) {
 		struct fd_endpoint * ep = (struct fd_endpoint *)li;
-		
 		CHECK_FCT( fd_msg_avp_new ( dictobj, 0, &avp ) );
 		CHECK_FCT( fd_msg_avp_value_encode ( &ep->ss, avp ) );
Index: libfdcore/server.c
===================================================================
--- libfdcore/server.c	(revision 1113)
+++ libfdcore/server.c	(revision 1122)
@@ -342,4 +342,6 @@
 	int empty_conf_ep = FD_IS_LIST_EMPTY(&fd_g_config->cnf_endpoints);
 	
+	struct fd_list filter_list = FD_LIST_INITIALIZER(filter_list);
+	
 	/* SCTP */
 	if (!fd_g_config->cnf_flags.no_sctp) {
@@ -447,4 +449,31 @@
 	}
 	
+	/* we will filter this list and create endpoints with port information */
+	#ifdef ADDRESS_AVP_INCLUDE_PORT
+	fd_list_move_end(&filter_list, &fd_g_config->cnf_endpoints);
+	while (!FD_IS_LIST_EMPTY(&filter_list)) {
+		struct fd_endpoint * ep = (struct fd_endpoint *)filter_list.next;
+		in_port_t * port = NULL;
+		fd_list_unlink(&ep->chain);
+		
+		switch( ep->sa.sa_family ) {
+		case AF_INET: port = &ep->sin.sin_port; break;
+		case AF_INET6: port = &ep->sin6.sin6_port; break;
+		}
+		
+		if (port) {
+			if (fd_g_config->cnf_port) {
+				*port = htons(fd_g_config->cnf_port);
+				CHECK_FCT(fd_ep_add_merge( &fd_g_config->cnf_endpoints, &ep->sa, sSAlen(&ep->sa), ep->flags ));
+			}
+			if (fd_g_config->cnf_port_tls) {
+				*port = htons(fd_g_config->cnf_port_tls);
+				CHECK_FCT(fd_ep_add_merge( &fd_g_config->cnf_endpoints, &ep->sa, sSAlen(&ep->sa), ep->flags ));
+			}
+		}
+		free(ep);
+	}
+	#endif /* ADDRESS_AVP_INCLUDE_PORT */
+	
 	{
 		char * buf = NULL;
Index: libfdcore/tcp.c
===================================================================
--- libfdcore/tcp.c	(revision 1085)
+++ libfdcore/tcp.c	(revision 1122)
@@ -138,5 +138,5 @@
 	pthread_cleanup_push(fd_cleanup_socket, &s);
 	
-	LOG_D( "Attempting TCP connection to %s...", fd_sa_dump_node(&buf, &len, NULL, sa, NI_NUMERICHOST | NI_NUMERICSERV)?:"<error>" );
+	LOG_D( "Attempting TCP connection to %s...", fd_sa_dump(&buf, &len, NULL, sa, NI_NUMERICHOST | NI_NUMERICSERV)?:"<error>" );
 	free(buf);
 	
