@@ -18,7 +18,7 @@ struct expr_ops {
const void *(*get)(const struct nftnl_expr *e, uint16_t type, uint32_t *data_len);
int (*parse)(struct nftnl_expr *e, struct nlattr *attr);
void (*build)(struct nlmsghdr *nlh, const struct nftnl_expr *e);
- int (*snprintf)(char *buf, size_t len, uint32_t flags, const struct nftnl_expr *e);
+ int (*output)(char *buf, size_t len, uint32_t flags, const struct nftnl_expr *e);
};
struct expr_ops *nftnl_expr_ops_lookup(const char *name);
@@ -109,7 +109,7 @@ struct obj_ops {
const void *(*get)(const struct nftnl_obj *e, uint16_t type, uint32_t *data_len);
int (*parse)(struct nftnl_obj *e, struct nlattr *attr);
void (*build)(struct nlmsghdr *nlh, const struct nftnl_obj *e);
- int (*snprintf)(char *buf, size_t len, uint32_t flags, const struct nftnl_obj *e);
+ int (*output)(char *buf, size_t len, uint32_t flags, const struct nftnl_obj *e);
};
extern struct obj_ops obj_ops_counter;
@@ -279,10 +279,10 @@ int nftnl_expr_snprintf(char *buf, size_t remain, const struct nftnl_expr *expr,
if (remain)
buf[0] = '\0';
- if (!expr->ops->snprintf || type != NFTNL_OUTPUT_DEFAULT)
+ if (!expr->ops->output || type != NFTNL_OUTPUT_DEFAULT)
return 0;
- ret = expr->ops->snprintf(buf + offset, remain, flags, expr);
+ ret = expr->ops->output(buf + offset, remain, flags, expr);
SNPRINTF_BUFFER_SIZE(ret, remain, offset);
return offset;
@@ -282,5 +282,5 @@ struct expr_ops expr_ops_bitwise = {
.get = nftnl_expr_bitwise_get,
.parse = nftnl_expr_bitwise_parse,
.build = nftnl_expr_bitwise_build,
- .snprintf = nftnl_expr_bitwise_snprintf,
+ .output = nftnl_expr_bitwise_snprintf,
};
@@ -220,5 +220,5 @@ struct expr_ops expr_ops_byteorder = {
.get = nftnl_expr_byteorder_get,
.parse = nftnl_expr_byteorder_parse,
.build = nftnl_expr_byteorder_build,
- .snprintf = nftnl_expr_byteorder_snprintf,
+ .output = nftnl_expr_byteorder_snprintf,
};
@@ -202,5 +202,5 @@ struct expr_ops expr_ops_cmp = {
.get = nftnl_expr_cmp_get,
.parse = nftnl_expr_cmp_parse,
.build = nftnl_expr_cmp_build,
- .snprintf = nftnl_expr_cmp_snprintf,
+ .output = nftnl_expr_cmp_snprintf,
};
@@ -135,5 +135,5 @@ struct expr_ops expr_ops_connlimit = {
.get = nftnl_expr_connlimit_get,
.parse = nftnl_expr_connlimit_parse,
.build = nftnl_expr_connlimit_build,
- .snprintf = nftnl_expr_connlimit_snprintf,
+ .output = nftnl_expr_connlimit_snprintf,
};
@@ -133,5 +133,5 @@ struct expr_ops expr_ops_counter = {
.get = nftnl_expr_counter_get,
.parse = nftnl_expr_counter_parse,
.build = nftnl_expr_counter_build,
- .snprintf = nftnl_expr_counter_snprintf,
+ .output = nftnl_expr_counter_snprintf,
};
@@ -258,5 +258,5 @@ struct expr_ops expr_ops_ct = {
.get = nftnl_expr_ct_get,
.parse = nftnl_expr_ct_parse,
.build = nftnl_expr_ct_build,
- .snprintf = nftnl_expr_ct_snprintf,
+ .output = nftnl_expr_ct_snprintf,
};
@@ -138,5 +138,5 @@ struct expr_ops expr_ops_dup = {
.get = nftnl_expr_dup_get,
.parse = nftnl_expr_dup_parse,
.build = nftnl_expr_dup_build,
- .snprintf = nftnl_expr_dup_snprintf,
+ .output = nftnl_expr_dup_snprintf,
};
@@ -373,5 +373,5 @@ struct expr_ops expr_ops_dynset = {
.get = nftnl_expr_dynset_get,
.parse = nftnl_expr_dynset_parse,
.build = nftnl_expr_dynset_build,
- .snprintf = nftnl_expr_dynset_snprintf,
+ .output = nftnl_expr_dynset_snprintf,
};
@@ -267,5 +267,5 @@ struct expr_ops expr_ops_exthdr = {
.get = nftnl_expr_exthdr_get,
.parse = nftnl_expr_exthdr_parse,
.build = nftnl_expr_exthdr_build,
- .snprintf = nftnl_expr_exthdr_snprintf,
+ .output = nftnl_expr_exthdr_snprintf,
};
@@ -198,5 +198,5 @@ struct expr_ops expr_ops_fib = {
.get = nftnl_expr_fib_get,
.parse = nftnl_expr_fib_parse,
.build = nftnl_expr_fib_build,
- .snprintf = nftnl_expr_fib_snprintf,
+ .output = nftnl_expr_fib_snprintf,
};
@@ -120,5 +120,5 @@ struct expr_ops expr_ops_flow = {
.get = nftnl_expr_flow_get,
.parse = nftnl_expr_flow_parse,
.build = nftnl_expr_flow_build,
- .snprintf = nftnl_expr_flow_snprintf,
+ .output = nftnl_expr_flow_snprintf,
};
@@ -158,5 +158,5 @@ struct expr_ops expr_ops_fwd = {
.get = nftnl_expr_fwd_get,
.parse = nftnl_expr_fwd_parse,
.build = nftnl_expr_fwd_build,
- .snprintf = nftnl_expr_fwd_snprintf,
+ .output = nftnl_expr_fwd_snprintf,
};
@@ -226,5 +226,5 @@ struct expr_ops expr_ops_hash = {
.get = nftnl_expr_hash_get,
.parse = nftnl_expr_hash_parse,
.build = nftnl_expr_hash_build,
- .snprintf = nftnl_expr_hash_snprintf,
+ .output = nftnl_expr_hash_snprintf,
};
@@ -229,5 +229,5 @@ struct expr_ops expr_ops_immediate = {
.get = nftnl_expr_immediate_get,
.parse = nftnl_expr_immediate_parse,
.build = nftnl_expr_immediate_build,
- .snprintf = nftnl_expr_immediate_snprintf,
+ .output = nftnl_expr_immediate_snprintf,
};
@@ -134,5 +134,5 @@ struct expr_ops expr_ops_last = {
.get = nftnl_expr_last_get,
.parse = nftnl_expr_last_parse,
.build = nftnl_expr_last_build,
- .snprintf = nftnl_expr_last_snprintf,
+ .output = nftnl_expr_last_snprintf,
};
@@ -202,5 +202,5 @@ struct expr_ops expr_ops_limit = {
.get = nftnl_expr_limit_get,
.parse = nftnl_expr_limit_parse,
.build = nftnl_expr_limit_build,
- .snprintf = nftnl_expr_limit_snprintf,
+ .output = nftnl_expr_limit_snprintf,
};
@@ -253,5 +253,5 @@ struct expr_ops expr_ops_log = {
.get = nftnl_expr_log_get,
.parse = nftnl_expr_log_parse,
.build = nftnl_expr_log_build,
- .snprintf = nftnl_expr_log_snprintf,
+ .output = nftnl_expr_log_snprintf,
};
@@ -206,5 +206,5 @@ struct expr_ops expr_ops_lookup = {
.get = nftnl_expr_lookup_get,
.parse = nftnl_expr_lookup_parse,
.build = nftnl_expr_lookup_build,
- .snprintf = nftnl_expr_lookup_snprintf,
+ .output = nftnl_expr_lookup_snprintf,
};
@@ -163,5 +163,5 @@ struct expr_ops expr_ops_masq = {
.get = nftnl_expr_masq_get,
.parse = nftnl_expr_masq_parse,
.build = nftnl_expr_masq_build,
- .snprintf = nftnl_expr_masq_snprintf,
+ .output = nftnl_expr_masq_snprintf,
};
@@ -189,5 +189,5 @@ struct expr_ops expr_ops_match = {
.get = nftnl_expr_match_get,
.parse = nftnl_expr_match_parse,
.build = nftnl_expr_match_build,
- .snprintf = nftnl_expr_match_snprintf,
+ .output = nftnl_expr_match_snprintf,
};
@@ -216,5 +216,5 @@ struct expr_ops expr_ops_meta = {
.get = nftnl_expr_meta_get,
.parse = nftnl_expr_meta_parse,
.build = nftnl_expr_meta_build,
- .snprintf = nftnl_expr_meta_snprintf,
+ .output = nftnl_expr_meta_snprintf,
};
@@ -274,5 +274,5 @@ struct expr_ops expr_ops_nat = {
.get = nftnl_expr_nat_get,
.parse = nftnl_expr_nat_parse,
.build = nftnl_expr_nat_build,
- .snprintf = nftnl_expr_nat_snprintf,
+ .output = nftnl_expr_nat_snprintf,
};
@@ -180,5 +180,5 @@ struct expr_ops expr_ops_ng = {
.get = nftnl_expr_ng_get,
.parse = nftnl_expr_ng_parse,
.build = nftnl_expr_ng_build,
- .snprintf = nftnl_expr_ng_snprintf,
+ .output = nftnl_expr_ng_snprintf,
};
@@ -205,5 +205,5 @@ struct expr_ops expr_ops_objref = {
.get = nftnl_expr_objref_get,
.parse = nftnl_expr_objref_parse,
.build = nftnl_expr_objref_build,
- .snprintf = nftnl_expr_objref_snprintf,
+ .output = nftnl_expr_objref_snprintf,
};
@@ -147,5 +147,5 @@ struct expr_ops expr_ops_osf = {
.get = nftnl_expr_osf_get,
.parse = nftnl_expr_osf_parse,
.build = nftnl_expr_osf_build,
- .snprintf = nftnl_expr_osf_snprintf,
+ .output = nftnl_expr_osf_snprintf,
};
@@ -259,5 +259,5 @@ struct expr_ops expr_ops_payload = {
.get = nftnl_expr_payload_get,
.parse = nftnl_expr_payload_parse,
.build = nftnl_expr_payload_build,
- .snprintf = nftnl_expr_payload_snprintf,
+ .output = nftnl_expr_payload_snprintf,
};
@@ -193,5 +193,5 @@ struct expr_ops expr_ops_queue = {
.get = nftnl_expr_queue_get,
.parse = nftnl_expr_queue_parse,
.build = nftnl_expr_queue_build,
- .snprintf = nftnl_expr_queue_snprintf,
+ .output = nftnl_expr_queue_snprintf,
};
@@ -147,5 +147,5 @@ struct expr_ops expr_ops_quota = {
.get = nftnl_expr_quota_get,
.parse = nftnl_expr_quota_parse,
.build = nftnl_expr_quota_build,
- .snprintf = nftnl_expr_quota_snprintf,
+ .output = nftnl_expr_quota_snprintf,
};
@@ -213,5 +213,5 @@ struct expr_ops expr_ops_range = {
.get = nftnl_expr_range_get,
.parse = nftnl_expr_range_parse,
.build = nftnl_expr_range_build,
- .snprintf = nftnl_expr_range_snprintf,
+ .output = nftnl_expr_range_snprintf,
};
@@ -167,5 +167,5 @@ struct expr_ops expr_ops_redir = {
.get = nftnl_expr_redir_get,
.parse = nftnl_expr_redir_parse,
.build = nftnl_expr_redir_build,
- .snprintf = nftnl_expr_redir_snprintf,
+ .output = nftnl_expr_redir_snprintf,
};
@@ -134,5 +134,5 @@ struct expr_ops expr_ops_reject = {
.get = nftnl_expr_reject_get,
.parse = nftnl_expr_reject_parse,
.build = nftnl_expr_reject_build,
- .snprintf = nftnl_expr_reject_snprintf,
+ .output = nftnl_expr_reject_snprintf,
};
@@ -162,5 +162,5 @@ struct expr_ops expr_ops_rt = {
.get = nftnl_expr_rt_get,
.parse = nftnl_expr_rt_parse,
.build = nftnl_expr_rt_build,
- .snprintf = nftnl_expr_rt_snprintf,
+ .output = nftnl_expr_rt_snprintf,
};
@@ -165,5 +165,5 @@ struct expr_ops expr_ops_socket = {
.get = nftnl_expr_socket_get,
.parse = nftnl_expr_socket_parse,
.build = nftnl_expr_socket_build,
- .snprintf = nftnl_expr_socket_snprintf,
+ .output = nftnl_expr_socket_snprintf,
};
@@ -152,5 +152,5 @@ struct expr_ops expr_ops_synproxy = {
.get = nftnl_expr_synproxy_get,
.parse = nftnl_expr_synproxy_parse,
.build = nftnl_expr_synproxy_build,
- .snprintf = nftnl_expr_synproxy_snprintf,
+ .output = nftnl_expr_synproxy_snprintf,
};
@@ -189,5 +189,5 @@ struct expr_ops expr_ops_target = {
.get = nftnl_expr_target_get,
.parse = nftnl_expr_target_parse,
.build = nftnl_expr_target_build,
- .snprintf = nftnl_expr_target_snprintf,
+ .output = nftnl_expr_target_snprintf,
};
@@ -170,5 +170,5 @@ struct expr_ops expr_ops_tproxy = {
.get = nftnl_expr_tproxy_get,
.parse = nftnl_expr_tproxy_parse,
.build = nftnl_expr_tproxy_build,
- .snprintf = nftnl_expr_tproxy_snprintf,
+ .output = nftnl_expr_tproxy_snprintf,
};
@@ -145,5 +145,5 @@ struct expr_ops expr_ops_tunnel = {
.get = nftnl_expr_tunnel_get,
.parse = nftnl_expr_tunnel_parse,
.build = nftnl_expr_tunnel_build,
- .snprintf = nftnl_expr_tunnel_snprintf,
+ .output = nftnl_expr_tunnel_snprintf,
};
@@ -196,5 +196,5 @@ struct expr_ops expr_ops_xfrm = {
.get = nftnl_expr_xfrm_get,
.parse = nftnl_expr_xfrm_parse,
.build = nftnl_expr_xfrm_build,
- .snprintf = nftnl_expr_xfrm_snprintf,
+ .output = nftnl_expr_xfrm_snprintf,
};
@@ -127,5 +127,5 @@ struct obj_ops obj_ops_counter = {
.get = nftnl_obj_counter_get,
.parse = nftnl_obj_counter_parse,
.build = nftnl_obj_counter_build,
- .snprintf = nftnl_obj_counter_snprintf,
+ .output = nftnl_obj_counter_snprintf,
};
@@ -196,5 +196,5 @@ struct obj_ops obj_ops_ct_expect = {
.get = nftnl_obj_ct_expect_get,
.parse = nftnl_obj_ct_expect_parse,
.build = nftnl_obj_ct_expect_build,
- .snprintf = nftnl_obj_ct_expect_snprintf,
+ .output = nftnl_obj_ct_expect_snprintf,
};
@@ -150,5 +150,5 @@ struct obj_ops obj_ops_ct_helper = {
.get = nftnl_obj_ct_helper_get,
.parse = nftnl_obj_ct_helper_parse,
.build = nftnl_obj_ct_helper_build,
- .snprintf = nftnl_obj_ct_helper_snprintf,
+ .output = nftnl_obj_ct_helper_snprintf,
};
@@ -316,5 +316,5 @@ struct obj_ops obj_ops_ct_timeout = {
.get = nftnl_obj_ct_timeout_get,
.parse = nftnl_obj_ct_timeout_parse,
.build = nftnl_obj_ct_timeout_build,
- .snprintf = nftnl_obj_ct_timeout_snprintf,
+ .output = nftnl_obj_ct_timeout_snprintf,
};
@@ -168,5 +168,5 @@ struct obj_ops obj_ops_limit = {
.get = nftnl_obj_limit_get,
.parse = nftnl_obj_limit_parse,
.build = nftnl_obj_limit_build,
- .snprintf = nftnl_obj_limit_snprintf,
+ .output = nftnl_obj_limit_snprintf,
};
@@ -144,5 +144,5 @@ struct obj_ops obj_ops_quota = {
.get = nftnl_obj_quota_get,
.parse = nftnl_obj_quota_parse,
.build = nftnl_obj_quota_build,
- .snprintf = nftnl_obj_quota_snprintf,
+ .output = nftnl_obj_quota_snprintf,
};
@@ -116,5 +116,5 @@ struct obj_ops obj_ops_secmark = {
.get = nftnl_obj_secmark_get,
.parse = nftnl_obj_secmark_parse,
.build = nftnl_obj_secmark_build,
- .snprintf = nftnl_obj_secmark_snprintf,
+ .output = nftnl_obj_secmark_snprintf,
};
@@ -143,5 +143,5 @@ struct obj_ops obj_ops_synproxy = {
.get = nftnl_obj_synproxy_get,
.parse = nftnl_obj_synproxy_parse,
.build = nftnl_obj_synproxy_build,
- .snprintf = nftnl_obj_synproxy_snprintf,
+ .output = nftnl_obj_synproxy_snprintf,
};
@@ -547,5 +547,5 @@ struct obj_ops obj_ops_tunnel = {
.get = nftnl_obj_tunnel_get,
.parse = nftnl_obj_tunnel_parse,
.build = nftnl_obj_tunnel_build,
- .snprintf = nftnl_obj_tunnel_snprintf,
+ .output = nftnl_obj_tunnel_snprintf,
};
@@ -396,7 +396,7 @@ static int nftnl_obj_snprintf_dflt(char *buf, size_t remain,
SNPRINTF_BUFFER_SIZE(ret, remain, offset);
if (obj->ops) {
- ret = obj->ops->snprintf(buf + offset, remain, flags, obj);
+ ret = obj->ops->output(buf + offset, remain, flags, obj);
SNPRINTF_BUFFER_SIZE(ret, remain, offset);
}
ret = snprintf(buf + offset, remain, "]");
When building with clang and glibc and -D_FORTIFY_SOURCE=2 is passed to clang, the snprintf member of the expr_ops and obj_ops structures will be incorrectly replaced with __builtin_snprintf_chk() which results in "error: no member named '__builtin___snprintf_chk'" errors at build time. This patch changes the member name from 'snprintf' to 'output' to prevent the replacement. This bug can be emulated using GCC by undefining the __va_arg_pack macro before stdio.h is included. This patch is based on the notes provided in https://bugs.gentoo.org/807766. Signed-off-by: Nicholas Vinson <nvinson234@gmail.com> --- include/expr_ops.h | 2 +- include/obj.h | 2 +- src/expr.c | 4 ++-- src/expr/bitwise.c | 2 +- src/expr/byteorder.c | 2 +- src/expr/cmp.c | 2 +- src/expr/connlimit.c | 2 +- src/expr/counter.c | 2 +- src/expr/ct.c | 2 +- src/expr/dup.c | 2 +- src/expr/dynset.c | 2 +- src/expr/exthdr.c | 2 +- src/expr/fib.c | 2 +- src/expr/flow_offload.c | 2 +- src/expr/fwd.c | 2 +- src/expr/hash.c | 2 +- src/expr/immediate.c | 2 +- src/expr/last.c | 2 +- src/expr/limit.c | 2 +- src/expr/log.c | 2 +- src/expr/lookup.c | 2 +- src/expr/masq.c | 2 +- src/expr/match.c | 2 +- src/expr/meta.c | 2 +- src/expr/nat.c | 2 +- src/expr/numgen.c | 2 +- src/expr/objref.c | 2 +- src/expr/osf.c | 2 +- src/expr/payload.c | 2 +- src/expr/queue.c | 2 +- src/expr/quota.c | 2 +- src/expr/range.c | 2 +- src/expr/redir.c | 2 +- src/expr/reject.c | 2 +- src/expr/rt.c | 2 +- src/expr/socket.c | 2 +- src/expr/synproxy.c | 2 +- src/expr/target.c | 2 +- src/expr/tproxy.c | 2 +- src/expr/tunnel.c | 2 +- src/expr/xfrm.c | 2 +- src/obj/counter.c | 2 +- src/obj/ct_expect.c | 2 +- src/obj/ct_helper.c | 2 +- src/obj/ct_timeout.c | 2 +- src/obj/limit.c | 2 +- src/obj/quota.c | 2 +- src/obj/secmark.c | 2 +- src/obj/synproxy.c | 2 +- src/obj/tunnel.c | 2 +- src/object.c | 2 +- 51 files changed, 52 insertions(+), 52 deletions(-)