[Openvpn-devel,3/3] dco: Check for ipi_addr before using it

Message ID 20220222132824.18935-4-kprovost@netgate.com
State Not Applicable
Headers show
Series
  • [Openvpn-devel,1/3] dco: dco_meesage_peer_id -> dco_message_peer_id
Related show

Commit Message

Kristof Provost via Openvpn-devel Feb. 22, 2022, 1:28 p.m.
From: Kristof Provost <kp@FreeBSD.org>

If IP_RECVDSTADDR exists we'll define ENABLE_IP_PKTINFO, but that
doesn't actually mean we have struct in_pktinfo. We need to check
HAVE_IN_PKTINFO for that.

This fixes DCO builds on FreeBSD.

Signed-off-by: Kristof Provost <kp@FreeBSD.org>
---
 src/openvpn/dco.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/src/openvpn/dco.c b/src/openvpn/dco.c
index 0ce03664..4234bb22 100644
--- a/src/openvpn/dco.c
+++ b/src/openvpn/dco.c
@@ -44,7 +44,7 @@  static bool
 dco_multi_get_localaddr(struct multi_context *m, struct multi_instance *mi,
                         struct sockaddr_storage *local)
 {
-#if ENABLE_IP_PKTINFO
+#if ENABLE_IP_PKTINFO && defined(HAVE_IN_PKTINFO)
     struct context *c = &mi->context;
 
     if (!(c->options.sockflags & SF_USE_IP_PKTINFO))