also allow binding to IP address with @iface info.iface = "eth0"; info.iface
= "192.168.1.5";
freeifaddrs(ifr);
+ if (rc == -1) {
+ /* check if bind to IP adddress */
+#ifdef LWS_USE_IPV6
+ if (inet_pton(AF_INET6, ifname, &addr6->sin6_addr) == 1)
+ rc = 0;
+ else
+#endif
+ if (inet_pton(AF_INET, ifname, &addr->sin_addr) == 1)
+ rc = 0;
+ }
+
return rc;
}
bzero((char *) &serv_addr4, sizeof(serv_addr4));
serv_addr4.sin_addr.s_addr = INADDR_ANY;
serv_addr4.sin_family = AF_INET;
- serv_addr4.sin_port = htons(info->port);
if (info->iface) {
if (interface_to_sa(context, info->iface,
return 1;
}
}
+
+ serv_addr4.sin_port = htons(info->port);
} /* ipv4 */
n = bind(sockfd, v, n);