diff options
author | Khem Raj <raj.khem@gmail.com> | 2015-10-07 18:56:31 -0700 |
---|---|---|
committer | Joe MacDonald <joe_macdonald@mentor.com> | 2015-10-21 15:59:03 -0400 |
commit | e8557c2d8da74c5e40151afc5cbbb1d9996c72dc (patch) | |
tree | 9670535caa7b69e4bcf621d014affce2fb4ccb4f /meta-networking | |
parent | c0a865d4efe5e5d702f39ac2793ee7a3de19d236 (diff) | |
download | meta-openembedded-e8557c2d8da74c5e40151afc5cbbb1d9996c72dc.tar.gz |
libnetfilter: Avoid using VLAs
VLAs in composite data types like structures and unions
are not a standard feature of C language, gcc has specific
implementations for but other compilers dont have that done specifically clang, and
the community refuses to implement it since its non standard.
Change-Id: I6ae24adb455bf262fe9406a1c8e3b3a4a0cf77d4
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
Diffstat (limited to 'meta-networking')
-rw-r--r-- | meta-networking/recipes-filter/libnetfilter/files/replace-VLAs-in-union.patch | 89 | ||||
-rw-r--r-- | meta-networking/recipes-filter/libnetfilter/libnetfilter-conntrack_1.0.4.bb | 4 |
2 files changed, 92 insertions, 1 deletions
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 0000000000..16e4af405d --- /dev/null +++ b/meta-networking/recipes-filter/libnetfilter/files/replace-VLAs-in-union.patch | |||
@@ -0,0 +1,89 @@ | |||
1 | VLAs in structs and unions (non-PODs) is unsupported in non-gcc compilers | ||
2 | therefore convert it to not use VLAs instead use fixed arrays | ||
3 | |||
4 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
5 | Upstream-Status: Pending | ||
6 | Index: libnetfilter_conntrack-1.0.4/src/conntrack/api.c | ||
7 | =================================================================== | ||
8 | --- libnetfilter_conntrack-1.0.4.orig/src/conntrack/api.c | ||
9 | +++ libnetfilter_conntrack-1.0.4/src/conntrack/api.c | ||
10 | @@ -954,16 +954,15 @@ int nfct_query(struct nfct_handle *h, | ||
11 | const enum nf_conntrack_query qt, | ||
12 | const void *data) | ||
13 | { | ||
14 | - size_t size = 4096; /* enough for now */ | ||
15 | union { | ||
16 | - char buffer[size]; | ||
17 | + char buffer[4096]; | ||
18 | struct nfnlhdr req; | ||
19 | } u; | ||
20 | |||
21 | assert(h != NULL); | ||
22 | assert(data != NULL); | ||
23 | |||
24 | - if (__build_query_ct(h->nfnlssh_ct, qt, data, &u.req, size) == -1) | ||
25 | + if (__build_query_ct(h->nfnlssh_ct, qt, data, &u.req, 4096) == -1) | ||
26 | return -1; | ||
27 | |||
28 | return nfnl_query(h->nfnlh, &u.req.nlh); | ||
29 | @@ -986,16 +985,15 @@ int nfct_send(struct nfct_handle *h, | ||
30 | const enum nf_conntrack_query qt, | ||
31 | const void *data) | ||
32 | { | ||
33 | - size_t size = 4096; /* enough for now */ | ||
34 | union { | ||
35 | - char buffer[size]; | ||
36 | + char buffer[4096]; | ||
37 | struct nfnlhdr req; | ||
38 | } u; | ||
39 | |||
40 | assert(h != NULL); | ||
41 | assert(data != NULL); | ||
42 | |||
43 | - if (__build_query_ct(h->nfnlssh_ct, qt, data, &u.req, size) == -1) | ||
44 | + if (__build_query_ct(h->nfnlssh_ct, qt, data, &u.req, 4096) == -1) | ||
45 | return -1; | ||
46 | |||
47 | return nfnl_send(h->nfnlh, &u.req.nlh); | ||
48 | Index: libnetfilter_conntrack-1.0.4/src/expect/api.c | ||
49 | =================================================================== | ||
50 | --- libnetfilter_conntrack-1.0.4.orig/src/expect/api.c | ||
51 | +++ libnetfilter_conntrack-1.0.4/src/expect/api.c | ||
52 | @@ -669,16 +669,15 @@ int nfexp_query(struct nfct_handle *h, | ||
53 | const enum nf_conntrack_query qt, | ||
54 | const void *data) | ||
55 | { | ||
56 | - size_t size = 4096; /* enough for now */ | ||
57 | union { | ||
58 | - char buffer[size]; | ||
59 | + char buffer[4096]; | ||
60 | struct nfnlhdr req; | ||
61 | } u; | ||
62 | |||
63 | assert(h != NULL); | ||
64 | assert(data != NULL); | ||
65 | |||
66 | - if (__build_query_exp(h->nfnlssh_exp, qt, data, &u.req, size) == -1) | ||
67 | + if (__build_query_exp(h->nfnlssh_exp, qt, data, &u.req, 4096) == -1) | ||
68 | return -1; | ||
69 | |||
70 | return nfnl_query(h->nfnlh, &u.req.nlh); | ||
71 | @@ -701,16 +700,15 @@ int nfexp_send(struct nfct_handle *h, | ||
72 | const enum nf_conntrack_query qt, | ||
73 | const void *data) | ||
74 | { | ||
75 | - size_t size = 4096; /* enough for now */ | ||
76 | union { | ||
77 | - char buffer[size]; | ||
78 | + char buffer[4096]; | ||
79 | struct nfnlhdr req; | ||
80 | } u; | ||
81 | |||
82 | assert(h != NULL); | ||
83 | assert(data != NULL); | ||
84 | |||
85 | - if (__build_query_exp(h->nfnlssh_exp, qt, data, &u.req, size) == -1) | ||
86 | + if (__build_query_exp(h->nfnlssh_exp, qt, data, &u.req, 4096) == -1) | ||
87 | return -1; | ||
88 | |||
89 | 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 c1df1cb66a..ecbc86ba71 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+" | |||
6 | LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b" | 6 | LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b" |
7 | DEPENDS = "libnfnetlink libmnl" | 7 | DEPENDS = "libnfnetlink libmnl" |
8 | 8 | ||
9 | SRC_URI = "http://www.netfilter.org/projects/libnetfilter_conntrack/files/libnetfilter_conntrack-${PV}.tar.bz2;name=tar" | 9 | SRC_URI = "http://www.netfilter.org/projects/libnetfilter_conntrack/files/libnetfilter_conntrack-${PV}.tar.bz2;name=tar \ |
10 | file://replace-VLAs-in-union.patch \ | ||
11 | " | ||
10 | SRC_URI[tar.md5sum] = "18cf80c4b339a3285e78822dbd4f08d7" | 12 | SRC_URI[tar.md5sum] = "18cf80c4b339a3285e78822dbd4f08d7" |
11 | SRC_URI[tar.sha256sum] = "d9ec4a3caf49417f2b0a2d8d44249133e8c3ec78c757b7eb8c273f1cb6929c7d" | 13 | SRC_URI[tar.sha256sum] = "d9ec4a3caf49417f2b0a2d8d44249133e8c3ec78c757b7eb8c273f1cb6929c7d" |
12 | 14 | ||