Commit 980a54ef authored by Sebastien Decugis's avatar Sebastien Decugis
Browse files

Fix broken test

parent 5429f433
......@@ -52,20 +52,25 @@ int fd_ep_add_merge( struct fd_list * list, sSA * sa, socklen_t sl, uint32_t fla
CHECK_PARAMS( list && sa && (sl <= sizeof(sSS)) );
/* Filter out loopback addresses, unspecified addresses, and invalid families */
ptr.sa = sa;
switch (sa->sa_family) {
case AF_INET:
if (IN_IS_ADDR_UNSPECIFIED(&ptr.sin->sin_addr) || IN_IS_ADDR_LOOPBACK(&ptr.sin->sin_addr))
return 0;
break;
case AF_INET6:
if (IN6_IS_ADDR_UNSPECIFIED(&ptr.sin6->sin6_addr) || IN6_IS_ADDR_LOOPBACK(&ptr.sin6->sin6_addr))
if (! (flags & EP_ACCEPTALL)) {
ptr.sa = sa;
switch (sa->sa_family) {
case AF_INET:
if (IN_IS_ADDR_UNSPECIFIED(&ptr.sin->sin_addr) || IN_IS_ADDR_LOOPBACK(&ptr.sin->sin_addr))
return 0;
break;
case AF_INET6:
if (IN6_IS_ADDR_UNSPECIFIED(&ptr.sin6->sin6_addr) || IN6_IS_ADDR_LOOPBACK(&ptr.sin6->sin6_addr))
return 0;
break;
default:
return 0;
break;
default:
return 0;
}
} else {
/* remove it */
flags &= ~EP_ACCEPTALL;
}
/* Search place in the list */
......
......@@ -590,7 +590,7 @@ int main(int argc, char *argv[])
CHECK( 0, getaddrinfo("localhost", _stringize(TEST_PORT), &hints, &ai) );
aip = ai;
while (aip) {
CHECK( 0, fd_ep_add_merge( &eps, aip->ai_addr, aip->ai_addrlen, EP_FL_DISC ));
CHECK( 0, fd_ep_add_merge( &eps, aip->ai_addr, aip->ai_addrlen, EP_FL_DISC | EP_ACCEPTALL ));
aip = aip->ai_next;
};
freeaddrinfo(ai);
......
......@@ -678,6 +678,7 @@ struct fd_endpoint {
#define EP_FL_ADV (1 << 2) /* This endpoint was advertized in Diameter CER/CEA exchange */
#define EP_FL_LL (1 << 3) /* Lower layer mechanism provided this endpoint */
#define EP_FL_PRIMARY (1 << 4) /* This endpoint is primary in a multihomed SCTP association */
#define EP_ACCEPTALL (1 << 15) /* This flag allows bypassing the address filter in fd_ep_add_merge. */
uint32_t flags; /* Additional information about the endpoint */
/* To add: a validity timestamp for DNS records ? How do we retrieve this lifetime from DNS ? */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment