Debian Codegraph @

src/set.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-or-later */cxx . . $ `<file>/src/set.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 <inttypes.h>
15 #include <netinet/in.h>
16 #include <limits.h>
17 #include <errno.h>
18
19 #include <libmnl/libmnl.h>
20 #include <linux/netfilter/nfnetlink.h>cxx . . $ `<file>/include/linux/netfilter/nfnetlink.h`/
21 #include <linux/netfilter/nf_tables.h>cxx . . $ `<file>/include/linux/netfilter/nf_tables.h`/
22
23 #include <libnftnl/set.h>cxx . . $ `<file>/include/libnftnl/set.h`/
24 #include <libnftnl/expr.h>cxx . . $ `<file>/include/libnftnl/expr.h`/
25
26 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_alloc);
27 struct nftnl_setcxx . . $ nftnl_set# *nftnl_set_alloccxx . . $ nftnl_set_alloc(65a15d5d5c3d0ae9).(void)
28 {
29 struct nftnl_setcxx . . $ nftnl_set# *s;
30
31 s = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_setcxx . . $ nftnl_set#));
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->element_list);
36 INIT_LIST_HEADcxx . . $ `include/linux_list.h:66:9`!(&s->expr_list);
37 return s;
38 }
39
40 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_free);
41 void nftnl_set_freecxx . . $ nftnl_set_free(1539d2f51666fae0).(const struct nftnl_setcxx . . $ nftnl_set# *s)
42 {
43 struct nftnl_set_elemcxx . . $ nftnl_set_elem# *elem, *tmp;
44 struct nftnl_exprcxx . . $ nftnl_expr# *expr, *next;
45
46 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_TABLEcxx . . $ NFTNL_SET_TABLE.))
47 xfreecxx . . $ `include/utils.h:22:9`!(s->table);
48 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_NAMEcxx . . $ NFTNL_SET_NAME.))
49 xfreecxx . . $ `include/utils.h:22:9`!(s->name);
50 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_USERDATAcxx . . $ NFTNL_SET_USERDATA.))
51 xfreecxx . . $ `include/utils.h:22:9`!(s->user.data);
52
53 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(expr, next, &s->expr_list, head) {
54 list_delcxx . . $ list_del(35ab6d74de6aba0a).(&expr->headcxx . . $ nftnl_expr#head.);
55 nftnl_expr_freecxx . . $ nftnl_expr_free(cbe1a28527736226).(expr);
56 }
57
58 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(elem, tmp, &s->element_list, head) {
59 list_delcxx . . $ list_del(35ab6d74de6aba0a).(&elem->headcxx . . $ nftnl_set_elem#head.);
60 nftnl_set_elem_freecxx . . $ nftnl_set_elem_free(aa0bbd50ab576260).(elem);
61 }
62
63 xfreecxx . . $ `include/utils.h:22:9`!(s->type);
64 xfreecxx . . $ `include/utils.h:22:9`!(s);
65 }
66
67 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_is_set);
68 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! nftnl_set_is_setcxx . . $ nftnl_set_is_set(ec8e185a97c30594).(const struct nftnl_setcxx . . $ nftnl_set# *s, uint16_tcxx . . $ uint16_t# attr)
69 {
70 return s->flagscxx . . $ nftnl_set#flags. & (1 << attr);
71 }
72
73 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_unset);
74 void nftnl_set_unsetcxx . . $ nftnl_set_unset(354b5c020bd4957b).(struct nftnl_setcxx . . $ nftnl_set# *s, uint16_tcxx . . $ uint16_t# attr)
75 {
76 struct nftnl_exprcxx . . $ nftnl_expr# *expr, *tmp;
77
78 if (!(s->flagscxx . . $ nftnl_set#flags. & (1 << attr)))
79 return;
80
81 switch (attr) {
82 case NFTNL_SET_TABLEcxx . . $ NFTNL_SET_TABLE.:
83 xfreecxx . . $ `include/utils.h:22:9`!(s->table);
84 break;
85 case NFTNL_SET_NAMEcxx . . $ NFTNL_SET_NAME.:
86 xfreecxx . . $ `include/utils.h:22:9`!(s->name);
87 break;
88 case NFTNL_SET_HANDLEcxx . . $ NFTNL_SET_HANDLE.:
89 case NFTNL_SET_FLAGScxx . . $ NFTNL_SET_FLAGS.:
90 case NFTNL_SET_KEY_TYPEcxx . . $ NFTNL_SET_KEY_TYPE.:
91 case NFTNL_SET_KEY_LENcxx . . $ NFTNL_SET_KEY_LEN.:
92 case NFTNL_SET_DATA_TYPEcxx . . $ NFTNL_SET_DATA_TYPE.:
93 case NFTNL_SET_DATA_LENcxx . . $ NFTNL_SET_DATA_LEN.:
94 case NFTNL_SET_OBJ_TYPEcxx . . $ NFTNL_SET_OBJ_TYPE.:
95 case NFTNL_SET_FAMILYcxx . . $ NFTNL_SET_FAMILY.:
96 case NFTNL_SET_IDcxx . . $ NFTNL_SET_ID.:
97 case NFTNL_SET_POLICYcxx . . $ NFTNL_SET_POLICY.:
98 case NFTNL_SET_DESC_SIZEcxx . . $ NFTNL_SET_DESC_SIZE.:
99 case NFTNL_SET_DESC_CONCATcxx . . $ NFTNL_SET_DESC_CONCAT.:
100 case NFTNL_SET_TIMEOUTcxx . . $ NFTNL_SET_TIMEOUT.:
101 case NFTNL_SET_GC_INTERVALcxx . . $ NFTNL_SET_GC_INTERVAL.:
102 case NFTNL_SET_COUNTcxx . . $ NFTNL_SET_COUNT.:
103 break;
104 case NFTNL_SET_USERDATAcxx . . $ NFTNL_SET_USERDATA.:
105 xfreecxx . . $ `include/utils.h:22:9`!(s->user.data);
106 break;
107 case NFTNL_SET_EXPRcxx . . $ NFTNL_SET_EXPR.:
108 case NFTNL_SET_EXPRESSIONScxx . . $ NFTNL_SET_EXPRESSIONS.:
109 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(expr, tmp, &s->expr_list, head) {
110 list_delcxx . . $ list_del(35ab6d74de6aba0a).(&expr->headcxx . . $ nftnl_expr#head.);
111 nftnl_expr_freecxx . . $ nftnl_expr_free(cbe1a28527736226).(expr);
112 }
113 break;
114 default:
115 return;
116 }
117
118 s->flagscxx . . $ nftnl_set#flags. &= ~(1 << attr);
119 }
120
121 static uint32_tcxx . . $ uint32_t# nftnl_set_validatecxx . . $ nftnl_set_validate.[NFTNL_SET_MAXcxx . . $ `include/libnftnl/set.h:38:9`! + 1] = {
122 [NFTNL_SET_HANDLEcxx . . $ NFTNL_SET_HANDLE.] = sizeof(uint64_tcxx . . $ uint64_t#),
123 [NFTNL_SET_FLAGScxx . . $ NFTNL_SET_FLAGS.] = sizeof(uint32_tcxx . . $ uint32_t#),
124 [NFTNL_SET_KEY_TYPEcxx . . $ NFTNL_SET_KEY_TYPE.] = sizeof(uint32_tcxx . . $ uint32_t#),
125 [NFTNL_SET_KEY_LENcxx . . $ NFTNL_SET_KEY_LEN.] = sizeof(uint32_tcxx . . $ uint32_t#),
126 [NFTNL_SET_DATA_TYPEcxx . . $ NFTNL_SET_DATA_TYPE.] = sizeof(uint32_tcxx . . $ uint32_t#),
127 [NFTNL_SET_DATA_LENcxx . . $ NFTNL_SET_DATA_LEN.] = sizeof(uint32_tcxx . . $ uint32_t#),
128 [NFTNL_SET_OBJ_TYPEcxx . . $ NFTNL_SET_OBJ_TYPE.] = sizeof(uint32_tcxx . . $ uint32_t#),
129 [NFTNL_SET_FAMILYcxx . . $ NFTNL_SET_FAMILY.] = sizeof(uint32_tcxx . . $ uint32_t#),
130 [NFTNL_SET_IDcxx . . $ NFTNL_SET_ID.] = sizeof(uint32_tcxx . . $ uint32_t#),
131 [NFTNL_SET_POLICYcxx . . $ NFTNL_SET_POLICY.] = sizeof(uint32_tcxx . . $ uint32_t#),
132 [NFTNL_SET_DESC_SIZEcxx . . $ NFTNL_SET_DESC_SIZE.] = sizeof(uint32_tcxx . . $ uint32_t#),
133 [NFTNL_SET_TIMEOUTcxx . . $ NFTNL_SET_TIMEOUT.] = sizeof(uint64_tcxx . . $ uint64_t#),
134 [NFTNL_SET_GC_INTERVALcxx . . $ NFTNL_SET_GC_INTERVAL.] = sizeof(uint32_tcxx . . $ uint32_t#),
135 [NFTNL_SET_COUNTcxx . . $ NFTNL_SET_COUNT.] = sizeof(uint32_tcxx . . $ uint32_t#),
136 };
137
138 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_set_data);
139 int nftnl_set_set_datacxx . . $ nftnl_set_set_data(bf01e01a0313c02a).(struct nftnl_setcxx . . $ nftnl_set# *s, uint16_tcxx . . $ uint16_t# attr, const void *data,
140 uint32_tcxx . . $ uint32_t# data_len)
141 {
142 struct nftnl_exprcxx . . $ nftnl_expr# *expr, *tmp;
143
144 nftnl_assert_attr_existscxx . . $ `include/utils.h:49:9`!(attr, NFTNL_SET_MAXcxx . . $ `include/libnftnl/set.h:38:9`!);
145 nftnl_assert_validatecxx . . $ `include/utils.h:38:9`!(data, nftnl_set_validate, attr, data_len);
146
147 switch(attr) {
148 case NFTNL_SET_TABLEcxx . . $ NFTNL_SET_TABLE.:
149 return nftnl_set_str_attrcxx . . $ nftnl_set_str_attr(fd565288bd370d98).(&s->tablecxx . . $ nftnl_set#table., &s->flagscxx . . $ nftnl_set#flags.,
150 attr, data, data_len);
151 case NFTNL_SET_NAMEcxx . . $ NFTNL_SET_NAME.:
152 return nftnl_set_str_attrcxx . . $ nftnl_set_str_attr(fd565288bd370d98).(&s->namecxx . . $ nftnl_set#name., &s->flagscxx . . $ nftnl_set#flags.,
153 attr, data, data_len);
154 case NFTNL_SET_HANDLEcxx . . $ NFTNL_SET_HANDLE.:
155 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->handlecxx . . $ nftnl_set#handle., data, sizeof(s->handlecxx . . $ nftnl_set#handle.));
156 break;
157 case NFTNL_SET_FLAGScxx . . $ NFTNL_SET_FLAGS.:
158 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->set_flagscxx . . $ nftnl_set#set_flags., data, sizeof(s->set_flagscxx . . $ nftnl_set#set_flags.));
159 break;
160 case NFTNL_SET_KEY_TYPEcxx . . $ NFTNL_SET_KEY_TYPE.:
161 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->key_typecxx . . $ nftnl_set#key_type., data, sizeof(s->key_typecxx . . $ nftnl_set#key_type.));
162 break;
163 case NFTNL_SET_KEY_LENcxx . . $ NFTNL_SET_KEY_LEN.:
164 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->key_lencxx . . $ nftnl_set#key_len., data, sizeof(s->key_lencxx . . $ nftnl_set#key_len.));
165 break;
166 case NFTNL_SET_DATA_TYPEcxx . . $ NFTNL_SET_DATA_TYPE.:
167 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->data_typecxx . . $ nftnl_set#data_type., data, sizeof(s->data_typecxx . . $ nftnl_set#data_type.));
168 break;
169 case NFTNL_SET_DATA_LENcxx . . $ NFTNL_SET_DATA_LEN.:
170 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->data_lencxx . . $ nftnl_set#data_len., data, sizeof(s->data_lencxx . . $ nftnl_set#data_len.));
171 break;
172 case NFTNL_SET_OBJ_TYPEcxx . . $ NFTNL_SET_OBJ_TYPE.:
173 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->obj_typecxx . . $ nftnl_set#obj_type., data, sizeof(s->obj_typecxx . . $ nftnl_set#obj_type.));
174 break;
175 case NFTNL_SET_FAMILYcxx . . $ NFTNL_SET_FAMILY.:
176 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->familycxx . . $ nftnl_set#family., data, sizeof(s->familycxx . . $ nftnl_set#family.));
177 break;
178 case NFTNL_SET_IDcxx . . $ NFTNL_SET_ID.:
179 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->idcxx . . $ nftnl_set#id., data, sizeof(s->idcxx . . $ nftnl_set#id.));
180 break;
181 case NFTNL_SET_POLICYcxx . . $ NFTNL_SET_POLICY.:
182 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->policycxx . . $ nftnl_set#policy., data, sizeof(s->policycxx . . $ nftnl_set#policy.));
183 break;
184 case NFTNL_SET_DESC_SIZEcxx . . $ NFTNL_SET_DESC_SIZE.:
185 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->desccxx . . $ nftnl_set#desc..sizecxx . . $ nftnl_set#$anonymous_type_1#size., data, sizeof(s->desccxx . . $ nftnl_set#desc..sizecxx . . $ nftnl_set#$anonymous_type_1#size.));
186 break;
187 case NFTNL_SET_DESC_CONCATcxx . . $ NFTNL_SET_DESC_CONCAT.:
188 if (data_len > sizeof(s->desccxx . . $ nftnl_set#desc..field_lencxx . . $ nftnl_set#$anonymous_type_1#field_len.))
189 return -1;
190
191 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->desccxx . . $ nftnl_set#desc..field_lencxx . . $ nftnl_set#$anonymous_type_1#field_len., data, data_len);
192 for (s->desccxx . . $ nftnl_set#desc..field_countcxx . . $ nftnl_set#$anonymous_type_1#field_count. = 0;
193 s->desccxx . . $ nftnl_set#desc..field_countcxx . . $ nftnl_set#$anonymous_type_1#field_count. < NFT_REG32_COUNTcxx . . $ `include/linux/netfilter/nf_tables.h:51:9`!;
194 s->desccxx . . $ nftnl_set#desc..field_countcxx . . $ nftnl_set#$anonymous_type_1#field_count.++) {
195 if (!s->desccxx . . $ nftnl_set#desc..field_lencxx . . $ nftnl_set#$anonymous_type_1#field_len.[s->desccxx . . $ nftnl_set#desc..field_countcxx . . $ nftnl_set#$anonymous_type_1#field_count.])
196 break;
197 }
198 break;
199 case NFTNL_SET_TIMEOUTcxx . . $ NFTNL_SET_TIMEOUT.:
200 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->timeoutcxx . . $ nftnl_set#timeout., data, sizeof(s->timeoutcxx . . $ nftnl_set#timeout.));
201 break;
202 case NFTNL_SET_GC_INTERVALcxx . . $ NFTNL_SET_GC_INTERVAL.:
203 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->gc_intervalcxx . . $ nftnl_set#gc_interval., data, sizeof(s->gc_intervalcxx . . $ nftnl_set#gc_interval.));
204 break;
205 case NFTNL_SET_COUNTcxx . . $ NFTNL_SET_COUNT.:
206 memcpycxx . . $ memcpy(cc817cb175f282d).(&s->elemcountcxx . . $ nftnl_set#elemcount., data, sizeof(s->elemcountcxx . . $ nftnl_set#elemcount.));
207 break;
208 case NFTNL_SET_USERDATAcxx . . $ NFTNL_SET_USERDATA.:
209 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_USERDATAcxx . . $ NFTNL_SET_USERDATA.))
210 xfreecxx . . $ `include/utils.h:22:9`!(s->user.data);
211
212 s->usercxx . . $ nftnl_set#user..datacxx . . $ nftnl_set#$anonymous_type_0#data. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(data_len);
213 if (!s->usercxx . . $ nftnl_set#user..datacxx . . $ nftnl_set#$anonymous_type_0#data.)
214 return -1;
215 memcpycxx . . $ memcpy(cc817cb175f282d).(s->usercxx . . $ nftnl_set#user..datacxx . . $ nftnl_set#$anonymous_type_0#data., data, data_len);
216 s->usercxx . . $ nftnl_set#user..lencxx . . $ nftnl_set#$anonymous_type_0#len. = data_len;
217 break;
218 case NFTNL_SET_EXPRcxx . . $ NFTNL_SET_EXPR.:
219 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(expr, tmp, &s->expr_list, head) {
220 list_delcxx . . $ list_del(35ab6d74de6aba0a).(&expr->headcxx . . $ nftnl_expr#head.);
221 nftnl_expr_freecxx . . $ nftnl_expr_free(cbe1a28527736226).(expr);
222 }
223
224 expr = (void *)data;
225 list_addcxx . . $ list_add(6c3f7387ec573de3).(&expr->headcxx . . $ nftnl_expr#head., &s->expr_listcxx . . $ nftnl_set#expr_list.);
226 break;
227 }
228 s->flagscxx . . $ nftnl_set#flags. |= (1 << attr);
229 return 0;
230 }
231
232 int nftnl_set_setcxx . . $ nftnl_set_set(47baf49cd6060eff).(struct nftnl_setcxx . . $ nftnl_set# *s, uint16_tcxx . . $ uint16_t# attr, const void *data) __visiblecxx . . $ `include/utils.h:13:10`!;
233 int nftnl_set_setcxx . . $ nftnl_set_set(47baf49cd6060eff).(struct nftnl_setcxx . . $ nftnl_set# *s, uint16_tcxx . . $ uint16_t# attr, const void *data)
234 {
235 return nftnl_set_set_datacxx . . $ nftnl_set_set_data(bf01e01a0313c02a).(s, attr, data, nftnl_set_validatecxx . . $ nftnl_set_validate.[attr]);
236 }
237
238 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_set_u32);
239 void nftnl_set_set_u32cxx . . $ nftnl_set_set_u32(c864744ea95bede8).(struct nftnl_setcxx . . $ nftnl_set# *s, uint16_tcxx . . $ uint16_t# attr, uint32_tcxx . . $ uint32_t# val)
240 {
241 nftnl_set_set_datacxx . . $ nftnl_set_set_data(bf01e01a0313c02a).(s, attr, &val, sizeof(uint32_tcxx . . $ uint32_t#));
242 }
243
244 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_set_u64);
245 void nftnl_set_set_u64cxx . . $ nftnl_set_set_u64(25d2da5408a038cf).(struct nftnl_setcxx . . $ nftnl_set# *s, uint16_tcxx . . $ uint16_t# attr, uint64_tcxx . . $ uint64_t# val)
246 {
247 nftnl_set_set_datacxx . . $ nftnl_set_set_data(bf01e01a0313c02a).(s, attr, &val, sizeof(uint64_tcxx . . $ uint64_t#));
248 }
249
250 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_set_str);
251 int nftnl_set_set_strcxx . . $ nftnl_set_set_str(4127a0a3c311c7cb).(struct nftnl_setcxx . . $ nftnl_set# *s, uint16_tcxx . . $ uint16_t# attr, const char *str)
252 {
253 return nftnl_set_set_datacxx . . $ nftnl_set_set_data(bf01e01a0313c02a).(s, attr, str, strlencxx . . $ strlen(751346f8406fd082).(str) + 1);
254 }
255
256 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_get_data);
257 const void *nftnl_set_get_datacxx . . $ nftnl_set_get_data(593ecc46dba1ced6).(const struct nftnl_setcxx . . $ nftnl_set# *s, uint16_tcxx . . $ uint16_t# attr,
258 uint32_tcxx . . $ uint32_t# *data_len)
259 {
260 struct nftnl_exprcxx . . $ nftnl_expr# *expr;
261
262 if (!(s->flagscxx . . $ nftnl_set#flags. & (1 << attr)))
263 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
264
265 switch(attr) {
266 case NFTNL_SET_TABLEcxx . . $ NFTNL_SET_TABLE.:
267 *data_len = strlencxx . . $ strlen(751346f8406fd082).(s->tablecxx . . $ nftnl_set#table.) + 1;
268 return s->tablecxx . . $ nftnl_set#table.;
269 case NFTNL_SET_NAMEcxx . . $ NFTNL_SET_NAME.:
270 *data_len = strlencxx . . $ strlen(751346f8406fd082).(s->namecxx . . $ nftnl_set#name.) + 1;
271 return s->namecxx . . $ nftnl_set#name.;
272 case NFTNL_SET_HANDLEcxx . . $ NFTNL_SET_HANDLE.:
273 *data_len = sizeof(uint64_tcxx . . $ uint64_t#);
274 return &s->handlecxx . . $ nftnl_set#handle.;
275 case NFTNL_SET_FLAGScxx . . $ NFTNL_SET_FLAGS.:
276 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
277 return &s->set_flagscxx . . $ nftnl_set#set_flags.;
278 case NFTNL_SET_KEY_TYPEcxx . . $ NFTNL_SET_KEY_TYPE.:
279 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
280 return &s->key_typecxx . . $ nftnl_set#key_type.;
281 case NFTNL_SET_KEY_LENcxx . . $ NFTNL_SET_KEY_LEN.:
282 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
283 return &s->key_lencxx . . $ nftnl_set#key_len.;
284 case NFTNL_SET_DATA_TYPEcxx . . $ NFTNL_SET_DATA_TYPE.:
285 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
286 return &s->data_typecxx . . $ nftnl_set#data_type.;
287 case NFTNL_SET_DATA_LENcxx . . $ NFTNL_SET_DATA_LEN.:
288 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
289 return &s->data_lencxx . . $ nftnl_set#data_len.;
290 case NFTNL_SET_OBJ_TYPEcxx . . $ NFTNL_SET_OBJ_TYPE.:
291 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
292 return &s->obj_typecxx . . $ nftnl_set#obj_type.;
293 case NFTNL_SET_FAMILYcxx . . $ NFTNL_SET_FAMILY.:
294 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
295 return &s->familycxx . . $ nftnl_set#family.;
296 case NFTNL_SET_IDcxx . . $ NFTNL_SET_ID.:
297 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
298 return &s->idcxx . . $ nftnl_set#id.;
299 case NFTNL_SET_POLICYcxx . . $ NFTNL_SET_POLICY.:
300 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
301 return &s->policycxx . . $ nftnl_set#policy.;
302 case NFTNL_SET_DESC_SIZEcxx . . $ NFTNL_SET_DESC_SIZE.:
303 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
304 return &s->desccxx . . $ nftnl_set#desc..sizecxx . . $ nftnl_set#$anonymous_type_1#size.;
305 case NFTNL_SET_DESC_CONCATcxx . . $ NFTNL_SET_DESC_CONCAT.:
306 *data_len = s->desccxx . . $ nftnl_set#desc..field_countcxx . . $ nftnl_set#$anonymous_type_1#field_count.;
307 return s->desccxx . . $ nftnl_set#desc..field_lencxx . . $ nftnl_set#$anonymous_type_1#field_len.;
308 case NFTNL_SET_TIMEOUTcxx . . $ NFTNL_SET_TIMEOUT.:
309 *data_len = sizeof(uint64_tcxx . . $ uint64_t#);
310 return &s->timeoutcxx . . $ nftnl_set#timeout.;
311 case NFTNL_SET_GC_INTERVALcxx . . $ NFTNL_SET_GC_INTERVAL.:
312 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
313 return &s->gc_intervalcxx . . $ nftnl_set#gc_interval.;
314 case NFTNL_SET_COUNTcxx . . $ NFTNL_SET_COUNT.:
315 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
316 return &s->elemcountcxx . . $ nftnl_set#elemcount.;
317 case NFTNL_SET_USERDATAcxx . . $ NFTNL_SET_USERDATA.:
318 *data_len = s->usercxx . . $ nftnl_set#user..lencxx . . $ nftnl_set#$anonymous_type_0#len.;
319 return s->usercxx . . $ nftnl_set#user..datacxx . . $ nftnl_set#$anonymous_type_0#data.;
320 case NFTNL_SET_EXPRcxx . . $ NFTNL_SET_EXPR.:
321 list_for_each_entrycxx . . $ `include/linux_list.h:384:9`!(expr, &s->expr_list, head)
322 break;
323 return expr;
324 }
325 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
326 }
327
328 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_get);
329 const void *nftnl_set_getcxx . . $ nftnl_set_get(59b596603b82e23e).(const struct nftnl_setcxx . . $ nftnl_set# *s, uint16_tcxx . . $ uint16_t# attr)
330 {
331 uint32_tcxx . . $ uint32_t# data_len;
332 return nftnl_set_get_datacxx . . $ nftnl_set_get_data(593ecc46dba1ced6).(s, attr, &data_len);
333 }
334
335 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_get_str);
336 const char *nftnl_set_get_strcxx . . $ nftnl_set_get_str(2643c3be2c1302af).(const struct nftnl_setcxx . . $ nftnl_set# *s, uint16_tcxx . . $ uint16_t# attr)
337 {
338 return nftnl_set_getcxx . . $ nftnl_set_get(59b596603b82e23e).(s, attr);
339 }
340
341 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_get_u32);
342 uint32_tcxx . . $ uint32_t# nftnl_set_get_u32cxx . . $ nftnl_set_get_u32(9fdb3f9dd9234466).(const struct nftnl_setcxx . . $ nftnl_set# *s, uint16_tcxx . . $ uint16_t# attr)
343 {
344 uint32_tcxx . . $ uint32_t# data_len;
345 const uint32_tcxx . . $ uint32_t# *val = nftnl_set_get_datacxx . . $ nftnl_set_get_data(593ecc46dba1ced6).(s, attr, &data_len);
346
347 nftnl_assertcxx . . $ `include/utils.h:33:9`!(val, attr, data_len == sizeof(uint32_t));
348
349 return val ? *val : 0;
350 }
351
352 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_get_u64);
353 uint64_tcxx . . $ uint64_t# nftnl_set_get_u64cxx . . $ nftnl_set_get_u64(38c03a6b58e8036f).(const struct nftnl_setcxx . . $ nftnl_set# *s, uint16_tcxx . . $ uint16_t# attr)
354 {
355 uint32_tcxx . . $ uint32_t# data_len;
356 const uint64_tcxx . . $ uint64_t# *val = nftnl_set_get_datacxx . . $ nftnl_set_get_data(593ecc46dba1ced6).(s, attr, &data_len);
357
358 nftnl_assertcxx . . $ `include/utils.h:33:9`!(val, attr, data_len == sizeof(uint64_t));
359
360 return val ? *val : 0;
361 }
362
363 static void nftnl_set_nlmsg_build_desc_size_payloadcxx . . $ nftnl_set_nlmsg_build_desc_size_payload(54bfe25df723ccae).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh,
364 struct nftnl_setcxx . . $ nftnl_set# *s)
365 {
366 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_SET_DESC_SIZEcxx . . $ NFTA_SET_DESC_SIZE., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(s->desc.size));
367 }
368
369 static void nftnl_set_nlmsg_build_desc_concat_payloadcxx . . $ nftnl_set_nlmsg_build_desc_concat_payload(54bfe25df723ccae).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh,
370 struct nftnl_setcxx . . $ nftnl_set# *s)
371 {
372 struct nlattrcxx . . $ nlattr# *nest;
373 int i;
374
375 nest = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_SET_DESC_CONCATcxx . . $ NFTA_SET_DESC_CONCAT.);
376 for (i = 0; i < NFT_REG32_COUNTcxx . . $ `include/linux/netfilter/nf_tables.h:51:9`! && i < s->desccxx . . $ nftnl_set#desc..field_countcxx . . $ nftnl_set#$anonymous_type_1#field_count.; i++) {
377 struct nlattrcxx . . $ nlattr# *nest_elem;
378
379 nest_elem = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_LIST_ELEMcxx . . $ NFTA_LIST_ELEM.);
380 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_SET_FIELD_LENcxx . . $ NFTA_SET_FIELD_LEN.,
381 htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(s->desc.field_len[i]));
382 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest_elem);
383 }
384 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest);
385 }
386
387 static void
388 nftnl_set_nlmsg_build_desc_payloadcxx . . $ nftnl_set_nlmsg_build_desc_payload(54bfe25df723ccae).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh, struct nftnl_setcxx . . $ nftnl_set# *s)
389 {
390 struct nlattrcxx . . $ nlattr# *nest;
391
392 nest = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_SET_DESCcxx . . $ NFTA_SET_DESC.);
393
394 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_DESC_SIZEcxx . . $ NFTNL_SET_DESC_SIZE.))
395 nftnl_set_nlmsg_build_desc_size_payloadcxx . . $ nftnl_set_nlmsg_build_desc_size_payload(54bfe25df723ccae).(nlh, s);
396 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_DESC_CONCATcxx . . $ NFTNL_SET_DESC_CONCAT.))
397 nftnl_set_nlmsg_build_desc_concat_payloadcxx . . $ nftnl_set_nlmsg_build_desc_concat_payload(54bfe25df723ccae).(nlh, s);
398
399 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest);
400 }
401
402 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_nlmsg_build_payload);
403 void nftnl_set_nlmsg_build_payloadcxx . . $ nftnl_set_nlmsg_build_payload(54bfe25df723ccae).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh, struct nftnl_setcxx . . $ nftnl_set# *s)
404 {
405 int num_exprs = 0;
406
407 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_TABLEcxx . . $ NFTNL_SET_TABLE.))
408 mnl_attr_put_strzcxx . . $ mnl_attr_put_strz(eb76286d4bfc1a8d).(nlh, NFTA_SET_TABLEcxx . . $ NFTA_SET_TABLE., s->tablecxx . . $ nftnl_set#table.);
409 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_NAMEcxx . . $ NFTNL_SET_NAME.))
410 mnl_attr_put_strzcxx . . $ mnl_attr_put_strz(eb76286d4bfc1a8d).(nlh, NFTA_SET_NAMEcxx . . $ NFTA_SET_NAME., s->namecxx . . $ nftnl_set#name.);
411 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_HANDLEcxx . . $ NFTNL_SET_HANDLE.))
412 mnl_attr_put_u64cxx . . $ mnl_attr_put_u64(6d753f4d486e3a2f).(nlh, NFTA_SET_HANDLEcxx . . $ NFTA_SET_HANDLE., htobe64cxx . . $ `<external>/15855202785537844739/endian.h:49:11`!(s->handle));
413 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_FLAGScxx . . $ NFTNL_SET_FLAGS.))
414 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_SET_FLAGScxx . . $ NFTA_SET_FLAGS., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(s->set_flags));
415 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_KEY_TYPEcxx . . $ NFTNL_SET_KEY_TYPE.))
416 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_SET_KEY_TYPEcxx . . $ NFTA_SET_KEY_TYPE., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(s->key_type));
417 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_KEY_LENcxx . . $ NFTNL_SET_KEY_LEN.))
418 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_SET_KEY_LENcxx . . $ NFTA_SET_KEY_LEN., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(s->key_len));
419 /* These are only used to map matching -> action (1:1) */
420 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_DATA_TYPEcxx . . $ NFTNL_SET_DATA_TYPE.))
421 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_SET_DATA_TYPEcxx . . $ NFTA_SET_DATA_TYPE., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(s->data_type));
422 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_DATA_LENcxx . . $ NFTNL_SET_DATA_LEN.))
423 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_SET_DATA_LENcxx . . $ NFTA_SET_DATA_LEN., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(s->data_len));
424 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_OBJ_TYPEcxx . . $ NFTNL_SET_OBJ_TYPE.))
425 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_SET_OBJ_TYPEcxx . . $ NFTA_SET_OBJ_TYPE., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(s->obj_type));
426 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_IDcxx . . $ NFTNL_SET_ID.))
427 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_SET_IDcxx . . $ NFTA_SET_ID., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(s->id));
428 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_POLICYcxx . . $ NFTNL_SET_POLICY.))
429 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_SET_POLICYcxx . . $ NFTA_SET_POLICY., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(s->policy));
430 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_DESC_SIZEcxx . . $ NFTNL_SET_DESC_SIZE. | 1 << NFTNL_SET_DESC_CONCATcxx . . $ NFTNL_SET_DESC_CONCAT.))
431 nftnl_set_nlmsg_build_desc_payloadcxx . . $ nftnl_set_nlmsg_build_desc_payload(54bfe25df723ccae).(nlh, s);
432 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_TIMEOUTcxx . . $ NFTNL_SET_TIMEOUT.))
433 mnl_attr_put_u64cxx . . $ mnl_attr_put_u64(6d753f4d486e3a2f).(nlh, NFTA_SET_TIMEOUTcxx . . $ NFTA_SET_TIMEOUT., htobe64cxx . . $ `<external>/15855202785537844739/endian.h:49:11`!(s->timeout));
434 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_GC_INTERVALcxx . . $ NFTNL_SET_GC_INTERVAL.))
435 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_SET_GC_INTERVALcxx . . $ NFTA_SET_GC_INTERVAL., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(s->gc_interval));
436 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_USERDATAcxx . . $ NFTNL_SET_USERDATA.))
437 mnl_attr_putcxx . . $ mnl_attr_put(612d908c39ff741d).(nlh, NFTA_SET_USERDATAcxx . . $ NFTA_SET_USERDATA., s->usercxx . . $ nftnl_set#user..lencxx . . $ nftnl_set#$anonymous_type_0#len., s->usercxx . . $ nftnl_set#user..datacxx . . $ nftnl_set#$anonymous_type_0#data.);
438 if (!list_emptycxx . . $ list_empty(df525b6afabf24a2).(&s->expr_listcxx . . $ nftnl_set#expr_list.)) {
439 struct nftnl_exprcxx . . $ nftnl_expr# *expr;
440
441 list_for_each_entrycxx . . $ `include/linux_list.h:384:9`!(expr, &s->expr_list, head)
442 num_exprs++;
443
444 if (num_exprs == 1) {
445 struct nlattrcxx . . $ nlattr# *nest1;
446
447 nest1 = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_SET_EXPRcxx . . $ NFTA_SET_EXPR.);
448 list_for_each_entrycxx . . $ `include/linux_list.h:384:9`!(expr, &s->expr_list, head)
449 nftnl_expr_build_payloadcxx . . $ nftnl_expr_build_payload(efa2a5c645f672a6).(nlh, expr);
450
451 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest1);
452 } else if (num_exprs > 1) {
453 struct nlattrcxx . . $ nlattr# *nest1, *nest2;
454
455 nest1 = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_SET_EXPRESSIONScxx . . $ NFTA_SET_EXPRESSIONS.);
456 list_for_each_entrycxx . . $ `include/linux_list.h:384:9`!(expr, &s->expr_list, head) {
457 nest2 = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_LIST_ELEMcxx . . $ NFTA_LIST_ELEM.);
458 nftnl_expr_build_payloadcxx . . $ nftnl_expr_build_payload(efa2a5c645f672a6).(nlh, expr);
459 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest2);
460 }
461 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest1);
462 }
463 }
464 }
465
466 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_add_expr);
467 void nftnl_set_add_exprcxx . . $ nftnl_set_add_expr(dc33cee67eb4e9d5).(struct nftnl_setcxx . . $ nftnl_set# *s, struct nftnl_exprcxx . . $ nftnl_expr# *expr)
468 {
469 list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&expr->headcxx . . $ nftnl_expr#head., &s->expr_listcxx . . $ nftnl_set#expr_list.);
470 }
471
472 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_expr_foreach);
473 int nftnl_set_expr_foreachcxx . . $ nftnl_set_expr_foreach(6a5638b5bb193514).(const struct nftnl_setcxx . . $ nftnl_set# *s,
474 int (*cb)(struct nftnl_exprcxx . . $ nftnl_expr# *e, void *data),
475 void *data)
476 {
477 struct nftnl_exprcxx . . $ nftnl_expr# *cur, *tmp;
478 int ret;
479
480 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(cur, tmp, &s->expr_list, head) {
481 ret = cb(cur, data);
482 if (ret < 0)
483 return ret;
484 }
485 return 0;
486 }
487
488 static int nftnl_set_parse_attr_cbcxx . . $ nftnl_set_parse_attr_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data)
489 {
490 const struct nlattrcxx . . $ nlattr# **tb = data;
491 int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr);
492
493 if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_SET_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:424:9`!) < 0)
494 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
495
496 switch(type) {
497 case NFTA_SET_TABLEcxx . . $ NFTA_SET_TABLE.:
498 case NFTA_SET_NAMEcxx . . $ NFTA_SET_NAME.:
499 case NFTA_SET_TYPEcxx . . $ NFTA_SET_TYPE.:
500 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_STRINGcxx . . $ MNL_TYPE_STRING.) < 0)
501 abi_breakagecxx . . $ `include/utils.h:28:9`!();
502 break;
503 case NFTA_SET_HANDLEcxx . . $ NFTA_SET_HANDLE.:
504 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U64cxx . . $ MNL_TYPE_U64.) < 0)
505 abi_breakagecxx . . $ `include/utils.h:28:9`!();
506 break;
507 case NFTA_SET_FLAGScxx . . $ NFTA_SET_FLAGS.:
508 case NFTA_SET_KEY_TYPEcxx . . $ NFTA_SET_KEY_TYPE.:
509 case NFTA_SET_KEY_LENcxx . . $ NFTA_SET_KEY_LEN.:
510 case NFTA_SET_DATA_TYPEcxx . . $ NFTA_SET_DATA_TYPE.:
511 case NFTA_SET_DATA_LENcxx . . $ NFTA_SET_DATA_LEN.:
512 case NFTA_SET_IDcxx . . $ NFTA_SET_ID.:
513 case NFTA_SET_POLICYcxx . . $ NFTA_SET_POLICY.:
514 case NFTA_SET_GC_INTERVALcxx . . $ NFTA_SET_GC_INTERVAL.:
515 case NFTA_SET_COUNTcxx . . $ NFTA_SET_COUNT.:
516 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U32cxx . . $ MNL_TYPE_U32.) < 0)
517 abi_breakagecxx . . $ `include/utils.h:28:9`!();
518 break;
519 case NFTA_SET_USERDATAcxx . . $ NFTA_SET_USERDATA.:
520 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_BINARYcxx . . $ MNL_TYPE_BINARY.) < 0)
521 abi_breakagecxx . . $ `include/utils.h:28:9`!();
522 break;
523 case NFTA_SET_TIMEOUTcxx . . $ NFTA_SET_TIMEOUT.:
524 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U64cxx . . $ MNL_TYPE_U64.) < 0)
525 abi_breakagecxx . . $ `include/utils.h:28:9`!();
526 break;
527 case NFTA_SET_DESCcxx . . $ NFTA_SET_DESC.:
528 case NFTA_SET_EXPRcxx . . $ NFTA_SET_EXPR.:
529 case NFTA_SET_EXPRESSIONScxx . . $ NFTA_SET_EXPRESSIONS.:
530 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_NESTEDcxx . . $ MNL_TYPE_NESTED.) < 0)
531 abi_breakagecxx . . $ `include/utils.h:28:9`!();
532 break;
533 }
534
535 tb[type] = attr;
536 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
537 }
538
539 static int
540 nftnl_set_desc_concat_field_parse_attr_cbcxx . . $ nftnl_set_desc_concat_field_parse_attr_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data)
541 {
542 int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr);
543 struct nftnl_setcxx . . $ nftnl_set# *s = data;
544
545 if (type != NFTA_SET_FIELD_LENcxx . . $ NFTA_SET_FIELD_LEN.)
546 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
547
548 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U32cxx . . $ MNL_TYPE_U32.))
549 return MNL_CB_ERRORcxx . . $ `<external>/12386019527593959648/libmnl.h:172:9`!;
550
551 s->desccxx . . $ nftnl_set#desc..field_lencxx . . $ nftnl_set#$anonymous_type_1#field_len.[s->desccxx . . $ nftnl_set#desc..field_countcxx . . $ nftnl_set#$anonymous_type_1#field_count.] = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(attr));
552 s->desccxx . . $ nftnl_set#desc..field_countcxx . . $ nftnl_set#$anonymous_type_1#field_count.++;
553
554 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
555 }
556
557 static int
558 nftnl_set_desc_concat_parse_attr_cbcxx . . $ nftnl_set_desc_concat_parse_attr_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data)
559 {
560 int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr);
561 struct nftnl_setcxx . . $ nftnl_set# *s = data;
562
563 if (type != NFTA_LIST_ELEMcxx . . $ NFTA_LIST_ELEM.)
564 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
565
566 return mnl_attr_parse_nestedcxx . . $ mnl_attr_parse_nested(f99c0e9fa94f99d9).(attr,
567 nftnl_set_desc_concat_field_parse_attr_cbcxx . . $ nftnl_set_desc_concat_field_parse_attr_cb(de2ef18c48fd675c).,
568 s);
569 }
570
571 static int nftnl_set_desc_parse_attr_cbcxx . . $ nftnl_set_desc_parse_attr_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data)
572 {
573 int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr), err;
574 struct nftnl_setcxx . . $ nftnl_set# *s = data;
575
576 if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_SET_DESC_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:363:9`!) < 0)
577 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
578
579 switch (type) {
580 case NFTA_SET_DESC_SIZEcxx . . $ NFTA_SET_DESC_SIZE.:
581 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U32cxx . . $ MNL_TYPE_U32.) < 0) {
582 abi_breakagecxx . . $ `include/utils.h:28:9`!();
583 break;
584 }
585
586 s->desccxx . . $ nftnl_set#desc..sizecxx . . $ nftnl_set#$anonymous_type_1#size. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(attr));
587 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_DESC_SIZEcxx . . $ NFTNL_SET_DESC_SIZE.);
588 break;
589 case NFTA_SET_DESC_CONCATcxx . . $ NFTA_SET_DESC_CONCAT.:
590 err = mnl_attr_parse_nestedcxx . . $ mnl_attr_parse_nested(f99c0e9fa94f99d9).(attr,
591 nftnl_set_desc_concat_parse_attr_cbcxx . . $ nftnl_set_desc_concat_parse_attr_cb(de2ef18c48fd675c).,
592 s);
593 if (err != MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!)
594 abi_breakagecxx . . $ `include/utils.h:28:9`!();
595
596 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_DESC_CONCATcxx . . $ NFTNL_SET_DESC_CONCAT.);
597 break;
598 default:
599 break;
600 }
601
602 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
603 }
604
605 static int nftnl_set_desc_parsecxx . . $ nftnl_set_desc_parse(de70658e6ee02afa).(struct nftnl_setcxx . . $ nftnl_set# *s, const struct nlattrcxx . . $ nlattr# *attr)
606 {
607 return mnl_attr_parse_nestedcxx . . $ mnl_attr_parse_nested(f99c0e9fa94f99d9).(attr, nftnl_set_desc_parse_attr_cbcxx . . $ nftnl_set_desc_parse_attr_cb(de2ef18c48fd675c)., s);
608 }
609
610 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_nlmsg_parse);
611 int nftnl_set_nlmsg_parsecxx . . $ nftnl_set_nlmsg_parse(ea0d196049dbd5e9).(const struct nlmsghdrcxx . . $ nlmsghdr# *nlh, struct nftnl_setcxx . . $ nftnl_set# *s)
612 {
613 struct nlattrcxx . . $ nlattr# *tb[NFTA_SET_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:424:9`!+1] = {};
614 struct nfgenmsgcxx . . $ nfgenmsg# *nfg = mnl_nlmsg_get_payloadcxx . . $ mnl_nlmsg_get_payload(33f780b45aa89a18).(nlh);
615 struct nftnl_exprcxx . . $ nftnl_expr# *expr, *next;
616 int ret;
617
618 if (mnl_attr_parsecxx . . $ mnl_attr_parse(8b80a5a12c5e6592).(nlh, sizeof(*nfg), nftnl_set_parse_attr_cbcxx . . $ nftnl_set_parse_attr_cb(de2ef18c48fd675c)., tb) < 0)
619 return -1;
620
621 if (nftnl_parse_str_attrcxx . . $ nftnl_parse_str_attr(2002c8408bf98f7f).(tb[NFTA_SET_TABLEcxx . . $ NFTA_SET_TABLE.], NFTNL_SET_TABLEcxx . . $ NFTNL_SET_TABLE.,
622 &s->tablecxx . . $ nftnl_set#table., &s->flagscxx . . $ nftnl_set#flags.) < 0)
623 return -1;
624 if (nftnl_parse_str_attrcxx . . $ nftnl_parse_str_attr(2002c8408bf98f7f).(tb[NFTA_SET_NAMEcxx . . $ NFTA_SET_NAME.], NFTNL_SET_NAMEcxx . . $ NFTNL_SET_NAME.,
625 &s->namecxx . . $ nftnl_set#name., &s->flagscxx . . $ nftnl_set#flags.) < 0)
626 return -1;
627 if (tb[NFTA_SET_HANDLEcxx . . $ NFTA_SET_HANDLE.]) {
628 s->handlecxx . . $ nftnl_set#handle. = be64tohcxx . . $ `<external>/15855202785537844739/endian.h:51:11`!(mnl_attr_get_u64(tb[NFTA_SET_HANDLE]));
629 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_HANDLEcxx . . $ NFTNL_SET_HANDLE.);
630 }
631 if (tb[NFTA_SET_FLAGScxx . . $ NFTA_SET_FLAGS.]) {
632 s->set_flagscxx . . $ nftnl_set#set_flags. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_SET_FLAGS]));
633 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_FLAGScxx . . $ NFTNL_SET_FLAGS.);
634 }
635 if (tb[NFTA_SET_KEY_TYPEcxx . . $ NFTA_SET_KEY_TYPE.]) {
636 s->key_typecxx . . $ nftnl_set#key_type. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_SET_KEY_TYPE]));
637 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_KEY_TYPEcxx . . $ NFTNL_SET_KEY_TYPE.);
638 }
639 if (tb[NFTA_SET_KEY_LENcxx . . $ NFTA_SET_KEY_LEN.]) {
640 s->key_lencxx . . $ nftnl_set#key_len. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_SET_KEY_LEN]));
641 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_KEY_LENcxx . . $ NFTNL_SET_KEY_LEN.);
642 }
643 if (tb[NFTA_SET_DATA_TYPEcxx . . $ NFTA_SET_DATA_TYPE.]) {
644 s->data_typecxx . . $ nftnl_set#data_type. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_SET_DATA_TYPE]));
645 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_DATA_TYPEcxx . . $ NFTNL_SET_DATA_TYPE.);
646 }
647 if (tb[NFTA_SET_DATA_LENcxx . . $ NFTA_SET_DATA_LEN.]) {
648 s->data_lencxx . . $ nftnl_set#data_len. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_SET_DATA_LEN]));
649 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_DATA_LENcxx . . $ NFTNL_SET_DATA_LEN.);
650 }
651 if (tb[NFTA_SET_OBJ_TYPEcxx . . $ NFTA_SET_OBJ_TYPE.]) {
652 s->obj_typecxx . . $ nftnl_set#obj_type. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_SET_OBJ_TYPE]));
653 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_OBJ_TYPEcxx . . $ NFTNL_SET_OBJ_TYPE.);
654 }
655 if (tb[NFTA_SET_IDcxx . . $ NFTA_SET_ID.]) {
656 s->idcxx . . $ nftnl_set#id. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_SET_ID]));
657 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_IDcxx . . $ NFTNL_SET_ID.);
658 }
659 if (tb[NFTA_SET_POLICYcxx . . $ NFTA_SET_POLICY.]) {
660 s->policycxx . . $ nftnl_set#policy. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_SET_POLICY]));
661 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_POLICYcxx . . $ NFTNL_SET_POLICY.);
662 }
663 if (tb[NFTA_SET_TIMEOUTcxx . . $ NFTA_SET_TIMEOUT.]) {
664 s->timeoutcxx . . $ nftnl_set#timeout. = be64tohcxx . . $ `<external>/15855202785537844739/endian.h:51:11`!(mnl_attr_get_u64(tb[NFTA_SET_TIMEOUT]));
665 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_TIMEOUTcxx . . $ NFTNL_SET_TIMEOUT.);
666 }
667 if (tb[NFTA_SET_GC_INTERVALcxx . . $ NFTA_SET_GC_INTERVAL.]) {
668 s->gc_intervalcxx . . $ nftnl_set#gc_interval. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_SET_GC_INTERVAL]));
669 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_GC_INTERVALcxx . . $ NFTNL_SET_GC_INTERVAL.);
670 }
671 if (tb[NFTA_SET_USERDATAcxx . . $ NFTA_SET_USERDATA.]) {
672 ret = nftnl_set_set_datacxx . . $ nftnl_set_set_data(bf01e01a0313c02a).(s, NFTNL_SET_USERDATAcxx . . $ NFTNL_SET_USERDATA.,
673 mnl_attr_get_payloadcxx . . $ mnl_attr_get_payload(cbbcdcb61d3bc7e8).(tb[NFTA_SET_USERDATAcxx . . $ NFTA_SET_USERDATA.]),
674 mnl_attr_get_payload_lencxx . . $ mnl_attr_get_payload_len(1da47bcc4c4b975).(tb[NFTA_SET_USERDATAcxx . . $ NFTA_SET_USERDATA.]));
675 if (ret < 0)
676 return ret;
677 }
678 if (tb[NFTA_SET_DESCcxx . . $ NFTA_SET_DESC.]) {
679 ret = nftnl_set_desc_parsecxx . . $ nftnl_set_desc_parse(de70658e6ee02afa).(s, tb[NFTA_SET_DESCcxx . . $ NFTA_SET_DESC.]);
680 if (ret < 0)
681 return ret;
682 }
683 if (tb[NFTA_SET_EXPRcxx . . $ NFTA_SET_EXPR.]) {
684 expr = nftnl_expr_parsecxx . . $ nftnl_expr_parse(ea32a576744d0134).(tb[NFTA_SET_EXPRcxx . . $ NFTA_SET_EXPR.]);
685 if (!expr)
686 goto out_set_expr;
687
688 list_addcxx . . $ list_add(6c3f7387ec573de3).(&expr->headcxx . . $ nftnl_expr#head., &s->expr_listcxx . . $ nftnl_set#expr_list.);
689 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_EXPRcxx . . $ NFTNL_SET_EXPR.);
690 } else if (tb[NFTA_SET_EXPRESSIONScxx . . $ NFTA_SET_EXPRESSIONS.]) {
691 struct nlattrcxx . . $ nlattr# *attr;
692
693 mnl_attr_for_each_nestedcxx . . $ `<external>/12386019527593959648/libmnl.h:152:9`!(attr, tb[NFTA_SET_EXPRESSIONS]) {
694 if (mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr) != NFTA_LIST_ELEMcxx . . $ NFTA_LIST_ELEM.)
695 goto out_set_expr;
696
697 expr = nftnl_expr_parsecxx . . $ nftnl_expr_parse(ea32a576744d0134).(attr);
698 if (expr == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)
699 goto out_set_expr;
700
701 list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&expr->headcxx . . $ nftnl_expr#head., &s->expr_listcxx . . $ nftnl_set#expr_list.);
702 }
703 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_EXPRESSIONScxx . . $ NFTNL_SET_EXPRESSIONS.);
704 }
705
706 if (tb[NFTA_SET_TYPEcxx . . $ NFTA_SET_TYPE.]) {
707 xfreecxx . . $ `include/utils.h:22:9`!(s->type);
708 s->typecxx . . $ nftnl_set#type. = strdupcxx . . $ strdup(a8b8e32347182212).(mnl_attr_get_strcxx . . $ mnl_attr_get_str(c24cebeef6d84d59).(tb[NFTA_SET_TYPEcxx . . $ NFTA_SET_TYPE.]));
709 }
710
711 if (tb[NFTA_SET_COUNTcxx . . $ NFTA_SET_COUNT.]) {
712 s->elemcountcxx . . $ nftnl_set#elemcount. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_SET_COUNT]));
713 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_COUNTcxx . . $ NFTNL_SET_COUNT.);
714 }
715
716 s->familycxx . . $ nftnl_set#family. = nfg->nfgen_familycxx . . $ nfgenmsg#nfgen_family.;
717 s->flagscxx . . $ nftnl_set#flags. |= (1 << NFTNL_SET_FAMILYcxx . . $ NFTNL_SET_FAMILY.);
718
719 return 0;
720 out_set_expr:
721 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(expr, next, &s->expr_list, head) {
722 list_delcxx . . $ list_del(35ab6d74de6aba0a).(&expr->headcxx . . $ nftnl_expr#head.);
723 nftnl_expr_freecxx . . $ nftnl_expr_free(cbe1a28527736226).(expr);
724 }
725
726 return -1;
727 }
728
729 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_parse);
730 int nftnl_set_parsecxx . . $ nftnl_set_parse(a851ba3458d3b03c).(struct nftnl_setcxx . . $ nftnl_set# *s, enum nftnl_parse_typecxx . . $ nftnl_parse_type# type,
731 const char *data, struct nftnl_parse_errcxx . . $ nftnl_parse_err# *err)
732 {
733 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!;
734
735 return -1;
736 }
737
738 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_parse_file);
739 int nftnl_set_parse_filecxx . . $ nftnl_set_parse_file(33e68307b9b68db).(struct nftnl_setcxx . . $ nftnl_set# *s, enum nftnl_parse_typecxx . . $ nftnl_parse_type# type,
740 FILEcxx . . $ FILE# *fp, struct nftnl_parse_errcxx . . $ nftnl_parse_err# *err)
741 {
742 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!;
743
744 return -1;
745 }
746
747 static int nftnl_set_snprintf_defaultcxx . . $ nftnl_set_snprintf_default(36df91043bfb55c1).(char *buf, size_t remain,
748 const struct nftnl_setcxx . . $ nftnl_set# *s,
749 uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags)
750 {
751 struct nftnl_set_elemcxx . . $ nftnl_set_elem# *elem;
752 int ret, offset = 0;
753
754 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf, remain, "%s %s %x",
755 s->namecxx . . $ nftnl_set#name., s->tablecxx . . $ nftnl_set#table., s->set_flagscxx . . $ nftnl_set#set_flags.);
756 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
757
758 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_TIMEOUTcxx . . $ NFTNL_SET_TIMEOUT.)) {
759 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " timeout %"PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:110:10`!"ms",
760 s->timeoutcxx . . $ nftnl_set#timeout.);
761 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
762 }
763
764 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_GC_INTERVALcxx . . $ NFTNL_SET_GC_INTERVAL.)) {
765 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " gc_interval %ums",
766 s->gc_intervalcxx . . $ nftnl_set#gc_interval.);
767 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
768 }
769
770 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_POLICYcxx . . $ NFTNL_SET_POLICY.)) {
771 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " policy %u", s->policycxx . . $ nftnl_set#policy.);
772 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
773 }
774
775 if (s->flagscxx . . $ nftnl_set#flags. & (1 << NFTNL_SET_DESC_SIZEcxx . . $ NFTNL_SET_DESC_SIZE.)) {
776 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " size %u", s->desccxx . . $ nftnl_set#desc..sizecxx . . $ nftnl_set#$anonymous_type_1#size.);
777 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
778 }
779
780 if (s->typecxx . . $ nftnl_set#type.) {
781 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " backend %s", s->typecxx . . $ nftnl_set#type.);
782 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
783 }
784
785 if (s->elemcountcxx . . $ nftnl_set#elemcount.) {
786 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " count %u", s->elemcountcxx . . $ nftnl_set#elemcount.);
787 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
788 }
789
790 /* Empty set? Skip printinf of elements */
791 if (list_emptycxx . . $ list_empty(df525b6afabf24a2).(&s->element_listcxx . . $ nftnl_set#element_list.))
792 return offset;
793
794 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, "\n");
795 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
796
797 list_for_each_entrycxx . . $ `include/linux_list.h:384:9`!(elem, &s->element_list, head) {
798 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, "\t");
799 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
800
801 ret = nftnl_set_elem_snprintf_defaultcxx . . $ nftnl_set_elem_snprintf_default(cd52fc5e46e09590).(buf + offset, remain,
802 elem);
803 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
804 }
805
806 return offset;
807 }
808
809 static int nftnl_set_cmd_snprintfcxx . . $ nftnl_set_cmd_snprintf(56807d1a9ea4ec94).(char *buf, size_t remain,
810 const struct nftnl_setcxx . . $ nftnl_set# *s, uint32_tcxx . . $ uint32_t# cmd,
811 uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags)
812 {
813 uint32_tcxx . . $ uint32_t# inner_flags = flags;
814 int ret, offset = 0;
815
816 if (type != NFTNL_OUTPUT_DEFAULTcxx . . $ NFTNL_OUTPUT_DEFAULT.)
817 return -1;
818
819 /* prevent set_elems to print as events */
820 inner_flags &= ~NFTNL_OF_EVENT_ANYcxx . . $ NFTNL_OF_EVENT_ANY.;
821
822 ret = nftnl_set_snprintf_defaultcxx . . $ nftnl_set_snprintf_default(36df91043bfb55c1).(buf + offset, remain, s, type,
823 inner_flags);
824 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
825 return offset;
826 }
827
828 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_snprintf);
829 int nftnl_set_snprintfcxx . . $ nftnl_set_snprintf(36df91043bfb55c1).(char *buf, size_t size, const struct nftnl_setcxx . . $ nftnl_set# *s,
830 uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags)
831 {
832 if (size)
833 buf[0] = '\0';
834
835 return nftnl_set_cmd_snprintfcxx . . $ nftnl_set_cmd_snprintf(56807d1a9ea4ec94).(buf, size, s, nftnl_flag2cmdcxx . . $ nftnl_flag2cmd(73b61a9477c235b4).(flags), type,
836 flags);
837 }
838
839 static int nftnl_set_do_snprintfcxx . . $ nftnl_set_do_snprintf(809f16203406eb30).(char *buf, size_t size, const void *s,
840 uint32_tcxx . . $ uint32_t# cmd, uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags)
841 {
842 return nftnl_set_snprintfcxx . . $ nftnl_set_snprintf(36df91043bfb55c1).(buf, size, s, type, flags);
843 }
844
845 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_fprintf);
846 int nftnl_set_fprintfcxx . . $ nftnl_set_fprintf(f46a2d32971443bd).(FILEcxx . . $ FILE# *fp, const struct nftnl_setcxx . . $ nftnl_set# *s, uint32_tcxx . . $ uint32_t# type,
847 uint32_tcxx . . $ uint32_t# flags)
848 {
849 return nftnl_fprintfcxx . . $ nftnl_fprintf(959aea809fde9589).(fp, s, NFTNL_CMD_UNSPECcxx . . $ NFTNL_CMD_UNSPEC., type, flags,
850 nftnl_set_do_snprintfcxx . . $ nftnl_set_do_snprintf(809f16203406eb30).);
851 }
852
853 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_elem_add);
854 void nftnl_set_elem_addcxx . . $ nftnl_set_elem_add(c4a4e5bd14d703c3).(struct nftnl_setcxx . . $ nftnl_set# *s, struct nftnl_set_elemcxx . . $ nftnl_set_elem# *elem)
855 {
856 list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&elem->headcxx . . $ nftnl_set_elem#head., &s->element_listcxx . . $ nftnl_set#element_list.);
857 }
858
859 #define SET_NAME_HSIZEcxx . . $ `src/set.c:859:9`! 512
860
861 struct nftnl_set_listcxx . . $ nftnl_set_list# {
862 struct list_headcxx . . $ list_head# listcxx . . $ nftnl_set_list#list.;
863 struct hlist_headcxx . . $ hlist_head# name_hashcxx . . $ nftnl_set_list#name_hash.[SET_NAME_HSIZEcxx . . $ `src/set.c:859:9`!];
864 };
865
866 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_list_alloc);
867 struct nftnl_set_listcxx . . $ nftnl_set_list# *nftnl_set_list_alloccxx . . $ nftnl_set_list_alloc(74ae4fc6f66feb).(void)
868 {
869 struct nftnl_set_listcxx . . $ nftnl_set_list# *list;
870 int i;
871
872 list = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_set_listcxx . . $ nftnl_set_list#));
873 if (list == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)
874 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
875
876 INIT_LIST_HEADcxx . . $ `include/linux_list.h:66:9`!(&list->list);
877 for (i = 0; i < SET_NAME_HSIZEcxx . . $ `src/set.c:859:9`!; i++)
878 INIT_HLIST_HEADcxx . . $ `include/linux_list.h:523:9`!(&list->name_hash[i]);
879
880 return list;
881 }
882
883 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_list_free);
884 void nftnl_set_list_freecxx . . $ nftnl_set_list_free(7d15d180ba1e7f04).(struct nftnl_set_listcxx . . $ nftnl_set_list# *list)
885 {
886 struct nftnl_setcxx . . $ nftnl_set# *s, *tmp;
887
888 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(s, tmp, &list->list, head) {
889 list_delcxx . . $ list_del(35ab6d74de6aba0a).(&s->headcxx . . $ nftnl_set#head.);
890 hlist_delcxx . . $ hlist_del(9568863142661c75).(&s->hnodecxx . . $ nftnl_set#hnode.);
891 nftnl_set_freecxx . . $ nftnl_set_free(1539d2f51666fae0).(s);
892 }
893 xfreecxx . . $ `include/utils.h:22:9`!(list);
894 }
895
896 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_list_is_empty);
897 int nftnl_set_list_is_emptycxx . . $ nftnl_set_list_is_empty(b89e0525932403fb).(const struct nftnl_set_listcxx . . $ nftnl_set_list# *list)
898 {
899 return list_emptycxx . . $ list_empty(df525b6afabf24a2).(&list->listcxx . . $ nftnl_set_list#list.);
900 }
901
902 static uint32_tcxx . . $ uint32_t# djb_hashcxx . . $ djb_hash(c61c63047ce273de).(const char *key)
903 {
904 uint32_tcxx . . $ uint32_t# i, hash = 5381;
905
906 for (i = 0; i < strlencxx . . $ strlen(751346f8406fd082).(key); i++)
907 hash = ((hash << 5) + hash) + key[i];
908
909 return hash;
910 }
911
912 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_list_add);
913 void nftnl_set_list_addcxx . . $ nftnl_set_list_add(cbd2e32984527c4c).(struct nftnl_setcxx . . $ nftnl_set# *s, struct nftnl_set_listcxx . . $ nftnl_set_list# *list)
914 {
915 int key = djb_hashcxx . . $ djb_hash(c61c63047ce273de).(s->namecxx . . $ nftnl_set#name.) % SET_NAME_HSIZEcxx . . $ `src/set.c:859:9`!;
916
917 hlist_add_headcxx . . $ hlist_add_head(32b7a2e391003461).(&s->hnodecxx . . $ nftnl_set#hnode., &list->name_hashcxx . . $ nftnl_set_list#name_hash.[key]);
918 list_addcxx . . $ list_add(6c3f7387ec573de3).(&s->headcxx . . $ nftnl_set#head., &list->listcxx . . $ nftnl_set_list#list.);
919 }
920
921 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_list_add_tail);
922 void nftnl_set_list_add_tailcxx . . $ nftnl_set_list_add_tail(cbd2e32984527c4c).(struct nftnl_setcxx . . $ nftnl_set# *s, struct nftnl_set_listcxx . . $ nftnl_set_list# *list)
923 {
924 int key = djb_hashcxx . . $ djb_hash(c61c63047ce273de).(s->namecxx . . $ nftnl_set#name.) % SET_NAME_HSIZEcxx . . $ `src/set.c:859:9`!;
925
926 hlist_add_headcxx . . $ hlist_add_head(32b7a2e391003461).(&s->hnodecxx . . $ nftnl_set#hnode., &list->name_hashcxx . . $ nftnl_set_list#name_hash.[key]);
927 list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&s->headcxx . . $ nftnl_set#head., &list->listcxx . . $ nftnl_set_list#list.);
928 }
929
930 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_list_del);
931 void nftnl_set_list_delcxx . . $ nftnl_set_list_del(f61903fdf3173757).(struct nftnl_setcxx . . $ nftnl_set# *s)
932 {
933 list_delcxx . . $ list_del(35ab6d74de6aba0a).(&s->headcxx . . $ nftnl_set#head.);
934 hlist_delcxx . . $ hlist_del(9568863142661c75).(&s->hnodecxx . . $ nftnl_set#hnode.);
935 }
936
937 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_list_foreach);
938 int nftnl_set_list_foreachcxx . . $ nftnl_set_list_foreach(57baf17fd9f85585).(struct nftnl_set_listcxx . . $ nftnl_set_list# *set_list,
939 int (*cb)(struct nftnl_setcxx . . $ nftnl_set# *t, void *data), void *data)
940 {
941 struct nftnl_setcxx . . $ nftnl_set# *cur, *tmp;
942 int ret;
943
944 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(cur, tmp, &set_list->list, head) {
945 ret = cb(cur, data);
946 if (ret < 0)
947 return ret;
948 }
949 return 0;
950 }
951
952 struct nftnl_set_list_itercxx . . $ nftnl_set_list_iter# {
953 const struct nftnl_set_listcxx . . $ nftnl_set_list# *listcxx . . $ nftnl_set_list_iter#list.;
954 struct nftnl_setcxx . . $ nftnl_set# *curcxx . . $ nftnl_set_list_iter#cur.;
955 };
956
957 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_list_iter_create);
958 struct nftnl_set_list_itercxx . . $ nftnl_set_list_iter# *
959 nftnl_set_list_iter_createcxx . . $ nftnl_set_list_iter_create(d60a0d08b40167d4).(const struct nftnl_set_listcxx . . $ nftnl_set_list# *l)
960 {
961 struct nftnl_set_list_itercxx . . $ nftnl_set_list_iter# *iter;
962
963 iter = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_set_list_itercxx . . $ nftnl_set_list_iter#));
964 if (iter == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)
965 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
966
967 iter->listcxx . . $ nftnl_set_list_iter#list. = l;
968 if (nftnl_set_list_is_emptycxx . . $ nftnl_set_list_is_empty(b89e0525932403fb).(l))
969 iter->curcxx . . $ nftnl_set_list_iter#cur. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
970 else
971 iter->curcxx . . $ nftnl_set_list_iter#cur. = list_entrycxx . . $ `include/linux_list.h:334:9`!(l->list.next, struct nftnl_set, head);
972
973 return iter;
974 }
975
976 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_list_iter_cur);
977 struct nftnl_setcxx . . $ nftnl_set# *
978 nftnl_set_list_iter_curcxx . . $ nftnl_set_list_iter_cur(f342c750e49a795e).(const struct nftnl_set_list_itercxx . . $ nftnl_set_list_iter# *iter)
979 {
980 return iter->curcxx . . $ nftnl_set_list_iter#cur.;
981 }
982
983 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_list_iter_next);
984 struct nftnl_setcxx . . $ nftnl_set# *nftnl_set_list_iter_nextcxx . . $ nftnl_set_list_iter_next(8190095024b9c04c).(struct nftnl_set_list_itercxx . . $ nftnl_set_list_iter# *iter)
985 {
986 struct nftnl_setcxx . . $ nftnl_set# *s = iter->curcxx . . $ nftnl_set_list_iter#cur.;
987
988 if (s == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)
989 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
990
991 /* get next rule, if any */
992 iter->curcxx . . $ nftnl_set_list_iter#cur. = list_entrycxx . . $ `include/linux_list.h:334:9`!(iter->cur->head.next, struct nftnl_set, head);
993 if (&iter->curcxx . . $ nftnl_set_list_iter#cur.->headcxx . . $ nftnl_set#head. == iter->listcxx . . $ nftnl_set_list_iter#list.->listcxx . . $ nftnl_set_list#list..nextcxx . . $ list_head#next.)
994 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
995
996 return s;
997 }
998
999 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_list_iter_destroy);
1000 void nftnl_set_list_iter_destroycxx . . $ nftnl_set_list_iter_destroy(48083b91c10291de).(const struct nftnl_set_list_itercxx . . $ nftnl_set_list_iter# *iter)
1001 {
1002 xfreecxx . . $ `include/utils.h:22:9`!(iter);
1003 }
1004
1005 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_set_list_lookup_byname);
1006 struct nftnl_setcxx . . $ nftnl_set# *
1007 nftnl_set_list_lookup_bynamecxx . . $ nftnl_set_list_lookup_byname(eb4db8798f056d25).(struct nftnl_set_listcxx . . $ nftnl_set_list# *set_list, const char *set)
1008 {
1009 int key = djb_hashcxx . . $ djb_hash(c61c63047ce273de).(set) % SET_NAME_HSIZEcxx . . $ `src/set.c:859:9`!;
1010 struct hlist_nodecxx . . $ hlist_node# *n;
1011 struct nftnl_setcxx . . $ nftnl_set# *s;
1012
1013 hlist_for_each_entrycxx . . $ `include/linux_list.h:667:9`!(s, n, &set_list->name_hash[key], hnode) {
1014 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(set, s->namecxx . . $ nftnl_set#name.))
1015 return s;
1016 }
1017 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1018 }
1019
1020 int nftnl_set_lookup_idcxx . . $ nftnl_set_lookup_id(47c668a896ee8392).(struct nftnl_exprcxx . . $ nftnl_expr# *e,
1021 struct nftnl_set_listcxx . . $ nftnl_set_list# *set_list, uint32_tcxx . . $ uint32_t# *set_id)
1022 {
1023 const char *set_name;
1024 struct nftnl_setcxx . . $ nftnl_set# *s;
1025
1026 set_name = nftnl_expr_get_strcxx . . $ nftnl_expr_get_str(89517962841a533e).(e, NFTNL_EXPR_LOOKUP_SETcxx . . $ NFTNL_EXPR_LOOKUP_SET.);
1027 if (set_name == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)
1028 return 0;
1029
1030 s = nftnl_set_list_lookup_bynamecxx . . $ nftnl_set_list_lookup_byname(eb4db8798f056d25).(set_list, set_name);
1031 if (s == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)
1032 return 0;
1033
1034 *set_id = nftnl_set_get_u32cxx . . $ nftnl_set_get_u32(9fdb3f9dd9234466).(s, NFTNL_SET_IDcxx . . $ NFTNL_SET_ID.);
1035 return 1;
1036 }