# HG changeset patch # User Sebastien Decugis # Date 1368687391 -28800 # Node ID 1404506157732b2dc9f2239cd0f3f74f87766bc6 # Parent 90e0382e65793b889540d4992c3707d75d4cf9a5 Revert changeset 1122 (ADDRESS_AVP_INCLUDE_PORT) as this will create too much interop issues. The Host-IP-Address AVP is not normally used to discover peer address, but only for validation of the addresses where a packet is received from -- which is quite useless with a connected transport connection, but anyway... diff -r 90e0382e6579 -r 140450615773 contrib/debian/changelog --- a/contrib/debian/changelog Thu May 16 14:54:42 2013 +0800 +++ b/contrib/debian/changelog Thu May 16 14:56:31 2013 +0800 @@ -15,7 +15,6 @@ * New script to generate dictionary extensions from org file (see contrib/tools) * 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. * Port value 0 allowed in configuration to disable local server (e.g. disable non-secure port). diff -r 90e0382e6579 -r 140450615773 include/freeDiameter/CMakeLists.txt --- a/include/freeDiameter/CMakeLists.txt Thu May 16 14:54:42 2013 +0800 +++ b/include/freeDiameter/CMakeLists.txt Thu May 16 14:56:31 2013 +0800 @@ -33,10 +33,7 @@ # compliancy of their implementation with the Diameter RFC... 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) ######################## ### System checks part diff -r 90e0382e6579 -r 140450615773 include/freeDiameter/freeDiameter-host.h.in --- a/include/freeDiameter/freeDiameter-host.h.in Thu May 16 14:54:42 2013 +0800 +++ b/include/freeDiameter/freeDiameter-host.h.in Thu May 16 14:56:31 2013 +0800 @@ -60,7 +60,6 @@ #cmakedefine DIAMID_IDNA_REJECT #cmakedefine DISABLE_PEER_EXPIRY #cmakedefine WORKAROUND_ACCEPT_INVALID_VSAI -#cmakedefine ADDRESS_AVP_INCLUDE_PORT #cmakedefine GNUTLS_VERSION_210 #cmakedefine GNUTLS_VERSION_300 #cmakedefine GNUTLS_VERSION_310 diff -r 90e0382e6579 -r 140450615773 include/freeDiameter/libfdcore.h --- a/include/freeDiameter/libfdcore.h Thu May 16 14:54:42 2013 +0800 +++ b/include/freeDiameter/libfdcore.h Thu May 16 14:56:31 2013 +0800 @@ -850,7 +850,6 @@ int fd_ep_add_merge( struct fd_list * list, sSA * sa, socklen_t sl, uint32_t flags ); 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 ); DECLARE_FD_DUMP_PROTOTYPE(fd_ep_dump, int preamble, int indent, struct fd_list * eps ); diff -r 90e0382e6579 -r 140450615773 libfdcore/endpoints.c --- a/libfdcore/endpoints.c Thu May 16 14:54:42 2013 +0800 +++ b/libfdcore/endpoints.c Thu May 16 14:56:31 2013 +0800 @@ -202,85 +202,6 @@ return 0; } -/* 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 ) { diff -r 90e0382e6579 -r 140450615773 libfdcore/p_cnx.c --- a/libfdcore/p_cnx.c Thu May 16 14:54:42 2013 +0800 +++ b/libfdcore/p_cnx.c Thu May 16 14:56:31 2013 +0800 @@ -120,9 +120,6 @@ AF_INET)); } - /* 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)) { TRACE_DEBUG(INFO, "No address %savailable to connect to peer '%s', aborting", diff -r 90e0382e6579 -r 140450615773 libfdcore/server.c --- a/libfdcore/server.c Thu May 16 14:54:42 2013 +0800 +++ b/libfdcore/server.c Thu May 16 14:56:31 2013 +0800 @@ -341,8 +341,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) { #ifdef DISABLE_SCTP @@ -448,33 +446,6 @@ } } - /* 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; size_t len = 0, offset = 0; diff -r 90e0382e6579 -r 140450615773 libfdproto/dictionary_functions.c --- a/libfdproto/dictionary_functions.c Thu May 16 14:54:42 2013 +0800 +++ b/libfdproto/dictionary_functions.c Thu May 16 14:56:31 2013 +0800 @@ -73,20 +73,11 @@ 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) ); /* 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; @@ -97,20 +88,12 @@ 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) ); /* The order is already good here */ 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; @@ -143,14 +126,11 @@ { 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; @@ -158,14 +138,11 @@ { 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); - } break;