Re: WMM related compile bug on F17

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/21/20 10:22 AM, Jouni Malinen wrote:
On Tue, Jan 21, 2020 at 10:12:09AM -0800, Ben Greear wrote:
While trying to get latest code to build on F17 and other older systems, I noticed
that this code fails to compile:

struct hostapd_wmm_ac_params wmmp[WMM_AC_NUM] = { 0 };

It looks like WMM_AC_NUM is treated as 0, even though the enum defines it
as 4.

Anyone know if this is some particular compiler bug or an acceptable work-around?

Which compilers and versions produced the error and what was the exact
error?


First, I'm using latest upstream with my changes on top, with this work-in-progress patch
to fix openssl compilation.  I'm compiling on fedora-17 32-bit currently, since that is the
oldest thing I compile against.


[greearb@v-f17-32 hostap]$ git diff
diff --git a/src/ap/wmm.c b/src/ap/wmm.c
index 881fd9f..d9721f8 100644
--- a/src/ap/wmm.c
+++ b/src/ap/wmm.c
@@ -111,6 +111,9 @@ u8 * hostapd_eid_wmm(struct hostapd_data *hapd, u8 *eid)
        u8 *pos = eid;
        struct wmm_parameter_element *wmm =
                (struct wmm_parameter_element *) (pos + 2);
+#if WMM_AC_VO == 0
+#error bad
+#endif
        struct hostapd_wmm_ac_params wmmp[WMM_AC_NUM] = { 0 };
        int e;

diff --git a/src/crypto/tls_openssl.c b/src/crypto/tls_openssl.c
index 9d11c8a..3fb29e3 100644
--- a/src/crypto/tls_openssl.c
+++ b/src/crypto/tls_openssl.c
@@ -2682,6 +2682,7 @@ static int tls_connection_ca_cert(struct tls_data *data,
                                      (const unsigned char **) &ca_cert_blob,
                                      ca_cert_blob_len);
                if (cert == NULL) {
+#if OPENSSL_VERSION_NUMBER >= 0x10200000L
                        BIO *bio = BIO_new_mem_buf(ca_cert_blob,
                                                   ca_cert_blob_len);

@@ -2699,6 +2700,11 @@ static int tls_connection_ca_cert(struct tls_data *data,
                        while (ERR_get_error()) {
                                /* Ignore errors from DER conversion. */
                        }
+#else
+                       tls_show_errors(MSG_WARNING, __func__,
+                                       "Failed to parse ca_cert_blob");
+                       return -1;
+#endif
                }

                if (!X509_STORE_add_cert(SSL_CTX_get_cert_store(ssl_ctx),
@@ -5253,6 +5259,7 @@ static void openssl_debug_dump_cipher_list(SSL_CTX *ssl_ctx)


 #if !defined(LIBRESSL_VERSION_NUMBER) && !defined(BORINGSSL_API_VERSION)
+#if OPENSSL_VERSION_NUMBER >= 0x10200000L

 static const char * openssl_pkey_type_str(const EVP_PKEY *pkey)
 {
@@ -5312,11 +5319,13 @@ static void openssl_debug_dump_certificates(SSL_CTX *ssl_ctx)
 }

 #endif
+#endif


 static void openssl_debug_dump_certificate_chains(SSL_CTX *ssl_ctx)
 {
 #if !defined(LIBRESSL_VERSION_NUMBER) && !defined(BORINGSSL_API_VERSION)
+#if OPENSSL_VERSION_NUMBER >= 0x10200000L
        int res;

        for (res = SSL_CTX_set_current_cert(ssl_ctx, SSL_CERT_SET_FIRST);
@@ -5326,6 +5335,7 @@ static void openssl_debug_dump_certificate_chains(SSL_CTX *ssl_ctx)

        SSL_CTX_set_current_cert(ssl_ctx, SSL_CERT_SET_FIRST);
 #endif
+#endif
 }


@@ -5660,6 +5670,10 @@ u16 tls_connection_get_cipher_suite(struct tls_connection *conn)
 #if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
        return SSL_CIPHER_get_protocol_id(cipher);
 #else
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+       return cipher->id & 0XFFFF;
+#else
        return SSL_CIPHER_get_id(cipher) & 0xFFFF;
 #endif
+#endif
 }


Compile error:

../src/ap/wmm.c: In function ‘hostapd_eid_wmm’:
../src/ap/wmm.c:115:2: error: #error bad
../src/ap/wmm.c:117:9: warning: missing braces around initializer [-Wmissing-braces]
../src/ap/wmm.c:117:9: warning: (near initialization for ‘wmmp[0]’) [-Wmissing-braces]
make[1]: *** [../src/ap/wmm.o] Error 1
make[1]: Leaving directory `/home/greearb/git/btbits/3plibs/hostap/hostapd'
make: *** [hostap_only] Error 2

greearb@v-f17-32 hostap]$ gcc --version
gcc (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Thanks,
Ben

--
Ben Greear <greearb@xxxxxxxxxxxxxxx>
Candela Technologies Inc  http://www.candelatech.com


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux