Revision 892e86ab transports/janus_http.c

View differences:

transports/janus_http.c
256 256
	gboolean ipv6 = FALSE;
257 257
	if(ip && strstr(ip, ":"))
258 258
		ipv6 = TRUE;
259
	if(ip || interface) {
260
		gboolean found = FALSE;
259
	gboolean found = FALSE;
260
	if(ip) {
261
		/* Do a quick check to see if we need to bind on all addresses of a specific family */
262
		if(!strcasecmp(ip, "0.0.0.0")) {
263
			/* Bind on all IPv4 addresses */
264
			found = TRUE;
265
			memset(&addr, 0, sizeof (struct sockaddr_in));
266
			addr.sin_family = AF_INET;
267
			addr.sin_port = htons(port);
268
			addr.sin_addr.s_addr = INADDR_ANY;
269
		} else if(!strcasecmp(ip, "::")) {
270
			/* Bind on all IPv6 addresses */
271
			found = TRUE;
272
			memset(&addr6, 0, sizeof (struct sockaddr_in6));
273
			addr6.sin6_family = AF_INET6;
274
			addr6.sin6_port = htons(port);
275
			addr6.sin6_addr = in6addr_any;
276
		}
277
	}
278
	if(!found && (ip || interface)) {
261 279
		struct ifaddrs *ifaddr = NULL, *ifa = NULL;
262 280
		int family = 0, s = 0, n = 0;
263 281
		char host[NI_MAXHOST];

Also available in: Unified diff