#include "unetd.h"
-int network_get_endpoint(union network_endpoint *dest, const char *str,
+int network_get_endpoint(union network_endpoint *dest, int af, const char *str,
int default_port, int idx)
{
struct addrinfo hints = {
.ai_flags = AI_ADDRCONFIG,
- .ai_family = AF_UNSPEC,
+ .ai_family = af,
};
char *buf = strdup(str);
char *host = buf, *port;
memset(dest, 0, sizeof(*dest));
if (*host == '[') {
+ if (af == AF_INET)
+ goto out;
+
host++;
port = strchr(host, ']');
if (!port)
}
static inline uint32_t
-csum_tcpudp_nofold(uint32_t saddr, uint32_t daddr, uint32_t len, uint8_t proto)
+csum_tcpudp_nofold(uint32_t saddr, uint32_t daddr, uint8_t proto, uint32_t len)
{
uint64_t sum = 0;