* [meta-networking][PATCH 1/2] net-snmp: Fix build with gcc5 @ 2015-10-03 19:55 Khem Raj 2015-10-03 19:55 ` [meta-networking][PATCH 2/2] libnetfilter: Avoid using VLAs Khem Raj 0 siblings, 1 reply; 4+ messages in thread From: Khem Raj @ 2015-10-03 19:55 UTC (permalink / raw) To: openembedded-devel Fix errors seen with gcc5 Change-Id: I9c4361f3a9c25342f5c740263f551c162dce8faf Signed-off-by: Khem Raj <raj.khem@gmail.com> --- ...tools.c-Don-t-check-for-return-from-EVP_M.patch | 33 ++++++++++++++++++++++ .../recipes-protocols/net-snmp/net-snmp_5.7.3.bb | 1 + 2 files changed, 34 insertions(+) create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch new file mode 100644 index 0000000..af242fa --- /dev/null +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch @@ -0,0 +1,33 @@ +From d3027a227bc0f603a5b650d01f97ee1dec515be5 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 18 Sep 2015 00:28:45 -0400 +Subject: [PATCH] snmplib/keytools.c: Don't check for return from + EVP_MD_CTX_init() + +EVP_MD_CTX_init() API returns void, it fixes errors with new compilers + +snmplib/keytools.c: In function 'generate_Ku': error: invalid use of void expression + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Submitted [https://sourceforge.net/p/net-snmp/patches/1317/] + snmplib/keytools.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/snmplib/keytools.c b/snmplib/keytools.c +index 0ccb3a6..880fc14 100644 +--- a/snmplib/keytools.c ++++ b/snmplib/keytools.c +@@ -153,8 +153,7 @@ generate_Ku(const oid * hashtype, u_int hashtype_len, + ctx = EVP_MD_CTX_create(); + #else + ctx = malloc(sizeof(*ctx)); +- if (!EVP_MD_CTX_init(ctx)) +- return SNMPERR_GENERR; ++ EVP_MD_CTX_init(ctx); + #endif + #ifndef NETSNMP_DISABLE_MD5 + if (ISTRANSFORM(hashtype, HMACMD5Auth)) { +-- +2.5.2 + diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb index 431a633..b32d842 100644 --- a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb @@ -20,6 +20,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \ file://run-ptest \ file://dont-return-incompletely-parsed-varbinds.patch \ file://0001-config_os_headers-Error-Fix.patch \ + file://0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch \ " SRC_URI[md5sum] = "9f682bd70c717efdd9f15b686d07baee" SRC_URI[sha256sum] = "e8dfc79b6539b71a6ff335746ce63d2da2239062ad41872fff4354cafed07a3e" -- 2.6.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [meta-networking][PATCH 2/2] libnetfilter: Avoid using VLAs 2015-10-03 19:55 [meta-networking][PATCH 1/2] net-snmp: Fix build with gcc5 Khem Raj @ 2015-10-03 19:55 ` Khem Raj 2015-10-03 22:34 ` Phil Blundell 0 siblings, 1 reply; 4+ messages in thread From: Khem Raj @ 2015-10-03 19:55 UTC (permalink / raw) To: openembedded-devel VLAs in non POD data types like structures and unions are not a standard feature of C language and gcc has specific implementation which other compilers dont have specifically clang, and they refuse to implement it since its non standard. Change-Id: I6ae24adb455bf262fe9406a1c8e3b3a4a0cf77d4 Signed-off-by: Khem Raj <raj.khem@gmail.com> --- .../libnetfilter/files/replace-VLAs-in-union.patch | 89 ++++++++++++++++++++++ .../libnetfilter/libnetfilter-conntrack_1.0.4.bb | 4 +- 2 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 meta-networking/recipes-filter/libnetfilter/files/replace-VLAs-in-union.patch diff --git a/meta-networking/recipes-filter/libnetfilter/files/replace-VLAs-in-union.patch b/meta-networking/recipes-filter/libnetfilter/files/replace-VLAs-in-union.patch new file mode 100644 index 0000000..16e4af4 --- /dev/null +++ b/meta-networking/recipes-filter/libnetfilter/files/replace-VLAs-in-union.patch @@ -0,0 +1,89 @@ +VLAs in structs and unions (non-PODs) is unsupported in non-gcc compilers +therefore convert it to not use VLAs instead use fixed arrays + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Upstream-Status: Pending +Index: libnetfilter_conntrack-1.0.4/src/conntrack/api.c +=================================================================== +--- libnetfilter_conntrack-1.0.4.orig/src/conntrack/api.c ++++ libnetfilter_conntrack-1.0.4/src/conntrack/api.c +@@ -954,16 +954,15 @@ int nfct_query(struct nfct_handle *h, + const enum nf_conntrack_query qt, + const void *data) + { +- size_t size = 4096; /* enough for now */ + union { +- char buffer[size]; ++ char buffer[4096]; + struct nfnlhdr req; + } u; + + assert(h != NULL); + assert(data != NULL); + +- if (__build_query_ct(h->nfnlssh_ct, qt, data, &u.req, size) == -1) ++ if (__build_query_ct(h->nfnlssh_ct, qt, data, &u.req, 4096) == -1) + return -1; + + return nfnl_query(h->nfnlh, &u.req.nlh); +@@ -986,16 +985,15 @@ int nfct_send(struct nfct_handle *h, + const enum nf_conntrack_query qt, + const void *data) + { +- size_t size = 4096; /* enough for now */ + union { +- char buffer[size]; ++ char buffer[4096]; + struct nfnlhdr req; + } u; + + assert(h != NULL); + assert(data != NULL); + +- if (__build_query_ct(h->nfnlssh_ct, qt, data, &u.req, size) == -1) ++ if (__build_query_ct(h->nfnlssh_ct, qt, data, &u.req, 4096) == -1) + return -1; + + return nfnl_send(h->nfnlh, &u.req.nlh); +Index: libnetfilter_conntrack-1.0.4/src/expect/api.c +=================================================================== +--- libnetfilter_conntrack-1.0.4.orig/src/expect/api.c ++++ libnetfilter_conntrack-1.0.4/src/expect/api.c +@@ -669,16 +669,15 @@ int nfexp_query(struct nfct_handle *h, + const enum nf_conntrack_query qt, + const void *data) + { +- size_t size = 4096; /* enough for now */ + union { +- char buffer[size]; ++ char buffer[4096]; + struct nfnlhdr req; + } u; + + assert(h != NULL); + assert(data != NULL); + +- if (__build_query_exp(h->nfnlssh_exp, qt, data, &u.req, size) == -1) ++ if (__build_query_exp(h->nfnlssh_exp, qt, data, &u.req, 4096) == -1) + return -1; + + return nfnl_query(h->nfnlh, &u.req.nlh); +@@ -701,16 +700,15 @@ int nfexp_send(struct nfct_handle *h, + const enum nf_conntrack_query qt, + const void *data) + { +- size_t size = 4096; /* enough for now */ + union { +- char buffer[size]; ++ char buffer[4096]; + struct nfnlhdr req; + } u; + + assert(h != NULL); + assert(data != NULL); + +- if (__build_query_exp(h->nfnlssh_exp, qt, data, &u.req, size) == -1) ++ if (__build_query_exp(h->nfnlssh_exp, qt, data, &u.req, 4096) == -1) + return -1; + + return nfnl_send(h->nfnlh, &u.req.nlh); diff --git a/meta-networking/recipes-filter/libnetfilter/libnetfilter-conntrack_1.0.4.bb b/meta-networking/recipes-filter/libnetfilter/libnetfilter-conntrack_1.0.4.bb index c1df1cb..ecbc86b 100644 --- a/meta-networking/recipes-filter/libnetfilter/libnetfilter-conntrack_1.0.4.bb +++ b/meta-networking/recipes-filter/libnetfilter/libnetfilter-conntrack_1.0.4.bb @@ -6,7 +6,9 @@ LICENSE = "GPLv2+" LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b" DEPENDS = "libnfnetlink libmnl" -SRC_URI = "http://www.netfilter.org/projects/libnetfilter_conntrack/files/libnetfilter_conntrack-${PV}.tar.bz2;name=tar" +SRC_URI = "http://www.netfilter.org/projects/libnetfilter_conntrack/files/libnetfilter_conntrack-${PV}.tar.bz2;name=tar \ + file://replace-VLAs-in-union.patch \ +" SRC_URI[tar.md5sum] = "18cf80c4b339a3285e78822dbd4f08d7" SRC_URI[tar.sha256sum] = "d9ec4a3caf49417f2b0a2d8d44249133e8c3ec78c757b7eb8c273f1cb6929c7d" -- 2.6.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [meta-networking][PATCH 2/2] libnetfilter: Avoid using VLAs 2015-10-03 19:55 ` [meta-networking][PATCH 2/2] libnetfilter: Avoid using VLAs Khem Raj @ 2015-10-03 22:34 ` Phil Blundell 2015-10-03 22:55 ` Khem Raj 0 siblings, 1 reply; 4+ messages in thread From: Phil Blundell @ 2015-10-03 22:34 UTC (permalink / raw) To: openembedded-devel On Sat, 2015-10-03 at 12:55 -0700, Khem Raj wrote: > VLAs in non POD data types like structures and unions > are not a standard feature of C language and gcc has specific > implementation which other compilers dont have specifically clang, and > they refuse to implement it since its non standard. The reference to "POD" here is a bit confusing. By the generally accepted meaning of the term, structs and unions would in fact be POD just like any other C type. But you seem to be using the term here to mean something along the lines of "non-aggregate type", which isn't a usage I've previously encountered. This is particularly confusing in this context because there is a different clang limitation which applies to VLAs where the variable-length element is not POD, irrespective of whether it is inside an aggregate or not, and someone reading your comment might be misled into thinking that this was the issue here. p. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [meta-networking][PATCH 2/2] libnetfilter: Avoid using VLAs 2015-10-03 22:34 ` Phil Blundell @ 2015-10-03 22:55 ` Khem Raj 0 siblings, 0 replies; 4+ messages in thread From: Khem Raj @ 2015-10-03 22:55 UTC (permalink / raw) To: openembeded-devel On Sat, Oct 3, 2015 at 3:34 PM, Phil Blundell <philb@gnu.org> wrote: > On Sat, 2015-10-03 at 12:55 -0700, Khem Raj wrote: >> VLAs in non POD data types like structures and unions >> are not a standard feature of C language and gcc has specific >> implementation which other compilers dont have specifically clang, and >> they refuse to implement it since its non standard. > > The reference to "POD" here is a bit confusing. By the generally > accepted meaning of the term, structs and unions would in fact be POD > just like any other C type. But you seem to be using the term here to > mean something along the lines of "non-aggregate type", which isn't a > usage I've previously encountered. > > This is particularly confusing in this context because there is a > different clang limitation which applies to VLAs where the > variable-length element is not POD, irrespective of whether it is inside > an aggregate or not, and someone reading your comment might be misled > into thinking that this was the issue here. Yes, infact I should have said composite data types instead of non-POD data types. I will send a v2 which should clear this confusion. > p. > > > > -- > _______________________________________________ > Openembedded-devel mailing list > Openembedded-devel@lists.openembedded.org > http://lists.openembedded.org/mailman/listinfo/openembedded-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-03 22:55 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-10-03 19:55 [meta-networking][PATCH 1/2] net-snmp: Fix build with gcc5 Khem Raj 2015-10-03 19:55 ` [meta-networking][PATCH 2/2] libnetfilter: Avoid using VLAs Khem Raj 2015-10-03 22:34 ` Phil Blundell 2015-10-03 22:55 ` Khem Raj
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox