From 511c77aa994cd7e94844b717fb8ae97bebf66889 Mon Sep 17 00:00:00 2001 From: Ka Ho Ng Date: Mon, 10 Jan 2022 20:19:37 -0500 Subject: [PATCH] ext/libnatpmp: Set sa_len properly in getdefaultgateway() In USE_SOCKET_ROUTE's implementation, sa_len of the sockaddrs need to be set as well. Sponsored by: The FreeBSD Foundation --- ext/libnatpmp/getgateway.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/libnatpmp/getgateway.c b/ext/libnatpmp/getgateway.c index f743a0894..0f06e1dc2 100644 --- a/ext/libnatpmp/getgateway.c +++ b/ext/libnatpmp/getgateway.c @@ -271,7 +271,9 @@ int getdefaultgateway(in_addr_t *addr) rtm.rtm_addrs = rtm_addrs; so_dst.sa_family = AF_INET; + so_dst.sa_len = sizeof(struct sockaddr); so_mask.sa_family = AF_INET; + so_mask.sa_len = sizeof(struct sockaddr); NEXTADDR(RTA_DST, so_dst); NEXTADDR(RTA_NETMASK, so_mask);