Index: contrib/debian/changelog
===================================================================
--- contrib/debian/changelog	(revision 1131)
+++ contrib/debian/changelog	(revision 1136)
@@ -16,5 +16,4 @@
   * New compilation option: WORKAROUND_ACCEPT_INVALID_VSAI to improve interoperability.
   * New compilation option: DISABLE_PEER_EXPIRY for use in test environments.
-  * Host-IP-Address AVP: now piggy-tail the port number by default. Disable with ADDRESS_AVP_INCLUDE_PORT:BOOL=OFF.
   * Extensions are now also searched in LD_LIBRARY_PATH.
   * Copy Proxy-Info AVP automatically in new answers.
Index: include/freeDiameter/CMakeLists.txt
===================================================================
--- include/freeDiameter/CMakeLists.txt	(revision 1133)
+++ include/freeDiameter/CMakeLists.txt	(revision 1136)
@@ -34,8 +34,5 @@
 OPTION(WORKAROUND_ACCEPT_INVALID_VSAI "Do not reject a CER/CEA with a Vendor-Specific-Application-Id AVP containing both Auth- and Acct- application AVPs?" OFF)
 
-# If the following is defined, the Address-based AVPs issued locally are extended to include the port information.
-OPTION(ADDRESS_AVP_INCLUDE_PORT "Include the port number in the Address-based AVPs?" OFF)
-
-MARK_AS_ADVANCED(DISABLE_SCTP DEBUG_SCTP SCTP_USE_MAPPED_ADDRESSES ERRORS_ON_TODO DIAMID_IDNA_IGNORE DIAMID_IDNA_REJECT DISABLE_PEER_EXPIRY WORKAROUND_ACCEPT_INVALID_VSAI ADDRESS_AVP_INCLUDE_PORT)
+MARK_AS_ADVANCED(DISABLE_SCTP DEBUG_SCTP SCTP_USE_MAPPED_ADDRESSES ERRORS_ON_TODO DIAMID_IDNA_IGNORE DIAMID_IDNA_REJECT DISABLE_PEER_EXPIRY WORKAROUND_ACCEPT_INVALID_VSAI)
 
 ########################
Index: include/freeDiameter/freeDiameter-host.h.in
===================================================================
--- include/freeDiameter/freeDiameter-host.h.in	(revision 1127)
+++ include/freeDiameter/freeDiameter-host.h.in	(revision 1136)
@@ -61,5 +61,4 @@
 #cmakedefine DISABLE_PEER_EXPIRY
 #cmakedefine WORKAROUND_ACCEPT_INVALID_VSAI
-#cmakedefine ADDRESS_AVP_INCLUDE_PORT
 #cmakedefine GNUTLS_VERSION_210
 #cmakedefine GNUTLS_VERSION_300
Index: include/freeDiameter/libfdcore.h
===================================================================
--- include/freeDiameter/libfdcore.h	(revision 1128)
+++ include/freeDiameter/libfdcore.h	(revision 1136)
@@ -851,5 +851,4 @@
 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 );
 DECLARE_FD_DUMP_PROTOTYPE(fd_ep_dump_one, int preamble, struct fd_endpoint * ep );
Index: libfdcore/endpoints.c
===================================================================
--- libfdcore/endpoints.c	(revision 1127)
+++ libfdcore/endpoints.c	(revision 1136)
@@ -203,83 +203,4 @@
 }
 
-/* Remove any endpoint from the exclude list in the list */
-int fd_ep_filter_list( struct fd_list * list, struct fd_list * exclude_list )
-{
-	struct fd_list * li_out, *li_ex, *li;
-	struct fd_endpoint * out, * ex;
-	
-	TRACE_ENTRY("%p %p", list, exclude_list);
-	CHECK_PARAMS(list && exclude_list);
-	
-	/* initialize. Both lists are ordered */
-	li_out = list->next;
-	li_ex = exclude_list->next;
-	
-	/* Now browse both lists in parallel */
-	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;
-
-		/* Compare the next elements families */
-		if (out->sa.sa_family < ex->sa.sa_family) {
-			li_out = li_out->next;
-			continue;
-		}
-		if (out->sa.sa_family > ex->sa.sa_family) {
-			li_ex = li_ex->next;
-			continue;
-		}
-
-		/* Then compare the address fields */
-		switch (out->sa.sa_family) {
-			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:
-				/* Filter this out */
-				cmp = 0;
-		}
-		if (cmp < 0) {
-			li_out = li_out->next;
-			continue;
-		}
-		if (cmp > 0) {
-			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;
-			}
-		}
-	
-		/* We remove this element then loop */
-		li = li_out;
-		li_out = li->next;
-		fd_list_unlink(li);
-		free(li);
-	}
-	
-	return 0;
-
-}
-
-
 /* Reset the given flag(s) from all items in the list */
 int fd_ep_clearflags( struct fd_list * list, uint32_t flags )
Index: libfdcore/p_cnx.c
===================================================================
--- libfdcore/p_cnx.c	(revision 1103)
+++ libfdcore/p_cnx.c	(revision 1136)
@@ -121,7 +121,4 @@
 	}
 	
-	/* Remove any local address that would be here, it should not happen but it does sometimes... */
-	CHECK_FCT( fd_ep_filter_list(&peer->p_hdr.info.pi_endpoints, &fd_g_config->cnf_endpoints) );
-	
 	/* Now check we have at least one address to attempt */
 	if (FD_IS_LIST_EMPTY(&peer->p_hdr.info.pi_endpoints)) {
Index: libfdcore/server.c
===================================================================
--- libfdcore/server.c	(revision 1122)
+++ libfdcore/server.c	(revision 1136)
@@ -342,6 +342,4 @@
 	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) {
@@ -449,31 +447,4 @@
 	}
 	
-	/* 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: libfdproto/dictionary_functions.c
===================================================================
--- libfdproto/dictionary_functions.c	(revision 1122)
+++ libfdproto/dictionary_functions.c	(revision 1136)
@@ -74,8 +74,4 @@
 				AddressType = 1;/* see http://www.iana.org/assignments/address-family-numbers/ */
 				size = 6;	/* 2 for AddressType + 4 for data */
-				#ifdef ADDRESS_AVP_INCLUDE_PORT
-				if (sin->sin_port != 0)
-					size += 2;
-				#endif /* ADDRESS_AVP_INCLUDE_PORT */
 				
 				CHECK_MALLOC(  buf = malloc(size)  );
@@ -83,9 +79,4 @@
 				/* may not work because of alignment: *(uint32_t *)(buf+2) = htonl(sin->sin_addr.s_addr); */
 				memcpy(buf + 2, &sin->sin_addr.s_addr, 4);
-				
-				#ifdef ADDRESS_AVP_INCLUDE_PORT
-				if (sin->sin_port != 0)
-					memcpy(buf + 6, &sin->sin_port, 2);
-				#endif /* ADDRESS_AVP_INCLUDE_PORT */
 			}
 			break;
@@ -98,8 +89,4 @@
 				AddressType = 2;/* see http://www.iana.org/assignments/address-family-numbers/ */
 				size = 18;	/* 2 for AddressType + 16 for data */
-				#ifdef ADDRESS_AVP_INCLUDE_PORT
-				if (sin6->sin6_port != 0)
-					size += 2;
-				#endif /* ADDRESS_AVP_INCLUDE_PORT */
 				
 				CHECK_MALLOC(  buf = malloc(size)  );
@@ -108,8 +95,4 @@
 				memcpy(buf + 2, &sin6->sin6_addr.s6_addr, 16);
 				
-				#ifdef ADDRESS_AVP_INCLUDE_PORT
-				if (sin6->sin6_port != 0)
-					memcpy(buf + 18, &sin6->sin6_port, 2);
-				#endif /* ADDRESS_AVP_INCLUDE_PORT */
 			}
 			break;
@@ -144,12 +127,9 @@
 				sSA4 * sin = (sSA4 *)interpreted;
 				
-				CHECK_PARAMS(  avp_value->os.len >= 6  );
+				CHECK_PARAMS(  avp_value->os.len == 6  );
 				
 				sin->sin_family = AF_INET;
 				/* sin->sin_addr.s_addr = ntohl( * (uint32_t *) buf); -- may not work because of bad alignment */
 				memcpy(&sin->sin_addr.s_addr, buf, 4);
-				
-				if (avp_value->os.len == 8)
-					memcpy(&sin->sin_port, buf + 4, 2);
 			}
 			break;
@@ -159,11 +139,8 @@
 				sSA6 * sin6 = (sSA6 *)interpreted;
 				
-				CHECK_PARAMS(  avp_value->os.len >= 18  );
+				CHECK_PARAMS(  avp_value->os.len == 18  );
 				
 				sin6->sin6_family = AF_INET6;
 				memcpy(&sin6->sin6_addr.s6_addr, buf, 16);
-				
-				if (avp_value->os.len == 20)
-					memcpy(&sin6->sin6_port, buf + 16, 2);
 				
 			}
