| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */cxx . . $ `<file>/src/ruleset.c`/ |
| 2 | /* |
| 3 | * (C) 2012-2013 by Pablo Neira Ayuso <[email protected]> |
| 4 | * (C) 2013 by Arturo Borrero Gonzalez <[email protected]> |
| 5 | * (C) 2013 by Alvaro Neira Ayuso <[email protected]> |
| 6 | * |
| 7 | * This code has been sponsored by Sophos Astaro <http://www.sophos.com> |
| 8 | */ |
| 9 | |
| 10 | #include <errno.h> |
| 11 | |
| 12 | #include "internal.h"cxx . . $ `<file>/include/internal.h`/ |
| 13 | #include <stdlib.h> |
| 14 | |
| 15 | #include <libmnl/libmnl.h> |
| 16 | #include <libnftnl/ruleset.h>cxx . . $ `<file>/include/libnftnl/ruleset.h`/ |
| 17 | #include <libnftnl/table.h>cxx . . $ `<file>/include/libnftnl/table.h`/ |
| 18 | #include <libnftnl/chain.h>cxx . . $ `<file>/include/libnftnl/chain.h`/ |
| 19 | #include <libnftnl/set.h>cxx . . $ `<file>/include/libnftnl/set.h`/ |
| 20 | #include <libnftnl/rule.h>cxx . . $ `<file>/include/libnftnl/rule.h`/ |
| 21 | |
| 22 | struct nftnl_rulesetcxx . . $ nftnl_ruleset# { |
| 23 | struct nftnl_table_listcxx . . $ nftnl_table_list# *table_listcxx . . $ nftnl_ruleset#table_list.; |
| 24 | struct nftnl_chain_listcxx . . $ nftnl_chain_list# *chain_listcxx . . $ nftnl_ruleset#chain_list.; |
| 25 | struct nftnl_set_listcxx . . $ nftnl_set_list# *set_listcxx . . $ nftnl_ruleset#set_list.; |
| 26 | struct nftnl_rule_listcxx . . $ nftnl_rule_list# *rule_listcxx . . $ nftnl_ruleset#rule_list.; |
| 27 | |
| 28 | uint16_tcxx . . $ uint16_t# flagscxx . . $ nftnl_ruleset#flags.; |
| 29 | }; |
| 30 | |
| 31 | struct nftnl_parse_ctxcxx . . $ nftnl_parse_ctx# { |
| 32 | enum nftnl_cmd_typecxx . . $ nftnl_cmd_type# cmdcxx . . $ nftnl_parse_ctx#cmd.; |
| 33 | enum nftnl_ruleset_typecxx . . $ nftnl_ruleset_type# typecxx . . $ nftnl_parse_ctx#type.; |
| 34 | unioncxx . . $ nftnl_parse_ctx#$anonymous_type_0# { |
| 35 | struct nftnl_tablecxx . . $ nftnl_table# *tablecxx . . $ nftnl_parse_ctx#$anonymous_type_0#table.; |
| 36 | struct nftnl_chaincxx . . $ nftnl_chain# *chaincxx . . $ nftnl_parse_ctx#$anonymous_type_0#chain.; |
| 37 | struct nftnl_rulecxx . . $ nftnl_rule# *rulecxx . . $ nftnl_parse_ctx#$anonymous_type_0#rule.; |
| 38 | struct nftnl_setcxx . . $ nftnl_set# *setcxx . . $ nftnl_parse_ctx#$anonymous_type_0#set.; |
| 39 | struct nftnl_set_elemcxx . . $ nftnl_set_elem# *set_elemcxx . . $ nftnl_parse_ctx#$anonymous_type_0#set_elem.; |
| 40 | }; |
| 41 | void *datacxx . . $ nftnl_parse_ctx#data.; |
| 42 | |
| 43 | /* These fields below are not exposed to the user */ |
| 44 | uint32_tcxx . . $ uint32_t# formatcxx . . $ nftnl_parse_ctx#format.; |
| 45 | uint32_tcxx . . $ uint32_t# set_idcxx . . $ nftnl_parse_ctx#set_id.; |
| 46 | struct nftnl_set_listcxx . . $ nftnl_set_list# *set_listcxx . . $ nftnl_parse_ctx#set_list.; |
| 47 | |
| 48 | int (*cbcxx . . $ nftnl_parse_ctx#cb.)(const struct nftnl_parse_ctxcxx . . $ nftnl_parse_ctx# *ctx); |
| 49 | uint16_tcxx . . $ uint16_t# flagscxx . . $ nftnl_parse_ctx#flags.; |
| 50 | }; |
| 51 | |
| 52 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_ruleset_alloc); |
| 53 | struct nftnl_rulesetcxx . . $ nftnl_ruleset# *nftnl_ruleset_alloccxx . . $ nftnl_ruleset_alloc(33e062f40d64c015).(void) |
| 54 | { |
| 55 | return calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_rulesetcxx . . $ nftnl_ruleset#)); |
| 56 | } |
| 57 | |
| 58 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_ruleset_free); |
| 59 | void nftnl_ruleset_freecxx . . $ nftnl_ruleset_free(2e8f763afbc4c486).(const struct nftnl_rulesetcxx . . $ nftnl_ruleset# *r) |
| 60 | { |
| 61 | if (r->flagscxx . . $ nftnl_ruleset#flags. & (1 << NFTNL_RULESET_TABLELISTcxx . . $ NFTNL_RULESET_TABLELIST.)) |
| 62 | nftnl_table_list_freecxx . . $ nftnl_table_list_free(b306a8d41ed1b520).(r->table_listcxx . . $ nftnl_ruleset#table_list.); |
| 63 | if (r->flagscxx . . $ nftnl_ruleset#flags. & (1 << NFTNL_RULESET_CHAINLISTcxx . . $ NFTNL_RULESET_CHAINLIST.)) |
| 64 | nftnl_chain_list_freecxx . . $ nftnl_chain_list_free(3f7465731f590af5).(r->chain_listcxx . . $ nftnl_ruleset#chain_list.); |
| 65 | if (r->flagscxx . . $ nftnl_ruleset#flags. & (1 << NFTNL_RULESET_SETLISTcxx . . $ NFTNL_RULESET_SETLIST.)) |
| 66 | nftnl_set_list_freecxx . . $ nftnl_set_list_free(7d15d180ba1e7f04).(r->set_listcxx . . $ nftnl_ruleset#set_list.); |
| 67 | if (r->flagscxx . . $ nftnl_ruleset#flags. & (1 << NFTNL_RULESET_RULELISTcxx . . $ NFTNL_RULESET_RULELIST.)) |
| 68 | nftnl_rule_list_freecxx . . $ nftnl_rule_list_free(3ac758a7595c423b).(r->rule_listcxx . . $ nftnl_ruleset#rule_list.); |
| 69 | xfreecxx . . $ `include/utils.h:22:9`!(r); |
| 70 | } |
| 71 | |
| 72 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_ruleset_is_set); |
| 73 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! nftnl_ruleset_is_setcxx . . $ nftnl_ruleset_is_set(f57b282ae8f9052c).(const struct nftnl_rulesetcxx . . $ nftnl_ruleset# *r, uint16_tcxx . . $ uint16_t# attr) |
| 74 | { |
| 75 | return r->flagscxx . . $ nftnl_ruleset#flags. & (1 << attr); |
| 76 | } |
| 77 | |
| 78 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_ruleset_unset); |
| 79 | void nftnl_ruleset_unsetcxx . . $ nftnl_ruleset_unset(14ec19f10e09083c).(struct nftnl_rulesetcxx . . $ nftnl_ruleset# *r, uint16_tcxx . . $ uint16_t# attr) |
| 80 | { |
| 81 | if (!(r->flagscxx . . $ nftnl_ruleset#flags. & (1 << attr))) |
| 82 | return; |
| 83 | |
| 84 | switch (attr) { |
| 85 | case NFTNL_RULESET_TABLELISTcxx . . $ NFTNL_RULESET_TABLELIST.: |
| 86 | nftnl_table_list_freecxx . . $ nftnl_table_list_free(b306a8d41ed1b520).(r->table_listcxx . . $ nftnl_ruleset#table_list.); |
| 87 | break; |
| 88 | case NFTNL_RULESET_CHAINLISTcxx . . $ NFTNL_RULESET_CHAINLIST.: |
| 89 | nftnl_chain_list_freecxx . . $ nftnl_chain_list_free(3f7465731f590af5).(r->chain_listcxx . . $ nftnl_ruleset#chain_list.); |
| 90 | break; |
| 91 | case NFTNL_RULESET_SETLISTcxx . . $ NFTNL_RULESET_SETLIST.: |
| 92 | nftnl_set_list_freecxx . . $ nftnl_set_list_free(7d15d180ba1e7f04).(r->set_listcxx . . $ nftnl_ruleset#set_list.); |
| 93 | break; |
| 94 | case NFTNL_RULESET_RULELISTcxx . . $ NFTNL_RULESET_RULELIST.: |
| 95 | nftnl_rule_list_freecxx . . $ nftnl_rule_list_free(3ac758a7595c423b).(r->rule_listcxx . . $ nftnl_ruleset#rule_list.); |
| 96 | break; |
| 97 | } |
| 98 | r->flagscxx . . $ nftnl_ruleset#flags. &= ~(1 << attr); |
| 99 | } |
| 100 | |
| 101 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_ruleset_set); |
| 102 | void nftnl_ruleset_setcxx . . $ nftnl_ruleset_set(8999b5f679fa3a32).(struct nftnl_rulesetcxx . . $ nftnl_ruleset# *r, uint16_tcxx . . $ uint16_t# attr, void *data) |
| 103 | { |
| 104 | switch (attr) { |
| 105 | case NFTNL_RULESET_TABLELISTcxx . . $ NFTNL_RULESET_TABLELIST.: |
| 106 | nftnl_ruleset_unsetcxx . . $ nftnl_ruleset_unset(14ec19f10e09083c).(r, NFTNL_RULESET_TABLELISTcxx . . $ NFTNL_RULESET_TABLELIST.); |
| 107 | r->table_listcxx . . $ nftnl_ruleset#table_list. = data; |
| 108 | break; |
| 109 | case NFTNL_RULESET_CHAINLISTcxx . . $ NFTNL_RULESET_CHAINLIST.: |
| 110 | nftnl_ruleset_unsetcxx . . $ nftnl_ruleset_unset(14ec19f10e09083c).(r, NFTNL_RULESET_CHAINLISTcxx . . $ NFTNL_RULESET_CHAINLIST.); |
| 111 | r->chain_listcxx . . $ nftnl_ruleset#chain_list. = data; |
| 112 | break; |
| 113 | case NFTNL_RULESET_SETLISTcxx . . $ NFTNL_RULESET_SETLIST.: |
| 114 | nftnl_ruleset_unsetcxx . . $ nftnl_ruleset_unset(14ec19f10e09083c).(r, NFTNL_RULESET_SETLISTcxx . . $ NFTNL_RULESET_SETLIST.); |
| 115 | r->set_listcxx . . $ nftnl_ruleset#set_list. = data; |
| 116 | break; |
| 117 | case NFTNL_RULESET_RULELISTcxx . . $ NFTNL_RULESET_RULELIST.: |
| 118 | nftnl_ruleset_unsetcxx . . $ nftnl_ruleset_unset(14ec19f10e09083c).(r, NFTNL_RULESET_RULELISTcxx . . $ NFTNL_RULESET_RULELIST.); |
| 119 | r->rule_listcxx . . $ nftnl_ruleset#rule_list. = data; |
| 120 | break; |
| 121 | default: |
| 122 | return; |
| 123 | } |
| 124 | r->flagscxx . . $ nftnl_ruleset#flags. |= (1 << attr); |
| 125 | } |
| 126 | |
| 127 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_ruleset_get); |
| 128 | void *nftnl_ruleset_getcxx . . $ nftnl_ruleset_get(5a96ee42f764a31f).(const struct nftnl_rulesetcxx . . $ nftnl_ruleset# *r, uint16_tcxx . . $ uint16_t# attr) |
| 129 | { |
| 130 | if (!(r->flagscxx . . $ nftnl_ruleset#flags. & (1 << attr))) |
| 131 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 132 | |
| 133 | switch (attr) { |
| 134 | case NFTNL_RULESET_TABLELISTcxx . . $ NFTNL_RULESET_TABLELIST.: |
| 135 | return r->table_listcxx . . $ nftnl_ruleset#table_list.; |
| 136 | case NFTNL_RULESET_CHAINLISTcxx . . $ NFTNL_RULESET_CHAINLIST.: |
| 137 | return r->chain_listcxx . . $ nftnl_ruleset#chain_list.; |
| 138 | case NFTNL_RULESET_SETLISTcxx . . $ NFTNL_RULESET_SETLIST.: |
| 139 | return r->set_listcxx . . $ nftnl_ruleset#set_list.; |
| 140 | case NFTNL_RULESET_RULELISTcxx . . $ NFTNL_RULESET_RULELIST.: |
| 141 | return r->rule_listcxx . . $ nftnl_ruleset#rule_list.; |
| 142 | default: |
| 143 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_ruleset_ctx_free); |
| 148 | void nftnl_ruleset_ctx_freecxx . . $ nftnl_ruleset_ctx_free(503e1b4757d8c8de).(const struct nftnl_parse_ctxcxx . . $ nftnl_parse_ctx# *ctx) |
| 149 | { |
| 150 | switch (ctx->typecxx . . $ nftnl_parse_ctx#type.) { |
| 151 | case NFTNL_RULESET_TABLEcxx . . $ NFTNL_RULESET_TABLE.: |
| 152 | nftnl_table_freecxx . . $ nftnl_table_free(9d199e246d0ec5ae).(ctx->tablecxx . . $ nftnl_parse_ctx#$anonymous_type_0#table.); |
| 153 | break; |
| 154 | case NFTNL_RULESET_CHAINcxx . . $ NFTNL_RULESET_CHAIN.: |
| 155 | nftnl_chain_freecxx . . $ nftnl_chain_free(769d8587cfdb0d4).(ctx->chaincxx . . $ nftnl_parse_ctx#$anonymous_type_0#chain.); |
| 156 | break; |
| 157 | case NFTNL_RULESET_RULEcxx . . $ NFTNL_RULESET_RULE.: |
| 158 | nftnl_rule_freecxx . . $ nftnl_rule_free(c1b52878f58022c2).(ctx->rulecxx . . $ nftnl_parse_ctx#$anonymous_type_0#rule.); |
| 159 | break; |
| 160 | case NFTNL_RULESET_SETcxx . . $ NFTNL_RULESET_SET.: |
| 161 | case NFTNL_RULESET_SET_ELEMScxx . . $ NFTNL_RULESET_SET_ELEMS.: |
| 162 | nftnl_set_freecxx . . $ nftnl_set_free(1539d2f51666fae0).(ctx->setcxx . . $ nftnl_parse_ctx#$anonymous_type_0#set.); |
| 163 | break; |
| 164 | case NFTNL_RULESET_RULESETcxx . . $ NFTNL_RULESET_RULESET.: |
| 165 | case NFTNL_RULESET_UNSPECcxx . . $ NFTNL_RULESET_UNSPEC.: |
| 166 | break; |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_ruleset_ctx_is_set); |
| 171 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! nftnl_ruleset_ctx_is_setcxx . . $ nftnl_ruleset_ctx_is_set(73debb51446abe6d).(const struct nftnl_parse_ctxcxx . . $ nftnl_parse_ctx# *ctx, uint16_tcxx . . $ uint16_t# attr) |
| 172 | { |
| 173 | return ctx->flagscxx . . $ nftnl_parse_ctx#flags. & (1 << attr); |
| 174 | } |
| 175 | |
| 176 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_ruleset_ctx_get); |
| 177 | void *nftnl_ruleset_ctx_getcxx . . $ nftnl_ruleset_ctx_get(da832789a8ce7d46).(const struct nftnl_parse_ctxcxx . . $ nftnl_parse_ctx# *ctx, uint16_tcxx . . $ uint16_t# attr) |
| 178 | { |
| 179 | if (!(ctx->flagscxx . . $ nftnl_parse_ctx#flags. & (1 << attr))) |
| 180 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 181 | |
| 182 | switch (attr) { |
| 183 | case NFTNL_RULESET_CTX_CMDcxx . . $ NFTNL_RULESET_CTX_CMD.: |
| 184 | return (void *)&ctx->cmdcxx . . $ nftnl_parse_ctx#cmd.; |
| 185 | case NFTNL_RULESET_CTX_TYPEcxx . . $ NFTNL_RULESET_CTX_TYPE.: |
| 186 | return (void *)&ctx->typecxx . . $ nftnl_parse_ctx#type.; |
| 187 | case NFTNL_RULESET_CTX_TABLEcxx . . $ NFTNL_RULESET_CTX_TABLE.: |
| 188 | return ctx->tablecxx . . $ nftnl_parse_ctx#$anonymous_type_0#table.; |
| 189 | case NFTNL_RULESET_CTX_CHAINcxx . . $ NFTNL_RULESET_CTX_CHAIN.: |
| 190 | return ctx->chaincxx . . $ nftnl_parse_ctx#$anonymous_type_0#chain.; |
| 191 | case NFTNL_RULESET_CTX_RULEcxx . . $ NFTNL_RULESET_CTX_RULE.: |
| 192 | return ctx->rulecxx . . $ nftnl_parse_ctx#$anonymous_type_0#rule.; |
| 193 | case NFTNL_RULESET_CTX_SETcxx . . $ NFTNL_RULESET_CTX_SET.: |
| 194 | return ctx->setcxx . . $ nftnl_parse_ctx#$anonymous_type_0#set.; |
| 195 | case NFTNL_RULESET_CTX_DATAcxx . . $ NFTNL_RULESET_CTX_DATA.: |
| 196 | return ctx->datacxx . . $ nftnl_parse_ctx#data.; |
| 197 | default: |
| 198 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_ruleset_ctx_get_u32); |
| 203 | uint32_tcxx . . $ uint32_t# nftnl_ruleset_ctx_get_u32cxx . . $ nftnl_ruleset_ctx_get_u32(1bd77fb11ba1e812).(const struct nftnl_parse_ctxcxx . . $ nftnl_parse_ctx# *ctx, uint16_tcxx . . $ uint16_t# attr) |
| 204 | { |
| 205 | const void *ret = nftnl_ruleset_ctx_getcxx . . $ nftnl_ruleset_ctx_get(da832789a8ce7d46).(ctx, attr); |
| 206 | return ret == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! ? 0 : *((uint32_tcxx . . $ uint32_t# *)ret); |
| 207 | } |
| 208 | |
| 209 | |
| 210 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_ruleset_parse_file_cb); |
| 211 | int nftnl_ruleset_parse_file_cbcxx . . $ nftnl_ruleset_parse_file_cb(231239ff56d00072).(enum nftnl_parse_typecxx . . $ nftnl_parse_type# type, FILEcxx . . $ FILE# *fp, |
| 212 | struct nftnl_parse_errcxx . . $ nftnl_parse_err# *err, void *data, |
| 213 | int (*cb)(const struct nftnl_parse_ctxcxx . . $ nftnl_parse_ctx# *ctx)) |
| 214 | { |
| 215 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!; |
| 216 | return -1; |
| 217 | } |
| 218 | |
| 219 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_ruleset_parse_buffer_cb); |
| 220 | int nftnl_ruleset_parse_buffer_cbcxx . . $ nftnl_ruleset_parse_buffer_cb(7dcb5b1ada81f13).(enum nftnl_parse_typecxx . . $ nftnl_parse_type# type, const char *buffer, |
| 221 | struct nftnl_parse_errcxx . . $ nftnl_parse_err# *err, void *data, |
| 222 | int (*cb)(const struct nftnl_parse_ctxcxx . . $ nftnl_parse_ctx# *ctx)) |
| 223 | { |
| 224 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!; |
| 225 | return -1; |
| 226 | } |
| 227 | |
| 228 | static int nftnl_ruleset_cbcxx . . $ nftnl_ruleset_cb(eedd972702b382f1).(const struct nftnl_parse_ctxcxx . . $ nftnl_parse_ctx# *ctx) |
| 229 | { |
| 230 | struct nftnl_rulesetcxx . . $ nftnl_ruleset# *r = ctx->datacxx . . $ nftnl_parse_ctx#data.; |
| 231 | |
| 232 | if (ctx->cmdcxx . . $ nftnl_parse_ctx#cmd. != NFTNL_CMD_ADDcxx . . $ NFTNL_CMD_ADD.) |
| 233 | return -1; |
| 234 | |
| 235 | switch (ctx->typecxx . . $ nftnl_parse_ctx#type.) { |
| 236 | case NFTNL_RULESET_TABLEcxx . . $ NFTNL_RULESET_TABLE.: |
| 237 | if (r->table_listcxx . . $ nftnl_ruleset#table_list. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 238 | r->table_listcxx . . $ nftnl_ruleset#table_list. = nftnl_table_list_alloccxx . . $ nftnl_table_list_alloc(464f806b73c26da8).(); |
| 239 | if (r->table_listcxx . . $ nftnl_ruleset#table_list. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 240 | return -1; |
| 241 | |
| 242 | nftnl_ruleset_setcxx . . $ nftnl_ruleset_set(8999b5f679fa3a32).(r, NFTNL_RULESET_TABLELISTcxx . . $ NFTNL_RULESET_TABLELIST., |
| 243 | r->table_listcxx . . $ nftnl_ruleset#table_list.); |
| 244 | } |
| 245 | nftnl_table_list_add_tailcxx . . $ nftnl_table_list_add_tail(7f6245b25fb35ca6).(ctx->tablecxx . . $ nftnl_parse_ctx#$anonymous_type_0#table., r->table_listcxx . . $ nftnl_ruleset#table_list.); |
| 246 | break; |
| 247 | case NFTNL_RULESET_CHAINcxx . . $ NFTNL_RULESET_CHAIN.: |
| 248 | if (r->chain_listcxx . . $ nftnl_ruleset#chain_list. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 249 | r->chain_listcxx . . $ nftnl_ruleset#chain_list. = nftnl_chain_list_alloccxx . . $ nftnl_chain_list_alloc(db7079ecded3b7c).(); |
| 250 | if (r->chain_listcxx . . $ nftnl_ruleset#chain_list. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 251 | return -1; |
| 252 | |
| 253 | nftnl_ruleset_setcxx . . $ nftnl_ruleset_set(8999b5f679fa3a32).(r, NFTNL_RULESET_CHAINLISTcxx . . $ NFTNL_RULESET_CHAINLIST., |
| 254 | r->chain_listcxx . . $ nftnl_ruleset#chain_list.); |
| 255 | } |
| 256 | nftnl_chain_list_add_tailcxx . . $ nftnl_chain_list_add_tail(71a9277eeddde5be).(ctx->chaincxx . . $ nftnl_parse_ctx#$anonymous_type_0#chain., r->chain_listcxx . . $ nftnl_ruleset#chain_list.); |
| 257 | break; |
| 258 | case NFTNL_RULESET_SETcxx . . $ NFTNL_RULESET_SET.: |
| 259 | if (r->set_listcxx . . $ nftnl_ruleset#set_list. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 260 | r->set_listcxx . . $ nftnl_ruleset#set_list. = nftnl_set_list_alloccxx . . $ nftnl_set_list_alloc(74ae4fc6f66feb).(); |
| 261 | if (r->set_listcxx . . $ nftnl_ruleset#set_list. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 262 | return -1; |
| 263 | |
| 264 | nftnl_ruleset_setcxx . . $ nftnl_ruleset_set(8999b5f679fa3a32).(r, NFTNL_RULESET_SETLISTcxx . . $ NFTNL_RULESET_SETLIST., |
| 265 | r->set_listcxx . . $ nftnl_ruleset#set_list.); |
| 266 | } |
| 267 | nftnl_set_list_add_tailcxx . . $ nftnl_set_list_add_tail(cbd2e32984527c4c).(ctx->setcxx . . $ nftnl_parse_ctx#$anonymous_type_0#set., r->set_listcxx . . $ nftnl_ruleset#set_list.); |
| 268 | break; |
| 269 | case NFTNL_RULESET_RULEcxx . . $ NFTNL_RULESET_RULE.: |
| 270 | if (r->rule_listcxx . . $ nftnl_ruleset#rule_list. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 271 | r->rule_listcxx . . $ nftnl_ruleset#rule_list. = nftnl_rule_list_alloccxx . . $ nftnl_rule_list_alloc(d8ec6d98a88dd60a).(); |
| 272 | if (r->rule_listcxx . . $ nftnl_ruleset#rule_list. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 273 | return -1; |
| 274 | |
| 275 | nftnl_ruleset_setcxx . . $ nftnl_ruleset_set(8999b5f679fa3a32).(r, NFTNL_RULESET_RULELISTcxx . . $ NFTNL_RULESET_RULELIST., |
| 276 | r->rule_listcxx . . $ nftnl_ruleset#rule_list.); |
| 277 | } |
| 278 | nftnl_rule_list_add_tailcxx . . $ nftnl_rule_list_add_tail(9beec01a35ebb477).(ctx->rulecxx . . $ nftnl_parse_ctx#$anonymous_type_0#rule., r->rule_listcxx . . $ nftnl_ruleset#rule_list.); |
| 279 | break; |
| 280 | case NFTNL_RULESET_RULESETcxx . . $ NFTNL_RULESET_RULESET.: |
| 281 | break; |
| 282 | default: |
| 283 | return -1; |
| 284 | } |
| 285 | |
| 286 | return 0; |
| 287 | } |
| 288 | |
| 289 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_ruleset_parse); |
| 290 | int nftnl_ruleset_parsecxx . . $ nftnl_ruleset_parse(4d36c42ad59ffb12).(struct nftnl_rulesetcxx . . $ nftnl_ruleset# *r, enum nftnl_parse_typecxx . . $ nftnl_parse_type# type, |
| 291 | const char *data, struct nftnl_parse_errcxx . . $ nftnl_parse_err# *err) |
| 292 | { |
| 293 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!; |
| 294 | return -1; |
| 295 | } |
| 296 | |
| 297 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_ruleset_parse_file); |
| 298 | int nftnl_ruleset_parse_filecxx . . $ nftnl_ruleset_parse_file(442b9e9f2248661f).(struct nftnl_rulesetcxx . . $ nftnl_ruleset# *rs, enum nftnl_parse_typecxx . . $ nftnl_parse_type# type, |
| 299 | FILEcxx . . $ FILE# *fp, struct nftnl_parse_errcxx . . $ nftnl_parse_err# *err) |
| 300 | { |
| 301 | return nftnl_ruleset_parse_file_cbcxx . . $ nftnl_ruleset_parse_file_cb(231239ff56d00072).(type, fp, err, rs, nftnl_ruleset_cbcxx . . $ nftnl_ruleset_cb(eedd972702b382f1).); |
| 302 | } |
| 303 | |
| 304 | static int |
| 305 | nftnl_ruleset_snprintf_tablecxx . . $ nftnl_ruleset_snprintf_table(b4340d5c0e8eec01).(char *buf, size_t remain, |
| 306 | const struct nftnl_rulesetcxx . . $ nftnl_ruleset# *rs, uint32_tcxx . . $ uint32_t# type, |
| 307 | uint32_tcxx . . $ uint32_t# flags) |
| 308 | { |
| 309 | struct nftnl_tablecxx . . $ nftnl_table# *t; |
| 310 | struct nftnl_table_list_itercxx . . $ nftnl_table_list_iter# *ti; |
| 311 | const char *sep = ""; |
| 312 | int ret, offset = 0; |
| 313 | |
| 314 | ti = nftnl_table_list_iter_createcxx . . $ nftnl_table_list_iter_create(117d499ef39538ba).(rs->table_listcxx . . $ nftnl_ruleset#table_list.); |
| 315 | if (ti == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 316 | return 0; |
| 317 | |
| 318 | t = nftnl_table_list_iter_nextcxx . . $ nftnl_table_list_iter_next(7438dcc808d229fd).(ti); |
| 319 | while (t != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 320 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, "%s", sep); |
| 321 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 322 | |
| 323 | ret = nftnl_table_snprintfcxx . . $ nftnl_table_snprintf(97a205a6ddb8ccf2).(buf + offset, remain, t, type, flags); |
| 324 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 325 | |
| 326 | t = nftnl_table_list_iter_nextcxx . . $ nftnl_table_list_iter_next(7438dcc808d229fd).(ti); |
| 327 | sep = "\n"; |
| 328 | } |
| 329 | nftnl_table_list_iter_destroycxx . . $ nftnl_table_list_iter_destroy(8b8829bcbe02f639).(ti); |
| 330 | |
| 331 | return offset; |
| 332 | } |
| 333 | |
| 334 | static int |
| 335 | nftnl_ruleset_snprintf_chaincxx . . $ nftnl_ruleset_snprintf_chain(b4340d5c0e8eec01).(char *buf, size_t remain, |
| 336 | const struct nftnl_rulesetcxx . . $ nftnl_ruleset# *rs, uint32_tcxx . . $ uint32_t# type, |
| 337 | uint32_tcxx . . $ uint32_t# flags) |
| 338 | { |
| 339 | struct nftnl_chaincxx . . $ nftnl_chain# *c; |
| 340 | struct nftnl_chain_list_itercxx . . $ nftnl_chain_list_iter# *ci; |
| 341 | const char *sep = ""; |
| 342 | int ret, offset = 0; |
| 343 | |
| 344 | ci = nftnl_chain_list_iter_createcxx . . $ nftnl_chain_list_iter_create(5251baceac31c2).(rs->chain_listcxx . . $ nftnl_ruleset#chain_list.); |
| 345 | if (ci == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 346 | return 0; |
| 347 | |
| 348 | c = nftnl_chain_list_iter_nextcxx . . $ nftnl_chain_list_iter_next(7b274ab990050d8b).(ci); |
| 349 | while (c != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 350 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, "%s", sep); |
| 351 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 352 | |
| 353 | ret = nftnl_chain_snprintfcxx . . $ nftnl_chain_snprintf(b1a008d61eb55206).(buf + offset, remain, c, type, flags); |
| 354 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 355 | |
| 356 | c = nftnl_chain_list_iter_nextcxx . . $ nftnl_chain_list_iter_next(7b274ab990050d8b).(ci); |
| 357 | sep = "\n"; |
| 358 | } |
| 359 | nftnl_chain_list_iter_destroycxx . . $ nftnl_chain_list_iter_destroy(a1f02e2d19c8b8b6).(ci); |
| 360 | |
| 361 | return offset; |
| 362 | } |
| 363 | |
| 364 | static int |
| 365 | nftnl_ruleset_snprintf_setcxx . . $ nftnl_ruleset_snprintf_set(b4340d5c0e8eec01).(char *buf, size_t remain, |
| 366 | const struct nftnl_rulesetcxx . . $ nftnl_ruleset# *rs, uint32_tcxx . . $ uint32_t# type, |
| 367 | uint32_tcxx . . $ uint32_t# flags) |
| 368 | { |
| 369 | struct nftnl_setcxx . . $ nftnl_set# *s; |
| 370 | struct nftnl_set_list_itercxx . . $ nftnl_set_list_iter# *si; |
| 371 | const char *sep = ""; |
| 372 | int ret, offset = 0; |
| 373 | |
| 374 | si = nftnl_set_list_iter_createcxx . . $ nftnl_set_list_iter_create(d60a0d08b40167d4).(rs->set_listcxx . . $ nftnl_ruleset#set_list.); |
| 375 | if (si == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 376 | return 0; |
| 377 | |
| 378 | s = nftnl_set_list_iter_nextcxx . . $ nftnl_set_list_iter_next(8190095024b9c04c).(si); |
| 379 | while (s != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 380 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, "%s", sep); |
| 381 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 382 | |
| 383 | ret = nftnl_set_snprintfcxx . . $ nftnl_set_snprintf(36df91043bfb55c1).(buf + offset, remain, s, type, flags); |
| 384 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 385 | |
| 386 | s = nftnl_set_list_iter_nextcxx . . $ nftnl_set_list_iter_next(8190095024b9c04c).(si); |
| 387 | sep = "\n"; |
| 388 | } |
| 389 | nftnl_set_list_iter_destroycxx . . $ nftnl_set_list_iter_destroy(48083b91c10291de).(si); |
| 390 | |
| 391 | return offset; |
| 392 | } |
| 393 | |
| 394 | static int |
| 395 | nftnl_ruleset_snprintf_rulecxx . . $ nftnl_ruleset_snprintf_rule(b4340d5c0e8eec01).(char *buf, size_t remain, |
| 396 | const struct nftnl_rulesetcxx . . $ nftnl_ruleset# *rs, uint32_tcxx . . $ uint32_t# type, |
| 397 | uint32_tcxx . . $ uint32_t# flags) |
| 398 | { |
| 399 | struct nftnl_rulecxx . . $ nftnl_rule# *r; |
| 400 | struct nftnl_rule_list_itercxx . . $ nftnl_rule_list_iter# *ri; |
| 401 | const char *sep = ""; |
| 402 | int ret, offset = 0; |
| 403 | |
| 404 | ri = nftnl_rule_list_iter_createcxx . . $ nftnl_rule_list_iter_create(6da56778383e8e1).(rs->rule_listcxx . . $ nftnl_ruleset#rule_list.); |
| 405 | if (ri == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 406 | return 0; |
| 407 | |
| 408 | r = nftnl_rule_list_iter_nextcxx . . $ nftnl_rule_list_iter_next(ba41a40cd1013298).(ri); |
| 409 | while (r != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 410 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, "%s", sep); |
| 411 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 412 | |
| 413 | ret = nftnl_rule_snprintfcxx . . $ nftnl_rule_snprintf(f37e2ba4daf5a3e1).(buf + offset, remain, r, type, flags); |
| 414 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 415 | |
| 416 | r = nftnl_rule_list_iter_nextcxx . . $ nftnl_rule_list_iter_next(ba41a40cd1013298).(ri); |
| 417 | sep = "\n"; |
| 418 | } |
| 419 | nftnl_rule_list_iter_destroycxx . . $ nftnl_rule_list_iter_destroy(dbe118f2d8769404).(ri); |
| 420 | |
| 421 | return offset; |
| 422 | } |
| 423 | |
| 424 | static int |
| 425 | nftnl_ruleset_do_snprintfcxx . . $ nftnl_ruleset_do_snprintf(65fa160d9d3e2f78).(char *buf, size_t remain, |
| 426 | const struct nftnl_rulesetcxx . . $ nftnl_ruleset# *rs, |
| 427 | uint32_tcxx . . $ uint32_t# cmd, uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags) |
| 428 | { |
| 429 | uint32_tcxx . . $ uint32_t# inner_flags = flags; |
| 430 | const char *sep = ""; |
| 431 | int ret, offset = 0; |
| 432 | |
| 433 | /* dont pass events flags to child calls of _snprintf() */ |
| 434 | inner_flags &= ~NFTNL_OF_EVENT_ANYcxx . . $ NFTNL_OF_EVENT_ANY.; |
| 435 | |
| 436 | if (nftnl_ruleset_is_setcxx . . $ nftnl_ruleset_is_set(f57b282ae8f9052c).(rs, NFTNL_RULESET_TABLELISTcxx . . $ NFTNL_RULESET_TABLELIST.) && |
| 437 | (!nftnl_table_list_is_emptycxx . . $ nftnl_table_list_is_empty(c535914e6e62c262).(rs->table_listcxx . . $ nftnl_ruleset#table_list.))) { |
| 438 | ret = nftnl_ruleset_snprintf_tablecxx . . $ nftnl_ruleset_snprintf_table(b4340d5c0e8eec01).(buf + offset, remain, rs, |
| 439 | type, inner_flags); |
| 440 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 441 | |
| 442 | if (ret > 0) |
| 443 | sep = "\n"; |
| 444 | } |
| 445 | |
| 446 | if (nftnl_ruleset_is_setcxx . . $ nftnl_ruleset_is_set(f57b282ae8f9052c).(rs, NFTNL_RULESET_CHAINLISTcxx . . $ NFTNL_RULESET_CHAINLIST.) && |
| 447 | (!nftnl_chain_list_is_emptycxx . . $ nftnl_chain_list_is_empty(c6fdf762001e3fe6).(rs->chain_listcxx . . $ nftnl_ruleset#chain_list.))) { |
| 448 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, "%s", sep); |
| 449 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 450 | |
| 451 | ret = nftnl_ruleset_snprintf_chaincxx . . $ nftnl_ruleset_snprintf_chain(b4340d5c0e8eec01).(buf + offset, remain, rs, |
| 452 | type, inner_flags); |
| 453 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 454 | |
| 455 | if (ret > 0) |
| 456 | sep = "\n"; |
| 457 | } |
| 458 | |
| 459 | if (nftnl_ruleset_is_setcxx . . $ nftnl_ruleset_is_set(f57b282ae8f9052c).(rs, NFTNL_RULESET_SETLISTcxx . . $ NFTNL_RULESET_SETLIST.) && |
| 460 | (!nftnl_set_list_is_emptycxx . . $ nftnl_set_list_is_empty(b89e0525932403fb).(rs->set_listcxx . . $ nftnl_ruleset#set_list.))) { |
| 461 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, "%s", sep); |
| 462 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 463 | |
| 464 | ret = nftnl_ruleset_snprintf_setcxx . . $ nftnl_ruleset_snprintf_set(b4340d5c0e8eec01).(buf + offset, remain, rs, |
| 465 | type, inner_flags); |
| 466 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 467 | |
| 468 | if (ret > 0) |
| 469 | sep = "\n"; |
| 470 | } |
| 471 | |
| 472 | if (nftnl_ruleset_is_setcxx . . $ nftnl_ruleset_is_set(f57b282ae8f9052c).(rs, NFTNL_RULESET_RULELISTcxx . . $ NFTNL_RULESET_RULELIST.) && |
| 473 | (!nftnl_rule_list_is_emptycxx . . $ nftnl_rule_list_is_empty(ab5641ab46a1af8c).(rs->rule_listcxx . . $ nftnl_ruleset#rule_list.))) { |
| 474 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, "%s", sep); |
| 475 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 476 | |
| 477 | ret = nftnl_ruleset_snprintf_rulecxx . . $ nftnl_ruleset_snprintf_rule(b4340d5c0e8eec01).(buf + offset, remain, rs, |
| 478 | type, inner_flags); |
| 479 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 480 | } |
| 481 | |
| 482 | return offset; |
| 483 | } |
| 484 | |
| 485 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_ruleset_snprintf); |
| 486 | int nftnl_ruleset_snprintfcxx . . $ nftnl_ruleset_snprintf(b4340d5c0e8eec01).(char *buf, size_t size, const struct nftnl_rulesetcxx . . $ nftnl_ruleset# *r, |
| 487 | uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags) |
| 488 | { |
| 489 | if (size) |
| 490 | buf[0] = '\0'; |
| 491 | |
| 492 | if (type != NFTNL_OUTPUT_DEFAULTcxx . . $ NFTNL_OUTPUT_DEFAULT.) { |
| 493 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!; |
| 494 | return -1; |
| 495 | } |
| 496 | return nftnl_ruleset_do_snprintfcxx . . $ nftnl_ruleset_do_snprintf(65fa160d9d3e2f78).(buf, size, r, nftnl_flag2cmdcxx . . $ nftnl_flag2cmd(73b61a9477c235b4).(flags), |
| 497 | type, flags); |
| 498 | } |
| 499 | |
| 500 | static int nftnl_ruleset_fprintf_tablescxx . . $ nftnl_ruleset_fprintf_tables(5871ab06206312bd).(FILEcxx . . $ FILE# *fp, const struct nftnl_rulesetcxx . . $ nftnl_ruleset# *rs, |
| 501 | uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags) |
| 502 | { |
| 503 | int len = 0, ret = 0; |
| 504 | struct nftnl_tablecxx . . $ nftnl_table# *t; |
| 505 | struct nftnl_table_list_itercxx . . $ nftnl_table_list_iter# *ti; |
| 506 | const char *sep = ""; |
| 507 | |
| 508 | ti = nftnl_table_list_iter_createcxx . . $ nftnl_table_list_iter_create(117d499ef39538ba).(rs->table_listcxx . . $ nftnl_ruleset#table_list.); |
| 509 | if (ti == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 510 | return -1; |
| 511 | |
| 512 | t = nftnl_table_list_iter_nextcxx . . $ nftnl_table_list_iter_next(7438dcc808d229fd).(ti); |
| 513 | while (t != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 514 | ret = fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fp, "%s", sep); |
| 515 | if (ret < 0) |
| 516 | goto err; |
| 517 | |
| 518 | len += ret; |
| 519 | |
| 520 | ret = nftnl_table_fprintfcxx . . $ nftnl_table_fprintf(77649173605e3b48).(fp, t, type, flags); |
| 521 | if (ret < 0) |
| 522 | goto err; |
| 523 | |
| 524 | len += ret; |
| 525 | |
| 526 | t = nftnl_table_list_iter_nextcxx . . $ nftnl_table_list_iter_next(7438dcc808d229fd).(ti); |
| 527 | sep = "\n"; |
| 528 | |
| 529 | } |
| 530 | nftnl_table_list_iter_destroycxx . . $ nftnl_table_list_iter_destroy(8b8829bcbe02f639).(ti); |
| 531 | |
| 532 | return len; |
| 533 | err: |
| 534 | nftnl_table_list_iter_destroycxx . . $ nftnl_table_list_iter_destroy(8b8829bcbe02f639).(ti); |
| 535 | return -1; |
| 536 | } |
| 537 | |
| 538 | static int nftnl_ruleset_fprintf_chainscxx . . $ nftnl_ruleset_fprintf_chains(5871ab06206312bd).(FILEcxx . . $ FILE# *fp, const struct nftnl_rulesetcxx . . $ nftnl_ruleset# *rs, |
| 539 | uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags) |
| 540 | { |
| 541 | int len = 0, ret = 0; |
| 542 | struct nftnl_chaincxx . . $ nftnl_chain# *o; |
| 543 | struct nftnl_chain_list_itercxx . . $ nftnl_chain_list_iter# *i; |
| 544 | const char *sep = ""; |
| 545 | |
| 546 | i = nftnl_chain_list_iter_createcxx . . $ nftnl_chain_list_iter_create(5251baceac31c2).(rs->chain_listcxx . . $ nftnl_ruleset#chain_list.); |
| 547 | if (i == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 548 | return -1; |
| 549 | |
| 550 | o = nftnl_chain_list_iter_nextcxx . . $ nftnl_chain_list_iter_next(7b274ab990050d8b).(i); |
| 551 | while (o != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 552 | ret = fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fp, "%s", sep); |
| 553 | if (ret < 0) |
| 554 | goto err; |
| 555 | |
| 556 | len += ret; |
| 557 | |
| 558 | ret = nftnl_chain_fprintfcxx . . $ nftnl_chain_fprintf(6fb51d5f6d9c0532).(fp, o, type, flags); |
| 559 | if (ret < 0) |
| 560 | goto err; |
| 561 | |
| 562 | len += ret; |
| 563 | |
| 564 | o = nftnl_chain_list_iter_nextcxx . . $ nftnl_chain_list_iter_next(7b274ab990050d8b).(i); |
| 565 | sep = "\n"; |
| 566 | } |
| 567 | nftnl_chain_list_iter_destroycxx . . $ nftnl_chain_list_iter_destroy(a1f02e2d19c8b8b6).(i); |
| 568 | |
| 569 | return len; |
| 570 | err: |
| 571 | nftnl_chain_list_iter_destroycxx . . $ nftnl_chain_list_iter_destroy(a1f02e2d19c8b8b6).(i); |
| 572 | return -1; |
| 573 | } |
| 574 | |
| 575 | static int nftnl_ruleset_fprintf_setscxx . . $ nftnl_ruleset_fprintf_sets(5871ab06206312bd).(FILEcxx . . $ FILE# *fp, const struct nftnl_rulesetcxx . . $ nftnl_ruleset# *rs, |
| 576 | uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags) |
| 577 | { |
| 578 | int len = 0, ret = 0; |
| 579 | struct nftnl_setcxx . . $ nftnl_set# *o; |
| 580 | struct nftnl_set_list_itercxx . . $ nftnl_set_list_iter# *i; |
| 581 | const char *sep = ""; |
| 582 | |
| 583 | i = nftnl_set_list_iter_createcxx . . $ nftnl_set_list_iter_create(d60a0d08b40167d4).(rs->set_listcxx . . $ nftnl_ruleset#set_list.); |
| 584 | if (i == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 585 | return -1; |
| 586 | |
| 587 | o = nftnl_set_list_iter_nextcxx . . $ nftnl_set_list_iter_next(8190095024b9c04c).(i); |
| 588 | while (o != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 589 | ret = fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fp, "%s", sep); |
| 590 | if (ret < 0) |
| 591 | goto err; |
| 592 | |
| 593 | len += ret; |
| 594 | |
| 595 | ret = nftnl_set_fprintfcxx . . $ nftnl_set_fprintf(f46a2d32971443bd).(fp, o, type, flags); |
| 596 | if (ret < 0) |
| 597 | goto err; |
| 598 | |
| 599 | len += ret; |
| 600 | |
| 601 | o = nftnl_set_list_iter_nextcxx . . $ nftnl_set_list_iter_next(8190095024b9c04c).(i); |
| 602 | sep = "\n"; |
| 603 | } |
| 604 | nftnl_set_list_iter_destroycxx . . $ nftnl_set_list_iter_destroy(48083b91c10291de).(i); |
| 605 | |
| 606 | return len; |
| 607 | err: |
| 608 | nftnl_set_list_iter_destroycxx . . $ nftnl_set_list_iter_destroy(48083b91c10291de).(i); |
| 609 | return -1; |
| 610 | } |
| 611 | |
| 612 | static int nftnl_ruleset_fprintf_rulescxx . . $ nftnl_ruleset_fprintf_rules(5871ab06206312bd).(FILEcxx . . $ FILE# *fp, const struct nftnl_rulesetcxx . . $ nftnl_ruleset# *rs, |
| 613 | uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags) |
| 614 | { |
| 615 | int len = 0, ret = 0; |
| 616 | struct nftnl_rulecxx . . $ nftnl_rule# *o; |
| 617 | struct nftnl_rule_list_itercxx . . $ nftnl_rule_list_iter# *i; |
| 618 | const char *sep = ""; |
| 619 | |
| 620 | i = nftnl_rule_list_iter_createcxx . . $ nftnl_rule_list_iter_create(6da56778383e8e1).(rs->rule_listcxx . . $ nftnl_ruleset#rule_list.); |
| 621 | if (i == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 622 | return -1; |
| 623 | |
| 624 | o = nftnl_rule_list_iter_nextcxx . . $ nftnl_rule_list_iter_next(ba41a40cd1013298).(i); |
| 625 | while (o != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 626 | ret = fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fp, "%s", sep); |
| 627 | if (ret < 0) |
| 628 | goto err; |
| 629 | |
| 630 | len += ret; |
| 631 | |
| 632 | ret = nftnl_rule_fprintfcxx . . $ nftnl_rule_fprintf(fb371cc68a88d0e0).(fp, o, type, flags); |
| 633 | if (ret < 0) |
| 634 | goto err; |
| 635 | |
| 636 | len += ret; |
| 637 | |
| 638 | o = nftnl_rule_list_iter_nextcxx . . $ nftnl_rule_list_iter_next(ba41a40cd1013298).(i); |
| 639 | sep = "\n"; |
| 640 | } |
| 641 | nftnl_rule_list_iter_destroycxx . . $ nftnl_rule_list_iter_destroy(dbe118f2d8769404).(i); |
| 642 | |
| 643 | return len; |
| 644 | err: |
| 645 | nftnl_rule_list_iter_destroycxx . . $ nftnl_rule_list_iter_destroy(dbe118f2d8769404).(i); |
| 646 | return -1; |
| 647 | } |
| 648 | |
| 649 | #define NFTNL_FPRINTF_RETURN_OR_FIXLENcxx . . $ `src/ruleset.c:649:9`!(ret, len) \ |
| 650 | if (ret < 0) \ |
| 651 | return -1; \ |
| 652 | len += ret; |
| 653 | |
| 654 | static int nftnl_ruleset_cmd_fprintfcxx . . $ nftnl_ruleset_cmd_fprintf(93795b84004e797b).(FILEcxx . . $ FILE# *fp, const struct nftnl_rulesetcxx . . $ nftnl_ruleset# *rs, |
| 655 | uint32_tcxx . . $ uint32_t# cmd, uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags) |
| 656 | { |
| 657 | int len = 0, ret = 0; |
| 658 | uint32_tcxx . . $ uint32_t# inner_flags = flags; |
| 659 | const char *sep = ""; |
| 660 | |
| 661 | /* dont pass events flags to child calls of _snprintf() */ |
| 662 | inner_flags &= ~NFTNL_OF_EVENT_ANYcxx . . $ NFTNL_OF_EVENT_ANY.; |
| 663 | |
| 664 | if ((nftnl_ruleset_is_setcxx . . $ nftnl_ruleset_is_set(f57b282ae8f9052c).(rs, NFTNL_RULESET_TABLELISTcxx . . $ NFTNL_RULESET_TABLELIST.)) && |
| 665 | (!nftnl_table_list_is_emptycxx . . $ nftnl_table_list_is_empty(c535914e6e62c262).(rs->table_listcxx . . $ nftnl_ruleset#table_list.))) { |
| 666 | ret = nftnl_ruleset_fprintf_tablescxx . . $ nftnl_ruleset_fprintf_tables(5871ab06206312bd).(fp, rs, type, inner_flags); |
| 667 | NFTNL_FPRINTF_RETURN_OR_FIXLENcxx . . $ `src/ruleset.c:649:9`!(ret, len); |
| 668 | |
| 669 | if (ret > 0) |
| 670 | sep = "\n"; |
| 671 | } |
| 672 | |
| 673 | if ((nftnl_ruleset_is_setcxx . . $ nftnl_ruleset_is_set(f57b282ae8f9052c).(rs, NFTNL_RULESET_CHAINLISTcxx . . $ NFTNL_RULESET_CHAINLIST.)) && |
| 674 | (!nftnl_chain_list_is_emptycxx . . $ nftnl_chain_list_is_empty(c6fdf762001e3fe6).(rs->chain_listcxx . . $ nftnl_ruleset#chain_list.))) { |
| 675 | ret = fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fp, "%s", sep); |
| 676 | NFTNL_FPRINTF_RETURN_OR_FIXLENcxx . . $ `src/ruleset.c:649:9`!(ret, len); |
| 677 | |
| 678 | ret = nftnl_ruleset_fprintf_chainscxx . . $ nftnl_ruleset_fprintf_chains(5871ab06206312bd).(fp, rs, type, inner_flags); |
| 679 | NFTNL_FPRINTF_RETURN_OR_FIXLENcxx . . $ `src/ruleset.c:649:9`!(ret, len); |
| 680 | |
| 681 | if (ret > 0) |
| 682 | sep = "\n"; |
| 683 | } |
| 684 | |
| 685 | if ((nftnl_ruleset_is_setcxx . . $ nftnl_ruleset_is_set(f57b282ae8f9052c).(rs, NFTNL_RULESET_SETLISTcxx . . $ NFTNL_RULESET_SETLIST.)) && |
| 686 | (!nftnl_set_list_is_emptycxx . . $ nftnl_set_list_is_empty(b89e0525932403fb).(rs->set_listcxx . . $ nftnl_ruleset#set_list.))) { |
| 687 | ret = fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fp, "%s", sep); |
| 688 | NFTNL_FPRINTF_RETURN_OR_FIXLENcxx . . $ `src/ruleset.c:649:9`!(ret, len); |
| 689 | |
| 690 | ret = nftnl_ruleset_fprintf_setscxx . . $ nftnl_ruleset_fprintf_sets(5871ab06206312bd).(fp, rs, type, inner_flags); |
| 691 | NFTNL_FPRINTF_RETURN_OR_FIXLENcxx . . $ `src/ruleset.c:649:9`!(ret, len); |
| 692 | |
| 693 | if (ret > 0) |
| 694 | sep = "\n"; |
| 695 | } |
| 696 | |
| 697 | if ((nftnl_ruleset_is_setcxx . . $ nftnl_ruleset_is_set(f57b282ae8f9052c).(rs, NFTNL_RULESET_RULELISTcxx . . $ NFTNL_RULESET_RULELIST.)) && |
| 698 | (!nftnl_rule_list_is_emptycxx . . $ nftnl_rule_list_is_empty(ab5641ab46a1af8c).(rs->rule_listcxx . . $ nftnl_ruleset#rule_list.))) { |
| 699 | ret = fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fp, "%s", sep); |
| 700 | NFTNL_FPRINTF_RETURN_OR_FIXLENcxx . . $ `src/ruleset.c:649:9`!(ret, len); |
| 701 | |
| 702 | ret = nftnl_ruleset_fprintf_rulescxx . . $ nftnl_ruleset_fprintf_rules(5871ab06206312bd).(fp, rs, type, inner_flags); |
| 703 | NFTNL_FPRINTF_RETURN_OR_FIXLENcxx . . $ `src/ruleset.c:649:9`!(ret, len); |
| 704 | } |
| 705 | |
| 706 | return len; |
| 707 | } |
| 708 | |
| 709 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_ruleset_fprintf); |
| 710 | int nftnl_ruleset_fprintfcxx . . $ nftnl_ruleset_fprintf(5871ab06206312bd).(FILEcxx . . $ FILE# *fp, const struct nftnl_rulesetcxx . . $ nftnl_ruleset# *rs, uint32_tcxx . . $ uint32_t# type, |
| 711 | uint32_tcxx . . $ uint32_t# flags) |
| 712 | { |
| 713 | return nftnl_ruleset_cmd_fprintfcxx . . $ nftnl_ruleset_cmd_fprintf(93795b84004e797b).(fp, rs, nftnl_flag2cmdcxx . . $ nftnl_flag2cmd(73b61a9477c235b4).(flags), type, |
| 714 | flags); |
| 715 | } |