if (!ifaddr || !ifnetmask) continue;
if (ifaddr->ss_family != local->ss_family) continue;
if (!any_address && !ip_check_equal(ifaddr, local)) continue;
- ret = !!ip_check_in_network_v4(ifaddr, ifnetmask, peer);
+ ret = !!ip_check_in_network(ifaddr, ifnetmask, peer);
if (ret) {
if (used_local)
memcpy(used_local, ifaddr, sizeof(struct sockaddr));
}
if (ss.ss_family == AF_INET)
- IP_AS_V4(ss, port) = 0;
+ IP_AS_V4(&ss, port) = 0;
else
- IP_AS_V6(ss, port) = 0;
+ IP_AS_V6(&ss, port) = 0;
memset(deflt, 0, sizeof(*deflt));
memcpy(deflt, &ss, ss_len);
if (tcp_default_ip_addr(bound, family) < 0)
return -1;
if (bound->ss_family == AF_INET)
- IP_AS_V4(*bound, port) = port;
+ IP_AS_V4(bound, port) = port;
else
- IP_AS_V6(*bound, port) = port;
+ IP_AS_V6(bound, port) = port;
return 0;
}
}
if (use->ai_family == AF_INET6) {
ss->ss_family = AF_INET6;
- IP_AS_V6(*ss, port) = htons(port);
- memcpy(&IP_AS_V6(*ss, addr), &((struct sockaddr_in6 *)use->ai_addr)->sin6_addr,
+ IP_AS_V6(ss, port) = htons(port);
+ memcpy(&IP_AS_V6(ss, addr), &((struct sockaddr_in6 *)use->ai_addr)->sin6_addr,
sizeof(struct in6_addr));
- *multicast = !!IN6_IS_ADDR_MULTICAST(&IP_AS_V6(*ss, addr));
+ *multicast = !!IN6_IS_ADDR_MULTICAST(&IP_AS_V6(ss, addr));
} else if (use->ai_family == AF_INET) {
ss->ss_family = AF_INET;
- IP_AS_V4(*ss, port) = htons(port);
- IP_AS_V4(*ss, addr) = ((struct sockaddr_in *)use->ai_addr)->sin_addr;
- *multicast = !!IN_MULTICAST(ntohl(IP_AS_V4(*ss, addr.s_addr)));
+ IP_AS_V4(ss, port) = htons(port);
+ IP_AS_V4(ss, addr) = ((struct sockaddr_in *)use->ai_addr)->sin_addr;
+ *multicast = !!IN_MULTICAST(ntohl(IP_AS_V4(ss, addr.s_addr)));
}
freeaddrinfo(ressave);
if (ss->ss_family != AF_INET && ss->ss_family != AF_INET6) {
/* Bind useful for receiver subsystem (not for udp streamer) */
if (subsystem != LS_UDP) {
if (bind(fd, (struct sockaddr *)&uc->ip, sizeof(struct sockaddr_in))) {
- inet_ntop(AF_INET, &IP_AS_V4(uc->ip, addr), buf, sizeof(buf));
+ inet_ntop(AF_INET, &IP_AS_V4(&uc->ip, addr), buf, sizeof(buf));
tvherror(subsystem, "%s - cannot bind %s:%hu [e=%s]",
- name, buf, ntohs(IP_AS_V4(uc->ip, port)), strerror(errno));
+ name, buf, ntohs(IP_AS_V4(&uc->ip, port)), strerror(errno));
goto error;
}
}
struct ip_mreq_source ms;
memset(&ms, 0, sizeof(ms));
- ms.imr_multiaddr = IP_AS_V4(uc->ip, addr);
+ ms.imr_multiaddr = IP_AS_V4(&uc->ip, addr);
/* Note, ip_mreq_source does not support the ifindex parameter,
so we have to resolve to the ip of the interface on all platforms. */
#endif
memset(&m, 0, sizeof(m));
- m.imr_multiaddr = IP_AS_V4(uc->ip, addr);
+ m.imr_multiaddr = IP_AS_V4(&uc->ip, addr);
#if !defined(PLATFORM_DARWIN)
m.imr_address.s_addr = 0;
m.imr_ifindex = ifindex;
/* Bind */
if (bind(fd, (struct sockaddr *)&uc->ip, sizeof(struct sockaddr_in6))) {
- inet_ntop(AF_INET6, &IP_AS_V6(uc->ip, addr), buf, sizeof(buf));
+ inet_ntop(AF_INET6, &IP_AS_V6(&uc->ip, addr), buf, sizeof(buf));
tvherror(subsystem, "%s - cannot bind %s:%hu [e=%s]",
- name, buf, ntohs(IP_AS_V6(uc->ip, port)), strerror(errno));
+ name, buf, ntohs(IP_AS_V6(&uc->ip, port)), strerror(errno));
goto error;
}
if (uc->multicast) {
/* Join group */
- m.ipv6mr_multiaddr = IP_AS_V6(uc->ip, addr);
+ m.ipv6mr_multiaddr = IP_AS_V6(&uc->ip, addr);
m.ipv6mr_interface = ifindex;
#ifdef SOL_IPV6
if (setsockopt(fd, SOL_IPV6, IPV6_ADD_MEMBERSHIP, &m, sizeof(m))) {