| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */cxx . . $ `<file>/src/rule.c`/ |
| 2 | /* |
| 3 | * (C) 2012-2013 by Pablo Neira Ayuso <[email protected]> |
| 4 | * |
| 5 | * This code has been sponsored by Sophos Astaro <http://www.sophos.com> |
| 6 | */ |
| 7 | #include "internal.h"cxx . . $ `<file>/include/internal.h`/ |
| 8 | |
| 9 | #include <time.h> |
| 10 | #include <endian.h> |
| 11 | #include <stdint.h> |
| 12 | #include <stdlib.h> |
| 13 | #include <limits.h> |
| 14 | #include <string.h> |
| 15 | #include <netinet/in.h> |
| 16 | #include <errno.h> |
| 17 | #include <inttypes.h> |
| 18 | #include <ctype.h> |
| 19 | |
| 20 | #include <libmnl/libmnl.h> |
| 21 | #include <linux/netfilter/nfnetlink.h>cxx . . $ `<file>/include/linux/netfilter/nfnetlink.h`/ |
| 22 | #include <linux/netfilter/nf_tables.h>cxx . . $ `<file>/include/linux/netfilter/nf_tables.h`/ |
| 23 | |
| 24 | #include <libnftnl/rule.h>cxx . . $ `<file>/include/libnftnl/rule.h`/ |
| 25 | #include <libnftnl/set.h>cxx . . $ `<file>/include/libnftnl/set.h`/ |
| 26 | #include <libnftnl/expr.h>cxx . . $ `<file>/include/libnftnl/expr.h`/ |
| 27 | |
| 28 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_alloc); |
| 29 | struct nftnl_rulecxx . . $ nftnl_rule# *nftnl_rule_alloccxx . . $ nftnl_rule_alloc(aae5069dd70a3b7d).(void) |
| 30 | { |
| 31 | struct nftnl_rulecxx . . $ nftnl_rule# *r; |
| 32 | |
| 33 | r = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_rulecxx . . $ nftnl_rule#)); |
| 34 | if (r == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 35 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 36 | |
| 37 | INIT_LIST_HEADcxx . . $ `include/linux_list.h:66:9`!(&r->expr_list); |
| 38 | |
| 39 | return r; |
| 40 | } |
| 41 | |
| 42 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_free); |
| 43 | void nftnl_rule_freecxx . . $ nftnl_rule_free(c1b52878f58022c2).(const struct nftnl_rulecxx . . $ nftnl_rule# *r) |
| 44 | { |
| 45 | struct nftnl_exprcxx . . $ nftnl_expr# *e, *tmp; |
| 46 | |
| 47 | list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(e, tmp, &r->expr_list, head) |
| 48 | nftnl_expr_freecxx . . $ nftnl_expr_free(cbe1a28527736226).(e); |
| 49 | |
| 50 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << (NFTNL_RULE_TABLEcxx . . $ NFTNL_RULE_TABLE.))) |
| 51 | xfreecxx . . $ `include/utils.h:22:9`!(r->table); |
| 52 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << (NFTNL_RULE_CHAINcxx . . $ NFTNL_RULE_CHAIN.))) |
| 53 | xfreecxx . . $ `include/utils.h:22:9`!(r->chain); |
| 54 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << (NFTNL_RULE_USERDATAcxx . . $ NFTNL_RULE_USERDATA.))) |
| 55 | xfreecxx . . $ `include/utils.h:22:9`!(r->user.data); |
| 56 | |
| 57 | xfreecxx . . $ `include/utils.h:22:9`!(r); |
| 58 | } |
| 59 | |
| 60 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_is_set); |
| 61 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! nftnl_rule_is_setcxx . . $ nftnl_rule_is_set(6ee49bdf9fa77fe6).(const struct nftnl_rulecxx . . $ nftnl_rule# *r, uint16_tcxx . . $ uint16_t# attr) |
| 62 | { |
| 63 | return r->flagscxx . . $ nftnl_rule#flags. & (1 << attr); |
| 64 | } |
| 65 | |
| 66 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_unset); |
| 67 | void nftnl_rule_unsetcxx . . $ nftnl_rule_unset(d36bf4fae05fd584).(struct nftnl_rulecxx . . $ nftnl_rule# *r, uint16_tcxx . . $ uint16_t# attr) |
| 68 | { |
| 69 | if (!(r->flagscxx . . $ nftnl_rule#flags. & (1 << attr))) |
| 70 | return; |
| 71 | |
| 72 | switch (attr) { |
| 73 | case NFTNL_RULE_TABLEcxx . . $ NFTNL_RULE_TABLE.: |
| 74 | xfreecxx . . $ `include/utils.h:22:9`!(r->table); |
| 75 | break; |
| 76 | case NFTNL_RULE_CHAINcxx . . $ NFTNL_RULE_CHAIN.: |
| 77 | xfreecxx . . $ `include/utils.h:22:9`!(r->chain); |
| 78 | break; |
| 79 | case NFTNL_RULE_HANDLEcxx . . $ NFTNL_RULE_HANDLE.: |
| 80 | case NFTNL_RULE_COMPAT_PROTOcxx . . $ NFTNL_RULE_COMPAT_PROTO.: |
| 81 | case NFTNL_RULE_COMPAT_FLAGScxx . . $ NFTNL_RULE_COMPAT_FLAGS.: |
| 82 | case NFTNL_RULE_POSITIONcxx . . $ NFTNL_RULE_POSITION.: |
| 83 | case NFTNL_RULE_FAMILYcxx . . $ NFTNL_RULE_FAMILY.: |
| 84 | case NFTNL_RULE_IDcxx . . $ NFTNL_RULE_ID.: |
| 85 | case NFTNL_RULE_POSITION_IDcxx . . $ NFTNL_RULE_POSITION_ID.: |
| 86 | break; |
| 87 | case NFTNL_RULE_USERDATAcxx . . $ NFTNL_RULE_USERDATA.: |
| 88 | xfreecxx . . $ `include/utils.h:22:9`!(r->user.data); |
| 89 | break; |
| 90 | } |
| 91 | |
| 92 | r->flagscxx . . $ nftnl_rule#flags. &= ~(1 << attr); |
| 93 | } |
| 94 | |
| 95 | static uint32_tcxx . . $ uint32_t# nftnl_rule_validatecxx . . $ nftnl_rule_validate.[NFTNL_RULE_MAXcxx . . $ `include/libnftnl/rule.h:34:9`! + 1] = { |
| 96 | [NFTNL_RULE_HANDLEcxx . . $ NFTNL_RULE_HANDLE.] = sizeof(uint64_tcxx . . $ uint64_t#), |
| 97 | [NFTNL_RULE_COMPAT_PROTOcxx . . $ NFTNL_RULE_COMPAT_PROTO.] = sizeof(uint32_tcxx . . $ uint32_t#), |
| 98 | [NFTNL_RULE_COMPAT_FLAGScxx . . $ NFTNL_RULE_COMPAT_FLAGS.] = sizeof(uint32_tcxx . . $ uint32_t#), |
| 99 | [NFTNL_RULE_FAMILYcxx . . $ NFTNL_RULE_FAMILY.] = sizeof(uint32_tcxx . . $ uint32_t#), |
| 100 | [NFTNL_RULE_POSITIONcxx . . $ NFTNL_RULE_POSITION.] = sizeof(uint64_tcxx . . $ uint64_t#), |
| 101 | [NFTNL_RULE_IDcxx . . $ NFTNL_RULE_ID.] = sizeof(uint32_tcxx . . $ uint32_t#), |
| 102 | [NFTNL_RULE_POSITION_IDcxx . . $ NFTNL_RULE_POSITION_ID.] = sizeof(uint32_tcxx . . $ uint32_t#), |
| 103 | }; |
| 104 | |
| 105 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_set_data); |
| 106 | int nftnl_rule_set_datacxx . . $ nftnl_rule_set_data(3a679628f2716b95).(struct nftnl_rulecxx . . $ nftnl_rule# *r, uint16_tcxx . . $ uint16_t# attr, |
| 107 | const void *data, uint32_tcxx . . $ uint32_t# data_len) |
| 108 | { |
| 109 | nftnl_assert_attr_existscxx . . $ `include/utils.h:49:9`!(attr, NFTNL_RULE_MAXcxx . . $ `include/libnftnl/rule.h:34:9`!); |
| 110 | nftnl_assert_validatecxx . . $ `include/utils.h:38:9`!(data, nftnl_rule_validate, attr, data_len); |
| 111 | |
| 112 | switch(attr) { |
| 113 | case NFTNL_RULE_TABLEcxx . . $ NFTNL_RULE_TABLE.: |
| 114 | return nftnl_set_str_attrcxx . . $ nftnl_set_str_attr(fd565288bd370d98).(&r->tablecxx . . $ nftnl_rule#table., &r->flagscxx . . $ nftnl_rule#flags., |
| 115 | attr, data, data_len); |
| 116 | case NFTNL_RULE_CHAINcxx . . $ NFTNL_RULE_CHAIN.: |
| 117 | return nftnl_set_str_attrcxx . . $ nftnl_set_str_attr(fd565288bd370d98).(&r->chaincxx . . $ nftnl_rule#chain., &r->flagscxx . . $ nftnl_rule#flags., |
| 118 | attr, data, data_len); |
| 119 | case NFTNL_RULE_HANDLEcxx . . $ NFTNL_RULE_HANDLE.: |
| 120 | memcpycxx . . $ memcpy(cc817cb175f282d).(&r->handlecxx . . $ nftnl_rule#handle., data, sizeof(r->handlecxx . . $ nftnl_rule#handle.)); |
| 121 | break; |
| 122 | case NFTNL_RULE_COMPAT_PROTOcxx . . $ NFTNL_RULE_COMPAT_PROTO.: |
| 123 | memcpycxx . . $ memcpy(cc817cb175f282d).(&r->compatcxx . . $ nftnl_rule#compat..protocxx . . $ nftnl_rule#$anonymous_type_1#proto., data, sizeof(r->compatcxx . . $ nftnl_rule#compat..protocxx . . $ nftnl_rule#$anonymous_type_1#proto.)); |
| 124 | break; |
| 125 | case NFTNL_RULE_COMPAT_FLAGScxx . . $ NFTNL_RULE_COMPAT_FLAGS.: |
| 126 | memcpycxx . . $ memcpy(cc817cb175f282d).(&r->compatcxx . . $ nftnl_rule#compat..flagscxx . . $ nftnl_rule#$anonymous_type_1#flags., data, sizeof(r->compatcxx . . $ nftnl_rule#compat..flagscxx . . $ nftnl_rule#$anonymous_type_1#flags.)); |
| 127 | break; |
| 128 | case NFTNL_RULE_FAMILYcxx . . $ NFTNL_RULE_FAMILY.: |
| 129 | memcpycxx . . $ memcpy(cc817cb175f282d).(&r->familycxx . . $ nftnl_rule#family., data, sizeof(r->familycxx . . $ nftnl_rule#family.)); |
| 130 | break; |
| 131 | case NFTNL_RULE_POSITIONcxx . . $ NFTNL_RULE_POSITION.: |
| 132 | memcpycxx . . $ memcpy(cc817cb175f282d).(&r->positioncxx . . $ nftnl_rule#position., data, sizeof(r->positioncxx . . $ nftnl_rule#position.)); |
| 133 | break; |
| 134 | case NFTNL_RULE_USERDATAcxx . . $ NFTNL_RULE_USERDATA.: |
| 135 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_USERDATAcxx . . $ NFTNL_RULE_USERDATA.)) |
| 136 | xfreecxx . . $ `include/utils.h:22:9`!(r->user.data); |
| 137 | |
| 138 | r->usercxx . . $ nftnl_rule#user..datacxx . . $ nftnl_rule#$anonymous_type_0#data. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(data_len); |
| 139 | if (!r->usercxx . . $ nftnl_rule#user..datacxx . . $ nftnl_rule#$anonymous_type_0#data.) |
| 140 | return -1; |
| 141 | |
| 142 | memcpycxx . . $ memcpy(cc817cb175f282d).(r->usercxx . . $ nftnl_rule#user..datacxx . . $ nftnl_rule#$anonymous_type_0#data., data, data_len); |
| 143 | r->usercxx . . $ nftnl_rule#user..lencxx . . $ nftnl_rule#$anonymous_type_0#len. = data_len; |
| 144 | break; |
| 145 | case NFTNL_RULE_IDcxx . . $ NFTNL_RULE_ID.: |
| 146 | memcpycxx . . $ memcpy(cc817cb175f282d).(&r->idcxx . . $ nftnl_rule#id., data, sizeof(r->idcxx . . $ nftnl_rule#id.)); |
| 147 | break; |
| 148 | case NFTNL_RULE_POSITION_IDcxx . . $ NFTNL_RULE_POSITION_ID.: |
| 149 | memcpycxx . . $ memcpy(cc817cb175f282d).(&r->position_idcxx . . $ nftnl_rule#position_id., data, sizeof(r->position_idcxx . . $ nftnl_rule#position_id.)); |
| 150 | break; |
| 151 | } |
| 152 | r->flagscxx . . $ nftnl_rule#flags. |= (1 << attr); |
| 153 | return 0; |
| 154 | } |
| 155 | |
| 156 | int nftnl_rule_setcxx . . $ nftnl_rule_set(41bd4365c17ed444).(struct nftnl_rulecxx . . $ nftnl_rule# *r, uint16_tcxx . . $ uint16_t# attr, const void *data) __visiblecxx . . $ `include/utils.h:13:10`!; |
| 157 | int nftnl_rule_setcxx . . $ nftnl_rule_set(41bd4365c17ed444).(struct nftnl_rulecxx . . $ nftnl_rule# *r, uint16_tcxx . . $ uint16_t# attr, const void *data) |
| 158 | { |
| 159 | return nftnl_rule_set_datacxx . . $ nftnl_rule_set_data(3a679628f2716b95).(r, attr, data, nftnl_rule_validatecxx . . $ nftnl_rule_validate.[attr]); |
| 160 | } |
| 161 | |
| 162 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_set_u32); |
| 163 | void nftnl_rule_set_u32cxx . . $ nftnl_rule_set_u32(4eae74c9e0500ff7).(struct nftnl_rulecxx . . $ nftnl_rule# *r, uint16_tcxx . . $ uint16_t# attr, uint32_tcxx . . $ uint32_t# val) |
| 164 | { |
| 165 | nftnl_rule_set_datacxx . . $ nftnl_rule_set_data(3a679628f2716b95).(r, attr, &val, sizeof(uint32_tcxx . . $ uint32_t#)); |
| 166 | } |
| 167 | |
| 168 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_set_u64); |
| 169 | void nftnl_rule_set_u64cxx . . $ nftnl_rule_set_u64(3f037bd8df9e699c).(struct nftnl_rulecxx . . $ nftnl_rule# *r, uint16_tcxx . . $ uint16_t# attr, uint64_tcxx . . $ uint64_t# val) |
| 170 | { |
| 171 | nftnl_rule_set_datacxx . . $ nftnl_rule_set_data(3a679628f2716b95).(r, attr, &val, sizeof(uint64_tcxx . . $ uint64_t#)); |
| 172 | } |
| 173 | |
| 174 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_set_str); |
| 175 | int nftnl_rule_set_strcxx . . $ nftnl_rule_set_str(88e503a675894fcb).(struct nftnl_rulecxx . . $ nftnl_rule# *r, uint16_tcxx . . $ uint16_t# attr, const char *str) |
| 176 | { |
| 177 | return nftnl_rule_set_datacxx . . $ nftnl_rule_set_data(3a679628f2716b95).(r, attr, str, strlencxx . . $ strlen(751346f8406fd082).(str) + 1); |
| 178 | } |
| 179 | |
| 180 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_get_data); |
| 181 | const void *nftnl_rule_get_datacxx . . $ nftnl_rule_get_data(53bd45535c11ee1b).(const struct nftnl_rulecxx . . $ nftnl_rule# *r, uint16_tcxx . . $ uint16_t# attr, |
| 182 | uint32_tcxx . . $ uint32_t# *data_len) |
| 183 | { |
| 184 | if (!(r->flagscxx . . $ nftnl_rule#flags. & (1 << attr))) |
| 185 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 186 | |
| 187 | switch(attr) { |
| 188 | case NFTNL_RULE_FAMILYcxx . . $ NFTNL_RULE_FAMILY.: |
| 189 | *data_len = sizeof(uint32_tcxx . . $ uint32_t#); |
| 190 | return &r->familycxx . . $ nftnl_rule#family.; |
| 191 | case NFTNL_RULE_TABLEcxx . . $ NFTNL_RULE_TABLE.: |
| 192 | *data_len = strlencxx . . $ strlen(751346f8406fd082).(r->tablecxx . . $ nftnl_rule#table.) + 1; |
| 193 | return r->tablecxx . . $ nftnl_rule#table.; |
| 194 | case NFTNL_RULE_CHAINcxx . . $ NFTNL_RULE_CHAIN.: |
| 195 | *data_len = strlencxx . . $ strlen(751346f8406fd082).(r->chaincxx . . $ nftnl_rule#chain.) + 1; |
| 196 | return r->chaincxx . . $ nftnl_rule#chain.; |
| 197 | case NFTNL_RULE_HANDLEcxx . . $ NFTNL_RULE_HANDLE.: |
| 198 | *data_len = sizeof(uint64_tcxx . . $ uint64_t#); |
| 199 | return &r->handlecxx . . $ nftnl_rule#handle.; |
| 200 | case NFTNL_RULE_COMPAT_PROTOcxx . . $ NFTNL_RULE_COMPAT_PROTO.: |
| 201 | *data_len = sizeof(uint32_tcxx . . $ uint32_t#); |
| 202 | return &r->compatcxx . . $ nftnl_rule#compat..protocxx . . $ nftnl_rule#$anonymous_type_1#proto.; |
| 203 | case NFTNL_RULE_COMPAT_FLAGScxx . . $ NFTNL_RULE_COMPAT_FLAGS.: |
| 204 | *data_len = sizeof(uint32_tcxx . . $ uint32_t#); |
| 205 | return &r->compatcxx . . $ nftnl_rule#compat..flagscxx . . $ nftnl_rule#$anonymous_type_1#flags.; |
| 206 | case NFTNL_RULE_POSITIONcxx . . $ NFTNL_RULE_POSITION.: |
| 207 | *data_len = sizeof(uint64_tcxx . . $ uint64_t#); |
| 208 | return &r->positioncxx . . $ nftnl_rule#position.; |
| 209 | case NFTNL_RULE_USERDATAcxx . . $ NFTNL_RULE_USERDATA.: |
| 210 | *data_len = r->usercxx . . $ nftnl_rule#user..lencxx . . $ nftnl_rule#$anonymous_type_0#len.; |
| 211 | return r->usercxx . . $ nftnl_rule#user..datacxx . . $ nftnl_rule#$anonymous_type_0#data.; |
| 212 | case NFTNL_RULE_IDcxx . . $ NFTNL_RULE_ID.: |
| 213 | *data_len = sizeof(uint32_tcxx . . $ uint32_t#); |
| 214 | return &r->idcxx . . $ nftnl_rule#id.; |
| 215 | case NFTNL_RULE_POSITION_IDcxx . . $ NFTNL_RULE_POSITION_ID.: |
| 216 | *data_len = sizeof(uint32_tcxx . . $ uint32_t#); |
| 217 | return &r->position_idcxx . . $ nftnl_rule#position_id.; |
| 218 | } |
| 219 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 220 | } |
| 221 | |
| 222 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_get); |
| 223 | const void *nftnl_rule_getcxx . . $ nftnl_rule_get(3b83d7b4d3b78773).(const struct nftnl_rulecxx . . $ nftnl_rule# *r, uint16_tcxx . . $ uint16_t# attr) |
| 224 | { |
| 225 | uint32_tcxx . . $ uint32_t# data_len; |
| 226 | return nftnl_rule_get_datacxx . . $ nftnl_rule_get_data(53bd45535c11ee1b).(r, attr, &data_len); |
| 227 | } |
| 228 | |
| 229 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_get_str); |
| 230 | const char *nftnl_rule_get_strcxx . . $ nftnl_rule_get_str(daaff5b7cd368807).(const struct nftnl_rulecxx . . $ nftnl_rule# *r, uint16_tcxx . . $ uint16_t# attr) |
| 231 | { |
| 232 | return nftnl_rule_getcxx . . $ nftnl_rule_get(3b83d7b4d3b78773).(r, attr); |
| 233 | } |
| 234 | |
| 235 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_get_u32); |
| 236 | uint32_tcxx . . $ uint32_t# nftnl_rule_get_u32cxx . . $ nftnl_rule_get_u32(95266dc48a5b1a7b).(const struct nftnl_rulecxx . . $ nftnl_rule# *r, uint16_tcxx . . $ uint16_t# attr) |
| 237 | { |
| 238 | uint32_tcxx . . $ uint32_t# data_len; |
| 239 | const uint32_tcxx . . $ uint32_t# *val = nftnl_rule_get_datacxx . . $ nftnl_rule_get_data(53bd45535c11ee1b).(r, attr, &data_len); |
| 240 | |
| 241 | nftnl_assertcxx . . $ `include/utils.h:33:9`!(val, attr, data_len == sizeof(uint32_t)); |
| 242 | |
| 243 | return val ? *val : 0; |
| 244 | } |
| 245 | |
| 246 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_get_u64); |
| 247 | uint64_tcxx . . $ uint64_t# nftnl_rule_get_u64cxx . . $ nftnl_rule_get_u64(a22c51359edd24a6).(const struct nftnl_rulecxx . . $ nftnl_rule# *r, uint16_tcxx . . $ uint16_t# attr) |
| 248 | { |
| 249 | uint32_tcxx . . $ uint32_t# data_len; |
| 250 | const uint64_tcxx . . $ uint64_t# *val = nftnl_rule_get_datacxx . . $ nftnl_rule_get_data(53bd45535c11ee1b).(r, attr, &data_len); |
| 251 | |
| 252 | nftnl_assertcxx . . $ `include/utils.h:33:9`!(val, attr, data_len == sizeof(uint64_t)); |
| 253 | |
| 254 | return val ? *val : 0; |
| 255 | } |
| 256 | |
| 257 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_get_u8); |
| 258 | uint8_tcxx . . $ uint8_t# nftnl_rule_get_u8cxx . . $ nftnl_rule_get_u8(107415a7af58a710).(const struct nftnl_rulecxx . . $ nftnl_rule# *r, uint16_tcxx . . $ uint16_t# attr) |
| 259 | { |
| 260 | uint32_tcxx . . $ uint32_t# data_len; |
| 261 | const uint8_tcxx . . $ uint8_t# *val = nftnl_rule_get_datacxx . . $ nftnl_rule_get_data(53bd45535c11ee1b).(r, attr, &data_len); |
| 262 | |
| 263 | nftnl_assertcxx . . $ `include/utils.h:33:9`!(val, attr, data_len == sizeof(uint8_t)); |
| 264 | |
| 265 | return val ? *val : 0; |
| 266 | } |
| 267 | |
| 268 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_nlmsg_build_payload); |
| 269 | void nftnl_rule_nlmsg_build_payloadcxx . . $ nftnl_rule_nlmsg_build_payload(290aa543b133e33b).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh, struct nftnl_rulecxx . . $ nftnl_rule# *r) |
| 270 | { |
| 271 | struct nftnl_exprcxx . . $ nftnl_expr# *expr; |
| 272 | struct nlattrcxx . . $ nlattr# *nest, *nest2; |
| 273 | |
| 274 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_TABLEcxx . . $ NFTNL_RULE_TABLE.)) |
| 275 | mnl_attr_put_strzcxx . . $ mnl_attr_put_strz(eb76286d4bfc1a8d).(nlh, NFTA_RULE_TABLEcxx . . $ NFTA_RULE_TABLE., r->tablecxx . . $ nftnl_rule#table.); |
| 276 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_CHAINcxx . . $ NFTNL_RULE_CHAIN.)) |
| 277 | mnl_attr_put_strzcxx . . $ mnl_attr_put_strz(eb76286d4bfc1a8d).(nlh, NFTA_RULE_CHAINcxx . . $ NFTA_RULE_CHAIN., r->chaincxx . . $ nftnl_rule#chain.); |
| 278 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_HANDLEcxx . . $ NFTNL_RULE_HANDLE.)) |
| 279 | mnl_attr_put_u64cxx . . $ mnl_attr_put_u64(6d753f4d486e3a2f).(nlh, NFTA_RULE_HANDLEcxx . . $ NFTA_RULE_HANDLE., htobe64cxx . . $ `<external>/15855202785537844739/endian.h:49:11`!(r->handle)); |
| 280 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_POSITIONcxx . . $ NFTNL_RULE_POSITION.)) |
| 281 | mnl_attr_put_u64cxx . . $ mnl_attr_put_u64(6d753f4d486e3a2f).(nlh, NFTA_RULE_POSITIONcxx . . $ NFTA_RULE_POSITION., htobe64cxx . . $ `<external>/15855202785537844739/endian.h:49:11`!(r->position)); |
| 282 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_USERDATAcxx . . $ NFTNL_RULE_USERDATA.)) { |
| 283 | mnl_attr_putcxx . . $ mnl_attr_put(612d908c39ff741d).(nlh, NFTA_RULE_USERDATAcxx . . $ NFTA_RULE_USERDATA., r->usercxx . . $ nftnl_rule#user..lencxx . . $ nftnl_rule#$anonymous_type_0#len., |
| 284 | r->usercxx . . $ nftnl_rule#user..datacxx . . $ nftnl_rule#$anonymous_type_0#data.); |
| 285 | } |
| 286 | |
| 287 | if (!list_emptycxx . . $ list_empty(df525b6afabf24a2).(&r->expr_listcxx . . $ nftnl_rule#expr_list.)) { |
| 288 | nest = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_RULE_EXPRESSIONScxx . . $ NFTA_RULE_EXPRESSIONS.); |
| 289 | list_for_each_entrycxx . . $ `include/linux_list.h:384:9`!(expr, &r->expr_list, head) { |
| 290 | nest2 = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_LIST_ELEMcxx . . $ NFTA_LIST_ELEM.); |
| 291 | nftnl_expr_build_payloadcxx . . $ nftnl_expr_build_payload(efa2a5c645f672a6).(nlh, expr); |
| 292 | mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest2); |
| 293 | } |
| 294 | mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest); |
| 295 | } |
| 296 | |
| 297 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_COMPAT_PROTOcxx . . $ NFTNL_RULE_COMPAT_PROTO.) && |
| 298 | r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_COMPAT_FLAGScxx . . $ NFTNL_RULE_COMPAT_FLAGS.)) { |
| 299 | |
| 300 | nest = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_RULE_COMPATcxx . . $ NFTA_RULE_COMPAT.); |
| 301 | mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_RULE_COMPAT_PROTOcxx . . $ NFTA_RULE_COMPAT_PROTO., |
| 302 | htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(r->compat.proto)); |
| 303 | mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_RULE_COMPAT_FLAGScxx . . $ NFTA_RULE_COMPAT_FLAGS., |
| 304 | htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(r->compat.flags)); |
| 305 | mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest); |
| 306 | } |
| 307 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_IDcxx . . $ NFTNL_RULE_ID.)) |
| 308 | mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_RULE_IDcxx . . $ NFTA_RULE_ID., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(r->id)); |
| 309 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_POSITION_IDcxx . . $ NFTNL_RULE_POSITION_ID.)) |
| 310 | mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_RULE_POSITION_IDcxx . . $ NFTA_RULE_POSITION_ID., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(r->position_id)); |
| 311 | } |
| 312 | |
| 313 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_add_expr); |
| 314 | void nftnl_rule_add_exprcxx . . $ nftnl_rule_add_expr(3643cfaf8d65ea98).(struct nftnl_rulecxx . . $ nftnl_rule# *r, struct nftnl_exprcxx . . $ nftnl_expr# *expr) |
| 315 | { |
| 316 | list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&expr->headcxx . . $ nftnl_expr#head., &r->expr_listcxx . . $ nftnl_rule#expr_list.); |
| 317 | } |
| 318 | |
| 319 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_del_expr); |
| 320 | void nftnl_rule_del_exprcxx . . $ nftnl_rule_del_expr(90e2e4ae79215b69).(struct nftnl_exprcxx . . $ nftnl_expr# *expr) |
| 321 | { |
| 322 | list_delcxx . . $ list_del(35ab6d74de6aba0a).(&expr->headcxx . . $ nftnl_expr#head.); |
| 323 | } |
| 324 | |
| 325 | static int nftnl_rule_parse_attr_cbcxx . . $ nftnl_rule_parse_attr_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data) |
| 326 | { |
| 327 | const struct nlattrcxx . . $ nlattr# **tb = data; |
| 328 | int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr); |
| 329 | |
| 330 | if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_RULE_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:287:9`!) < 0) |
| 331 | return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!; |
| 332 | |
| 333 | switch(type) { |
| 334 | case NFTA_RULE_TABLEcxx . . $ NFTA_RULE_TABLE.: |
| 335 | case NFTA_RULE_CHAINcxx . . $ NFTA_RULE_CHAIN.: |
| 336 | if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_STRINGcxx . . $ MNL_TYPE_STRING.) < 0) |
| 337 | abi_breakagecxx . . $ `include/utils.h:28:9`!(); |
| 338 | break; |
| 339 | case NFTA_RULE_HANDLEcxx . . $ NFTA_RULE_HANDLE.: |
| 340 | if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U64cxx . . $ MNL_TYPE_U64.) < 0) |
| 341 | abi_breakagecxx . . $ `include/utils.h:28:9`!(); |
| 342 | break; |
| 343 | case NFTA_RULE_COMPATcxx . . $ NFTA_RULE_COMPAT.: |
| 344 | if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_NESTEDcxx . . $ MNL_TYPE_NESTED.) < 0) |
| 345 | abi_breakagecxx . . $ `include/utils.h:28:9`!(); |
| 346 | break; |
| 347 | case NFTA_RULE_POSITIONcxx . . $ NFTA_RULE_POSITION.: |
| 348 | if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U64cxx . . $ MNL_TYPE_U64.) < 0) |
| 349 | abi_breakagecxx . . $ `include/utils.h:28:9`!(); |
| 350 | break; |
| 351 | case NFTA_RULE_USERDATAcxx . . $ NFTA_RULE_USERDATA.: |
| 352 | if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_BINARYcxx . . $ MNL_TYPE_BINARY.) < 0) |
| 353 | abi_breakagecxx . . $ `include/utils.h:28:9`!(); |
| 354 | break; |
| 355 | case NFTA_RULE_IDcxx . . $ NFTA_RULE_ID.: |
| 356 | case NFTA_RULE_POSITION_IDcxx . . $ NFTA_RULE_POSITION_ID.: |
| 357 | if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U32cxx . . $ MNL_TYPE_U32.) < 0) |
| 358 | abi_breakagecxx . . $ `include/utils.h:28:9`!(); |
| 359 | break; |
| 360 | } |
| 361 | |
| 362 | tb[type] = attr; |
| 363 | return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!; |
| 364 | } |
| 365 | |
| 366 | static int nftnl_rule_parse_exprcxx . . $ nftnl_rule_parse_expr(467d5720b3a284c).(struct nlattrcxx . . $ nlattr# *nest, struct nftnl_rulecxx . . $ nftnl_rule# *r) |
| 367 | { |
| 368 | struct nftnl_exprcxx . . $ nftnl_expr# *expr; |
| 369 | struct nlattrcxx . . $ nlattr# *attr; |
| 370 | |
| 371 | mnl_attr_for_each_nestedcxx . . $ `<external>/12386019527593959648/libmnl.h:152:9`!(attr, nest) { |
| 372 | if (mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr) != NFTA_LIST_ELEMcxx . . $ NFTA_LIST_ELEM.) |
| 373 | return -1; |
| 374 | |
| 375 | expr = nftnl_expr_parsecxx . . $ nftnl_expr_parse(ea32a576744d0134).(attr); |
| 376 | if (expr == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 377 | return -1; |
| 378 | |
| 379 | list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&expr->headcxx . . $ nftnl_expr#head., &r->expr_listcxx . . $ nftnl_rule#expr_list.); |
| 380 | } |
| 381 | return 0; |
| 382 | } |
| 383 | |
| 384 | static int nftnl_rule_parse_compat_cbcxx . . $ nftnl_rule_parse_compat_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data) |
| 385 | { |
| 386 | const struct nlattrcxx . . $ nlattr# **tb = data; |
| 387 | int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr); |
| 388 | |
| 389 | if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_RULE_COMPAT_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:313:9`!) < 0) |
| 390 | return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!; |
| 391 | |
| 392 | switch(type) { |
| 393 | case NFTA_RULE_COMPAT_PROTOcxx . . $ NFTA_RULE_COMPAT_PROTO.: |
| 394 | case NFTA_RULE_COMPAT_FLAGScxx . . $ NFTA_RULE_COMPAT_FLAGS.: |
| 395 | if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U32cxx . . $ MNL_TYPE_U32.) < 0) |
| 396 | abi_breakagecxx . . $ `include/utils.h:28:9`!(); |
| 397 | break; |
| 398 | } |
| 399 | |
| 400 | tb[type] = attr; |
| 401 | return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!; |
| 402 | } |
| 403 | |
| 404 | static int nftnl_rule_parse_compatcxx . . $ nftnl_rule_parse_compat(467d5720b3a284c).(struct nlattrcxx . . $ nlattr# *nest, struct nftnl_rulecxx . . $ nftnl_rule# *r) |
| 405 | { |
| 406 | struct nlattrcxx . . $ nlattr# *tb[NFTA_RULE_COMPAT_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:313:9`!+1] = {}; |
| 407 | |
| 408 | if (mnl_attr_parse_nestedcxx . . $ mnl_attr_parse_nested(f99c0e9fa94f99d9).(nest, nftnl_rule_parse_compat_cbcxx . . $ nftnl_rule_parse_compat_cb(de2ef18c48fd675c)., tb) < 0) |
| 409 | return -1; |
| 410 | |
| 411 | if (tb[NFTA_RULE_COMPAT_PROTOcxx . . $ NFTA_RULE_COMPAT_PROTO.]) { |
| 412 | r->compatcxx . . $ nftnl_rule#compat..protocxx . . $ nftnl_rule#$anonymous_type_1#proto. = |
| 413 | ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_RULE_COMPAT_PROTO])); |
| 414 | r->flagscxx . . $ nftnl_rule#flags. |= (1 << NFTNL_RULE_COMPAT_PROTOcxx . . $ NFTNL_RULE_COMPAT_PROTO.); |
| 415 | } |
| 416 | if (tb[NFTA_RULE_COMPAT_FLAGScxx . . $ NFTA_RULE_COMPAT_FLAGS.]) { |
| 417 | r->compatcxx . . $ nftnl_rule#compat..flagscxx . . $ nftnl_rule#$anonymous_type_1#flags. = |
| 418 | ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_RULE_COMPAT_FLAGS])); |
| 419 | r->flagscxx . . $ nftnl_rule#flags. |= (1 << NFTNL_RULE_COMPAT_FLAGScxx . . $ NFTNL_RULE_COMPAT_FLAGS.); |
| 420 | } |
| 421 | return 0; |
| 422 | } |
| 423 | |
| 424 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_nlmsg_parse); |
| 425 | int nftnl_rule_nlmsg_parsecxx . . $ nftnl_rule_nlmsg_parse(3af18c47d7f2c0e4).(const struct nlmsghdrcxx . . $ nlmsghdr# *nlh, struct nftnl_rulecxx . . $ nftnl_rule# *r) |
| 426 | { |
| 427 | struct nlattrcxx . . $ nlattr# *tb[NFTA_RULE_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:287:9`!+1] = {}; |
| 428 | struct nfgenmsgcxx . . $ nfgenmsg# *nfg = mnl_nlmsg_get_payloadcxx . . $ mnl_nlmsg_get_payload(33f780b45aa89a18).(nlh); |
| 429 | int ret; |
| 430 | |
| 431 | if (mnl_attr_parsecxx . . $ mnl_attr_parse(8b80a5a12c5e6592).(nlh, sizeof(*nfg), nftnl_rule_parse_attr_cbcxx . . $ nftnl_rule_parse_attr_cb(de2ef18c48fd675c)., tb) < 0) |
| 432 | return -1; |
| 433 | |
| 434 | if (nftnl_parse_str_attrcxx . . $ nftnl_parse_str_attr(2002c8408bf98f7f).(tb[NFTA_RULE_TABLEcxx . . $ NFTA_RULE_TABLE.], NFTNL_RULE_TABLEcxx . . $ NFTNL_RULE_TABLE., |
| 435 | &r->tablecxx . . $ nftnl_rule#table., &r->flagscxx . . $ nftnl_rule#flags.) < 0) |
| 436 | return -1; |
| 437 | if (nftnl_parse_str_attrcxx . . $ nftnl_parse_str_attr(2002c8408bf98f7f).(tb[NFTA_RULE_CHAINcxx . . $ NFTA_RULE_CHAIN.], NFTNL_RULE_CHAINcxx . . $ NFTNL_RULE_CHAIN., |
| 438 | &r->chaincxx . . $ nftnl_rule#chain., &r->flagscxx . . $ nftnl_rule#flags.) < 0) |
| 439 | return -1; |
| 440 | if (tb[NFTA_RULE_HANDLEcxx . . $ NFTA_RULE_HANDLE.]) { |
| 441 | r->handlecxx . . $ nftnl_rule#handle. = be64tohcxx . . $ `<external>/15855202785537844739/endian.h:51:11`!(mnl_attr_get_u64(tb[NFTA_RULE_HANDLE])); |
| 442 | r->flagscxx . . $ nftnl_rule#flags. |= (1 << NFTNL_RULE_HANDLEcxx . . $ NFTNL_RULE_HANDLE.); |
| 443 | } |
| 444 | if (tb[NFTA_RULE_EXPRESSIONScxx . . $ NFTA_RULE_EXPRESSIONS.]) { |
| 445 | ret = nftnl_rule_parse_exprcxx . . $ nftnl_rule_parse_expr(467d5720b3a284c).(tb[NFTA_RULE_EXPRESSIONScxx . . $ NFTA_RULE_EXPRESSIONS.], r); |
| 446 | if (ret < 0) |
| 447 | return ret; |
| 448 | } |
| 449 | if (tb[NFTA_RULE_COMPATcxx . . $ NFTA_RULE_COMPAT.]) { |
| 450 | ret = nftnl_rule_parse_compatcxx . . $ nftnl_rule_parse_compat(467d5720b3a284c).(tb[NFTA_RULE_COMPATcxx . . $ NFTA_RULE_COMPAT.], r); |
| 451 | if (ret < 0) |
| 452 | return ret; |
| 453 | } |
| 454 | if (tb[NFTA_RULE_POSITIONcxx . . $ NFTA_RULE_POSITION.]) { |
| 455 | r->positioncxx . . $ nftnl_rule#position. = be64tohcxx . . $ `<external>/15855202785537844739/endian.h:51:11`!(mnl_attr_get_u64(tb[NFTA_RULE_POSITION])); |
| 456 | r->flagscxx . . $ nftnl_rule#flags. |= (1 << NFTNL_RULE_POSITIONcxx . . $ NFTNL_RULE_POSITION.); |
| 457 | } |
| 458 | if (tb[NFTA_RULE_USERDATAcxx . . $ NFTA_RULE_USERDATA.]) { |
| 459 | const void *udata = |
| 460 | mnl_attr_get_payloadcxx . . $ mnl_attr_get_payload(cbbcdcb61d3bc7e8).(tb[NFTA_RULE_USERDATAcxx . . $ NFTA_RULE_USERDATA.]); |
| 461 | |
| 462 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_USERDATAcxx . . $ NFTNL_RULE_USERDATA.)) |
| 463 | xfreecxx . . $ `include/utils.h:22:9`!(r->user.data); |
| 464 | |
| 465 | r->usercxx . . $ nftnl_rule#user..lencxx . . $ nftnl_rule#$anonymous_type_0#len. = mnl_attr_get_payload_lencxx . . $ mnl_attr_get_payload_len(1da47bcc4c4b975).(tb[NFTA_RULE_USERDATAcxx . . $ NFTA_RULE_USERDATA.]); |
| 466 | |
| 467 | r->usercxx . . $ nftnl_rule#user..datacxx . . $ nftnl_rule#$anonymous_type_0#data. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(r->usercxx . . $ nftnl_rule#user..lencxx . . $ nftnl_rule#$anonymous_type_0#len.); |
| 468 | if (r->usercxx . . $ nftnl_rule#user..datacxx . . $ nftnl_rule#$anonymous_type_0#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 469 | return -1; |
| 470 | |
| 471 | memcpycxx . . $ memcpy(cc817cb175f282d).(r->usercxx . . $ nftnl_rule#user..datacxx . . $ nftnl_rule#$anonymous_type_0#data., udata, r->usercxx . . $ nftnl_rule#user..lencxx . . $ nftnl_rule#$anonymous_type_0#len.); |
| 472 | r->flagscxx . . $ nftnl_rule#flags. |= (1 << NFTNL_RULE_USERDATAcxx . . $ NFTNL_RULE_USERDATA.); |
| 473 | } |
| 474 | if (tb[NFTA_RULE_IDcxx . . $ NFTA_RULE_ID.]) { |
| 475 | r->idcxx . . $ nftnl_rule#id. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_RULE_ID])); |
| 476 | r->flagscxx . . $ nftnl_rule#flags. |= (1 << NFTNL_RULE_IDcxx . . $ NFTNL_RULE_ID.); |
| 477 | } |
| 478 | if (tb[NFTA_RULE_POSITION_IDcxx . . $ NFTA_RULE_POSITION_ID.]) { |
| 479 | r->position_idcxx . . $ nftnl_rule#position_id. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_RULE_POSITION_ID])); |
| 480 | r->flagscxx . . $ nftnl_rule#flags. |= (1 << NFTNL_RULE_POSITION_IDcxx . . $ NFTNL_RULE_POSITION_ID.); |
| 481 | } |
| 482 | |
| 483 | r->familycxx . . $ nftnl_rule#family. = nfg->nfgen_familycxx . . $ nfgenmsg#nfgen_family.; |
| 484 | r->flagscxx . . $ nftnl_rule#flags. |= (1 << NFTNL_RULE_FAMILYcxx . . $ NFTNL_RULE_FAMILY.); |
| 485 | |
| 486 | return 0; |
| 487 | } |
| 488 | |
| 489 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_parse); |
| 490 | int nftnl_rule_parsecxx . . $ nftnl_rule_parse(ccd71bd7e11714d9).(struct nftnl_rulecxx . . $ nftnl_rule# *r, enum nftnl_parse_typecxx . . $ nftnl_parse_type# type, |
| 491 | const char *data, struct nftnl_parse_errcxx . . $ nftnl_parse_err# *err) |
| 492 | { |
| 493 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!; |
| 494 | |
| 495 | return -1; |
| 496 | } |
| 497 | |
| 498 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_parse_file); |
| 499 | int nftnl_rule_parse_filecxx . . $ nftnl_rule_parse_file(5c7fe6b726564331).(struct nftnl_rulecxx . . $ nftnl_rule# *r, enum nftnl_parse_typecxx . . $ nftnl_parse_type# type, |
| 500 | FILEcxx . . $ FILE# *fp, struct nftnl_parse_errcxx . . $ nftnl_parse_err# *err) |
| 501 | { |
| 502 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!; |
| 503 | |
| 504 | return -1; |
| 505 | } |
| 506 | |
| 507 | static int nftnl_rule_snprintf_defaultcxx . . $ nftnl_rule_snprintf_default(f37e2ba4daf5a3e1).(char *buf, size_t remain, |
| 508 | const struct nftnl_rulecxx . . $ nftnl_rule# *r, |
| 509 | uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags) |
| 510 | { |
| 511 | struct nftnl_exprcxx . . $ nftnl_expr# *expr; |
| 512 | const char *sep = ""; |
| 513 | int ret, offset = 0; |
| 514 | |
| 515 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_FAMILYcxx . . $ NFTNL_RULE_FAMILY.)) { |
| 516 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, "%s%s", sep, |
| 517 | nftnl_family2strcxx . . $ nftnl_family2str(81a3ae90da26a711).(r->familycxx . . $ nftnl_rule#family.)); |
| 518 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 519 | sep = " "; |
| 520 | } |
| 521 | |
| 522 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_TABLEcxx . . $ NFTNL_RULE_TABLE.)) { |
| 523 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, "%s%s", sep, |
| 524 | r->tablecxx . . $ nftnl_rule#table.); |
| 525 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 526 | sep = " "; |
| 527 | } |
| 528 | |
| 529 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_CHAINcxx . . $ NFTNL_RULE_CHAIN.)) { |
| 530 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, "%s%s", sep, |
| 531 | r->chaincxx . . $ nftnl_rule#chain.); |
| 532 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 533 | sep = " "; |
| 534 | } |
| 535 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_HANDLEcxx . . $ NFTNL_RULE_HANDLE.)) { |
| 536 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, "%s%" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:110:10`!, sep, |
| 537 | r->handlecxx . . $ nftnl_rule#handle.); |
| 538 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 539 | sep = " "; |
| 540 | } |
| 541 | |
| 542 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_POSITIONcxx . . $ NFTNL_RULE_POSITION.)) { |
| 543 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, "%s%" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:110:10`!, sep, |
| 544 | r->positioncxx . . $ nftnl_rule#position.); |
| 545 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 546 | sep = " "; |
| 547 | } |
| 548 | |
| 549 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_IDcxx . . $ NFTNL_RULE_ID.)) { |
| 550 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, "%s%u", sep, r->idcxx . . $ nftnl_rule#id.); |
| 551 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 552 | sep = " "; |
| 553 | } |
| 554 | |
| 555 | if (r->flagscxx . . $ nftnl_rule#flags. & (1 << NFTNL_RULE_POSITION_IDcxx . . $ NFTNL_RULE_POSITION_ID.)) { |
| 556 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, "%s%u", sep, |
| 557 | r->position_idcxx . . $ nftnl_rule#position_id.); |
| 558 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 559 | sep = " "; |
| 560 | } |
| 561 | |
| 562 | list_for_each_entrycxx . . $ `include/linux_list.h:384:9`!(expr, &r->expr_list, head) { |
| 563 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, |
| 564 | "\n [ %s ", expr->opscxx . . $ nftnl_expr#ops.->namecxx . . $ expr_ops#name.); |
| 565 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 566 | |
| 567 | ret = nftnl_expr_snprintfcxx . . $ nftnl_expr_snprintf(7e053fe52193f124).(buf + offset, remain, expr, |
| 568 | type, flags); |
| 569 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 570 | |
| 571 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, "]"); |
| 572 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 573 | } |
| 574 | |
| 575 | if (r->usercxx . . $ nftnl_rule#user..lencxx . . $ nftnl_rule#$anonymous_type_0#len.) { |
| 576 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, |
| 577 | "\n userdata len %d sum 0x%x", |
| 578 | r->usercxx . . $ nftnl_rule#user..lencxx . . $ nftnl_rule#$anonymous_type_0#len., bytesumcxx . . $ bytesum(8cbb85865c56216f).(r->usercxx . . $ nftnl_rule#user..datacxx . . $ nftnl_rule#$anonymous_type_0#data., r->usercxx . . $ nftnl_rule#user..lencxx . . $ nftnl_rule#$anonymous_type_0#len.)); |
| 579 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 580 | } |
| 581 | |
| 582 | return offset; |
| 583 | } |
| 584 | |
| 585 | static int nftnl_rule_cmd_snprintfcxx . . $ nftnl_rule_cmd_snprintf(747f99a75546a1a5).(char *buf, size_t remain, |
| 586 | const struct nftnl_rulecxx . . $ nftnl_rule# *r, uint32_tcxx . . $ uint32_t# cmd, |
| 587 | uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags) |
| 588 | { |
| 589 | uint32_tcxx . . $ uint32_t# inner_flags = flags; |
| 590 | int ret, offset = 0; |
| 591 | |
| 592 | inner_flags &= ~NFTNL_OF_EVENT_ANYcxx . . $ NFTNL_OF_EVENT_ANY.; |
| 593 | |
| 594 | if (type != NFTNL_OUTPUT_DEFAULTcxx . . $ NFTNL_OUTPUT_DEFAULT.) |
| 595 | return -1; |
| 596 | |
| 597 | ret = nftnl_rule_snprintf_defaultcxx . . $ nftnl_rule_snprintf_default(f37e2ba4daf5a3e1).(buf + offset, remain, r, type, |
| 598 | inner_flags); |
| 599 | SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset); |
| 600 | return offset; |
| 601 | } |
| 602 | |
| 603 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_snprintf); |
| 604 | int nftnl_rule_snprintfcxx . . $ nftnl_rule_snprintf(f37e2ba4daf5a3e1).(char *buf, size_t size, const struct nftnl_rulecxx . . $ nftnl_rule# *r, |
| 605 | uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags) |
| 606 | { |
| 607 | if (size) |
| 608 | buf[0] = '\0'; |
| 609 | |
| 610 | return nftnl_rule_cmd_snprintfcxx . . $ nftnl_rule_cmd_snprintf(747f99a75546a1a5).(buf, size, r, nftnl_flag2cmdcxx . . $ nftnl_flag2cmd(73b61a9477c235b4).(flags), type, |
| 611 | flags); |
| 612 | } |
| 613 | |
| 614 | static int nftnl_rule_do_snprintfcxx . . $ nftnl_rule_do_snprintf(809f16203406eb30).(char *buf, size_t size, const void *r, |
| 615 | uint32_tcxx . . $ uint32_t# cmd, uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags) |
| 616 | { |
| 617 | return nftnl_rule_snprintfcxx . . $ nftnl_rule_snprintf(f37e2ba4daf5a3e1).(buf, size, r, type, flags); |
| 618 | } |
| 619 | |
| 620 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_fprintf); |
| 621 | int nftnl_rule_fprintfcxx . . $ nftnl_rule_fprintf(fb371cc68a88d0e0).(FILEcxx . . $ FILE# *fp, const struct nftnl_rulecxx . . $ nftnl_rule# *r, uint32_tcxx . . $ uint32_t# type, |
| 622 | uint32_tcxx . . $ uint32_t# flags) |
| 623 | { |
| 624 | return nftnl_fprintfcxx . . $ nftnl_fprintf(959aea809fde9589).(fp, r, NFTNL_CMD_UNSPECcxx . . $ NFTNL_CMD_UNSPEC., type, flags, |
| 625 | nftnl_rule_do_snprintfcxx . . $ nftnl_rule_do_snprintf(809f16203406eb30).); |
| 626 | } |
| 627 | |
| 628 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_expr_foreach); |
| 629 | int nftnl_expr_foreachcxx . . $ nftnl_expr_foreach(62877d05a9b5ed26).(struct nftnl_rulecxx . . $ nftnl_rule# *r, |
| 630 | int (*cb)(struct nftnl_exprcxx . . $ nftnl_expr# *e, void *data), |
| 631 | void *data) |
| 632 | { |
| 633 | struct nftnl_exprcxx . . $ nftnl_expr# *cur, *tmp; |
| 634 | int ret; |
| 635 | |
| 636 | list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(cur, tmp, &r->expr_list, head) { |
| 637 | ret = cb(cur, data); |
| 638 | if (ret < 0) |
| 639 | return ret; |
| 640 | } |
| 641 | return 0; |
| 642 | } |
| 643 | |
| 644 | struct nftnl_expr_itercxx . . $ nftnl_expr_iter# { |
| 645 | const struct nftnl_rulecxx . . $ nftnl_rule# *rcxx . . $ nftnl_expr_iter#r.; |
| 646 | struct nftnl_exprcxx . . $ nftnl_expr# *curcxx . . $ nftnl_expr_iter#cur.; |
| 647 | }; |
| 648 | |
| 649 | static void nftnl_expr_iter_initcxx . . $ nftnl_expr_iter_init(8da936eabc087e46).(const struct nftnl_rulecxx . . $ nftnl_rule# *r, |
| 650 | struct nftnl_expr_itercxx . . $ nftnl_expr_iter# *iter) |
| 651 | { |
| 652 | iter->rcxx . . $ nftnl_expr_iter#r. = r; |
| 653 | if (list_emptycxx . . $ list_empty(df525b6afabf24a2).(&r->expr_listcxx . . $ nftnl_rule#expr_list.)) |
| 654 | iter->curcxx . . $ nftnl_expr_iter#cur. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 655 | else |
| 656 | iter->curcxx . . $ nftnl_expr_iter#cur. = list_entrycxx . . $ `include/linux_list.h:334:9`!(r->expr_list.next, struct nftnl_expr, |
| 657 | head); |
| 658 | } |
| 659 | |
| 660 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_expr_iter_create); |
| 661 | struct nftnl_expr_itercxx . . $ nftnl_expr_iter# *nftnl_expr_iter_createcxx . . $ nftnl_expr_iter_create(26fc435c08e1ea46).(const struct nftnl_rulecxx . . $ nftnl_rule# *r) |
| 662 | { |
| 663 | struct nftnl_expr_itercxx . . $ nftnl_expr_iter# *iter; |
| 664 | |
| 665 | iter = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_expr_itercxx . . $ nftnl_expr_iter#)); |
| 666 | if (iter == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 667 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 668 | |
| 669 | nftnl_expr_iter_initcxx . . $ nftnl_expr_iter_init(8da936eabc087e46).(r, iter); |
| 670 | |
| 671 | return iter; |
| 672 | } |
| 673 | |
| 674 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_expr_iter_next); |
| 675 | struct nftnl_exprcxx . . $ nftnl_expr# *nftnl_expr_iter_nextcxx . . $ nftnl_expr_iter_next(bcb2311d9c5a69eb).(struct nftnl_expr_itercxx . . $ nftnl_expr_iter# *iter) |
| 676 | { |
| 677 | struct nftnl_exprcxx . . $ nftnl_expr# *expr = iter->curcxx . . $ nftnl_expr_iter#cur.; |
| 678 | |
| 679 | if (expr == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 680 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 681 | |
| 682 | /* get next expression, if any */ |
| 683 | iter->curcxx . . $ nftnl_expr_iter#cur. = list_entrycxx . . $ `include/linux_list.h:334:9`!(iter->cur->head.next, struct nftnl_expr, head); |
| 684 | if (&iter->curcxx . . $ nftnl_expr_iter#cur.->headcxx . . $ nftnl_expr#head. == iter->rcxx . . $ nftnl_expr_iter#r.->expr_listcxx . . $ nftnl_rule#expr_list..nextcxx . . $ list_head#next.) |
| 685 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 686 | |
| 687 | return expr; |
| 688 | } |
| 689 | |
| 690 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_expr_iter_destroy); |
| 691 | void nftnl_expr_iter_destroycxx . . $ nftnl_expr_iter_destroy(6c78a787f215df3d).(struct nftnl_expr_itercxx . . $ nftnl_expr_iter# *iter) |
| 692 | { |
| 693 | xfreecxx . . $ `include/utils.h:22:9`!(iter); |
| 694 | } |
| 695 | |
| 696 | struct nftnl_rule_listcxx . . $ nftnl_rule_list# { |
| 697 | struct list_headcxx . . $ list_head# listcxx . . $ nftnl_rule_list#list.; |
| 698 | }; |
| 699 | |
| 700 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_list_alloc); |
| 701 | struct nftnl_rule_listcxx . . $ nftnl_rule_list# *nftnl_rule_list_alloccxx . . $ nftnl_rule_list_alloc(d8ec6d98a88dd60a).(void) |
| 702 | { |
| 703 | struct nftnl_rule_listcxx . . $ nftnl_rule_list# *list; |
| 704 | |
| 705 | list = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_rule_listcxx . . $ nftnl_rule_list#)); |
| 706 | if (list == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 707 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 708 | |
| 709 | INIT_LIST_HEADcxx . . $ `include/linux_list.h:66:9`!(&list->list); |
| 710 | |
| 711 | return list; |
| 712 | } |
| 713 | |
| 714 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_list_free); |
| 715 | void nftnl_rule_list_freecxx . . $ nftnl_rule_list_free(3ac758a7595c423b).(struct nftnl_rule_listcxx . . $ nftnl_rule_list# *list) |
| 716 | { |
| 717 | struct nftnl_rulecxx . . $ nftnl_rule# *r, *tmp; |
| 718 | |
| 719 | list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(r, tmp, &list->list, head) { |
| 720 | list_delcxx . . $ list_del(35ab6d74de6aba0a).(&r->headcxx . . $ nftnl_rule#head.); |
| 721 | nftnl_rule_freecxx . . $ nftnl_rule_free(c1b52878f58022c2).(r); |
| 722 | } |
| 723 | xfreecxx . . $ `include/utils.h:22:9`!(list); |
| 724 | } |
| 725 | |
| 726 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_list_is_empty); |
| 727 | int nftnl_rule_list_is_emptycxx . . $ nftnl_rule_list_is_empty(ab5641ab46a1af8c).(const struct nftnl_rule_listcxx . . $ nftnl_rule_list# *list) |
| 728 | { |
| 729 | return list_emptycxx . . $ list_empty(df525b6afabf24a2).(&list->listcxx . . $ nftnl_rule_list#list.); |
| 730 | } |
| 731 | |
| 732 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_list_add); |
| 733 | void nftnl_rule_list_addcxx . . $ nftnl_rule_list_add(9beec01a35ebb477).(struct nftnl_rulecxx . . $ nftnl_rule# *r, struct nftnl_rule_listcxx . . $ nftnl_rule_list# *list) |
| 734 | { |
| 735 | list_addcxx . . $ list_add(6c3f7387ec573de3).(&r->headcxx . . $ nftnl_rule#head., &list->listcxx . . $ nftnl_rule_list#list.); |
| 736 | } |
| 737 | |
| 738 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_list_insert_at); |
| 739 | void nftnl_rule_list_insert_atcxx . . $ nftnl_rule_list_insert_at(47913c483d795e14).(struct nftnl_rulecxx . . $ nftnl_rule# *r, struct nftnl_rulecxx . . $ nftnl_rule# *pos) |
| 740 | { |
| 741 | list_addcxx . . $ list_add(6c3f7387ec573de3).(&r->headcxx . . $ nftnl_rule#head., &pos->headcxx . . $ nftnl_rule#head.); |
| 742 | } |
| 743 | |
| 744 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_list_add_tail); |
| 745 | void nftnl_rule_list_add_tailcxx . . $ nftnl_rule_list_add_tail(9beec01a35ebb477).(struct nftnl_rulecxx . . $ nftnl_rule# *r, struct nftnl_rule_listcxx . . $ nftnl_rule_list# *list) |
| 746 | { |
| 747 | list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&r->headcxx . . $ nftnl_rule#head., &list->listcxx . . $ nftnl_rule_list#list.); |
| 748 | } |
| 749 | |
| 750 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_list_del); |
| 751 | void nftnl_rule_list_delcxx . . $ nftnl_rule_list_del(6a7057e190e103a6).(struct nftnl_rulecxx . . $ nftnl_rule# *r) |
| 752 | { |
| 753 | list_delcxx . . $ list_del(35ab6d74de6aba0a).(&r->headcxx . . $ nftnl_rule#head.); |
| 754 | } |
| 755 | |
| 756 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_list_foreach); |
| 757 | int nftnl_rule_list_foreachcxx . . $ nftnl_rule_list_foreach(2680f1105f1900b5).(struct nftnl_rule_listcxx . . $ nftnl_rule_list# *rule_list, |
| 758 | int (*cb)(struct nftnl_rulecxx . . $ nftnl_rule# *r, void *data), |
| 759 | void *data) |
| 760 | { |
| 761 | struct nftnl_rulecxx . . $ nftnl_rule# *cur, *tmp; |
| 762 | int ret; |
| 763 | |
| 764 | list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(cur, tmp, &rule_list->list, head) { |
| 765 | ret = cb(cur, data); |
| 766 | if (ret < 0) |
| 767 | return ret; |
| 768 | } |
| 769 | return 0; |
| 770 | } |
| 771 | |
| 772 | struct nftnl_rule_list_itercxx . . $ nftnl_rule_list_iter# { |
| 773 | const struct nftnl_rule_listcxx . . $ nftnl_rule_list# *listcxx . . $ nftnl_rule_list_iter#list.; |
| 774 | struct nftnl_rulecxx . . $ nftnl_rule# *curcxx . . $ nftnl_rule_list_iter#cur.; |
| 775 | }; |
| 776 | |
| 777 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_list_iter_create); |
| 778 | struct nftnl_rule_list_itercxx . . $ nftnl_rule_list_iter# * |
| 779 | nftnl_rule_list_iter_createcxx . . $ nftnl_rule_list_iter_create(6da56778383e8e1).(const struct nftnl_rule_listcxx . . $ nftnl_rule_list# *l) |
| 780 | { |
| 781 | struct nftnl_rule_list_itercxx . . $ nftnl_rule_list_iter# *iter; |
| 782 | |
| 783 | iter = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_rule_list_itercxx . . $ nftnl_rule_list_iter#)); |
| 784 | if (iter == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 785 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 786 | |
| 787 | iter->listcxx . . $ nftnl_rule_list_iter#list. = l; |
| 788 | if (nftnl_rule_list_is_emptycxx . . $ nftnl_rule_list_is_empty(ab5641ab46a1af8c).(l)) |
| 789 | iter->curcxx . . $ nftnl_rule_list_iter#cur. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 790 | else |
| 791 | iter->curcxx . . $ nftnl_rule_list_iter#cur. = list_entrycxx . . $ `include/linux_list.h:334:9`!(l->list.next, struct nftnl_rule, head); |
| 792 | |
| 793 | return iter; |
| 794 | } |
| 795 | |
| 796 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_list_iter_cur); |
| 797 | struct nftnl_rulecxx . . $ nftnl_rule# *nftnl_rule_list_iter_curcxx . . $ nftnl_rule_list_iter_cur(ba41a40cd1013298).(struct nftnl_rule_list_itercxx . . $ nftnl_rule_list_iter# *iter) |
| 798 | { |
| 799 | return iter->curcxx . . $ nftnl_rule_list_iter#cur.; |
| 800 | } |
| 801 | |
| 802 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_list_iter_next); |
| 803 | struct nftnl_rulecxx . . $ nftnl_rule# *nftnl_rule_list_iter_nextcxx . . $ nftnl_rule_list_iter_next(ba41a40cd1013298).(struct nftnl_rule_list_itercxx . . $ nftnl_rule_list_iter# *iter) |
| 804 | { |
| 805 | struct nftnl_rulecxx . . $ nftnl_rule# *r = iter->curcxx . . $ nftnl_rule_list_iter#cur.; |
| 806 | |
| 807 | if (r == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 808 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 809 | |
| 810 | /* get next rule, if any */ |
| 811 | iter->curcxx . . $ nftnl_rule_list_iter#cur. = list_entrycxx . . $ `include/linux_list.h:334:9`!(iter->cur->head.next, struct nftnl_rule, head); |
| 812 | if (&iter->curcxx . . $ nftnl_rule_list_iter#cur.->headcxx . . $ nftnl_rule#head. == iter->listcxx . . $ nftnl_rule_list_iter#list.->listcxx . . $ nftnl_rule_list#list..nextcxx . . $ list_head#next.) |
| 813 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 814 | |
| 815 | return r; |
| 816 | } |
| 817 | |
| 818 | EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_list_iter_destroy); |
| 819 | void nftnl_rule_list_iter_destroycxx . . $ nftnl_rule_list_iter_destroy(dbe118f2d8769404).(const struct nftnl_rule_list_itercxx . . $ nftnl_rule_list_iter# *iter) |
| 820 | { |
| 821 | xfreecxx . . $ `include/utils.h:22:9`!(iter); |
| 822 | } |