Debian Codegraph @

src/set_elem.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-or-later */cxx . . $ `<file>/src/set_elem.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 <string.h>
14 #include <netinet/in.h>
15 #include <errno.h>
16 #include <ctype.h>
17
18 #include <libmnl/libmnl.h>
19 #include <linux/netfilter/nfnetlink.h>cxx . . $ `<file>/include/linux/netfilter/nfnetlink.h`/
20 #include <linux/netfilter/nf_tables.h>cxx . . $ `<file>/include/linux/netfilter/nf_tables.h`/
21
22 #include <libnftnl/set.h>cxx . . $ `<file>/include/libnftnl/set.h`/
23 #include <libnftnl/rule.h>cxx . . $ `<file>/include/libnftnl/rule.h`/
24 #include <libnftnl/expr.h>cxx . . $ `<file>/include/libnftnl/expr.h`/
25
26 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_alloc);
27 struct nftnl_set_elemcxx . . $ nftnl_set_elem# *nftnl_set_elem_alloccxx . . $ nftnl_set_elem_alloc(a0cbc9f6acf83051).(void)
28 {
29 struct nftnl_set_elemcxx . . $ nftnl_set_elem# *s;
30
31 s = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_set_elemcxx . . $ nftnl_set_elem#));
32 if (s == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)
33 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
34
35 INIT_LIST_HEADcxx . . $ `include/linux_list.h:66:9`!(&s->expr_list);
36
37 return s;
38 }
39
40 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_free);
41 void nftnl_set_elem_freecxx . . $ nftnl_set_elem_free(aa0bbd50ab576260).(struct nftnl_set_elemcxx . . $ nftnl_set_elem# *s)
42 {
43 struct nftnl_exprcxx . . $ nftnl_expr# *e, *tmp;
44
45 if (s->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_CHAINcxx . . $ NFTNL_SET_ELEM_CHAIN.))
46 xfreecxx . . $ `include/utils.h:22:9`!(s->data.chain);
47
48 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(e, tmp, &s->expr_list, head)
49 nftnl_expr_freecxx . . $ nftnl_expr_free(cbe1a28527736226).(e);
50
51 if (s->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_USERDATAcxx . . $ NFTNL_SET_ELEM_USERDATA.))
52 xfreecxx . . $ `include/utils.h:22:9`!(s->user.data);
53
54 if (s->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_OBJREFcxx . . $ NFTNL_SET_ELEM_OBJREF.))
55 xfreecxx . . $ `include/utils.h:22:9`!(s->objref);
56
57 xfreecxx . . $ `include/utils.h:22:9`!(s);
58 }
59
60 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_is_set);
61 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! nftnl_set_elem_is_setcxx . . $ nftnl_set_elem_is_set(6b6a40c036efe113).(const struct nftnl_set_elemcxx . . $ nftnl_set_elem# *s, uint16_tcxx . . $ uint16_t# attr)
62 {
63 return s->flagscxx . . $ nftnl_set_elem#flags. & (1 << attr);
64 }
65
66 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_unset);
67 void nftnl_set_elem_unsetcxx . . $ nftnl_set_elem_unset(8159a606c637d590).(struct nftnl_set_elemcxx . . $ nftnl_set_elem# *s, uint16_tcxx . . $ uint16_t# attr)
68 {
69 struct nftnl_exprcxx . . $ nftnl_expr# *expr, *tmp;
70
71 if (!(s->flagscxx . . $ nftnl_set_elem#flags. & (1 << attr)))
72 return;
73
74 switch (attr) {
75 case NFTNL_SET_ELEM_CHAINcxx . . $ NFTNL_SET_ELEM_CHAIN.:
76 xfreecxx . . $ `include/utils.h:22:9`!(s->data.chain);
77 break;
78 case NFTNL_SET_ELEM_FLAGScxx . . $ NFTNL_SET_ELEM_FLAGS.:
79 case NFTNL_SET_ELEM_KEYcxx . . $ NFTNL_SET_ELEM_KEY.: /* NFTA_SET_ELEM_KEY */
80 case NFTNL_SET_ELEM_KEY_ENDcxx . . $ NFTNL_SET_ELEM_KEY_END.: /* NFTA_SET_ELEM_KEY_END */
81 case NFTNL_SET_ELEM_VERDICTcxx . . $ NFTNL_SET_ELEM_VERDICT.: /* NFTA_SET_ELEM_DATA */
82 case NFTNL_SET_ELEM_DATAcxx . . $ NFTNL_SET_ELEM_DATA.: /* NFTA_SET_ELEM_DATA */
83 case NFTNL_SET_ELEM_TIMEOUTcxx . . $ NFTNL_SET_ELEM_TIMEOUT.: /* NFTA_SET_ELEM_TIMEOUT */
84 case NFTNL_SET_ELEM_EXPIRATIONcxx . . $ NFTNL_SET_ELEM_EXPIRATION.: /* NFTA_SET_ELEM_EXPIRATION */
85 break;
86 case NFTNL_SET_ELEM_USERDATAcxx . . $ NFTNL_SET_ELEM_USERDATA.: /* NFTA_SET_ELEM_USERDATA */
87 xfreecxx . . $ `include/utils.h:22:9`!(s->user.data);
88 break;
89 case NFTNL_SET_ELEM_EXPRcxx . . $ NFTNL_SET_ELEM_EXPR.:
90 case NFTNL_SET_ELEM_EXPRESSIONScxx . . $ NFTNL_SET_ELEM_EXPRESSIONS.:
91 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(expr, tmp, &s->expr_list, head)
92 nftnl_expr_freecxx . . $ nftnl_expr_free(cbe1a28527736226).(expr);
93 break;
94 case NFTNL_SET_ELEM_OBJREFcxx . . $ NFTNL_SET_ELEM_OBJREF.:
95 xfreecxx . . $ `include/utils.h:22:9`!(s->objref);
96 break;
97 default:
98 return;
99 }
100
101 s->flagscxx . . $ nftnl_set_elem#flags. &= ~(1 << attr);
102 }
103
104 static uint32_tcxx . . $ uint32_t# nftnl_set_elem_validatecxx . . $ nftnl_set_elem_validate.[NFTNL_SET_ELEM_MAXcxx . . $ `include/libnftnl/set.h:119:9`! + 1] = {
105 [NFTNL_SET_ELEM_FLAGScxx . . $ NFTNL_SET_ELEM_FLAGS.] = sizeof(uint32_tcxx . . $ uint32_t#),
106 [NFTNL_SET_ELEM_VERDICTcxx . . $ NFTNL_SET_ELEM_VERDICT.] = sizeof(uint32_tcxx . . $ uint32_t#),
107 [NFTNL_SET_ELEM_TIMEOUTcxx . . $ NFTNL_SET_ELEM_TIMEOUT.] = sizeof(uint64_tcxx . . $ uint64_t#),
108 [NFTNL_SET_ELEM_EXPIRATIONcxx . . $ NFTNL_SET_ELEM_EXPIRATION.] = sizeof(uint64_tcxx . . $ uint64_t#),
109 };
110
111 static int
112 __nftnl_set_elem_setcxx . . $ __nftnl_set_elem_set(36bc15b3fbd75f70).(struct nftnl_set_elemcxx . . $ nftnl_set_elem# *s, uint16_tcxx . . $ uint16_t# attr, const void *data,
113 uint32_tcxx . . $ uint32_t# data_len, uint32_tcxx . . $ uint32_t# byteorder, uint8_tcxx . . $ uint8_t# *sizes)
114 {
115 struct nftnl_exprcxx . . $ nftnl_expr# *expr, *tmp;
116
117 nftnl_assert_attr_existscxx . . $ `include/utils.h:49:9`!(attr, NFTNL_SET_ELEM_MAXcxx . . $ `include/libnftnl/set.h:119:9`!);
118 nftnl_assert_validatecxx . . $ `include/utils.h:38:9`!(data, nftnl_set_elem_validate, attr, data_len);
119
120 switch(attr) {
121 case NFTNL_SET_ELEM_FLAGScxx . . $ NFTNL_SET_ELEM_FLAGS.:
122 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->set_elem_flagscxx . . $ nftnl_set_elem#set_elem_flags., data, sizeof(s->set_elem_flagscxx . . $ nftnl_set_elem#set_elem_flags.));
123 break;
124 case NFTNL_SET_ELEM_KEYcxx . . $ NFTNL_SET_ELEM_KEY.: /* NFTA_SET_ELEM_KEY */
125 if (nftnl_data_cpycxx . . $ nftnl_data_cpy(fe1838cfef5a2dc9).(&s->keycxx . . $ nftnl_set_elem#key., data,
126 data_len, byteorder, sizes) < 0)
127 return -1;
128 break;
129 case NFTNL_SET_ELEM_KEY_ENDcxx . . $ NFTNL_SET_ELEM_KEY_END.: /* NFTA_SET_ELEM_KEY_END */
130 if (nftnl_data_cpycxx . . $ nftnl_data_cpy(fe1838cfef5a2dc9).(&s->key_endcxx . . $ nftnl_set_elem#key_end., data,
131 data_len, byteorder, sizes) < 0)
132 return -1;
133 break;
134 case NFTNL_SET_ELEM_VERDICTcxx . . $ NFTNL_SET_ELEM_VERDICT.: /* NFTA_SET_ELEM_DATA */
135 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->datacxx . . $ nftnl_set_elem#data..verdictcxx . . $ nftnl_data_reg#$anonymous_type_3#verdict., data, sizeof(s->datacxx . . $ nftnl_set_elem#data..verdictcxx . . $ nftnl_data_reg#$anonymous_type_3#verdict.));
136 break;
137 case NFTNL_SET_ELEM_CHAINcxx . . $ NFTNL_SET_ELEM_CHAIN.: /* NFTA_SET_ELEM_DATA */
138 if (s->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_CHAINcxx . . $ NFTNL_SET_ELEM_CHAIN.))
139 xfreecxx . . $ `include/utils.h:22:9`!(s->data.chain);
140
141 s->datacxx . . $ nftnl_set_elem#data..chaincxx . . $ nftnl_data_reg#$anonymous_type_3#chain. = strdupcxx . . $ strdup(a8b8e32347182212).(data);
142 if (!s->datacxx . . $ nftnl_set_elem#data..chaincxx . . $ nftnl_data_reg#$anonymous_type_3#chain.)
143 return -1;
144 break;
145 case NFTNL_SET_ELEM_DATAcxx . . $ NFTNL_SET_ELEM_DATA.: /* NFTA_SET_ELEM_DATA */
146 if (nftnl_data_cpycxx . . $ nftnl_data_cpy(fe1838cfef5a2dc9).(&s->datacxx . . $ nftnl_set_elem#data., data,
147 data_len, byteorder, sizes) < 0)
148 return -1;
149 break;
150 case NFTNL_SET_ELEM_TIMEOUTcxx . . $ NFTNL_SET_ELEM_TIMEOUT.: /* NFTA_SET_ELEM_TIMEOUT */
151 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->timeoutcxx . . $ nftnl_set_elem#timeout., data, sizeof(s->timeoutcxx . . $ nftnl_set_elem#timeout.));
152 break;
153 case NFTNL_SET_ELEM_EXPIRATIONcxx . . $ NFTNL_SET_ELEM_EXPIRATION.: /* NFTA_SET_ELEM_EXPIRATION */
154 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->expirationcxx . . $ nftnl_set_elem#expiration., data, sizeof(s->expirationcxx . . $ nftnl_set_elem#expiration.));
155 break;
156 case NFTNL_SET_ELEM_USERDATAcxx . . $ NFTNL_SET_ELEM_USERDATA.: /* NFTA_SET_ELEM_USERDATA */
157 if (s->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_USERDATAcxx . . $ NFTNL_SET_ELEM_USERDATA.))
158 xfreecxx . . $ `include/utils.h:22:9`!(s->user.data);
159
160 s->usercxx . . $ nftnl_set_elem#user..datacxx . . $ nftnl_set_elem#$anonymous_type_0#data. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(data_len);
161 if (!s->usercxx . . $ nftnl_set_elem#user..datacxx . . $ nftnl_set_elem#$anonymous_type_0#data.)
162 return -1;
163 memcpycxx . . $ memcpy(cc817cb175f282d).(s->usercxx . . $ nftnl_set_elem#user..datacxx . . $ nftnl_set_elem#$anonymous_type_0#data., data, data_len);
164 s->usercxx . . $ nftnl_set_elem#user..lencxx . . $ nftnl_set_elem#$anonymous_type_0#len. = data_len;
165 break;
166 case NFTNL_SET_ELEM_OBJREFcxx . . $ NFTNL_SET_ELEM_OBJREF.:
167 if (s->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_OBJREFcxx . . $ NFTNL_SET_ELEM_OBJREF.))
168 xfreecxx . . $ `include/utils.h:22:9`!(s->objref);
169
170 s->objrefcxx . . $ nftnl_set_elem#objref. = strdupcxx . . $ strdup(a8b8e32347182212).(data);
171 if (!s->objrefcxx . . $ nftnl_set_elem#objref.)
172 return -1;
173 break;
174 case NFTNL_SET_ELEM_EXPRcxx . . $ NFTNL_SET_ELEM_EXPR.:
175 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(expr, tmp, &s->expr_list, head)
176 nftnl_expr_freecxx . . $ nftnl_expr_free(cbe1a28527736226).(expr);
177
178 expr = (void *)data;
179 list_addcxx . . $ list_add(6c3f7387ec573de3).(&expr->headcxx . . $ nftnl_expr#head., &s->expr_listcxx . . $ nftnl_set_elem#expr_list.);
180 break;
181 }
182 s->flagscxx . . $ nftnl_set_elem#flags. |= (1 << attr);
183 return 0;
184 }
185
186 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_set);
187 int nftnl_set_elem_setcxx . . $ nftnl_set_elem_set(12edf157ee863da0).(struct nftnl_set_elemcxx . . $ nftnl_set_elem# *s, uint16_tcxx . . $ uint16_t# attr,
188 const void *data, uint32_tcxx . . $ uint32_t# data_len)
189 {
190 return __nftnl_set_elem_setcxx . . $ __nftnl_set_elem_set(36bc15b3fbd75f70).(s, attr, data, data_len, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
191 }
192
193 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_set_imm);
194 int nftnl_set_elem_set_immcxx . . $ nftnl_set_elem_set_imm(36bc15b3fbd75f70).(struct nftnl_set_elemcxx . . $ nftnl_set_elem# *s, uint16_tcxx . . $ uint16_t# attr,
195 const void *data, uint32_tcxx . . $ uint32_t# data_len,
196 uint32_tcxx . . $ uint32_t# byteorder, uint8_tcxx . . $ uint8_t# *sizes)
197 {
198 return __nftnl_set_elem_setcxx . . $ __nftnl_set_elem_set(36bc15b3fbd75f70).(s, attr, data, data_len, byteorder, sizes);
199 }
200
201 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_set_u32);
202 void nftnl_set_elem_set_u32cxx . . $ nftnl_set_elem_set_u32(ac2d3bc4cce76773).(struct nftnl_set_elemcxx . . $ nftnl_set_elem# *s, uint16_tcxx . . $ uint16_t# attr, uint32_tcxx . . $ uint32_t# val)
203 {
204 nftnl_set_elem_setcxx . . $ nftnl_set_elem_set(12edf157ee863da0).(s, attr, &val, sizeof(uint32_tcxx . . $ uint32_t#));
205 }
206
207 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_set_u64);
208 void nftnl_set_elem_set_u64cxx . . $ nftnl_set_elem_set_u64(9f99c4db2e03f9d2).(struct nftnl_set_elemcxx . . $ nftnl_set_elem# *s, uint16_tcxx . . $ uint16_t# attr, uint64_tcxx . . $ uint64_t# val)
209 {
210 nftnl_set_elem_setcxx . . $ nftnl_set_elem_set(12edf157ee863da0).(s, attr, &val, sizeof(uint64_tcxx . . $ uint64_t#));
211 }
212
213 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_set_str);
214 int nftnl_set_elem_set_strcxx . . $ nftnl_set_elem_set_str(a7abba25c9a3e659).(struct nftnl_set_elemcxx . . $ nftnl_set_elem# *s, uint16_tcxx . . $ uint16_t# attr, const char *str)
215 {
216 return nftnl_set_elem_setcxx . . $ nftnl_set_elem_set(12edf157ee863da0).(s, attr, str, strlencxx . . $ strlen(751346f8406fd082).(str) + 1);
217 }
218
219 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_get);
220 const void *nftnl_set_elem_getcxx . . $ nftnl_set_elem_get(975a8634af1eaa0a).(struct nftnl_set_elemcxx . . $ nftnl_set_elem# *s, uint16_tcxx . . $ uint16_t# attr, uint32_tcxx . . $ uint32_t# *data_len)
221 {
222 struct nftnl_exprcxx . . $ nftnl_expr# *expr;
223
224 if (!(s->flagscxx . . $ nftnl_set_elem#flags. & (1 << attr)))
225 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
226
227 switch(attr) {
228 case NFTNL_SET_ELEM_FLAGScxx . . $ NFTNL_SET_ELEM_FLAGS.:
229 *data_len = sizeof(s->set_elem_flagscxx . . $ nftnl_set_elem#set_elem_flags.);
230 return &s->set_elem_flagscxx . . $ nftnl_set_elem#set_elem_flags.;
231 case NFTNL_SET_ELEM_KEYcxx . . $ NFTNL_SET_ELEM_KEY.: /* NFTA_SET_ELEM_KEY */
232 *data_len = s->keycxx . . $ nftnl_set_elem#key..lencxx . . $ nftnl_data_reg#$anonymous_type_2#len.;
233 return &s->keycxx . . $ nftnl_set_elem#key..valcxx . . $ nftnl_data_reg#$anonymous_type_2#val.;
234 case NFTNL_SET_ELEM_KEY_ENDcxx . . $ NFTNL_SET_ELEM_KEY_END.: /* NFTA_SET_ELEM_KEY_END */
235 *data_len = s->key_endcxx . . $ nftnl_set_elem#key_end..lencxx . . $ nftnl_data_reg#$anonymous_type_2#len.;
236 return &s->key_endcxx . . $ nftnl_set_elem#key_end..valcxx . . $ nftnl_data_reg#$anonymous_type_2#val.;
237 case NFTNL_SET_ELEM_VERDICTcxx . . $ NFTNL_SET_ELEM_VERDICT.: /* NFTA_SET_ELEM_DATA */
238 *data_len = sizeof(s->datacxx . . $ nftnl_set_elem#data..verdictcxx . . $ nftnl_data_reg#$anonymous_type_3#verdict.);
239 return &s->datacxx . . $ nftnl_set_elem#data..verdictcxx . . $ nftnl_data_reg#$anonymous_type_3#verdict.;
240 case NFTNL_SET_ELEM_CHAINcxx . . $ NFTNL_SET_ELEM_CHAIN.: /* NFTA_SET_ELEM_DATA */
241 *data_len = strlencxx . . $ strlen(751346f8406fd082).(s->datacxx . . $ nftnl_set_elem#data..chaincxx . . $ nftnl_data_reg#$anonymous_type_3#chain.) + 1;
242 return s->datacxx . . $ nftnl_set_elem#data..chaincxx . . $ nftnl_data_reg#$anonymous_type_3#chain.;
243 case NFTNL_SET_ELEM_DATAcxx . . $ NFTNL_SET_ELEM_DATA.: /* NFTA_SET_ELEM_DATA */
244 *data_len = s->datacxx . . $ nftnl_set_elem#data..lencxx . . $ nftnl_data_reg#$anonymous_type_2#len.;
245 return &s->datacxx . . $ nftnl_set_elem#data..valcxx . . $ nftnl_data_reg#$anonymous_type_2#val.;
246 case NFTNL_SET_ELEM_TIMEOUTcxx . . $ NFTNL_SET_ELEM_TIMEOUT.: /* NFTA_SET_ELEM_TIMEOUT */
247 *data_len = sizeof(s->timeoutcxx . . $ nftnl_set_elem#timeout.);
248 return &s->timeoutcxx . . $ nftnl_set_elem#timeout.;
249 case NFTNL_SET_ELEM_EXPIRATIONcxx . . $ NFTNL_SET_ELEM_EXPIRATION.: /* NFTA_SET_ELEM_EXPIRATION */
250 *data_len = sizeof(s->expirationcxx . . $ nftnl_set_elem#expiration.);
251 return &s->expirationcxx . . $ nftnl_set_elem#expiration.;
252 case NFTNL_SET_ELEM_USERDATAcxx . . $ NFTNL_SET_ELEM_USERDATA.:
253 *data_len = s->usercxx . . $ nftnl_set_elem#user..lencxx . . $ nftnl_set_elem#$anonymous_type_0#len.;
254 return s->usercxx . . $ nftnl_set_elem#user..datacxx . . $ nftnl_set_elem#$anonymous_type_0#data.;
255 case NFTNL_SET_ELEM_EXPRcxx . . $ NFTNL_SET_ELEM_EXPR.:
256 list_for_each_entrycxx . . $ `include/linux_list.h:384:9`!(expr, &s->expr_list, head)
257 break;
258 return expr;
259 case NFTNL_SET_ELEM_OBJREFcxx . . $ NFTNL_SET_ELEM_OBJREF.:
260 *data_len = strlencxx . . $ strlen(751346f8406fd082).(s->objrefcxx . . $ nftnl_set_elem#objref.) + 1;
261 return s->objrefcxx . . $ nftnl_set_elem#objref.;
262 }
263 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
264 }
265
266 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_get_str);
267 const char *nftnl_set_elem_get_strcxx . . $ nftnl_set_elem_get_str(e4818d4140470213).(struct nftnl_set_elemcxx . . $ nftnl_set_elem# *s, uint16_tcxx . . $ uint16_t# attr)
268 {
269 uint32_tcxx . . $ uint32_t# size;
270
271 return nftnl_set_elem_getcxx . . $ nftnl_set_elem_get(975a8634af1eaa0a).(s, attr, &size);
272 }
273
274 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_get_u32);
275 uint32_tcxx . . $ uint32_t# nftnl_set_elem_get_u32cxx . . $ nftnl_set_elem_get_u32(598478f8ab14e38).(struct nftnl_set_elemcxx . . $ nftnl_set_elem# *s, uint16_tcxx . . $ uint16_t# attr)
276 {
277 uint32_tcxx . . $ uint32_t# size, val;
278
279 memcpycxx . . $ memcpy(cc817cb175f282d).(&val, nftnl_set_elem_getcxx . . $ nftnl_set_elem_get(975a8634af1eaa0a).(s, attr, &size), sizeof(val));
280
281 return val;
282 }
283
284 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_get_u64);
285 uint64_tcxx . . $ uint64_t# nftnl_set_elem_get_u64cxx . . $ nftnl_set_elem_get_u64(76aabab64c3994c4).(struct nftnl_set_elemcxx . . $ nftnl_set_elem# *s, uint16_tcxx . . $ uint16_t# attr)
286 {
287 uint32_tcxx . . $ uint32_t# size;
288 uint64_tcxx . . $ uint64_t# val;
289
290 memcpycxx . . $ memcpy(cc817cb175f282d).(&val, nftnl_set_elem_getcxx . . $ nftnl_set_elem_get(975a8634af1eaa0a).(s, attr, &size), sizeof(val));
291
292 return val;
293 }
294
295 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_nlmsg_build_payload);
296 void nftnl_set_elem_nlmsg_build_payloadcxx . . $ nftnl_set_elem_nlmsg_build_payload(cb5cda8fbd58ad1c).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh,
297 struct nftnl_set_elemcxx . . $ nftnl_set_elem# *e)
298 {
299 struct nftnl_exprcxx . . $ nftnl_expr# *expr;
300 int num_exprs = 0;
301
302 if (e->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_FLAGScxx . . $ NFTNL_SET_ELEM_FLAGS.))
303 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_SET_ELEM_FLAGScxx . . $ NFTA_SET_ELEM_FLAGS., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(e->set_elem_flags));
304 if (e->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_TIMEOUTcxx . . $ NFTNL_SET_ELEM_TIMEOUT.))
305 mnl_attr_put_u64cxx . . $ mnl_attr_put_u64(6d753f4d486e3a2f).(nlh, NFTA_SET_ELEM_TIMEOUTcxx . . $ NFTA_SET_ELEM_TIMEOUT., htobe64cxx . . $ `<external>/15855202785537844739/endian.h:49:11`!(e->timeout));
306 if (e->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_EXPIRATIONcxx . . $ NFTNL_SET_ELEM_EXPIRATION.))
307 mnl_attr_put_u64cxx . . $ mnl_attr_put_u64(6d753f4d486e3a2f).(nlh, NFTA_SET_ELEM_EXPIRATIONcxx . . $ NFTA_SET_ELEM_EXPIRATION., htobe64cxx . . $ `<external>/15855202785537844739/endian.h:49:11`!(e->expiration));
308 if (e->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_KEYcxx . . $ NFTNL_SET_ELEM_KEY.)) {
309 struct nlattrcxx . . $ nlattr# *nest1;
310
311 nest1 = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_SET_ELEM_KEYcxx . . $ NFTA_SET_ELEM_KEY.);
312 mnl_attr_putcxx . . $ mnl_attr_put(612d908c39ff741d).(nlh, NFTA_DATA_VALUEcxx . . $ NFTA_DATA_VALUE., e->keycxx . . $ nftnl_set_elem#key..lencxx . . $ nftnl_data_reg#$anonymous_type_2#len., e->keycxx . . $ nftnl_set_elem#key..valcxx . . $ nftnl_data_reg#$anonymous_type_2#val.);
313 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest1);
314 }
315 if (e->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_KEY_ENDcxx . . $ NFTNL_SET_ELEM_KEY_END.)) {
316 struct nlattrcxx . . $ nlattr# *nest1;
317
318 nest1 = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_SET_ELEM_KEY_ENDcxx . . $ NFTA_SET_ELEM_KEY_END.);
319 mnl_attr_putcxx . . $ mnl_attr_put(612d908c39ff741d).(nlh, NFTA_DATA_VALUEcxx . . $ NFTA_DATA_VALUE., e->key_endcxx . . $ nftnl_set_elem#key_end..lencxx . . $ nftnl_data_reg#$anonymous_type_2#len.,
320 e->key_endcxx . . $ nftnl_set_elem#key_end..valcxx . . $ nftnl_data_reg#$anonymous_type_2#val.);
321 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest1);
322 }
323 if (e->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_VERDICTcxx . . $ NFTNL_SET_ELEM_VERDICT.)) {
324 struct nlattrcxx . . $ nlattr# *nest1, *nest2;
325
326 nest1 = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_SET_ELEM_DATAcxx . . $ NFTA_SET_ELEM_DATA.);
327 nest2 = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_DATA_VERDICTcxx . . $ NFTA_DATA_VERDICT.);
328 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_VERDICT_CODEcxx . . $ NFTA_VERDICT_CODE., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(e->data.verdict));
329 if (e->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_CHAINcxx . . $ NFTNL_SET_ELEM_CHAIN.))
330 mnl_attr_put_strzcxx . . $ mnl_attr_put_strz(eb76286d4bfc1a8d).(nlh, NFTA_VERDICT_CHAINcxx . . $ NFTA_VERDICT_CHAIN., e->datacxx . . $ nftnl_set_elem#data..chaincxx . . $ nftnl_data_reg#$anonymous_type_3#chain.);
331
332 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest1);
333 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest2);
334 }
335 if (e->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_DATAcxx . . $ NFTNL_SET_ELEM_DATA.)) {
336 struct nlattrcxx . . $ nlattr# *nest1;
337
338 nest1 = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_SET_ELEM_DATAcxx . . $ NFTA_SET_ELEM_DATA.);
339 mnl_attr_putcxx . . $ mnl_attr_put(612d908c39ff741d).(nlh, NFTA_DATA_VALUEcxx . . $ NFTA_DATA_VALUE., e->datacxx . . $ nftnl_set_elem#data..lencxx . . $ nftnl_data_reg#$anonymous_type_2#len., e->datacxx . . $ nftnl_set_elem#data..valcxx . . $ nftnl_data_reg#$anonymous_type_2#val.);
340 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest1);
341 }
342 if (e->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_USERDATAcxx . . $ NFTNL_SET_ELEM_USERDATA.))
343 mnl_attr_putcxx . . $ mnl_attr_put(612d908c39ff741d).(nlh, NFTA_SET_ELEM_USERDATAcxx . . $ NFTA_SET_ELEM_USERDATA., e->usercxx . . $ nftnl_set_elem#user..lencxx . . $ nftnl_set_elem#$anonymous_type_0#len., e->usercxx . . $ nftnl_set_elem#user..datacxx . . $ nftnl_set_elem#$anonymous_type_0#data.);
344 if (e->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_OBJREFcxx . . $ NFTNL_SET_ELEM_OBJREF.))
345 mnl_attr_put_strzcxx . . $ mnl_attr_put_strz(eb76286d4bfc1a8d).(nlh, NFTA_SET_ELEM_OBJREFcxx . . $ NFTA_SET_ELEM_OBJREF., e->objrefcxx . . $ nftnl_set_elem#objref.);
346
347 if (!list_emptycxx . . $ list_empty(df525b6afabf24a2).(&e->expr_listcxx . . $ nftnl_set_elem#expr_list.)) {
348 list_for_each_entrycxx . . $ `include/linux_list.h:384:9`!(expr, &e->expr_list, head)
349 num_exprs++;
350
351 if (num_exprs == 1) {
352 struct nlattrcxx . . $ nlattr# *nest1;
353
354 nest1 = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_SET_ELEM_EXPRcxx . . $ NFTA_SET_ELEM_EXPR.);
355 list_for_each_entrycxx . . $ `include/linux_list.h:384:9`!(expr, &e->expr_list, head)
356 nftnl_expr_build_payloadcxx . . $ nftnl_expr_build_payload(efa2a5c645f672a6).(nlh, expr);
357
358 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest1);
359 } else if (num_exprs > 1) {
360 struct nlattrcxx . . $ nlattr# *nest1, *nest2;
361
362 nest1 = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_SET_ELEM_EXPRESSIONScxx . . $ NFTA_SET_ELEM_EXPRESSIONS.);
363 list_for_each_entrycxx . . $ `include/linux_list.h:384:9`!(expr, &e->expr_list, head) {
364 nest2 = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_LIST_ELEMcxx . . $ NFTA_LIST_ELEM.);
365 nftnl_expr_build_payloadcxx . . $ nftnl_expr_build_payload(efa2a5c645f672a6).(nlh, expr);
366 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest2);
367 }
368 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest1);
369 }
370 }
371 }
372
373 static void nftnl_set_elem_nlmsg_build_defcxx . . $ nftnl_set_elem_nlmsg_build_def(4ec48f159c00541f).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh,
374 const struct nftnl_setcxx . . $ nftnl_set# *s)
375 {
376 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_NAMEcxx . . $ NFTNL_SET_NAME.))
377 mnl_attr_put_strzcxx . . $ mnl_attr_put_strz(eb76286d4bfc1a8d).(nlh, NFTA_SET_ELEM_LIST_SETcxx . . $ NFTA_SET_ELEM_LIST_SET., s->namecxx . . $ nftnl_set#name.);
378 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_IDcxx . . $ NFTNL_SET_ID.))
379 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_SET_ELEM_LIST_SET_IDcxx . . $ NFTA_SET_ELEM_LIST_SET_ID., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(s->id));
380 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_TABLEcxx . . $ NFTNL_SET_TABLE.))
381 mnl_attr_put_strzcxx . . $ mnl_attr_put_strz(eb76286d4bfc1a8d).(nlh, NFTA_SET_ELEM_LIST_TABLEcxx . . $ NFTA_SET_ELEM_LIST_TABLE., s->tablecxx . . $ nftnl_set#table.);
382 }
383
384 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_nlmsg_build);
385 struct nlattrcxx . . $ nlattr# *nftnl_set_elem_nlmsg_buildcxx . . $ nftnl_set_elem_nlmsg_build(a38f406a57d3b12e).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh,
386 struct nftnl_set_elemcxx . . $ nftnl_set_elem# *elem, int i)
387 {
388 struct nlattrcxx . . $ nlattr# *nest2;
389
390 nest2 = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, i);
391 nftnl_set_elem_nlmsg_build_payloadcxx . . $ nftnl_set_elem_nlmsg_build_payload(cb5cda8fbd58ad1c).(nlh, elem);
392 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest2);
393
394 return nest2;
395 }
396
397 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elems_nlmsg_build_payload);
398 void nftnl_set_elems_nlmsg_build_payloadcxx . . $ nftnl_set_elems_nlmsg_build_payload(54bfe25df723ccae).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh, struct nftnl_setcxx . . $ nftnl_set# *s)
399 {
400 struct nftnl_set_elemcxx . . $ nftnl_set_elem# *elem;
401 struct nlattrcxx . . $ nlattr# *nest1;
402 int i = 0;
403
404 nftnl_set_elem_nlmsg_build_defcxx . . $ nftnl_set_elem_nlmsg_build_def(4ec48f159c00541f).(nlh, s);
405
406 if (list_emptycxx . . $ list_empty(df525b6afabf24a2).(&s->element_listcxx . . $ nftnl_set#element_list.))
407 return;
408
409 nest1 = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_SET_ELEM_LIST_ELEMENTScxx . . $ NFTA_SET_ELEM_LIST_ELEMENTS.);
410 list_for_each_entrycxx . . $ `include/linux_list.h:384:9`!(elem, &s->element_list, head)
411 nftnl_set_elem_nlmsg_buildcxx . . $ nftnl_set_elem_nlmsg_build(a38f406a57d3b12e).(nlh, elem, ++i);
412
413 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest1);
414 }
415
416 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_add_expr);
417 void nftnl_set_elem_add_exprcxx . . $ nftnl_set_elem_add_expr(b8ef5dbd9b67c4a6).(struct nftnl_set_elemcxx . . $ nftnl_set_elem# *e, struct nftnl_exprcxx . . $ nftnl_expr# *expr)
418 {
419 list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&expr->headcxx . . $ nftnl_expr#head., &e->expr_listcxx . . $ nftnl_set_elem#expr_list.);
420 }
421
422 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_expr_foreach);
423 int nftnl_set_elem_expr_foreachcxx . . $ nftnl_set_elem_expr_foreach(4089529bdc4e23e0).(struct nftnl_set_elemcxx . . $ nftnl_set_elem# *e,
424 int (*cb)(struct nftnl_exprcxx . . $ nftnl_expr# *e, void *data),
425 void *data)
426 {
427 struct nftnl_exprcxx . . $ nftnl_expr# *cur, *tmp;
428 int ret;
429
430 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(cur, tmp, &e->expr_list, head) {
431 ret = cb(cur, data);
432 if (ret < 0)
433 return ret;
434 }
435 return 0;
436 }
437
438 static int nftnl_set_elem_parse_attr_cbcxx . . $ nftnl_set_elem_parse_attr_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data)
439 {
440 const struct nlattrcxx . . $ nlattr# **tb = data;
441 int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr);
442
443 if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_SET_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:424:9`!) < 0)
444 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
445
446 switch(type) {
447 case NFTA_SET_ELEM_FLAGScxx . . $ NFTA_SET_ELEM_FLAGS.:
448 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U32cxx . . $ MNL_TYPE_U32.) < 0)
449 abi_breakagecxx . . $ `include/utils.h:28:9`!();
450 break;
451 case NFTA_SET_ELEM_TIMEOUTcxx . . $ NFTA_SET_ELEM_TIMEOUT.:
452 case NFTA_SET_ELEM_EXPIRATIONcxx . . $ NFTA_SET_ELEM_EXPIRATION.:
453 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U64cxx . . $ MNL_TYPE_U64.) < 0)
454 abi_breakagecxx . . $ `include/utils.h:28:9`!();
455 break;
456 case NFTA_SET_ELEM_KEYcxx . . $ NFTA_SET_ELEM_KEY.:
457 case NFTA_SET_ELEM_KEY_ENDcxx . . $ NFTA_SET_ELEM_KEY_END.:
458 case NFTA_SET_ELEM_DATAcxx . . $ NFTA_SET_ELEM_DATA.:
459 case NFTA_SET_ELEM_EXPRcxx . . $ NFTA_SET_ELEM_EXPR.:
460 case NFTA_SET_ELEM_EXPRESSIONScxx . . $ NFTA_SET_ELEM_EXPRESSIONS.:
461 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_NESTEDcxx . . $ MNL_TYPE_NESTED.) < 0)
462 abi_breakagecxx . . $ `include/utils.h:28:9`!();
463 break;
464 case NFTA_SET_ELEM_USERDATAcxx . . $ NFTA_SET_ELEM_USERDATA.:
465 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_BINARYcxx . . $ MNL_TYPE_BINARY.) < 0)
466 abi_breakagecxx . . $ `include/utils.h:28:9`!();
467 break;
468 }
469
470 tb[type] = attr;
471 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
472 }
473
474 static int nftnl_set_elems_parse2cxx . . $ nftnl_set_elems_parse2(de70658e6ee02afa).(struct nftnl_setcxx . . $ nftnl_set# *s, const struct nlattrcxx . . $ nlattr# *nest)
475 {
476 struct nlattrcxx . . $ nlattr# *tb[NFTA_SET_ELEM_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:466:9`!+1] = {};
477 struct nftnl_set_elemcxx . . $ nftnl_set_elem# *e;
478 int ret, type;
479
480 e = nftnl_set_elem_alloccxx . . $ nftnl_set_elem_alloc(a0cbc9f6acf83051).();
481 if (e == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)
482 return -1;
483
484 ret = mnl_attr_parse_nestedcxx . . $ mnl_attr_parse_nested(f99c0e9fa94f99d9).(nest, nftnl_set_elem_parse_attr_cbcxx . . $ nftnl_set_elem_parse_attr_cb(de2ef18c48fd675c)., tb);
485 if (ret < 0)
486 goto out_set_elem;
487
488 if (tb[NFTA_SET_ELEM_FLAGScxx . . $ NFTA_SET_ELEM_FLAGS.]) {
489 e->set_elem_flagscxx . . $ nftnl_set_elem#set_elem_flags. =
490 ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_SET_ELEM_FLAGS]));
491 e->flagscxx . . $ nftnl_set_elem#flags. |= (1 << NFTNL_SET_ELEM_FLAGScxx . . $ NFTNL_SET_ELEM_FLAGS.);
492 }
493 if (tb[NFTA_SET_ELEM_TIMEOUTcxx . . $ NFTA_SET_ELEM_TIMEOUT.]) {
494 e->timeoutcxx . . $ nftnl_set_elem#timeout. = be64tohcxx . . $ `<external>/15855202785537844739/endian.h:51:11`!(mnl_attr_get_u64(tb[NFTA_SET_ELEM_TIMEOUT]));
495 e->flagscxx . . $ nftnl_set_elem#flags. |= (1 << NFTNL_SET_ELEM_TIMEOUTcxx . . $ NFTNL_SET_ELEM_TIMEOUT.);
496 }
497 if (tb[NFTA_SET_ELEM_EXPIRATIONcxx . . $ NFTA_SET_ELEM_EXPIRATION.]) {
498 e->expirationcxx . . $ nftnl_set_elem#expiration. = be64tohcxx . . $ `<external>/15855202785537844739/endian.h:51:11`!(mnl_attr_get_u64(tb[NFTA_SET_ELEM_EXPIRATION]));
499 e->flagscxx . . $ nftnl_set_elem#flags. |= (1 << NFTNL_SET_ELEM_EXPIRATIONcxx . . $ NFTNL_SET_ELEM_EXPIRATION.);
500 }
501 if (tb[NFTA_SET_ELEM_KEYcxx . . $ NFTA_SET_ELEM_KEY.]) {
502 ret = nftnl_parse_datacxx . . $ nftnl_parse_data(1f43ec2decb5ffec).(&e->keycxx . . $ nftnl_set_elem#key., tb[NFTA_SET_ELEM_KEYcxx . . $ NFTA_SET_ELEM_KEY.], &type);
503 if (ret < 0)
504 goto out_set_elem;
505 e->flagscxx . . $ nftnl_set_elem#flags. |= (1 << NFTNL_SET_ELEM_KEYcxx . . $ NFTNL_SET_ELEM_KEY.);
506 }
507 if (tb[NFTA_SET_ELEM_KEY_ENDcxx . . $ NFTA_SET_ELEM_KEY_END.]) {
508 ret = nftnl_parse_datacxx . . $ nftnl_parse_data(1f43ec2decb5ffec).(&e->key_endcxx . . $ nftnl_set_elem#key_end., tb[NFTA_SET_ELEM_KEY_ENDcxx . . $ NFTA_SET_ELEM_KEY_END.],
509 &type);
510 if (ret < 0)
511 goto out_set_elem;
512 e->flagscxx . . $ nftnl_set_elem#flags. |= (1 << NFTNL_SET_ELEM_KEY_ENDcxx . . $ NFTNL_SET_ELEM_KEY_END.);
513 }
514 if (tb[NFTA_SET_ELEM_DATAcxx . . $ NFTA_SET_ELEM_DATA.]) {
515 ret = nftnl_parse_datacxx . . $ nftnl_parse_data(1f43ec2decb5ffec).(&e->datacxx . . $ nftnl_set_elem#data., tb[NFTA_SET_ELEM_DATAcxx . . $ NFTA_SET_ELEM_DATA.], &type);
516 if (ret < 0)
517 goto out_set_elem;
518 switch(type) {
519 case DATA_VERDICTcxx . . $ DATA_VERDICT.:
520 e->flagscxx . . $ nftnl_set_elem#flags. |= (1 << NFTNL_SET_ELEM_VERDICTcxx . . $ NFTNL_SET_ELEM_VERDICT.);
521 break;
522 case DATA_CHAINcxx . . $ DATA_CHAIN.:
523 e->flagscxx . . $ nftnl_set_elem#flags. |= (1 << NFTNL_SET_ELEM_VERDICTcxx . . $ NFTNL_SET_ELEM_VERDICT.) |
524 (1 << NFTNL_SET_ELEM_CHAINcxx . . $ NFTNL_SET_ELEM_CHAIN.);
525 break;
526 case DATA_VALUEcxx . . $ DATA_VALUE.:
527 e->flagscxx . . $ nftnl_set_elem#flags. |= (1 << NFTNL_SET_ELEM_DATAcxx . . $ NFTNL_SET_ELEM_DATA.);
528 break;
529 }
530 }
531 if (tb[NFTA_SET_ELEM_EXPRcxx . . $ NFTA_SET_ELEM_EXPR.]) {
532 struct nftnl_exprcxx . . $ nftnl_expr# *expr;
533
534 expr = nftnl_expr_parsecxx . . $ nftnl_expr_parse(ea32a576744d0134).(tb[NFTA_SET_ELEM_EXPRcxx . . $ NFTA_SET_ELEM_EXPR.]);
535 if (expr == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
536 ret = -1;
537 goto out_set_elem;
538 }
539 list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&expr->headcxx . . $ nftnl_expr#head., &e->expr_listcxx . . $ nftnl_set_elem#expr_list.);
540 e->flagscxx . . $ nftnl_set_elem#flags. |= (1 << NFTNL_SET_ELEM_EXPRcxx . . $ NFTNL_SET_ELEM_EXPR.);
541 } else if (tb[NFTA_SET_ELEM_EXPRESSIONScxx . . $ NFTA_SET_ELEM_EXPRESSIONS.]) {
542 struct nftnl_exprcxx . . $ nftnl_expr# *expr;
543 struct nlattrcxx . . $ nlattr# *attr;
544
545 mnl_attr_for_each_nestedcxx . . $ `<external>/12386019527593959648/libmnl.h:152:9`!(attr, tb[NFTA_SET_ELEM_EXPRESSIONS]) {
546 if (mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr) != NFTA_LIST_ELEMcxx . . $ NFTA_LIST_ELEM.) {
547 ret = -1;
548 goto out_set_elem;
549 }
550 expr = nftnl_expr_parsecxx . . $ nftnl_expr_parse(ea32a576744d0134).(attr);
551 if (expr == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
552 ret = -1;
553 goto out_set_elem;
554 }
555 list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&expr->headcxx . . $ nftnl_expr#head., &e->expr_listcxx . . $ nftnl_set_elem#expr_list.);
556 }
557 e->flagscxx . . $ nftnl_set_elem#flags. |= (1 << NFTNL_SET_ELEM_EXPRESSIONScxx . . $ NFTNL_SET_ELEM_EXPRESSIONS.);
558 }
559 if (tb[NFTA_SET_ELEM_USERDATAcxx . . $ NFTA_SET_ELEM_USERDATA.]) {
560 const void *udata =
561 mnl_attr_get_payloadcxx . . $ mnl_attr_get_payload(cbbcdcb61d3bc7e8).(tb[NFTA_SET_ELEM_USERDATAcxx . . $ NFTA_SET_ELEM_USERDATA.]);
562
563 if (e->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_RULE_USERDATAcxx . . $ NFTNL_RULE_USERDATA.))
564 xfreecxx . . $ `include/utils.h:22:9`!(e->user.data);
565
566 e->usercxx . . $ nftnl_set_elem#user..lencxx . . $ nftnl_set_elem#$anonymous_type_0#len. = mnl_attr_get_payload_lencxx . . $ mnl_attr_get_payload_len(1da47bcc4c4b975).(tb[NFTA_SET_ELEM_USERDATAcxx . . $ NFTA_SET_ELEM_USERDATA.]);
567 e->usercxx . . $ nftnl_set_elem#user..datacxx . . $ nftnl_set_elem#$anonymous_type_0#data. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(e->usercxx . . $ nftnl_set_elem#user..lencxx . . $ nftnl_set_elem#$anonymous_type_0#len.);
568 if (e->usercxx . . $ nftnl_set_elem#user..datacxx . . $ nftnl_set_elem#$anonymous_type_0#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
569 ret = -1;
570 goto out_set_elem;
571 }
572 memcpycxx . . $ memcpy(cc817cb175f282d).(e->usercxx . . $ nftnl_set_elem#user..datacxx . . $ nftnl_set_elem#$anonymous_type_0#data., udata, e->usercxx . . $ nftnl_set_elem#user..lencxx . . $ nftnl_set_elem#$anonymous_type_0#len.);
573 e->flagscxx . . $ nftnl_set_elem#flags. |= (1 << NFTNL_RULE_USERDATAcxx . . $ NFTNL_RULE_USERDATA.);
574 }
575 if (nftnl_parse_str_attrcxx . . $ nftnl_parse_str_attr(2002c8408bf98f7f).(tb[NFTA_SET_ELEM_OBJREFcxx . . $ NFTA_SET_ELEM_OBJREF.],
576 NFTNL_SET_ELEM_OBJREFcxx . . $ NFTNL_SET_ELEM_OBJREF.,
577 &e->objrefcxx . . $ nftnl_set_elem#objref., &e->flagscxx . . $ nftnl_set_elem#flags.) < 0) {
578 ret = -1;
579 goto out_set_elem;
580 }
581
582 /* Add this new element to this set */
583 list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&e->headcxx . . $ nftnl_set_elem#head., &s->element_listcxx . . $ nftnl_set#element_list.);
584
585 return 0;
586 out_set_elem:
587 nftnl_set_elem_freecxx . . $ nftnl_set_elem_free(aa0bbd50ab576260).(e);
588 return ret;
589 }
590
591 static int
592 nftnl_set_elem_list_parse_attr_cbcxx . . $ nftnl_set_elem_list_parse_attr_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data)
593 {
594 const struct nlattrcxx . . $ nlattr# **tb = data;
595 int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr);
596
597 if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_SET_ELEM_LIST_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:484:9`!) < 0)
598 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
599
600 switch(type) {
601 case NFTA_SET_ELEM_LIST_TABLEcxx . . $ NFTA_SET_ELEM_LIST_TABLE.:
602 case NFTA_SET_ELEM_LIST_SETcxx . . $ NFTA_SET_ELEM_LIST_SET.:
603 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_STRINGcxx . . $ MNL_TYPE_STRING.) < 0)
604 abi_breakagecxx . . $ `include/utils.h:28:9`!();
605 break;
606 case NFTA_SET_ELEM_LIST_ELEMENTScxx . . $ NFTA_SET_ELEM_LIST_ELEMENTS.:
607 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_NESTEDcxx . . $ MNL_TYPE_NESTED.) < 0)
608 abi_breakagecxx . . $ `include/utils.h:28:9`!();
609 break;
610 }
611
612 tb[type] = attr;
613 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
614 }
615
616 static int nftnl_set_elems_parsecxx . . $ nftnl_set_elems_parse(de70658e6ee02afa).(struct nftnl_setcxx . . $ nftnl_set# *s, const struct nlattrcxx . . $ nlattr# *nest)
617 {
618 struct nlattrcxx . . $ nlattr# *attr;
619 int ret = 0;
620
621 mnl_attr_for_each_nestedcxx . . $ `<external>/12386019527593959648/libmnl.h:152:9`!(attr, nest) {
622 if (mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr) != NFTA_LIST_ELEMcxx . . $ NFTA_LIST_ELEM.)
623 return -1;
624
625 ret = nftnl_set_elems_parse2cxx . . $ nftnl_set_elems_parse2(de70658e6ee02afa).(s, attr);
626 if (ret < 0)
627 return ret;
628 }
629 return ret;
630 }
631
632 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elems_nlmsg_parse);
633 int nftnl_set_elems_nlmsg_parsecxx . . $ nftnl_set_elems_nlmsg_parse(ea0d196049dbd5e9).(const struct nlmsghdrcxx . . $ nlmsghdr# *nlh, struct nftnl_setcxx . . $ nftnl_set# *s)
634 {
635 struct nlattrcxx . . $ nlattr# *tb[NFTA_SET_ELEM_LIST_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:484:9`!+1] = {};
636 struct nfgenmsgcxx . . $ nfgenmsg# *nfg = mnl_nlmsg_get_payloadcxx . . $ mnl_nlmsg_get_payload(33f780b45aa89a18).(nlh);
637 int ret;
638
639 if (mnl_attr_parsecxx . . $ mnl_attr_parse(8b80a5a12c5e6592).(nlh, sizeof(*nfg),
640 nftnl_set_elem_list_parse_attr_cbcxx . . $ nftnl_set_elem_list_parse_attr_cb(de2ef18c48fd675c)., tb) < 0)
641 return -1;
642
643 if (nftnl_parse_str_attrcxx . . $ nftnl_parse_str_attr(2002c8408bf98f7f).(tb[NFTA_SET_ELEM_LIST_TABLEcxx . . $ NFTA_SET_ELEM_LIST_TABLE.],
644 NFTNL_SET_TABLEcxx . . $ NFTNL_SET_TABLE.,
645 &s->tablecxx . . $ nftnl_set#table., &s->flagscxx . . $ nftnl_set#flags.) < 0)
646 return -1;
647 if (nftnl_parse_str_attrcxx . . $ nftnl_parse_str_attr(2002c8408bf98f7f).(tb[NFTA_SET_ELEM_LIST_SETcxx . . $ NFTA_SET_ELEM_LIST_SET.],
648 NFTNL_SET_NAMEcxx . . $ NFTNL_SET_NAME.,
649 &s->namecxx . . $ nftnl_set#name., &s->flagscxx . . $ nftnl_set#flags.) < 0)
650 return -1;
651 if (tb[NFTA_SET_ELEM_LIST_SET_IDcxx . . $ NFTA_SET_ELEM_LIST_SET_ID.]) {
652 s->idcxx . . $ nftnl_set#id. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_SET_ELEM_LIST_SET_ID]));
653 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_IDcxx . . $ NFTNL_SET_ID.);
654 }
655 if (tb[NFTA_SET_ELEM_LIST_ELEMENTScxx . . $ NFTA_SET_ELEM_LIST_ELEMENTS.]) {
656 ret = nftnl_set_elems_parsecxx . . $ nftnl_set_elems_parse(de70658e6ee02afa).(s, tb[NFTA_SET_ELEM_LIST_ELEMENTScxx . . $ NFTA_SET_ELEM_LIST_ELEMENTS.]);
657 if (ret < 0)
658 return ret;
659 }
660
661 s->familycxx . . $ nftnl_set#family. = nfg->nfgen_familycxx . . $ nfgenmsg#nfgen_family.;
662 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_FAMILYcxx . . $ NFTNL_SET_FAMILY.);
663
664 return 0;
665 }
666
667 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_parse);
668 int nftnl_set_elem_parsecxx . . $ nftnl_set_elem_parse(f292cbdb729fc389).(struct nftnl_set_elemcxx . . $ nftnl_set_elem# *e, enum nftnl_parse_typecxx . . $ nftnl_parse_type# type,
669 const char *data, struct nftnl_parse_errcxx . . $ nftnl_parse_err# *err)
670 {
671 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!;
672 return -1;
673 }
674
675 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_parse_file);
676 int nftnl_set_elem_parse_filecxx . . $ nftnl_set_elem_parse_file(37ca8bf435f7befb).(struct nftnl_set_elemcxx . . $ nftnl_set_elem# *e, enum nftnl_parse_typecxx . . $ nftnl_parse_type# type,
677 FILEcxx . . $ FILE# *fp, struct nftnl_parse_errcxx . . $ nftnl_parse_err# *err)
678 {
679 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!;
680 return -1;
681 }
682
683 int nftnl_set_elem_snprintf_defaultcxx . . $ nftnl_set_elem_snprintf_default(cd52fc5e46e09590).(char *buf, size_t remain,
684 const struct nftnl_set_elemcxx . . $ nftnl_set_elem# *e)
685 {
686 int ret, dregtype = DATA_NONEcxx . . $ DATA_NONE., offset = 0;
687
688 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf, remain, "element ");
689 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
690
691 ret = nftnl_data_reg_snprintfcxx . . $ nftnl_data_reg_snprintf(92088fbd4b6db60b).(buf + offset, remain, &e->keycxx . . $ nftnl_set_elem#key.,
692 DATA_F_NOPFXcxx . . $ DATA_F_NOPFX., DATA_VALUEcxx . . $ DATA_VALUE.);
693 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
694
695 if (e->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_KEY_ENDcxx . . $ NFTNL_SET_ELEM_KEY_END.)) {
696 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " - ");
697 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
698
699 ret = nftnl_data_reg_snprintfcxx . . $ nftnl_data_reg_snprintf(92088fbd4b6db60b).(buf + offset, remain, &e->key_endcxx . . $ nftnl_set_elem#key_end.,
700 DATA_F_NOPFXcxx . . $ DATA_F_NOPFX., DATA_VALUEcxx . . $ DATA_VALUE.);
701 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
702 }
703
704 if (e->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_DATAcxx . . $ NFTNL_SET_ELEM_DATA.))
705 dregtype = DATA_VALUEcxx . . $ DATA_VALUE.;
706 else if (e->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_CHAINcxx . . $ NFTNL_SET_ELEM_CHAIN.))
707 dregtype = DATA_CHAINcxx . . $ DATA_CHAIN.;
708 else if (e->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_VERDICTcxx . . $ NFTNL_SET_ELEM_VERDICT.))
709 dregtype = DATA_VERDICTcxx . . $ DATA_VERDICT.;
710
711 if (dregtype != DATA_NONEcxx . . $ DATA_NONE.) {
712 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " : ");
713 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
714
715 ret = nftnl_data_reg_snprintfcxx . . $ nftnl_data_reg_snprintf(92088fbd4b6db60b).(buf + offset, remain, &e->datacxx . . $ nftnl_set_elem#data.,
716 DATA_F_NOPFXcxx . . $ DATA_F_NOPFX., dregtype);
717 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
718 } else if (e->flagscxx . . $ nftnl_set_elem#flags. & (1 << NFTNL_SET_ELEM_OBJREFcxx . . $ NFTNL_SET_ELEM_OBJREF.)) {
719 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " : %s", e->objrefcxx . . $ nftnl_set_elem#objref.);
720 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
721 }
722
723 if (e->set_elem_flagscxx . . $ nftnl_set_elem#set_elem_flags.) {
724 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " flags %u", e->set_elem_flagscxx . . $ nftnl_set_elem#set_elem_flags.);
725 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
726 }
727
728 if (e->usercxx . . $ nftnl_set_elem#user..lencxx . . $ nftnl_set_elem#$anonymous_type_0#len.) {
729 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain,
730 " userdata len %d sum 0x%x",
731 e->usercxx . . $ nftnl_set_elem#user..lencxx . . $ nftnl_set_elem#$anonymous_type_0#len., bytesumcxx . . $ bytesum(8cbb85865c56216f).(e->usercxx . . $ nftnl_set_elem#user..datacxx . . $ nftnl_set_elem#$anonymous_type_0#data., e->usercxx . . $ nftnl_set_elem#user..lencxx . . $ nftnl_set_elem#$anonymous_type_0#len.));
732 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
733 }
734
735 return offset;
736 }
737
738 static int nftnl_set_elem_cmd_snprintfcxx . . $ nftnl_set_elem_cmd_snprintf(7c95c174dd8cd6c8).(char *buf, size_t remain,
739 const struct nftnl_set_elemcxx . . $ nftnl_set_elem# *e,
740 uint32_tcxx . . $ uint32_t# cmd, uint32_tcxx . . $ uint32_t# type,
741 uint32_tcxx . . $ uint32_t# flags)
742 {
743 int ret, offset = 0;
744
745 if (type != NFTNL_OUTPUT_DEFAULTcxx . . $ NFTNL_OUTPUT_DEFAULT.)
746 return -1;
747
748 ret = nftnl_set_elem_snprintf_defaultcxx . . $ nftnl_set_elem_snprintf_default(cd52fc5e46e09590).(buf + offset, remain, e);
749 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
750
751 return offset;
752 }
753
754 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_snprintf);
755 int nftnl_set_elem_snprintfcxx . . $ nftnl_set_elem_snprintf(ba2b45b090652a1c).(char *buf, size_t size,
756 const struct nftnl_set_elemcxx . . $ nftnl_set_elem# *e,
757 uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags)
758 {
759 if (size)
760 buf[0] = '\0';
761
762 return nftnl_set_elem_cmd_snprintfcxx . . $ nftnl_set_elem_cmd_snprintf(7c95c174dd8cd6c8).(buf, size, e, nftnl_flag2cmdcxx . . $ nftnl_flag2cmd(73b61a9477c235b4).(flags),
763 type, flags);
764 }
765
766 static int nftnl_set_elem_do_snprintfcxx . . $ nftnl_set_elem_do_snprintf(809f16203406eb30).(char *buf, size_t size, const void *e,
767 uint32_tcxx . . $ uint32_t# cmd, uint32_tcxx . . $ uint32_t# type,
768 uint32_tcxx . . $ uint32_t# flags)
769 {
770 return nftnl_set_elem_snprintfcxx . . $ nftnl_set_elem_snprintf(ba2b45b090652a1c).(buf, size, e, type, flags);
771 }
772
773 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_fprintf);
774 int nftnl_set_elem_fprintfcxx . . $ nftnl_set_elem_fprintf(6d2d4f2e106546b3).(FILEcxx . . $ FILE# *fp, const struct nftnl_set_elemcxx . . $ nftnl_set_elem# *se, uint32_tcxx . . $ uint32_t# type,
775 uint32_tcxx . . $ uint32_t# flags)
776 {
777 return nftnl_fprintfcxx . . $ nftnl_fprintf(959aea809fde9589).(fp, se, NFTNL_CMD_UNSPECcxx . . $ NFTNL_CMD_UNSPEC., type, flags,
778 nftnl_set_elem_do_snprintfcxx . . $ nftnl_set_elem_do_snprintf(809f16203406eb30).);
779 }
780
781 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_foreach);
782 int nftnl_set_elem_foreachcxx . . $ nftnl_set_elem_foreach(b672976af5072167).(struct nftnl_setcxx . . $ nftnl_set# *s,
783 int (*cb)(struct nftnl_set_elemcxx . . $ nftnl_set_elem# *e, void *data),
784 void *data)
785 {
786 struct nftnl_set_elemcxx . . $ nftnl_set_elem# *elem;
787 int ret;
788
789 list_for_each_entrycxx . . $ `include/linux_list.h:384:9`!(elem, &s->element_list, head) {
790 ret = cb(elem, data);
791 if (ret < 0)
792 return ret;
793 }
794 return 0;
795 }
796
797 struct nftnl_set_elems_itercxx . . $ nftnl_set_elems_iter# {
798 const struct nftnl_setcxx . . $ nftnl_set# *setcxx . . $ nftnl_set_elems_iter#set.;
799 const struct list_headcxx . . $ list_head# *listcxx . . $ nftnl_set_elems_iter#list.;
800 struct nftnl_set_elemcxx . . $ nftnl_set_elem# *curcxx . . $ nftnl_set_elems_iter#cur.;
801 };
802
803 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elems_iter_create);
804 struct nftnl_set_elems_itercxx . . $ nftnl_set_elems_iter# *
805 nftnl_set_elems_iter_createcxx . . $ nftnl_set_elems_iter_create(515785a4cd79bcb9).(const struct nftnl_setcxx . . $ nftnl_set# *s)
806 {
807 struct nftnl_set_elems_itercxx . . $ nftnl_set_elems_iter# *iter;
808
809 iter = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_set_elems_itercxx . . $ nftnl_set_elems_iter#));
810 if (iter == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)
811 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
812
813 iter->setcxx . . $ nftnl_set_elems_iter#set. = s;
814 iter->listcxx . . $ nftnl_set_elems_iter#list. = &s->element_listcxx . . $ nftnl_set#element_list.;
815 if (list_emptycxx . . $ list_empty(df525b6afabf24a2).(&s->element_listcxx . . $ nftnl_set#element_list.))
816 iter->curcxx . . $ nftnl_set_elems_iter#cur. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
817 else
818 iter->curcxx . . $ nftnl_set_elems_iter#cur. = list_entrycxx . . $ `include/linux_list.h:334:9`!(s->element_list.next,
819 struct nftnl_set_elem, head);
820
821 return iter;
822 }
823
824 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elems_iter_cur);
825 struct nftnl_set_elemcxx . . $ nftnl_set_elem# *
826 nftnl_set_elems_iter_curcxx . . $ nftnl_set_elems_iter_cur(6dfaf31879cfc1ae).(const struct nftnl_set_elems_itercxx . . $ nftnl_set_elems_iter# *iter)
827 {
828 return iter->curcxx . . $ nftnl_set_elems_iter#cur.;
829 }
830
831 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elems_iter_next);
832 struct nftnl_set_elemcxx . . $ nftnl_set_elem# *nftnl_set_elems_iter_nextcxx . . $ nftnl_set_elems_iter_next(3d9a9ddd671d3e5e).(struct nftnl_set_elems_itercxx . . $ nftnl_set_elems_iter# *iter)
833 {
834 struct nftnl_set_elemcxx . . $ nftnl_set_elem# *s = iter->curcxx . . $ nftnl_set_elems_iter#cur.;
835
836 if (s == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)
837 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
838
839 iter->curcxx . . $ nftnl_set_elems_iter#cur. = list_entrycxx . . $ `include/linux_list.h:334:9`!(iter->cur->head.next, struct nftnl_set_elem, head);
840 if (&iter->curcxx . . $ nftnl_set_elems_iter#cur.->headcxx . . $ nftnl_set_elem#head. == iter->listcxx . . $ nftnl_set_elems_iter#list.->nextcxx . . $ list_head#next.)
841 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
842
843 return s;
844 }
845
846 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elems_iter_destroy);
847 void nftnl_set_elems_iter_destroycxx . . $ nftnl_set_elems_iter_destroy(70304886f10c1ef7).(struct nftnl_set_elems_itercxx . . $ nftnl_set_elems_iter# *iter)
848 {
849 xfreecxx . . $ `include/utils.h:22:9`!(iter);
850 }
851
852 static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! nftnl_attr_nest_overflowcxx . . $ nftnl_attr_nest_overflow(c7e7da8af1458cef).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh,
853 const struct nlattrcxx . . $ nlattr# *from,
854 const struct nlattrcxx . . $ nlattr# *to)
855 {
856 int len = (void *)to + to->nla_lencxx . . $ nlattr#nla_len. - (void *)from;
857
858 /* The attribute length field is 16 bits long, thus the maximum payload
859 * that an attribute can convey is UINT16_MAX. In case of overflow,
860 * discard the last that did not fit into the attribute.
861 */
862 if (len > UINT16_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:123:10`!) {
863 nlh->nlmsg_lencxx . . $ nlmsghdr#nlmsg_len. -= to->nla_lencxx . . $ nlattr#nla_len.;
864 return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
865 }
866 return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
867 }
868
869 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elems_nlmsg_build_payload_iter);
870 int nftnl_set_elems_nlmsg_build_payload_itercxx . . $ nftnl_set_elems_nlmsg_build_payload_iter(ef64d1c99e7705eb).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh,
871 struct nftnl_set_elems_itercxx . . $ nftnl_set_elems_iter# *iter)
872 {
873 struct nftnl_set_elemcxx . . $ nftnl_set_elem# *elem;
874 struct nlattrcxx . . $ nlattr# *nest1, *nest2;
875 int i = 0, ret = 0;
876
877 nftnl_set_elem_nlmsg_build_defcxx . . $ nftnl_set_elem_nlmsg_build_def(4ec48f159c00541f).(nlh, iter->setcxx . . $ nftnl_set_elems_iter#set.);
878
879 /* This set is empty, don't add an empty list element nest. */
880 if (list_emptycxx . . $ list_empty(df525b6afabf24a2).(&iter->setcxx . . $ nftnl_set_elems_iter#set.->element_listcxx . . $ nftnl_set#element_list.))
881 return ret;
882
883 nest1 = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_SET_ELEM_LIST_ELEMENTScxx . . $ NFTA_SET_ELEM_LIST_ELEMENTS.);
884 elem = nftnl_set_elems_iter_nextcxx . . $ nftnl_set_elems_iter_next(3d9a9ddd671d3e5e).(iter);
885 while (elem != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
886 nest2 = nftnl_set_elem_nlmsg_buildcxx . . $ nftnl_set_elem_nlmsg_build(a38f406a57d3b12e).(nlh, elem, ++i);
887 if (nftnl_attr_nest_overflowcxx . . $ nftnl_attr_nest_overflow(c7e7da8af1458cef).(nlh, nest1, nest2)) {
888 /* Go back to previous not to miss this element */
889 iter->curcxx . . $ nftnl_set_elems_iter#cur. = list_entrycxx . . $ `include/linux_list.h:334:9`!(iter->cur->head.prev,
890 struct nftnl_set_elem, head);
891 ret = 1;
892 break;
893 }
894 elem = nftnl_set_elems_iter_nextcxx . . $ nftnl_set_elems_iter_next(3d9a9ddd671d3e5e).(iter);
895 }
896 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest1);
897
898 return ret;
899 }