]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix build failure on freebsd due to missing data declaration
authorTomas Mraz <tomas@openssl.org>
Mon, 5 Sep 2022 08:17:58 +0000 (10:17 +0200)
committerTomas Mraz <tomas@openssl.org>
Wed, 7 Sep 2022 06:20:43 +0000 (08:20 +0200)
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19130)

crypto/bio/bss_dgram.c

index 2675a038748a5aed5391a3193372aba7d351dc57..09619e13a0970fcfb1ac764d3d7b68c98382aa04 100644 (file)
@@ -1105,12 +1105,14 @@ static int extract_local(BIO *b, MSGHDR_TYPE *mh, BIO_ADDR *local) {
 
 static int pack_local(BIO *b, MSGHDR_TYPE *mh, const BIO_ADDR *local) {
     int af = dgram_get_sock_family(b);
+#  if defined(IP_PKTINFO) || defined(IP_RECVDSTADDR) || defined(IPV6_PKTINFO)
+    CMSGHDR_TYPE *cmsg;
+    bio_dgram_data *data = b->ptr;
+#  endif
 
     if (af == AF_INET) {
 #  if defined(IP_PKTINFO)
-        CMSGHDR_TYPE *cmsg;
         struct in_pktinfo *info;
-        bio_dgram_data *data = b->ptr;
 
 #   if defined(OPENSSL_SYS_WINDOWS)
         cmsg = (CMSGHDR_TYPE *)mh->Control.buf;
@@ -1147,18 +1149,15 @@ static int pack_local(BIO *b, MSGHDR_TYPE *mh, const BIO_ADDR *local) {
         return 1;
 
 #  elif defined(IP_SENDSRCADDR)
-        {
-            struct cmsghdr *cmsg;
-            struct in_addr *info;
+        struct in_addr *info;
 
-            cmsg = (struct cmsghdr *)mh->msg_control;
-            cmsg->cmsg_len   = BIO_CMSG_LEN(sizeof(struct in_addr));
-            cmsg->cmsg_level = IPPROTO_IP;
-            cmsg->cmsg_type  = IP_SENDSRCADDR;
+        cmsg = (struct cmsghdr *)mh->msg_control;
+        cmsg->cmsg_len   = BIO_CMSG_LEN(sizeof(struct in_addr));
+        cmsg->cmsg_level = IPPROTO_IP;
+        cmsg->cmsg_type  = IP_SENDSRCADDR;
 
-            info = (struct in_addr *)BIO_CMSG_DATA(cmsg);
-            *info = local->s_in.sin_addr;
-        }
+        info = (struct in_addr *)BIO_CMSG_DATA(cmsg);
+        *info = local->s_in.sin_addr;
 
         /* See comment above. */
         if (local->s_in.sin_port != 0
@@ -1174,9 +1173,7 @@ static int pack_local(BIO *b, MSGHDR_TYPE *mh, const BIO_ADDR *local) {
 #  if OPENSSL_USE_IPV6
     else if (af == AF_INET6) {
 #   if defined(IPV6_PKTINFO)
-        CMSGHDR_TYPE *cmsg;
         struct in6_pktinfo *info;
-        bio_dgram_data *data = b->ptr;
 
 #    if defined(OPENSSL_SYS_WINDOWS)
         cmsg = (CMSGHDR_TYPE *)mh->Control.buf;