Debian Codegraph @

src/chain.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-or-later */cxx . . $ `<file>/src/chain.c`/
2 /*
3 * (C) 2012-2013 by Pablo Neira Ayuso <[email protected]>
4 *
5 * This code has been sponsored by Sophos Astaro <http://www.sophos.com>
6 */
7 #include "internal.h"cxx . . $ `<file>/include/internal.h`/
8
9 #include <time.h>
10 #include <endian.h>
11 #include <stdint.h>
12 #include <stdlib.h>
13 #include <limits.h>
14 #include <string.h>
15 #include <netinet/in.h>
16 #include <errno.h>
17 #include <inttypes.h>
18
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 #include <linux/netfilter.h>cxx . . $ `<file>/include/linux/netfilter.h`/
23 #include <linux/netfilter_arp.h>
24
25 #include <libnftnl/chain.h>cxx . . $ `<file>/include/libnftnl/chain.h`/
26 #include <libnftnl/rule.h>cxx . . $ `<file>/include/libnftnl/rule.h`/
27
28 struct nftnl_chaincxx . . $ nftnl_chain# {
29 struct list_headcxx . . $ list_head# headcxx . . $ nftnl_chain#head.;
30 struct hlist_nodecxx . . $ hlist_node# hnodecxx . . $ nftnl_chain#hnode.;
31
32 const char *namecxx . . $ nftnl_chain#name.;
33 const char *typecxx . . $ nftnl_chain#type.;
34 const char *tablecxx . . $ nftnl_chain#table.;
35 const char *devcxx . . $ nftnl_chain#dev.;
36 struct nftnl_str_arraycxx . . $ nftnl_str_array# dev_arraycxx . . $ nftnl_chain#dev_array.;
37 uint32_tcxx . . $ uint32_t# familycxx . . $ nftnl_chain#family.;
38 uint32_tcxx . . $ uint32_t# policycxx . . $ nftnl_chain#policy.;
39 uint32_tcxx . . $ uint32_t# hooknumcxx . . $ nftnl_chain#hooknum.;
40 int32_tcxx . . $ int32_t# priocxx . . $ nftnl_chain#prio.;
41 uint32_tcxx . . $ uint32_t# chain_flagscxx . . $ nftnl_chain#chain_flags.;
42 uint32_tcxx . . $ uint32_t# usecxx . . $ nftnl_chain#use.;
43 uint64_tcxx . . $ uint64_t# packetscxx . . $ nftnl_chain#packets.;
44 uint64_tcxx . . $ uint64_t# bytescxx . . $ nftnl_chain#bytes.;
45 uint64_tcxx . . $ uint64_t# handlecxx . . $ nftnl_chain#handle.;
46 uint32_tcxx . . $ uint32_t# flagscxx . . $ nftnl_chain#flags.;
47 uint32_tcxx . . $ uint32_t# chain_idcxx . . $ nftnl_chain#chain_id.;
48
49 structcxx . . $ nftnl_chain#$anonymous_type_0# {
50 void *datacxx . . $ nftnl_chain#$anonymous_type_0#data.;
51 uint32_tcxx . . $ uint32_t# lencxx . . $ nftnl_chain#$anonymous_type_0#len.;
52 } usercxx . . $ nftnl_chain#user.;
53
54 struct list_headcxx . . $ list_head# rule_listcxx . . $ nftnl_chain#rule_list.;
55 };
56
57 static const char *nftnl_hooknum2strcxx . . $ nftnl_hooknum2str(bd5db3388d838e27).(int family, int hooknum)
58 {
59 switch (family) {
60 case NFPROTO_IPV4cxx . . $ NFPROTO_IPV4.:
61 case NFPROTO_IPV6cxx . . $ NFPROTO_IPV6.:
62 case NFPROTO_INETcxx . . $ NFPROTO_INET.:
63 case NFPROTO_BRIDGEcxx . . $ NFPROTO_BRIDGE.:
64 switch (hooknum) {
65 case NF_INET_PRE_ROUTINGcxx . . $ NF_INET_PRE_ROUTING.:
66 return "prerouting";
67 case NF_INET_LOCAL_INcxx . . $ NF_INET_LOCAL_IN.:
68 return "input";
69 case NF_INET_FORWARDcxx . . $ NF_INET_FORWARD.:
70 return "forward";
71 case NF_INET_LOCAL_OUTcxx . . $ NF_INET_LOCAL_OUT.:
72 return "output";
73 case NF_INET_POST_ROUTINGcxx . . $ NF_INET_POST_ROUTING.:
74 return "postrouting";
75 }
76 break;
77 case NFPROTO_ARPcxx . . $ NFPROTO_ARP.:
78 switch (hooknum) {
79 case NF_ARP_INcxx . . $ `<external>/3547350308491103602/netfilter_arp.h:15:9`!:
80 return "input";
81 case NF_ARP_OUTcxx . . $ `<external>/3547350308491103602/netfilter_arp.h:16:9`!:
82 return "output";
83 case NF_ARP_FORWARDcxx . . $ `<external>/3547350308491103602/netfilter_arp.h:17:9`!:
84 return "forward";
85 }
86 break;
87 case NFPROTO_NETDEVcxx . . $ NFPROTO_NETDEV.:
88 switch (hooknum) {
89 case NF_NETDEV_INGRESScxx . . $ NF_NETDEV_INGRESS.:
90 return "ingress";
91 }
92 break;
93 }
94 return "unknown";
95 }
96
97 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_alloc);
98 struct nftnl_chaincxx . . $ nftnl_chain# *nftnl_chain_alloccxx . . $ nftnl_chain_alloc(7abe214def4395f0).(void)
99 {
100 struct nftnl_chaincxx . . $ nftnl_chain# *c;
101
102 c = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_chaincxx . . $ nftnl_chain#));
103 if (c == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)
104 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
105
106 INIT_LIST_HEADcxx . . $ `include/linux_list.h:66:9`!(&c->rule_list);
107
108 return c;
109 }
110
111 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_free);
112 void nftnl_chain_freecxx . . $ nftnl_chain_free(769d8587cfdb0d4).(const struct nftnl_chaincxx . . $ nftnl_chain# *c)
113 {
114 struct nftnl_rulecxx . . $ nftnl_rule# *r, *tmp;
115
116 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(r, tmp, &c->rule_list, head)
117 nftnl_rule_freecxx . . $ nftnl_rule_free(c1b52878f58022c2).(r);
118
119 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_NAMEcxx . . $ NFTNL_CHAIN_NAME.))
120 xfreecxx . . $ `include/utils.h:22:9`!(c->name);
121 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_TABLEcxx . . $ NFTNL_CHAIN_TABLE.))
122 xfreecxx . . $ `include/utils.h:22:9`!(c->table);
123 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_TYPEcxx . . $ NFTNL_CHAIN_TYPE.))
124 xfreecxx . . $ `include/utils.h:22:9`!(c->type);
125 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_DEVcxx . . $ NFTNL_CHAIN_DEV.))
126 xfreecxx . . $ `include/utils.h:22:9`!(c->dev);
127 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_USERDATAcxx . . $ NFTNL_CHAIN_USERDATA.))
128 xfreecxx . . $ `include/utils.h:22:9`!(c->user.data);
129 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_DEVICEScxx . . $ NFTNL_CHAIN_DEVICES.))
130 nftnl_str_array_clearcxx . . $ nftnl_str_array_clear(da9ec48ca4ecf134).((struct nftnl_str_arraycxx . . $ nftnl_str_array# *)&c->dev_arraycxx . . $ nftnl_chain#dev_array.);
131 xfreecxx . . $ `include/utils.h:22:9`!(c);
132 }
133
134 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_is_set);
135 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! nftnl_chain_is_setcxx . . $ nftnl_chain_is_set(db495151793fcbca).(const struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr)
136 {
137 return c->flagscxx . . $ nftnl_chain#flags. & (1 << attr);
138 }
139
140 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_unset);
141 void nftnl_chain_unsetcxx . . $ nftnl_chain_unset(3640645244028935).(struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr)
142 {
143 if (!(c->flagscxx . . $ nftnl_chain#flags. & (1 << attr)))
144 return;
145
146 switch (attr) {
147 case NFTNL_CHAIN_NAMEcxx . . $ NFTNL_CHAIN_NAME.:
148 xfreecxx . . $ `include/utils.h:22:9`!(c->name);
149 break;
150 case NFTNL_CHAIN_TABLEcxx . . $ NFTNL_CHAIN_TABLE.:
151 xfreecxx . . $ `include/utils.h:22:9`!(c->table);
152 break;
153 case NFTNL_CHAIN_USEcxx . . $ NFTNL_CHAIN_USE.:
154 break;
155 case NFTNL_CHAIN_TYPEcxx . . $ NFTNL_CHAIN_TYPE.:
156 xfreecxx . . $ `include/utils.h:22:9`!(c->type);
157 break;
158 case NFTNL_CHAIN_HOOKNUMcxx . . $ NFTNL_CHAIN_HOOKNUM.:
159 case NFTNL_CHAIN_PRIOcxx . . $ NFTNL_CHAIN_PRIO.:
160 case NFTNL_CHAIN_POLICYcxx . . $ NFTNL_CHAIN_POLICY.:
161 case NFTNL_CHAIN_BYTEScxx . . $ NFTNL_CHAIN_BYTES.:
162 case NFTNL_CHAIN_PACKETScxx . . $ NFTNL_CHAIN_PACKETS.:
163 case NFTNL_CHAIN_HANDLEcxx . . $ NFTNL_CHAIN_HANDLE.:
164 case NFTNL_CHAIN_FAMILYcxx . . $ NFTNL_CHAIN_FAMILY.:
165 case NFTNL_CHAIN_FLAGScxx . . $ NFTNL_CHAIN_FLAGS.:
166 case NFTNL_CHAIN_IDcxx . . $ NFTNL_CHAIN_ID.:
167 break;
168 case NFTNL_CHAIN_DEVcxx . . $ NFTNL_CHAIN_DEV.:
169 xfreecxx . . $ `include/utils.h:22:9`!(c->dev);
170 break;
171 case NFTNL_CHAIN_DEVICEScxx . . $ NFTNL_CHAIN_DEVICES.:
172 nftnl_str_array_clearcxx . . $ nftnl_str_array_clear(da9ec48ca4ecf134).(&c->dev_arraycxx . . $ nftnl_chain#dev_array.);
173 break;
174 case NFTNL_CHAIN_USERDATAcxx . . $ NFTNL_CHAIN_USERDATA.:
175 xfreecxx . . $ `include/utils.h:22:9`!(c->user.data);
176 break;
177 default:
178 return;
179 }
180
181 c->flagscxx . . $ nftnl_chain#flags. &= ~(1 << attr);
182 }
183
184 static uint32_tcxx . . $ uint32_t# nftnl_chain_validatecxx . . $ nftnl_chain_validate.[NFTNL_CHAIN_MAXcxx . . $ `include/libnftnl/chain.h:40:9`! + 1] = {
185 [NFTNL_CHAIN_HOOKNUMcxx . . $ NFTNL_CHAIN_HOOKNUM.] = sizeof(uint32_tcxx . . $ uint32_t#),
186 [NFTNL_CHAIN_PRIOcxx . . $ NFTNL_CHAIN_PRIO.] = sizeof(int32_tcxx . . $ int32_t#),
187 [NFTNL_CHAIN_POLICYcxx . . $ NFTNL_CHAIN_POLICY.] = sizeof(uint32_tcxx . . $ uint32_t#),
188 [NFTNL_CHAIN_USEcxx . . $ NFTNL_CHAIN_USE.] = sizeof(uint32_tcxx . . $ uint32_t#),
189 [NFTNL_CHAIN_BYTEScxx . . $ NFTNL_CHAIN_BYTES.] = sizeof(uint64_tcxx . . $ uint64_t#),
190 [NFTNL_CHAIN_PACKETScxx . . $ NFTNL_CHAIN_PACKETS.] = sizeof(uint64_tcxx . . $ uint64_t#),
191 [NFTNL_CHAIN_HANDLEcxx . . $ NFTNL_CHAIN_HANDLE.] = sizeof(uint64_tcxx . . $ uint64_t#),
192 [NFTNL_CHAIN_FAMILYcxx . . $ NFTNL_CHAIN_FAMILY.] = sizeof(uint32_tcxx . . $ uint32_t#),
193 [NFTNL_CHAIN_FLAGScxx . . $ NFTNL_CHAIN_FLAGS.] = sizeof(uint32_tcxx . . $ uint32_t#),
194 [NFTNL_CHAIN_IDcxx . . $ NFTNL_CHAIN_ID.] = sizeof(uint32_tcxx . . $ uint32_t#),
195 };
196
197 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_set_data);
198 int nftnl_chain_set_datacxx . . $ nftnl_chain_set_data(f8aff8e21c847c71).(struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr,
199 const void *data, uint32_tcxx . . $ uint32_t# data_len)
200 {
201 nftnl_assert_attr_existscxx . . $ `include/utils.h:49:9`!(attr, NFTNL_CHAIN_MAXcxx . . $ `include/libnftnl/chain.h:40:9`!);
202 nftnl_assert_validatecxx . . $ `include/utils.h:38:9`!(data, nftnl_chain_validate, attr, data_len);
203
204 switch(attr) {
205 case NFTNL_CHAIN_NAMEcxx . . $ NFTNL_CHAIN_NAME.:
206 return nftnl_set_str_attrcxx . . $ nftnl_set_str_attr(fd565288bd370d98).(&c->namecxx . . $ nftnl_chain#name., &c->flagscxx . . $ nftnl_chain#flags.,
207 attr, data, data_len);
208 case NFTNL_CHAIN_TABLEcxx . . $ NFTNL_CHAIN_TABLE.:
209 return nftnl_set_str_attrcxx . . $ nftnl_set_str_attr(fd565288bd370d98).(&c->tablecxx . . $ nftnl_chain#table., &c->flagscxx . . $ nftnl_chain#flags.,
210 attr, data, data_len);
211 case NFTNL_CHAIN_HOOKNUMcxx . . $ NFTNL_CHAIN_HOOKNUM.:
212 memcpycxx . . $ memcpy(cc817cb175f282d).(&c->hooknumcxx . . $ nftnl_chain#hooknum., data, sizeof(c->hooknumcxx . . $ nftnl_chain#hooknum.));
213 break;
214 case NFTNL_CHAIN_PRIOcxx . . $ NFTNL_CHAIN_PRIO.:
215 memcpycxx . . $ memcpy(cc817cb175f282d).(&c->priocxx . . $ nftnl_chain#prio., data, sizeof(c->priocxx . . $ nftnl_chain#prio.));
216 break;
217 case NFTNL_CHAIN_POLICYcxx . . $ NFTNL_CHAIN_POLICY.:
218 memcpycxx . . $ memcpy(cc817cb175f282d).(&c->policycxx . . $ nftnl_chain#policy., data, sizeof(c->policycxx . . $ nftnl_chain#policy.));
219 break;
220 case NFTNL_CHAIN_USEcxx . . $ NFTNL_CHAIN_USE.:
221 memcpycxx . . $ memcpy(cc817cb175f282d).(&c->usecxx . . $ nftnl_chain#use., data, sizeof(c->usecxx . . $ nftnl_chain#use.));
222 break;
223 case NFTNL_CHAIN_BYTEScxx . . $ NFTNL_CHAIN_BYTES.:
224 memcpycxx . . $ memcpy(cc817cb175f282d).(&c->bytescxx . . $ nftnl_chain#bytes., data, sizeof(c->bytescxx . . $ nftnl_chain#bytes.));
225 break;
226 case NFTNL_CHAIN_PACKETScxx . . $ NFTNL_CHAIN_PACKETS.:
227 memcpycxx . . $ memcpy(cc817cb175f282d).(&c->packetscxx . . $ nftnl_chain#packets., data, sizeof(c->packetscxx . . $ nftnl_chain#packets.));
228 break;
229 case NFTNL_CHAIN_HANDLEcxx . . $ NFTNL_CHAIN_HANDLE.:
230 memcpycxx . . $ memcpy(cc817cb175f282d).(&c->handlecxx . . $ nftnl_chain#handle., data, sizeof(c->handlecxx . . $ nftnl_chain#handle.));
231 break;
232 case NFTNL_CHAIN_FAMILYcxx . . $ NFTNL_CHAIN_FAMILY.:
233 memcpycxx . . $ memcpy(cc817cb175f282d).(&c->familycxx . . $ nftnl_chain#family., data, sizeof(c->familycxx . . $ nftnl_chain#family.));
234 break;
235 case NFTNL_CHAIN_TYPEcxx . . $ NFTNL_CHAIN_TYPE.:
236 return nftnl_set_str_attrcxx . . $ nftnl_set_str_attr(fd565288bd370d98).(&c->typecxx . . $ nftnl_chain#type., &c->flagscxx . . $ nftnl_chain#flags.,
237 attr, data, data_len);
238 case NFTNL_CHAIN_DEVcxx . . $ NFTNL_CHAIN_DEV.:
239 return nftnl_set_str_attrcxx . . $ nftnl_set_str_attr(fd565288bd370d98).(&c->devcxx . . $ nftnl_chain#dev., &c->flagscxx . . $ nftnl_chain#flags.,
240 attr, data, data_len);
241 case NFTNL_CHAIN_DEVICEScxx . . $ NFTNL_CHAIN_DEVICES.:
242 if (nftnl_str_array_setcxx . . $ nftnl_str_array_set(c729e707ba698544).(&c->dev_arraycxx . . $ nftnl_chain#dev_array., data) < 0)
243 return -1;
244 break;
245 case NFTNL_CHAIN_FLAGScxx . . $ NFTNL_CHAIN_FLAGS.:
246 memcpycxx . . $ memcpy(cc817cb175f282d).(&c->chain_flagscxx . . $ nftnl_chain#chain_flags., data, sizeof(c->chain_flagscxx . . $ nftnl_chain#chain_flags.));
247 break;
248 case NFTNL_CHAIN_IDcxx . . $ NFTNL_CHAIN_ID.:
249 memcpycxx . . $ memcpy(cc817cb175f282d).(&c->chain_idcxx . . $ nftnl_chain#chain_id., data, sizeof(c->chain_idcxx . . $ nftnl_chain#chain_id.));
250 break;
251 case NFTNL_CHAIN_USERDATAcxx . . $ NFTNL_CHAIN_USERDATA.:
252 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_USERDATAcxx . . $ NFTNL_CHAIN_USERDATA.))
253 xfreecxx . . $ `include/utils.h:22:9`!(c->user.data);
254
255 c->usercxx . . $ nftnl_chain#user..datacxx . . $ nftnl_chain#$anonymous_type_0#data. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(data_len);
256 if (!c->usercxx . . $ nftnl_chain#user..datacxx . . $ nftnl_chain#$anonymous_type_0#data.)
257 return -1;
258 memcpycxx . . $ memcpy(cc817cb175f282d).(c->usercxx . . $ nftnl_chain#user..datacxx . . $ nftnl_chain#$anonymous_type_0#data., data, data_len);
259 c->usercxx . . $ nftnl_chain#user..lencxx . . $ nftnl_chain#$anonymous_type_0#len. = data_len;
260 break;
261 }
262 c->flagscxx . . $ nftnl_chain#flags. |= (1 << attr);
263 return 0;
264 }
265
266 void nftnl_chain_setcxx . . $ nftnl_chain_set(c231ca13d07b5615).(struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr, const void *data) __visiblecxx . . $ `include/utils.h:13:10`!;
267 void nftnl_chain_setcxx . . $ nftnl_chain_set(c231ca13d07b5615).(struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr, const void *data)
268 {
269 nftnl_chain_set_datacxx . . $ nftnl_chain_set_data(f8aff8e21c847c71).(c, attr, data, nftnl_chain_validatecxx . . $ nftnl_chain_validate.[attr]);
270 }
271
272 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_set_u32);
273 void nftnl_chain_set_u32cxx . . $ nftnl_chain_set_u32(58cef1e896ef72f9).(struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr, uint32_tcxx . . $ uint32_t# data)
274 {
275 nftnl_chain_set_datacxx . . $ nftnl_chain_set_data(f8aff8e21c847c71).(c, attr, &data, sizeof(uint32_tcxx . . $ uint32_t#));
276 }
277
278 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_set_s32);
279 void nftnl_chain_set_s32cxx . . $ nftnl_chain_set_s32(83ba088c7266b4dc).(struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr, int32_tcxx . . $ int32_t# data)
280 {
281 nftnl_chain_set_datacxx . . $ nftnl_chain_set_data(f8aff8e21c847c71).(c, attr, &data, sizeof(int32_tcxx . . $ int32_t#));
282 }
283
284 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_set_u64);
285 void nftnl_chain_set_u64cxx . . $ nftnl_chain_set_u64(62615322545dda60).(struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr, uint64_tcxx . . $ uint64_t# data)
286 {
287 nftnl_chain_set_datacxx . . $ nftnl_chain_set_data(f8aff8e21c847c71).(c, attr, &data, sizeof(uint64_tcxx . . $ uint64_t#));
288 }
289
290 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_set_u8);
291 void nftnl_chain_set_u8cxx . . $ nftnl_chain_set_u8(d1059cbcb662d2db).(struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr, uint8_tcxx . . $ uint8_t# data)
292 {
293 nftnl_chain_set_datacxx . . $ nftnl_chain_set_data(f8aff8e21c847c71).(c, attr, &data, sizeof(uint8_tcxx . . $ uint8_t#));
294 }
295
296 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_set_str);
297 int nftnl_chain_set_strcxx . . $ nftnl_chain_set_str(546f649f4699e236).(struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr, const char *str)
298 {
299 return nftnl_chain_set_datacxx . . $ nftnl_chain_set_data(f8aff8e21c847c71).(c, attr, str, strlencxx . . $ strlen(751346f8406fd082).(str) + 1);
300 }
301
302 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_set_array);
303 int nftnl_chain_set_arraycxx . . $ nftnl_chain_set_array(b96043d70de04277).(struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr,
304 const char **data)
305 {
306 return nftnl_chain_set_datacxx . . $ nftnl_chain_set_data(f8aff8e21c847c71).(c, attr, data, 0);
307 }
308
309 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_get_data);
310 const void *nftnl_chain_get_datacxx . . $ nftnl_chain_get_data(62d7c17440bd7438).(const struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr,
311 uint32_tcxx . . $ uint32_t# *data_len)
312 {
313 if (!(c->flagscxx . . $ nftnl_chain#flags. & (1 << attr)))
314 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
315
316 switch(attr) {
317 case NFTNL_CHAIN_NAMEcxx . . $ NFTNL_CHAIN_NAME.:
318 *data_len = strlencxx . . $ strlen(751346f8406fd082).(c->namecxx . . $ nftnl_chain#name.) + 1;
319 return c->namecxx . . $ nftnl_chain#name.;
320 case NFTNL_CHAIN_TABLEcxx . . $ NFTNL_CHAIN_TABLE.:
321 *data_len = strlencxx . . $ strlen(751346f8406fd082).(c->tablecxx . . $ nftnl_chain#table.) + 1;
322 return c->tablecxx . . $ nftnl_chain#table.;
323 case NFTNL_CHAIN_HOOKNUMcxx . . $ NFTNL_CHAIN_HOOKNUM.:
324 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
325 return &c->hooknumcxx . . $ nftnl_chain#hooknum.;
326 case NFTNL_CHAIN_PRIOcxx . . $ NFTNL_CHAIN_PRIO.:
327 *data_len = sizeof(int32_tcxx . . $ int32_t#);
328 return &c->priocxx . . $ nftnl_chain#prio.;
329 case NFTNL_CHAIN_POLICYcxx . . $ NFTNL_CHAIN_POLICY.:
330 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
331 return &c->policycxx . . $ nftnl_chain#policy.;
332 case NFTNL_CHAIN_USEcxx . . $ NFTNL_CHAIN_USE.:
333 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
334 return &c->usecxx . . $ nftnl_chain#use.;
335 case NFTNL_CHAIN_BYTEScxx . . $ NFTNL_CHAIN_BYTES.:
336 *data_len = sizeof(uint64_tcxx . . $ uint64_t#);
337 return &c->bytescxx . . $ nftnl_chain#bytes.;
338 case NFTNL_CHAIN_PACKETScxx . . $ NFTNL_CHAIN_PACKETS.:
339 *data_len = sizeof(uint64_tcxx . . $ uint64_t#);
340 return &c->packetscxx . . $ nftnl_chain#packets.;
341 case NFTNL_CHAIN_HANDLEcxx . . $ NFTNL_CHAIN_HANDLE.:
342 *data_len = sizeof(uint64_tcxx . . $ uint64_t#);
343 return &c->handlecxx . . $ nftnl_chain#handle.;
344 case NFTNL_CHAIN_FAMILYcxx . . $ NFTNL_CHAIN_FAMILY.:
345 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
346 return &c->familycxx . . $ nftnl_chain#family.;
347 case NFTNL_CHAIN_TYPEcxx . . $ NFTNL_CHAIN_TYPE.:
348 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
349 return c->typecxx . . $ nftnl_chain#type.;
350 case NFTNL_CHAIN_DEVcxx . . $ NFTNL_CHAIN_DEV.:
351 *data_len = strlencxx . . $ strlen(751346f8406fd082).(c->devcxx . . $ nftnl_chain#dev.) + 1;
352 return c->devcxx . . $ nftnl_chain#dev.;
353 case NFTNL_CHAIN_DEVICEScxx . . $ NFTNL_CHAIN_DEVICES.:
354 *data_len = 0;
355 return c->dev_arraycxx . . $ nftnl_chain#dev_array..arraycxx . . $ nftnl_str_array#array.;
356 case NFTNL_CHAIN_FLAGScxx . . $ NFTNL_CHAIN_FLAGS.:
357 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
358 return &c->chain_flagscxx . . $ nftnl_chain#chain_flags.;
359 case NFTNL_CHAIN_IDcxx . . $ NFTNL_CHAIN_ID.:
360 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
361 return &c->chain_idcxx . . $ nftnl_chain#chain_id.;
362 case NFTNL_CHAIN_USERDATAcxx . . $ NFTNL_CHAIN_USERDATA.:
363 *data_len = c->usercxx . . $ nftnl_chain#user..lencxx . . $ nftnl_chain#$anonymous_type_0#len.;
364 return c->usercxx . . $ nftnl_chain#user..datacxx . . $ nftnl_chain#$anonymous_type_0#data.;
365 }
366 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
367 }
368
369 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_get);
370 const void *nftnl_chain_getcxx . . $ nftnl_chain_get(2d10140073bf2b19).(const struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr)
371 {
372 uint32_tcxx . . $ uint32_t# data_len;
373 return nftnl_chain_get_datacxx . . $ nftnl_chain_get_data(62d7c17440bd7438).(c, attr, &data_len);
374 }
375
376 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_get_str);
377 const char *nftnl_chain_get_strcxx . . $ nftnl_chain_get_str(315de10603ea2a30).(const struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr)
378 {
379 return nftnl_chain_getcxx . . $ nftnl_chain_get(2d10140073bf2b19).(c, attr);
380 }
381
382 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_get_u32);
383 uint32_tcxx . . $ uint32_t# nftnl_chain_get_u32cxx . . $ nftnl_chain_get_u32(65f1da9589475f98).(const struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr)
384 {
385 uint32_tcxx . . $ uint32_t# data_len;
386 const uint32_tcxx . . $ uint32_t# *val = nftnl_chain_get_datacxx . . $ nftnl_chain_get_data(62d7c17440bd7438).(c, attr, &data_len);
387
388 nftnl_assertcxx . . $ `include/utils.h:33:9`!(val, attr, data_len == sizeof(uint32_t));
389
390 return val ? *val : 0;
391 }
392
393 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_get_s32);
394 int32_tcxx . . $ int32_t# nftnl_chain_get_s32cxx . . $ nftnl_chain_get_s32(d096a086cf70480f).(const struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr)
395 {
396 uint32_tcxx . . $ uint32_t# data_len;
397 const int32_tcxx . . $ int32_t# *val = nftnl_chain_get_datacxx . . $ nftnl_chain_get_data(62d7c17440bd7438).(c, attr, &data_len);
398
399 nftnl_assertcxx . . $ `include/utils.h:33:9`!(val, attr, data_len == sizeof(int32_t));
400
401 return val ? *val : 0;
402 }
403
404 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_get_u64);
405 uint64_tcxx . . $ uint64_t# nftnl_chain_get_u64cxx . . $ nftnl_chain_get_u64(36e0cfd446badde2).(const struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr)
406 {
407 uint32_tcxx . . $ uint32_t# data_len;
408 const uint64_tcxx . . $ uint64_t# *val = nftnl_chain_get_datacxx . . $ nftnl_chain_get_data(62d7c17440bd7438).(c, attr, &data_len);
409
410 nftnl_assertcxx . . $ `include/utils.h:33:9`!(val, attr, data_len == sizeof(int64_t));
411
412 return val ? *val : 0;
413 }
414
415 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_get_u8);
416 uint8_tcxx . . $ uint8_t# nftnl_chain_get_u8cxx . . $ nftnl_chain_get_u8(b100e8147165919e).(const struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr)
417 {
418 uint32_tcxx . . $ uint32_t# data_len;
419 const uint8_tcxx . . $ uint8_t# *val = nftnl_chain_get_datacxx . . $ nftnl_chain_get_data(62d7c17440bd7438).(c, attr, &data_len);
420
421 nftnl_assertcxx . . $ `include/utils.h:33:9`!(val, attr, data_len == sizeof(int8_t));
422
423 return val ? *val : 0;
424 }
425
426 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_get_array);
427 const char *const *nftnl_chain_get_arraycxx . . $ nftnl_chain_get_array(5d5aa2f1edf7c888).(const struct nftnl_chaincxx . . $ nftnl_chain# *c, uint16_tcxx . . $ uint16_t# attr)
428 {
429 uint32_tcxx . . $ uint32_t# data_len;
430 const char * const *val = nftnl_chain_get_datacxx . . $ nftnl_chain_get_data(62d7c17440bd7438).(c, attr, &data_len);
431
432 nftnl_assertcxx . . $ `include/utils.h:33:9`!(val, attr, attr == NFTNL_CHAIN_DEVICES);
433
434 return val;
435 }
436
437 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_nlmsg_build_payload);
438 void nftnl_chain_nlmsg_build_payloadcxx . . $ nftnl_chain_nlmsg_build_payload(57e43645b6b9f7e9).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh, const struct nftnl_chaincxx . . $ nftnl_chain# *c)
439 {
440 struct nlattrcxx . . $ nlattr# *nest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
441 int i;
442
443 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_TABLEcxx . . $ NFTNL_CHAIN_TABLE.))
444 mnl_attr_put_strzcxx . . $ mnl_attr_put_strz(eb76286d4bfc1a8d).(nlh, NFTA_CHAIN_TABLEcxx . . $ NFTA_CHAIN_TABLE., c->tablecxx . . $ nftnl_chain#table.);
445 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_NAMEcxx . . $ NFTNL_CHAIN_NAME.))
446 mnl_attr_put_strzcxx . . $ mnl_attr_put_strz(eb76286d4bfc1a8d).(nlh, NFTA_CHAIN_NAMEcxx . . $ NFTA_CHAIN_NAME., c->namecxx . . $ nftnl_chain#name.);
447
448 if ((c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_HOOKNUMcxx . . $ NFTNL_CHAIN_HOOKNUM.)) ||
449 (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_PRIOcxx . . $ NFTNL_CHAIN_PRIO.)) ||
450 (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_DEVcxx . . $ NFTNL_CHAIN_DEV.)) ||
451 (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_DEVICEScxx . . $ NFTNL_CHAIN_DEVICES.)))
452 nest = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_CHAIN_HOOKcxx . . $ NFTA_CHAIN_HOOK.);
453
454 if ((c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_HOOKNUMcxx . . $ NFTNL_CHAIN_HOOKNUM.)))
455 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_HOOK_HOOKNUMcxx . . $ NFTA_HOOK_HOOKNUM., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(c->hooknum));
456 if ((c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_PRIOcxx . . $ NFTNL_CHAIN_PRIO.)))
457 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_HOOK_PRIORITYcxx . . $ NFTA_HOOK_PRIORITY., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(c->prio));
458
459 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_DEVcxx . . $ NFTNL_CHAIN_DEV.))
460 mnl_attr_put_strzcxx . . $ mnl_attr_put_strz(eb76286d4bfc1a8d).(nlh, NFTA_HOOK_DEVcxx . . $ NFTA_HOOK_DEV., c->devcxx . . $ nftnl_chain#dev.);
461 else if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_DEVICEScxx . . $ NFTNL_CHAIN_DEVICES.)) {
462 struct nlattrcxx . . $ nlattr# *nest_dev;
463 const char *dev;
464
465 nest_dev = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_HOOK_DEVScxx . . $ NFTA_HOOK_DEVS.);
466 nftnl_str_array_foreachcxx . . $ `include/str_array.h:17:9`!(dev, &c->dev_array, i)
467 nftnl_attr_put_ifnamecxx . . $ nftnl_attr_put_ifname(96236743ed9497eb).(nlh, dev);
468 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest_dev);
469 }
470
471 if ((c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_HOOKNUMcxx . . $ NFTNL_CHAIN_HOOKNUM.)) ||
472 (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_PRIOcxx . . $ NFTNL_CHAIN_PRIO.)) ||
473 (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_DEVcxx . . $ NFTNL_CHAIN_DEV.)) ||
474 (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_DEVICEScxx . . $ NFTNL_CHAIN_DEVICES.)))
475 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest);
476
477 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_POLICYcxx . . $ NFTNL_CHAIN_POLICY.))
478 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_CHAIN_POLICYcxx . . $ NFTA_CHAIN_POLICY., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(c->policy));
479 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_USEcxx . . $ NFTNL_CHAIN_USE.))
480 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_CHAIN_USEcxx . . $ NFTA_CHAIN_USE., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(c->use));
481 if ((c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_PACKETScxx . . $ NFTNL_CHAIN_PACKETS.)) &&
482 (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_BYTEScxx . . $ NFTNL_CHAIN_BYTES.))) {
483 nest = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_CHAIN_COUNTERScxx . . $ NFTA_CHAIN_COUNTERS.);
484 mnl_attr_put_u64cxx . . $ mnl_attr_put_u64(6d753f4d486e3a2f).(nlh, NFTA_COUNTER_PACKETScxx . . $ NFTA_COUNTER_PACKETS., be64tohcxx . . $ `<external>/15855202785537844739/endian.h:51:11`!(c->packets));
485 mnl_attr_put_u64cxx . . $ mnl_attr_put_u64(6d753f4d486e3a2f).(nlh, NFTA_COUNTER_BYTEScxx . . $ NFTA_COUNTER_BYTES., be64tohcxx . . $ `<external>/15855202785537844739/endian.h:51:11`!(c->bytes));
486 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest);
487 }
488 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_HANDLEcxx . . $ NFTNL_CHAIN_HANDLE.))
489 mnl_attr_put_u64cxx . . $ mnl_attr_put_u64(6d753f4d486e3a2f).(nlh, NFTA_CHAIN_HANDLEcxx . . $ NFTA_CHAIN_HANDLE., be64tohcxx . . $ `<external>/15855202785537844739/endian.h:51:11`!(c->handle));
490 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_TYPEcxx . . $ NFTNL_CHAIN_TYPE.))
491 mnl_attr_put_strzcxx . . $ mnl_attr_put_strz(eb76286d4bfc1a8d).(nlh, NFTA_CHAIN_TYPEcxx . . $ NFTA_CHAIN_TYPE., c->typecxx . . $ nftnl_chain#type.);
492 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_FLAGScxx . . $ NFTNL_CHAIN_FLAGS.))
493 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_CHAIN_FLAGScxx . . $ NFTA_CHAIN_FLAGS., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(c->chain_flags));
494 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_IDcxx . . $ NFTNL_CHAIN_ID.))
495 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_CHAIN_IDcxx . . $ NFTA_CHAIN_ID., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(c->chain_id));
496 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_USERDATAcxx . . $ NFTNL_CHAIN_USERDATA.))
497 mnl_attr_putcxx . . $ mnl_attr_put(612d908c39ff741d).(nlh, NFTA_CHAIN_USERDATAcxx . . $ NFTA_CHAIN_USERDATA., c->usercxx . . $ nftnl_chain#user..lencxx . . $ nftnl_chain#$anonymous_type_0#len., c->usercxx . . $ nftnl_chain#user..datacxx . . $ nftnl_chain#$anonymous_type_0#data.);
498 }
499
500 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_rule_add);
501 void nftnl_chain_rule_addcxx . . $ nftnl_chain_rule_add(dcb0572f3f3054db).(struct nftnl_rulecxx . . $ nftnl_rule# *rule, struct nftnl_chaincxx . . $ nftnl_chain# *c)
502 {
503 list_addcxx . . $ list_add(6c3f7387ec573de3).(&rule->headcxx . . $ nftnl_rule#head., &c->rule_listcxx . . $ nftnl_chain#rule_list.);
504 }
505
506 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_rule_del);
507 void nftnl_chain_rule_delcxx . . $ nftnl_chain_rule_del(6a7057e190e103a6).(struct nftnl_rulecxx . . $ nftnl_rule# *r)
508 {
509 list_delcxx . . $ list_del(35ab6d74de6aba0a).(&r->headcxx . . $ nftnl_rule#head.);
510 }
511
512 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_rule_add_tail);
513 void nftnl_chain_rule_add_tailcxx . . $ nftnl_chain_rule_add_tail(dcb0572f3f3054db).(struct nftnl_rulecxx . . $ nftnl_rule# *rule, struct nftnl_chaincxx . . $ nftnl_chain# *c)
514 {
515 list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&rule->headcxx . . $ nftnl_rule#head., &c->rule_listcxx . . $ nftnl_chain#rule_list.);
516 }
517
518 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_rule_insert_at);
519 void nftnl_chain_rule_insert_atcxx . . $ nftnl_chain_rule_insert_at(47913c483d795e14).(struct nftnl_rulecxx . . $ nftnl_rule# *rule, struct nftnl_rulecxx . . $ nftnl_rule# *pos)
520 {
521 list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&rule->headcxx . . $ nftnl_rule#head., &pos->headcxx . . $ nftnl_rule#head.);
522 }
523
524 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_rule_append_at);
525 void nftnl_chain_rule_append_atcxx . . $ nftnl_chain_rule_append_at(47913c483d795e14).(struct nftnl_rulecxx . . $ nftnl_rule# *rule, struct nftnl_rulecxx . . $ nftnl_rule# *pos)
526 {
527 list_addcxx . . $ list_add(6c3f7387ec573de3).(&rule->headcxx . . $ nftnl_rule#head., &pos->headcxx . . $ nftnl_rule#head.);
528 }
529
530 static int nftnl_chain_parse_attr_cbcxx . . $ nftnl_chain_parse_attr_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data)
531 {
532 const struct nlattrcxx . . $ nlattr# **tb = data;
533 int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr);
534
535 if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_CHAIN_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:256:9`!) < 0)
536 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
537
538 switch(type) {
539 case NFTA_CHAIN_NAMEcxx . . $ NFTA_CHAIN_NAME.:
540 case NFTA_CHAIN_TABLEcxx . . $ NFTA_CHAIN_TABLE.:
541 case NFTA_CHAIN_TYPEcxx . . $ NFTA_CHAIN_TYPE.:
542 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_STRINGcxx . . $ MNL_TYPE_STRING.) < 0)
543 abi_breakagecxx . . $ `include/utils.h:28:9`!();
544 break;
545 case NFTA_CHAIN_HOOKcxx . . $ NFTA_CHAIN_HOOK.:
546 case NFTA_CHAIN_COUNTERScxx . . $ NFTA_CHAIN_COUNTERS.:
547 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_NESTEDcxx . . $ MNL_TYPE_NESTED.) < 0)
548 abi_breakagecxx . . $ `include/utils.h:28:9`!();
549 break;
550 case NFTA_CHAIN_POLICYcxx . . $ NFTA_CHAIN_POLICY.:
551 case NFTA_CHAIN_USEcxx . . $ NFTA_CHAIN_USE.:
552 case NFTA_CHAIN_FLAGScxx . . $ NFTA_CHAIN_FLAGS.:
553 case NFTA_CHAIN_IDcxx . . $ NFTA_CHAIN_ID.:
554 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U32cxx . . $ MNL_TYPE_U32.) < 0)
555 abi_breakagecxx . . $ `include/utils.h:28:9`!();
556 break;
557 case NFTA_CHAIN_HANDLEcxx . . $ NFTA_CHAIN_HANDLE.:
558 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U64cxx . . $ MNL_TYPE_U64.) < 0)
559 abi_breakagecxx . . $ `include/utils.h:28:9`!();
560 break;
561 case NFTA_CHAIN_USERDATAcxx . . $ NFTA_CHAIN_USERDATA.:
562 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_BINARYcxx . . $ MNL_TYPE_BINARY.) < 0)
563 abi_breakagecxx . . $ `include/utils.h:28:9`!();
564 break;
565 }
566
567 tb[type] = attr;
568 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
569 }
570
571 static int nftnl_chain_parse_counters_cbcxx . . $ nftnl_chain_parse_counters_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data)
572 {
573 const struct nlattrcxx . . $ nlattr# **tb = data;
574 int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr);
575
576 if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_COUNTER_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1274:9`!) < 0)
577 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
578
579 switch(type) {
580 case NFTA_COUNTER_BYTEScxx . . $ NFTA_COUNTER_BYTES.:
581 case NFTA_COUNTER_PACKETScxx . . $ NFTA_COUNTER_PACKETS.:
582 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U64cxx . . $ MNL_TYPE_U64.) < 0)
583 abi_breakagecxx . . $ `include/utils.h:28:9`!();
584 break;
585 }
586
587 tb[type] = attr;
588 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
589 }
590
591 static int nftnl_chain_parse_counterscxx . . $ nftnl_chain_parse_counters(aafa3017903422f6).(struct nlattrcxx . . $ nlattr# *attr, struct nftnl_chaincxx . . $ nftnl_chain# *c)
592 {
593 struct nlattrcxx . . $ nlattr# *tb[NFTA_COUNTER_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1274:9`!+1] = {};
594
595 if (mnl_attr_parse_nestedcxx . . $ mnl_attr_parse_nested(f99c0e9fa94f99d9).(attr, nftnl_chain_parse_counters_cbcxx . . $ nftnl_chain_parse_counters_cb(de2ef18c48fd675c)., tb) < 0)
596 return -1;
597
598 if (tb[NFTA_COUNTER_PACKETScxx . . $ NFTA_COUNTER_PACKETS.]) {
599 c->packetscxx . . $ nftnl_chain#packets. = be64tohcxx . . $ `<external>/15855202785537844739/endian.h:51:11`!(mnl_attr_get_u64(tb[NFTA_COUNTER_PACKETS]));
600 c->flagscxx . . $ nftnl_chain#flags. |= (1 << NFTNL_CHAIN_PACKETScxx . . $ NFTNL_CHAIN_PACKETS.);
601 }
602 if (tb[NFTA_COUNTER_BYTEScxx . . $ NFTA_COUNTER_BYTES.]) {
603 c->bytescxx . . $ nftnl_chain#bytes. = be64tohcxx . . $ `<external>/15855202785537844739/endian.h:51:11`!(mnl_attr_get_u64(tb[NFTA_COUNTER_BYTES]));
604 c->flagscxx . . $ nftnl_chain#flags. |= (1 << NFTNL_CHAIN_BYTEScxx . . $ NFTNL_CHAIN_BYTES.);
605 }
606
607 return 0;
608 }
609
610 static int nftnl_chain_parse_hook_cbcxx . . $ nftnl_chain_parse_hook_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data)
611 {
612 const struct nlattrcxx . . $ nlattr# **tb = data;
613 int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr);
614
615 if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_HOOK_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:176:9`!) < 0)
616 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
617
618 switch(type) {
619 case NFTA_HOOK_HOOKNUMcxx . . $ NFTA_HOOK_HOOKNUM.:
620 case NFTA_HOOK_PRIORITYcxx . . $ NFTA_HOOK_PRIORITY.:
621 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U32cxx . . $ MNL_TYPE_U32.) < 0)
622 abi_breakagecxx . . $ `include/utils.h:28:9`!();
623 break;
624 case NFTA_HOOK_DEVcxx . . $ NFTA_HOOK_DEV.:
625 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_STRINGcxx . . $ MNL_TYPE_STRING.) < 0)
626 abi_breakagecxx . . $ `include/utils.h:28:9`!();
627 break;
628 }
629
630 tb[type] = attr;
631 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
632 }
633
634 static int nftnl_chain_parse_hookcxx . . $ nftnl_chain_parse_hook(aafa3017903422f6).(struct nlattrcxx . . $ nlattr# *attr, struct nftnl_chaincxx . . $ nftnl_chain# *c)
635 {
636 struct nlattrcxx . . $ nlattr# *tb[NFTA_HOOK_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:176:9`!+1] = {};
637 int ret;
638
639 if (mnl_attr_parse_nestedcxx . . $ mnl_attr_parse_nested(f99c0e9fa94f99d9).(attr, nftnl_chain_parse_hook_cbcxx . . $ nftnl_chain_parse_hook_cb(de2ef18c48fd675c)., tb) < 0)
640 return -1;
641
642 if (tb[NFTA_HOOK_HOOKNUMcxx . . $ NFTA_HOOK_HOOKNUM.]) {
643 c->hooknumcxx . . $ nftnl_chain#hooknum. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_HOOK_HOOKNUM]));
644 c->flagscxx . . $ nftnl_chain#flags. |= (1 << NFTNL_CHAIN_HOOKNUMcxx . . $ NFTNL_CHAIN_HOOKNUM.);
645 }
646 if (tb[NFTA_HOOK_PRIORITYcxx . . $ NFTA_HOOK_PRIORITY.]) {
647 c->priocxx . . $ nftnl_chain#prio. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_HOOK_PRIORITY]));
648 c->flagscxx . . $ nftnl_chain#flags. |= (1 << NFTNL_CHAIN_PRIOcxx . . $ NFTNL_CHAIN_PRIO.);
649 }
650 if (tb[NFTA_HOOK_DEVcxx . . $ NFTA_HOOK_DEV.]) {
651 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_DEVcxx . . $ NFTNL_CHAIN_DEV.))
652 xfreecxx . . $ `include/utils.h:22:9`!(c->dev);
653 c->devcxx . . $ nftnl_chain#dev. = strdupcxx . . $ strdup(a8b8e32347182212).(mnl_attr_get_strcxx . . $ mnl_attr_get_str(c24cebeef6d84d59).(tb[NFTA_HOOK_DEVcxx . . $ NFTA_HOOK_DEV.]));
654 if (!c->devcxx . . $ nftnl_chain#dev.)
655 return -1;
656 c->flagscxx . . $ nftnl_chain#flags. |= (1 << NFTNL_CHAIN_DEVcxx . . $ NFTNL_CHAIN_DEV.);
657 }
658 if (tb[NFTA_HOOK_DEVScxx . . $ NFTA_HOOK_DEVS.]) {
659 ret = nftnl_parse_devscxx . . $ nftnl_parse_devs(2b1f6624489517c0).(&c->dev_arraycxx . . $ nftnl_chain#dev_array., tb[NFTA_HOOK_DEVScxx . . $ NFTA_HOOK_DEVS.]);
660 if (ret < 0)
661 return -1;
662 c->flagscxx . . $ nftnl_chain#flags. |= (1 << NFTNL_CHAIN_DEVICEScxx . . $ NFTNL_CHAIN_DEVICES.);
663 }
664
665 return 0;
666 }
667
668 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_nlmsg_parse);
669 int nftnl_chain_nlmsg_parsecxx . . $ nftnl_chain_nlmsg_parse(8eaab103653823c7).(const struct nlmsghdrcxx . . $ nlmsghdr# *nlh, struct nftnl_chaincxx . . $ nftnl_chain# *c)
670 {
671 struct nlattrcxx . . $ nlattr# *tb[NFTA_CHAIN_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:256:9`!+1] = {};
672 struct nfgenmsgcxx . . $ nfgenmsg# *nfg = mnl_nlmsg_get_payloadcxx . . $ mnl_nlmsg_get_payload(33f780b45aa89a18).(nlh);
673 int ret = 0;
674
675 if (mnl_attr_parsecxx . . $ mnl_attr_parse(8b80a5a12c5e6592).(nlh, sizeof(*nfg), nftnl_chain_parse_attr_cbcxx . . $ nftnl_chain_parse_attr_cb(de2ef18c48fd675c)., tb) < 0)
676 return -1;
677
678 if (nftnl_parse_str_attrcxx . . $ nftnl_parse_str_attr(2002c8408bf98f7f).(tb[NFTA_CHAIN_NAMEcxx . . $ NFTA_CHAIN_NAME.], NFTNL_CHAIN_NAMEcxx . . $ NFTNL_CHAIN_NAME.,
679 &c->namecxx . . $ nftnl_chain#name., &c->flagscxx . . $ nftnl_chain#flags.) < 0)
680 return -1;
681 if (nftnl_parse_str_attrcxx . . $ nftnl_parse_str_attr(2002c8408bf98f7f).(tb[NFTA_CHAIN_TABLEcxx . . $ NFTA_CHAIN_TABLE.], NFTNL_CHAIN_TABLEcxx . . $ NFTNL_CHAIN_TABLE.,
682 &c->tablecxx . . $ nftnl_chain#table., &c->flagscxx . . $ nftnl_chain#flags.) < 0)
683 return -1;
684 if (tb[NFTA_CHAIN_HOOKcxx . . $ NFTA_CHAIN_HOOK.]) {
685 ret = nftnl_chain_parse_hookcxx . . $ nftnl_chain_parse_hook(aafa3017903422f6).(tb[NFTA_CHAIN_HOOKcxx . . $ NFTA_CHAIN_HOOK.], c);
686 if (ret < 0)
687 return ret;
688 }
689 if (tb[NFTA_CHAIN_POLICYcxx . . $ NFTA_CHAIN_POLICY.]) {
690 c->policycxx . . $ nftnl_chain#policy. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_CHAIN_POLICY]));
691 c->flagscxx . . $ nftnl_chain#flags. |= (1 << NFTNL_CHAIN_POLICYcxx . . $ NFTNL_CHAIN_POLICY.);
692 }
693 if (tb[NFTA_CHAIN_USEcxx . . $ NFTA_CHAIN_USE.]) {
694 c->usecxx . . $ nftnl_chain#use. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_CHAIN_USE]));
695 c->flagscxx . . $ nftnl_chain#flags. |= (1 << NFTNL_CHAIN_USEcxx . . $ NFTNL_CHAIN_USE.);
696 }
697 if (tb[NFTA_CHAIN_COUNTERScxx . . $ NFTA_CHAIN_COUNTERS.]) {
698 ret = nftnl_chain_parse_counterscxx . . $ nftnl_chain_parse_counters(aafa3017903422f6).(tb[NFTA_CHAIN_COUNTERScxx . . $ NFTA_CHAIN_COUNTERS.], c);
699 if (ret < 0)
700 return ret;
701 }
702 if (tb[NFTA_CHAIN_HANDLEcxx . . $ NFTA_CHAIN_HANDLE.]) {
703 c->handlecxx . . $ nftnl_chain#handle. = be64tohcxx . . $ `<external>/15855202785537844739/endian.h:51:11`!(mnl_attr_get_u64(tb[NFTA_CHAIN_HANDLE]));
704 c->flagscxx . . $ nftnl_chain#flags. |= (1 << NFTNL_CHAIN_HANDLEcxx . . $ NFTNL_CHAIN_HANDLE.);
705 }
706 if (nftnl_parse_str_attrcxx . . $ nftnl_parse_str_attr(2002c8408bf98f7f).(tb[NFTA_CHAIN_TYPEcxx . . $ NFTA_CHAIN_TYPE.], NFTNL_CHAIN_TYPEcxx . . $ NFTNL_CHAIN_TYPE.,
707 &c->typecxx . . $ nftnl_chain#type., &c->flagscxx . . $ nftnl_chain#flags.) < 0)
708 return -1;
709 if (tb[NFTA_CHAIN_FLAGScxx . . $ NFTA_CHAIN_FLAGS.]) {
710 c->chain_flagscxx . . $ nftnl_chain#chain_flags. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_CHAIN_FLAGS]));
711 c->flagscxx . . $ nftnl_chain#flags. |= (1 << NFTNL_CHAIN_FLAGScxx . . $ NFTNL_CHAIN_FLAGS.);
712 }
713 if (tb[NFTA_CHAIN_IDcxx . . $ NFTA_CHAIN_ID.]) {
714 c->chain_idcxx . . $ nftnl_chain#chain_id. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_CHAIN_ID]));
715 c->flagscxx . . $ nftnl_chain#flags. |= (1 << NFTNL_CHAIN_IDcxx . . $ NFTNL_CHAIN_ID.);
716 }
717 if (tb[NFTA_CHAIN_USERDATAcxx . . $ NFTA_CHAIN_USERDATA.]) {
718 nftnl_chain_set_datacxx . . $ nftnl_chain_set_data(f8aff8e21c847c71).(c, NFTNL_CHAIN_USERDATAcxx . . $ NFTNL_CHAIN_USERDATA.,
719 mnl_attr_get_payloadcxx . . $ mnl_attr_get_payload(cbbcdcb61d3bc7e8).(tb[NFTA_CHAIN_USERDATAcxx . . $ NFTA_CHAIN_USERDATA.]),
720 mnl_attr_get_payload_lencxx . . $ mnl_attr_get_payload_len(1da47bcc4c4b975).(tb[NFTA_CHAIN_USERDATAcxx . . $ NFTA_CHAIN_USERDATA.]));
721 }
722
723 c->familycxx . . $ nftnl_chain#family. = nfg->nfgen_familycxx . . $ nfgenmsg#nfgen_family.;
724 c->flagscxx . . $ nftnl_chain#flags. |= (1 << NFTNL_CHAIN_FAMILYcxx . . $ NFTNL_CHAIN_FAMILY.);
725
726 return ret;
727 }
728
729 static int nftnl_chain_snprintf_defaultcxx . . $ nftnl_chain_snprintf_default(edfd74eb5fbb8793).(char *buf, size_t remain,
730 const struct nftnl_chaincxx . . $ nftnl_chain# *c)
731 {
732 int ret, offset = 0, i;
733 const char *dev;
734
735 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf, remain, "%s %s %s use %u",
736 nftnl_family2strcxx . . $ nftnl_family2str(81a3ae90da26a711).(c->familycxx . . $ nftnl_chain#family.), c->tablecxx . . $ nftnl_chain#table., c->namecxx . . $ nftnl_chain#name., c->usecxx . . $ nftnl_chain#use.);
737 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
738
739 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_HOOKNUMcxx . . $ NFTNL_CHAIN_HOOKNUM.)) {
740 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " type %s hook %s prio %d",
741 c->typecxx . . $ nftnl_chain#type., nftnl_hooknum2strcxx . . $ nftnl_hooknum2str(bd5db3388d838e27).(c->familycxx . . $ nftnl_chain#family., c->hooknumcxx . . $ nftnl_chain#hooknum.),
742 c->priocxx . . $ nftnl_chain#prio.);
743 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
744
745 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_POLICYcxx . . $ NFTNL_CHAIN_POLICY.)) {
746 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " policy %s",
747 nftnl_verdict2strcxx . . $ nftnl_verdict2str(81a3ae90da26a711).(c->policycxx . . $ nftnl_chain#policy.));
748 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
749 }
750
751 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain,
752 " packets %"PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:110:10`!" bytes %"PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:110:10`!"",
753 c->packetscxx . . $ nftnl_chain#packets., c->bytescxx . . $ nftnl_chain#bytes.);
754 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
755
756 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_DEVcxx . . $ NFTNL_CHAIN_DEV.)) {
757 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " dev %s ",
758 c->devcxx . . $ nftnl_chain#dev.);
759 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
760 }
761 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_DEVICEScxx . . $ NFTNL_CHAIN_DEVICES.)) {
762 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " dev { ");
763 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
764
765 nftnl_str_array_foreachcxx . . $ `include/str_array.h:17:9`!(dev, &c->dev_array, i) {
766 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " %s ",
767 dev);
768 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
769 }
770 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " } ");
771 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
772 }
773 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_FLAGScxx . . $ NFTNL_CHAIN_FLAGS.)) {
774 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " flags %x",
775 c->chain_flagscxx . . $ nftnl_chain#chain_flags.);
776 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
777 }
778 if (c->flagscxx . . $ nftnl_chain#flags. & (1 << NFTNL_CHAIN_IDcxx . . $ NFTNL_CHAIN_ID.)) {
779 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " id %x",
780 c->chain_idcxx . . $ nftnl_chain#chain_id.);
781 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
782 }
783 }
784
785 return offset;
786 }
787
788 static int nftnl_chain_cmd_snprintfcxx . . $ nftnl_chain_cmd_snprintf(4826c07e5ab7a289).(char *buf, size_t remain,
789 const struct nftnl_chaincxx . . $ nftnl_chain# *c, uint32_tcxx . . $ uint32_t# cmd,
790 uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags)
791 {
792 int ret, offset = 0;
793
794 if (type != NFTNL_OUTPUT_DEFAULTcxx . . $ NFTNL_OUTPUT_DEFAULT.)
795 return -1;
796
797 ret = nftnl_chain_snprintf_defaultcxx . . $ nftnl_chain_snprintf_default(edfd74eb5fbb8793).(buf + offset, remain, c);
798 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
799 return offset;
800 }
801
802 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_snprintf);
803 int nftnl_chain_snprintfcxx . . $ nftnl_chain_snprintf(b1a008d61eb55206).(char *buf, size_t size, const struct nftnl_chaincxx . . $ nftnl_chain# *c,
804 uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags)
805 {
806 if (size)
807 buf[0] = '\0';
808
809 return nftnl_chain_cmd_snprintfcxx . . $ nftnl_chain_cmd_snprintf(4826c07e5ab7a289).(buf, size, c, nftnl_flag2cmdcxx . . $ nftnl_flag2cmd(73b61a9477c235b4).(flags),
810 type, flags);
811 }
812
813 static int nftnl_chain_do_snprintfcxx . . $ nftnl_chain_do_snprintf(809f16203406eb30).(char *buf, size_t size, const void *c,
814 uint32_tcxx . . $ uint32_t# cmd, uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags)
815 {
816 return nftnl_chain_snprintfcxx . . $ nftnl_chain_snprintf(b1a008d61eb55206).(buf, size, c, type, flags);
817 }
818
819 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_fprintf);
820 int nftnl_chain_fprintfcxx . . $ nftnl_chain_fprintf(6fb51d5f6d9c0532).(FILEcxx . . $ FILE# *fp, const struct nftnl_chaincxx . . $ nftnl_chain# *c, uint32_tcxx . . $ uint32_t# type,
821 uint32_tcxx . . $ uint32_t# flags)
822 {
823 return nftnl_fprintfcxx . . $ nftnl_fprintf(959aea809fde9589).(fp, c, NFTNL_CMD_UNSPECcxx . . $ NFTNL_CMD_UNSPEC., type, flags,
824 nftnl_chain_do_snprintfcxx . . $ nftnl_chain_do_snprintf(809f16203406eb30).);
825 }
826
827 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_foreach);
828 int nftnl_rule_foreachcxx . . $ nftnl_rule_foreach(688ecee4e42d52fc).(struct nftnl_chaincxx . . $ nftnl_chain# *c,
829 int (*cb)(struct nftnl_rulecxx . . $ nftnl_rule# *r, void *data),
830 void *data)
831 {
832 struct nftnl_rulecxx . . $ nftnl_rule# *cur, *tmp;
833 int ret;
834
835 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(cur, tmp, &c->rule_list, head) {
836 ret = cb(cur, data);
837 if (ret < 0)
838 return ret;
839 }
840 return 0;
841 }
842
843 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_lookup_byindex);
844 struct nftnl_rulecxx . . $ nftnl_rule# *
845 nftnl_rule_lookup_byindexcxx . . $ nftnl_rule_lookup_byindex(27284d7f789b3a66).(struct nftnl_chaincxx . . $ nftnl_chain# *c, uint32_tcxx . . $ uint32_t# index)
846 {
847 struct nftnl_rulecxx . . $ nftnl_rule# *r;
848
849 list_for_each_entrycxx . . $ `include/linux_list.h:384:9`!(r, &c->rule_list, head) {
850 if (!index)
851 return r;
852 index--;
853 }
854 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
855 }
856
857 struct nftnl_rule_itercxx . . $ nftnl_rule_iter# {
858 const struct nftnl_chaincxx . . $ nftnl_chain# *ccxx . . $ nftnl_rule_iter#c.;
859 struct nftnl_rulecxx . . $ nftnl_rule# *curcxx . . $ nftnl_rule_iter#cur.;
860 };
861
862 static void nftnl_rule_iter_initcxx . . $ nftnl_rule_iter_init(6dcecea71e8ee4ee).(const struct nftnl_chaincxx . . $ nftnl_chain# *c,
863 struct nftnl_rule_itercxx . . $ nftnl_rule_iter# *iter)
864 {
865 iter->ccxx . . $ nftnl_rule_iter#c. = c;
866 if (list_emptycxx . . $ list_empty(df525b6afabf24a2).(&c->rule_listcxx . . $ nftnl_chain#rule_list.))
867 iter->curcxx . . $ nftnl_rule_iter#cur. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
868 else
869 iter->curcxx . . $ nftnl_rule_iter#cur. = list_entrycxx . . $ `include/linux_list.h:334:9`!(c->rule_list.next, struct nftnl_rule,
870 head);
871 }
872
873 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_iter_create);
874 struct nftnl_rule_itercxx . . $ nftnl_rule_iter# *nftnl_rule_iter_createcxx . . $ nftnl_rule_iter_create(60b318b154971d05).(const struct nftnl_chaincxx . . $ nftnl_chain# *c)
875 {
876 struct nftnl_rule_itercxx . . $ nftnl_rule_iter# *iter;
877
878 iter = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_rule_itercxx . . $ nftnl_rule_iter#));
879 if (iter == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)
880 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
881
882 nftnl_rule_iter_initcxx . . $ nftnl_rule_iter_init(6dcecea71e8ee4ee).(c, iter);
883
884 return iter;
885 }
886
887 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_iter_next);
888 struct nftnl_rulecxx . . $ nftnl_rule# *nftnl_rule_iter_nextcxx . . $ nftnl_rule_iter_next(9a3878fc30bf9700).(struct nftnl_rule_itercxx . . $ nftnl_rule_iter# *iter)
889 {
890 struct nftnl_rulecxx . . $ nftnl_rule# *rule = iter->curcxx . . $ nftnl_rule_iter#cur.;
891
892 if (rule == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)
893 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
894
895 /* get next rule, if any */
896 iter->curcxx . . $ nftnl_rule_iter#cur. = list_entrycxx . . $ `include/linux_list.h:334:9`!(iter->cur->head.next, struct nftnl_rule, head);
897 if (&iter->curcxx . . $ nftnl_rule_iter#cur.->headcxx . . $ nftnl_rule#head. == iter->ccxx . . $ nftnl_rule_iter#c.->rule_listcxx . . $ nftnl_chain#rule_list..nextcxx . . $ list_head#next.)
898 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
899
900 return rule;
901 }
902
903 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_rule_iter_destroy);
904 void nftnl_rule_iter_destroycxx . . $ nftnl_rule_iter_destroy(6606356ac884ad73).(struct nftnl_rule_itercxx . . $ nftnl_rule_iter# *iter)
905 {
906 xfreecxx . . $ `include/utils.h:22:9`!(iter);
907 }
908
909 #define CHAIN_NAME_HSIZEcxx . . $ `src/chain.c:909:9`! 512
910
911 struct nftnl_chain_listcxx . . $ nftnl_chain_list# {
912
913 struct list_headcxx . . $ list_head# listcxx . . $ nftnl_chain_list#list.;
914 struct hlist_headcxx . . $ hlist_head# name_hashcxx . . $ nftnl_chain_list#name_hash.[CHAIN_NAME_HSIZEcxx . . $ `src/chain.c:909:9`!];
915 };
916
917 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_list_alloc);
918 struct nftnl_chain_listcxx . . $ nftnl_chain_list# *nftnl_chain_list_alloccxx . . $ nftnl_chain_list_alloc(db7079ecded3b7c).(void)
919 {
920 struct nftnl_chain_listcxx . . $ nftnl_chain_list# *list;
921 int i;
922
923 list = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_chain_listcxx . . $ nftnl_chain_list#));
924 if (list == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)
925 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
926
927 INIT_LIST_HEADcxx . . $ `include/linux_list.h:66:9`!(&list->list);
928 for (i = 0; i < CHAIN_NAME_HSIZEcxx . . $ `src/chain.c:909:9`!; i++)
929 INIT_HLIST_HEADcxx . . $ `include/linux_list.h:523:9`!(&list->name_hash[i]);
930
931 return list;
932 }
933
934 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_list_free);
935 void nftnl_chain_list_freecxx . . $ nftnl_chain_list_free(3f7465731f590af5).(struct nftnl_chain_listcxx . . $ nftnl_chain_list# *list)
936 {
937 struct nftnl_chaincxx . . $ nftnl_chain# *r, *tmp;
938
939 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(r, tmp, &list->list, head) {
940 list_delcxx . . $ list_del(35ab6d74de6aba0a).(&r->headcxx . . $ nftnl_chain#head.);
941 hlist_delcxx . . $ hlist_del(9568863142661c75).(&r->hnodecxx . . $ nftnl_chain#hnode.);
942 nftnl_chain_freecxx . . $ nftnl_chain_free(769d8587cfdb0d4).(r);
943 }
944 xfreecxx . . $ `include/utils.h:22:9`!(list);
945 }
946
947 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_list_is_empty);
948 int nftnl_chain_list_is_emptycxx . . $ nftnl_chain_list_is_empty(c6fdf762001e3fe6).(const struct nftnl_chain_listcxx . . $ nftnl_chain_list# *list)
949 {
950 return list_emptycxx . . $ list_empty(df525b6afabf24a2).(&list->listcxx . . $ nftnl_chain_list#list.);
951 }
952
953 static uint32_tcxx . . $ uint32_t# djb_hashcxx . . $ djb_hash(c61c63047ce273de).(const char *key)
954 {
955 uint32_tcxx . . $ uint32_t# i, hash = 5381;
956
957 for (i = 0; i < strlencxx . . $ strlen(751346f8406fd082).(key); i++)
958 hash = ((hash << 5) + hash) + key[i];
959
960 return hash;
961 }
962
963 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_list_add);
964 void nftnl_chain_list_addcxx . . $ nftnl_chain_list_add(71a9277eeddde5be).(struct nftnl_chaincxx . . $ nftnl_chain# *r, struct nftnl_chain_listcxx . . $ nftnl_chain_list# *list)
965 {
966 int key = djb_hashcxx . . $ djb_hash(c61c63047ce273de).(r->namecxx . . $ nftnl_chain#name.) % CHAIN_NAME_HSIZEcxx . . $ `src/chain.c:909:9`!;
967
968 hlist_add_headcxx . . $ hlist_add_head(32b7a2e391003461).(&r->hnodecxx . . $ nftnl_chain#hnode., &list->name_hashcxx . . $ nftnl_chain_list#name_hash.[key]);
969 list_addcxx . . $ list_add(6c3f7387ec573de3).(&r->headcxx . . $ nftnl_chain#head., &list->listcxx . . $ nftnl_chain_list#list.);
970 }
971
972 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_list_add_tail);
973 void nftnl_chain_list_add_tailcxx . . $ nftnl_chain_list_add_tail(71a9277eeddde5be).(struct nftnl_chaincxx . . $ nftnl_chain# *r, struct nftnl_chain_listcxx . . $ nftnl_chain_list# *list)
974 {
975 int key = djb_hashcxx . . $ djb_hash(c61c63047ce273de).(r->namecxx . . $ nftnl_chain#name.) % CHAIN_NAME_HSIZEcxx . . $ `src/chain.c:909:9`!;
976
977 hlist_add_headcxx . . $ hlist_add_head(32b7a2e391003461).(&r->hnodecxx . . $ nftnl_chain#hnode., &list->name_hashcxx . . $ nftnl_chain_list#name_hash.[key]);
978 list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&r->headcxx . . $ nftnl_chain#head., &list->listcxx . . $ nftnl_chain_list#list.);
979 }
980
981 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_list_del);
982 void nftnl_chain_list_delcxx . . $ nftnl_chain_list_del(347422a895c02d52).(struct nftnl_chaincxx . . $ nftnl_chain# *r)
983 {
984 list_delcxx . . $ list_del(35ab6d74de6aba0a).(&r->headcxx . . $ nftnl_chain#head.);
985 hlist_delcxx . . $ hlist_del(9568863142661c75).(&r->hnodecxx . . $ nftnl_chain#hnode.);
986 }
987
988 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_list_foreach);
989 int nftnl_chain_list_foreachcxx . . $ nftnl_chain_list_foreach(624e8934cfe99875).(struct nftnl_chain_listcxx . . $ nftnl_chain_list# *chain_list,
990 int (*cb)(struct nftnl_chaincxx . . $ nftnl_chain# *r, void *data),
991 void *data)
992 {
993 struct nftnl_chaincxx . . $ nftnl_chain# *cur, *tmp;
994 int ret;
995
996 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(cur, tmp, &chain_list->list, head) {
997 ret = cb(cur, data);
998 if (ret < 0)
999 return ret;
1000 }
1001 return 0;
1002 }
1003
1004 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_list_lookup_byname);
1005 struct nftnl_chaincxx . . $ nftnl_chain# *
1006 nftnl_chain_list_lookup_bynamecxx . . $ nftnl_chain_list_lookup_byname(2619c3c5e789042).(struct nftnl_chain_listcxx . . $ nftnl_chain_list# *chain_list,
1007 const char *chain)
1008 {
1009 int key = djb_hashcxx . . $ djb_hash(c61c63047ce273de).(chain) % CHAIN_NAME_HSIZEcxx . . $ `src/chain.c:909:9`!;
1010 struct nftnl_chaincxx . . $ nftnl_chain# *c;
1011 struct hlist_nodecxx . . $ hlist_node# *n;
1012
1013 hlist_for_each_entrycxx . . $ `include/linux_list.h:667:9`!(c, n, &chain_list->name_hash[key], hnode) {
1014 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(chain, c->namecxx . . $ nftnl_chain#name.))
1015 return c;
1016 }
1017 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1018 }
1019
1020 struct nftnl_chain_list_itercxx . . $ nftnl_chain_list_iter# {
1021 const struct nftnl_chain_listcxx . . $ nftnl_chain_list# *listcxx . . $ nftnl_chain_list_iter#list.;
1022 struct nftnl_chaincxx . . $ nftnl_chain# *curcxx . . $ nftnl_chain_list_iter#cur.;
1023 };
1024
1025 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_list_iter_create);
1026 struct nftnl_chain_list_itercxx . . $ nftnl_chain_list_iter# *
1027 nftnl_chain_list_iter_createcxx . . $ nftnl_chain_list_iter_create(5251baceac31c2).(const struct nftnl_chain_listcxx . . $ nftnl_chain_list# *l)
1028 {
1029 struct nftnl_chain_list_itercxx . . $ nftnl_chain_list_iter# *iter;
1030
1031 iter = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_chain_list_itercxx . . $ nftnl_chain_list_iter#));
1032 if (iter == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)
1033 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1034
1035 iter->listcxx . . $ nftnl_chain_list_iter#list. = l;
1036 if (nftnl_chain_list_is_emptycxx . . $ nftnl_chain_list_is_empty(c6fdf762001e3fe6).(l))
1037 iter->curcxx . . $ nftnl_chain_list_iter#cur. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1038 else
1039 iter->curcxx . . $ nftnl_chain_list_iter#cur. = list_entrycxx . . $ `include/linux_list.h:334:9`!(l->list.next, struct nftnl_chain, head);
1040
1041 return iter;
1042 }
1043
1044 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_list_iter_next);
1045 struct nftnl_chaincxx . . $ nftnl_chain# *nftnl_chain_list_iter_nextcxx . . $ nftnl_chain_list_iter_next(7b274ab990050d8b).(struct nftnl_chain_list_itercxx . . $ nftnl_chain_list_iter# *iter)
1046 {
1047 struct nftnl_chaincxx . . $ nftnl_chain# *r = iter->curcxx . . $ nftnl_chain_list_iter#cur.;
1048
1049 if (r == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)
1050 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1051
1052 /* get next chain, if any */
1053 iter->curcxx . . $ nftnl_chain_list_iter#cur. = list_entrycxx . . $ `include/linux_list.h:334:9`!(iter->cur->head.next, struct nftnl_chain, head);
1054 if (&iter->curcxx . . $ nftnl_chain_list_iter#cur.->headcxx . . $ nftnl_chain#head. == iter->listcxx . . $ nftnl_chain_list_iter#list.->listcxx . . $ nftnl_chain_list#list..nextcxx . . $ list_head#next.)
1055 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1056
1057 return r;
1058 }
1059
1060 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_chain_list_iter_destroy);
1061 void nftnl_chain_list_iter_destroycxx . . $ nftnl_chain_list_iter_destroy(a1f02e2d19c8b8b6).(struct nftnl_chain_list_itercxx . . $ nftnl_chain_list_iter# *iter)
1062 {
1063 xfreecxx . . $ `include/utils.h:22:9`!(iter);
1064 }