From 771a11bae461bccb23ee52f269c61c4bbdf4e152 Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Mon, 16 May 2016 00:40:02 -0700 Subject: conntrack: Fix Clang errors * error: fields must have a constant size: 'variable length array in structure' extension will never be supported Change-Id: Iad4e0452dcf636179227cfadba363a207f2fcb93 --- Android.mk | 1 - src/conntrack/api.c | 11 +++++------ src/expect/api.c | 11 +++++------ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/Android.mk b/Android.mk index fda7fb3..a88c4a7 100644 --- a/Android.mk +++ b/Android.mk @@ -68,7 +68,6 @@ LOCAL_CFLAGS += -include $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include/linu LOCAL_SHARED_LIBRARIES := $(common_SHARED_LIBRARIES) libnfnetlink LOCAL_MODULE:= libnetfilter_conntrack -LOCAL_CLANG := false include $(BUILD_SHARED_LIBRARY) ### diff --git a/src/conntrack/api.c b/src/conntrack/api.c index 09270ee..439e884 100644 --- a/src/conntrack/api.c +++ b/src/conntrack/api.c @@ -950,20 +950,20 @@ int nfct_parse_conntrack(enum nf_conntrack_msg_type type, * On error, -1 is returned and errno is explicitely set. On success, 0 * is returned. */ +#define QUERY_SIZE 4096 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[QUERY_SIZE]; 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, QUERY_SIZE) == -1) return -1; return nfnl_query(h->nfnlh, &u.req.nlh); @@ -986,16 +986,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[QUERY_SIZE]; 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, QUERY_SIZE) == -1) return -1; return nfnl_send(h->nfnlh, &u.req.nlh); diff --git a/src/expect/api.c b/src/expect/api.c index a1dbbff..4521f16 100644 --- a/src/expect/api.c +++ b/src/expect/api.c @@ -665,20 +665,20 @@ int nfexp_parse_expect(enum nf_conntrack_msg_type type, * On error, -1 is returned and errno is explicitely set. On success, 0 * is returned. */ +#define QUERY_SIZE 4096 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[QUERY_SIZE]; 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, QUERY_SIZE) == -1) return -1; return nfnl_query(h->nfnlh, &u.req.nlh); @@ -701,16 +701,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[QUERY_SIZE]; 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, QUERY_SIZE) == -1) return -1; return nfnl_send(h->nfnlh, &u.req.nlh); -- cgit v1.2.3