Debian Codegraph @

src/flowtable.c

raw symbols SCIP
1 #cxx . . $ `<file>/src/flowtable.c`/include "internal.h"cxx . . $ `<file>/include/internal.h`/
2
3 #include <time.h>
4 #include <endian.h>
5 #include <stdint.h>
6 #include <stdlib.h>
7 #include <limits.h>
8 #include <string.h>
9 #include <netinet/in.h>
10 #include <errno.h>
11 #include <inttypes.h>
12
13 #include <libmnl/libmnl.h>
14 #include <linux/netfilter/nfnetlink.h>cxx . . $ `<file>/include/linux/netfilter/nfnetlink.h`/
15 #include <linux/netfilter/nf_tables.h>cxx . . $ `<file>/include/linux/netfilter/nf_tables.h`/
16 #include <linux/netfilter.h>cxx . . $ `<file>/include/linux/netfilter.h`/
17 #include <linux/netfilter_arp.h>
18
19 #include <libnftnl/flowtable.h>cxx . . $ `<file>/include/libnftnl/flowtable.h`/
20
21 struct nftnl_flowtablecxx . . $ nftnl_flowtable# {
22 struct list_headcxx . . $ list_head# headcxx . . $ nftnl_flowtable#head.;
23 const char *namecxx . . $ nftnl_flowtable#name.;
24 const char *tablecxx . . $ nftnl_flowtable#table.;
25 int familycxx . . $ nftnl_flowtable#family.;
26 uint32_tcxx . . $ uint32_t# hooknumcxx . . $ nftnl_flowtable#hooknum.;
27 int32_tcxx . . $ int32_t# priocxx . . $ nftnl_flowtable#prio.;
28 uint32_tcxx . . $ uint32_t# sizecxx . . $ nftnl_flowtable#size.;
29 struct nftnl_str_arraycxx . . $ nftnl_str_array# dev_arraycxx . . $ nftnl_flowtable#dev_array.;
30 uint32_tcxx . . $ uint32_t# ft_flagscxx . . $ nftnl_flowtable#ft_flags.;
31 uint32_tcxx . . $ uint32_t# usecxx . . $ nftnl_flowtable#use.;
32 uint32_tcxx . . $ uint32_t# flagscxx . . $ nftnl_flowtable#flags.;
33 uint64_tcxx . . $ uint64_t# handlecxx . . $ nftnl_flowtable#handle.;
34 };
35
36 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_alloc);
37 struct nftnl_flowtablecxx . . $ nftnl_flowtable# *nftnl_flowtable_alloccxx . . $ nftnl_flowtable_alloc(a631ef1b0115b22a).(void)
38 {
39 return calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_flowtablecxx . . $ nftnl_flowtable#));
40 }
41
42 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_free);
43 void nftnl_flowtable_freecxx . . $ nftnl_flowtable_free(a50942fa1cec3053).(const struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c)
44 {
45 if (c->flagscxx . . $ nftnl_flowtable#flags. & (1 << NFTNL_FLOWTABLE_NAMEcxx . . $ NFTNL_FLOWTABLE_NAME.))
46 xfreecxx . . $ `include/utils.h:22:9`!(c->name);
47 if (c->flagscxx . . $ nftnl_flowtable#flags. & (1 << NFTNL_FLOWTABLE_TABLEcxx . . $ NFTNL_FLOWTABLE_TABLE.))
48 xfreecxx . . $ `include/utils.h:22:9`!(c->table);
49 if (c->flagscxx . . $ nftnl_flowtable#flags. & (1 << NFTNL_FLOWTABLE_DEVICEScxx . . $ NFTNL_FLOWTABLE_DEVICES.))
50 nftnl_str_array_clearcxx . . $ nftnl_str_array_clear(da9ec48ca4ecf134).((struct nftnl_str_arraycxx . . $ nftnl_str_array# *)&c->dev_arraycxx . . $ nftnl_flowtable#dev_array.);
51 xfreecxx . . $ `include/utils.h:22:9`!(c);
52 }
53
54 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_is_set);
55 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! nftnl_flowtable_is_setcxx . . $ nftnl_flowtable_is_set(7d67dceb533884b8).(const struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c, uint16_tcxx . . $ uint16_t# attr)
56 {
57 return c->flagscxx . . $ nftnl_flowtable#flags. & (1 << attr);
58 }
59
60 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_unset);
61 void nftnl_flowtable_unsetcxx . . $ nftnl_flowtable_unset(2a357df98ea53e46).(struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c, uint16_tcxx . . $ uint16_t# attr)
62 {
63 if (!(c->flagscxx . . $ nftnl_flowtable#flags. & (1 << attr)))
64 return;
65
66 switch (attr) {
67 case NFTNL_FLOWTABLE_NAMEcxx . . $ NFTNL_FLOWTABLE_NAME.:
68 xfreecxx . . $ `include/utils.h:22:9`!(c->name);
69 break;
70 case NFTNL_FLOWTABLE_TABLEcxx . . $ NFTNL_FLOWTABLE_TABLE.:
71 xfreecxx . . $ `include/utils.h:22:9`!(c->table);
72 break;
73 case NFTNL_FLOWTABLE_HOOKNUMcxx . . $ NFTNL_FLOWTABLE_HOOKNUM.:
74 case NFTNL_FLOWTABLE_PRIOcxx . . $ NFTNL_FLOWTABLE_PRIO.:
75 case NFTNL_FLOWTABLE_USEcxx . . $ NFTNL_FLOWTABLE_USE.:
76 case NFTNL_FLOWTABLE_FAMILYcxx . . $ NFTNL_FLOWTABLE_FAMILY.:
77 case NFTNL_FLOWTABLE_FLAGScxx . . $ NFTNL_FLOWTABLE_FLAGS.:
78 case NFTNL_FLOWTABLE_HANDLEcxx . . $ NFTNL_FLOWTABLE_HANDLE.:
79 break;
80 case NFTNL_FLOWTABLE_DEVICEScxx . . $ NFTNL_FLOWTABLE_DEVICES.:
81 nftnl_str_array_clearcxx . . $ nftnl_str_array_clear(da9ec48ca4ecf134).(&c->dev_arraycxx . . $ nftnl_flowtable#dev_array.);
82 break;
83 default:
84 return;
85 }
86
87 c->flagscxx . . $ nftnl_flowtable#flags. &= ~(1 << attr);
88 }
89
90 static uint32_tcxx . . $ uint32_t# nftnl_flowtable_validatecxx . . $ nftnl_flowtable_validate.[NFTNL_FLOWTABLE_MAXcxx . . $ `include/libnftnl/flowtable.h:33:9`! + 1] = {
91 [NFTNL_FLOWTABLE_HOOKNUMcxx . . $ NFTNL_FLOWTABLE_HOOKNUM.] = sizeof(uint32_tcxx . . $ uint32_t#),
92 [NFTNL_FLOWTABLE_PRIOcxx . . $ NFTNL_FLOWTABLE_PRIO.] = sizeof(int32_tcxx . . $ int32_t#),
93 [NFTNL_FLOWTABLE_FAMILYcxx . . $ NFTNL_FLOWTABLE_FAMILY.] = sizeof(uint32_tcxx . . $ uint32_t#),
94 [NFTNL_FLOWTABLE_SIZEcxx . . $ NFTNL_FLOWTABLE_SIZE.] = sizeof(uint32_tcxx . . $ uint32_t#),
95 [NFTNL_FLOWTABLE_FLAGScxx . . $ NFTNL_FLOWTABLE_FLAGS.] = sizeof(uint32_tcxx . . $ uint32_t#),
96 [NFTNL_FLOWTABLE_HANDLEcxx . . $ NFTNL_FLOWTABLE_HANDLE.] = sizeof(uint64_tcxx . . $ uint64_t#),
97 };
98
99 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_set_data);
100 int nftnl_flowtable_set_datacxx . . $ nftnl_flowtable_set_data(8f58dc86855f4eb5).(struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c, uint16_tcxx . . $ uint16_t# attr,
101 const void *data, uint32_tcxx . . $ uint32_t# data_len)
102 {
103 nftnl_assert_attr_existscxx . . $ `include/utils.h:49:9`!(attr, NFTNL_FLOWTABLE_MAXcxx . . $ `include/libnftnl/flowtable.h:33:9`!);
104 nftnl_assert_validatecxx . . $ `include/utils.h:38:9`!(data, nftnl_flowtable_validate, attr, data_len);
105
106 switch(attr) {
107 case NFTNL_FLOWTABLE_NAMEcxx . . $ NFTNL_FLOWTABLE_NAME.:
108 return nftnl_set_str_attrcxx . . $ nftnl_set_str_attr(fd565288bd370d98).(&c->namecxx . . $ nftnl_flowtable#name., &c->flagscxx . . $ nftnl_flowtable#flags.,
109 attr, data, data_len);
110 case NFTNL_FLOWTABLE_TABLEcxx . . $ NFTNL_FLOWTABLE_TABLE.:
111 return nftnl_set_str_attrcxx . . $ nftnl_set_str_attr(fd565288bd370d98).(&c->tablecxx . . $ nftnl_flowtable#table., &c->flagscxx . . $ nftnl_flowtable#flags.,
112 attr, data, data_len);
113 break;
114 case NFTNL_FLOWTABLE_HOOKNUMcxx . . $ NFTNL_FLOWTABLE_HOOKNUM.:
115 memcpycxx . . $ memcpy(cc817cb175f282d).(&c->hooknumcxx . . $ nftnl_flowtable#hooknum., data, sizeof(c->hooknumcxx . . $ nftnl_flowtable#hooknum.));
116 break;
117 case NFTNL_FLOWTABLE_PRIOcxx . . $ NFTNL_FLOWTABLE_PRIO.:
118 memcpycxx . . $ memcpy(cc817cb175f282d).(&c->priocxx . . $ nftnl_flowtable#prio., data, sizeof(c->priocxx . . $ nftnl_flowtable#prio.));
119 break;
120 case NFTNL_FLOWTABLE_FAMILYcxx . . $ NFTNL_FLOWTABLE_FAMILY.:
121 memcpycxx . . $ memcpy(cc817cb175f282d).(&c->familycxx . . $ nftnl_flowtable#family., data, sizeof(c->familycxx . . $ nftnl_flowtable#family.));
122 break;
123 case NFTNL_FLOWTABLE_DEVICEScxx . . $ NFTNL_FLOWTABLE_DEVICES.:
124 if (nftnl_str_array_setcxx . . $ nftnl_str_array_set(c729e707ba698544).(&c->dev_arraycxx . . $ nftnl_flowtable#dev_array., data) < 0)
125 return -1;
126 break;
127 case NFTNL_FLOWTABLE_SIZEcxx . . $ NFTNL_FLOWTABLE_SIZE.:
128 memcpycxx . . $ memcpy(cc817cb175f282d).(&c->sizecxx . . $ nftnl_flowtable#size., data, sizeof(c->sizecxx . . $ nftnl_flowtable#size.));
129 break;
130 case NFTNL_FLOWTABLE_FLAGScxx . . $ NFTNL_FLOWTABLE_FLAGS.:
131 memcpycxx . . $ memcpy(cc817cb175f282d).(&c->ft_flagscxx . . $ nftnl_flowtable#ft_flags., data, sizeof(c->ft_flagscxx . . $ nftnl_flowtable#ft_flags.));
132 break;
133 case NFTNL_FLOWTABLE_HANDLEcxx . . $ NFTNL_FLOWTABLE_HANDLE.:
134 memcpycxx . . $ memcpy(cc817cb175f282d).(&c->handlecxx . . $ nftnl_flowtable#handle., data, sizeof(c->handlecxx . . $ nftnl_flowtable#handle.));
135 break;
136 }
137 c->flagscxx . . $ nftnl_flowtable#flags. |= (1 << attr);
138 return 0;
139 }
140
141 void nftnl_flowtable_setcxx . . $ nftnl_flowtable_set(7ff06be65a82e186).(struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c, uint16_tcxx . . $ uint16_t# attr, const void *data) __visiblecxx . . $ `include/utils.h:13:10`!;
142 void nftnl_flowtable_setcxx . . $ nftnl_flowtable_set(7ff06be65a82e186).(struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c, uint16_tcxx . . $ uint16_t# attr, const void *data)
143 {
144 nftnl_flowtable_set_datacxx . . $ nftnl_flowtable_set_data(8f58dc86855f4eb5).(c, attr, data, nftnl_flowtable_validatecxx . . $ nftnl_flowtable_validate.[attr]);
145 }
146
147 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_set_u32);
148 void nftnl_flowtable_set_u32cxx . . $ nftnl_flowtable_set_u32(19e81b63633e8fe7).(struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c, uint16_tcxx . . $ uint16_t# attr, uint32_tcxx . . $ uint32_t# data)
149 {
150 nftnl_flowtable_set_datacxx . . $ nftnl_flowtable_set_data(8f58dc86855f4eb5).(c, attr, &data, sizeof(uint32_tcxx . . $ uint32_t#));
151 }
152
153 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_set_s32);
154 void nftnl_flowtable_set_s32cxx . . $ nftnl_flowtable_set_s32(aeaff04f66ff95d3).(struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c, uint16_tcxx . . $ uint16_t# attr, int32_tcxx . . $ int32_t# data)
155 {
156 nftnl_flowtable_set_datacxx . . $ nftnl_flowtable_set_data(8f58dc86855f4eb5).(c, attr, &data, sizeof(int32_tcxx . . $ int32_t#));
157 }
158
159 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_set_str);
160 int nftnl_flowtable_set_strcxx . . $ nftnl_flowtable_set_str(17c0dee852f8987f).(struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c, uint16_tcxx . . $ uint16_t# attr, const char *str)
161 {
162 return nftnl_flowtable_set_datacxx . . $ nftnl_flowtable_set_data(8f58dc86855f4eb5).(c, attr, str, strlencxx . . $ strlen(751346f8406fd082).(str) + 1);
163 }
164
165 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_set_u64);
166 void nftnl_flowtable_set_u64cxx . . $ nftnl_flowtable_set_u64(361d46c19a51d225).(struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c, uint16_tcxx . . $ uint16_t# attr, uint64_tcxx . . $ uint64_t# data)
167 {
168 nftnl_flowtable_set_datacxx . . $ nftnl_flowtable_set_data(8f58dc86855f4eb5).(c, attr, &data, sizeof(uint64_tcxx . . $ uint64_t#));
169 }
170
171 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_set_array);
172 int nftnl_flowtable_set_arraycxx . . $ nftnl_flowtable_set_array(4cd740aef316c8c2).(struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c, uint16_tcxx . . $ uint16_t# attr,
173 const char **data)
174 {
175 return nftnl_flowtable_set_datacxx . . $ nftnl_flowtable_set_data(8f58dc86855f4eb5).(c, attr, data, 0);
176 }
177
178 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_get_data);
179 const void *nftnl_flowtable_get_datacxx . . $ nftnl_flowtable_get_data(a5fc57aa12389925).(const struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c,
180 uint16_tcxx . . $ uint16_t# attr, uint32_tcxx . . $ uint32_t# *data_len)
181 {
182 if (!(c->flagscxx . . $ nftnl_flowtable#flags. & (1 << attr)))
183 return NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
184
185 switch(attr) {
186 case NFTNL_FLOWTABLE_NAMEcxx . . $ NFTNL_FLOWTABLE_NAME.:
187 *data_len = strlencxx . . $ strlen(751346f8406fd082).(c->namecxx . . $ nftnl_flowtable#name.) + 1;
188 return c->namecxx . . $ nftnl_flowtable#name.;
189 case NFTNL_FLOWTABLE_TABLEcxx . . $ NFTNL_FLOWTABLE_TABLE.:
190 *data_len = strlencxx . . $ strlen(751346f8406fd082).(c->tablecxx . . $ nftnl_flowtable#table.) + 1;
191 return c->tablecxx . . $ nftnl_flowtable#table.;
192 case NFTNL_FLOWTABLE_HOOKNUMcxx . . $ NFTNL_FLOWTABLE_HOOKNUM.:
193 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
194 return &c->hooknumcxx . . $ nftnl_flowtable#hooknum.;
195 case NFTNL_FLOWTABLE_PRIOcxx . . $ NFTNL_FLOWTABLE_PRIO.:
196 *data_len = sizeof(int32_tcxx . . $ int32_t#);
197 return &c->priocxx . . $ nftnl_flowtable#prio.;
198 case NFTNL_FLOWTABLE_FAMILYcxx . . $ NFTNL_FLOWTABLE_FAMILY.:
199 *data_len = sizeof(int32_tcxx . . $ int32_t#);
200 return &c->familycxx . . $ nftnl_flowtable#family.;
201 case NFTNL_FLOWTABLE_DEVICEScxx . . $ NFTNL_FLOWTABLE_DEVICES.:
202 *data_len = 0;
203 return c->dev_arraycxx . . $ nftnl_flowtable#dev_array..arraycxx . . $ nftnl_str_array#array.;
204 case NFTNL_FLOWTABLE_SIZEcxx . . $ NFTNL_FLOWTABLE_SIZE.:
205 *data_len = sizeof(int32_tcxx . . $ int32_t#);
206 return &c->sizecxx . . $ nftnl_flowtable#size.;
207 case NFTNL_FLOWTABLE_FLAGScxx . . $ NFTNL_FLOWTABLE_FLAGS.:
208 *data_len = sizeof(int32_tcxx . . $ int32_t#);
209 return &c->ft_flagscxx . . $ nftnl_flowtable#ft_flags.;
210 case NFTNL_FLOWTABLE_HANDLEcxx . . $ NFTNL_FLOWTABLE_HANDLE.:
211 *data_len = sizeof(uint64_tcxx . . $ uint64_t#);
212 return &c->handlecxx . . $ nftnl_flowtable#handle.;
213 }
214 return NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
215 }
216
217 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_get);
218 const void *nftnl_flowtable_getcxx . . $ nftnl_flowtable_get(eb1fb06b06c1148).(const struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c, uint16_tcxx . . $ uint16_t# attr)
219 {
220 uint32_tcxx . . $ uint32_t# data_len;
221 return nftnl_flowtable_get_datacxx . . $ nftnl_flowtable_get_data(a5fc57aa12389925).(c, attr, &data_len);
222 }
223
224 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_get_str);
225 const char *nftnl_flowtable_get_strcxx . . $ nftnl_flowtable_get_str(5aab184cf919765c).(const struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c, uint16_tcxx . . $ uint16_t# attr)
226 {
227 return nftnl_flowtable_getcxx . . $ nftnl_flowtable_get(eb1fb06b06c1148).(c, attr);
228 }
229
230 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_get_u32);
231 uint32_tcxx . . $ uint32_t# nftnl_flowtable_get_u32cxx . . $ nftnl_flowtable_get_u32(bd963fc316646ca8).(const struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c, uint16_tcxx . . $ uint16_t# attr)
232 {
233 uint32_tcxx . . $ uint32_t# data_len = 0;
234 const uint32_tcxx . . $ uint32_t# *val = nftnl_flowtable_get_datacxx . . $ nftnl_flowtable_get_data(a5fc57aa12389925).(c, attr, &data_len);
235
236 nftnl_assertcxx . . $ `include/utils.h:33:9`!(val, attr, data_len == sizeof(uint32_t));
237
238 return val ? *val : 0;
239 }
240
241 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_get_u64);
242 uint64_tcxx . . $ uint64_t# nftnl_flowtable_get_u64cxx . . $ nftnl_flowtable_get_u64(344898629c138794).(const struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c, uint16_tcxx . . $ uint16_t# attr)
243 {
244 uint32_tcxx . . $ uint32_t# data_len = 0;
245 const uint64_tcxx . . $ uint64_t# *val = nftnl_flowtable_get_datacxx . . $ nftnl_flowtable_get_data(a5fc57aa12389925).(c, attr, &data_len);
246
247 nftnl_assertcxx . . $ `include/utils.h:33:9`!(val, attr, data_len == sizeof(uint64_t));
248
249 return val ? *val : 0;
250 }
251
252 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_get_s32);
253 int32_tcxx . . $ int32_t# nftnl_flowtable_get_s32cxx . . $ nftnl_flowtable_get_s32(b88b09c54203f982).(const struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c, uint16_tcxx . . $ uint16_t# attr)
254 {
255 uint32_tcxx . . $ uint32_t# data_len = 0;
256 const int32_tcxx . . $ int32_t# *val = nftnl_flowtable_get_datacxx . . $ nftnl_flowtable_get_data(a5fc57aa12389925).(c, attr, &data_len);
257
258 nftnl_assertcxx . . $ `include/utils.h:33:9`!(val, attr, data_len == sizeof(int32_t));
259
260 return val ? *val : 0;
261 }
262
263 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_get_array);
264 const char *const *nftnl_flowtable_get_arraycxx . . $ nftnl_flowtable_get_array(c12d616f8e9a4b42).(const struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c, uint16_tcxx . . $ uint16_t# attr)
265 {
266 uint32_tcxx . . $ uint32_t# data_len;
267 const char * const *val = nftnl_flowtable_get_datacxx . . $ nftnl_flowtable_get_data(a5fc57aa12389925).(c, attr, &data_len);
268
269 nftnl_assertcxx . . $ `include/utils.h:33:9`!(val, attr, attr == NFTNL_FLOWTABLE_DEVICES);
270
271 return val;
272 }
273
274 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_nlmsg_build_payload);
275 void nftnl_flowtable_nlmsg_build_payloadcxx . . $ nftnl_flowtable_nlmsg_build_payload(5fa97e84a60a3931).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh,
276 const struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c)
277 {
278 struct nlattrcxx . . $ nlattr# *nest = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
279 int i;
280
281 if (c->flagscxx . . $ nftnl_flowtable#flags. & (1 << NFTNL_FLOWTABLE_TABLEcxx . . $ NFTNL_FLOWTABLE_TABLE.))
282 mnl_attr_put_strzcxx . . $ mnl_attr_put_strz(eb76286d4bfc1a8d).(nlh, NFTA_FLOWTABLE_TABLEcxx . . $ NFTA_FLOWTABLE_TABLE., c->tablecxx . . $ nftnl_flowtable#table.);
283 if (c->flagscxx . . $ nftnl_flowtable#flags. & (1 << NFTNL_FLOWTABLE_NAMEcxx . . $ NFTNL_FLOWTABLE_NAME.))
284 mnl_attr_put_strzcxx . . $ mnl_attr_put_strz(eb76286d4bfc1a8d).(nlh, NFTA_FLOWTABLE_NAMEcxx . . $ NFTA_FLOWTABLE_NAME., c->namecxx . . $ nftnl_flowtable#name.);
285
286 if (c->flagscxx . . $ nftnl_flowtable#flags. & (1 << NFTNL_FLOWTABLE_HOOKNUMcxx . . $ NFTNL_FLOWTABLE_HOOKNUM.) ||
287 c->flagscxx . . $ nftnl_flowtable#flags. & (1 << NFTNL_FLOWTABLE_PRIOcxx . . $ NFTNL_FLOWTABLE_PRIO.) ||
288 c->flagscxx . . $ nftnl_flowtable#flags. & (1 << NFTNL_FLOWTABLE_DEVICEScxx . . $ NFTNL_FLOWTABLE_DEVICES.))
289 nest = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_FLOWTABLE_HOOKcxx . . $ NFTA_FLOWTABLE_HOOK.);
290
291 if (c->flagscxx . . $ nftnl_flowtable#flags. & (1 << NFTNL_FLOWTABLE_HOOKNUMcxx . . $ NFTNL_FLOWTABLE_HOOKNUM.))
292 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_FLOWTABLE_HOOK_NUMcxx . . $ NFTA_FLOWTABLE_HOOK_NUM., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(c->hooknum));
293 if (c->flagscxx . . $ nftnl_flowtable#flags. & (1 << NFTNL_FLOWTABLE_PRIOcxx . . $ NFTNL_FLOWTABLE_PRIO.))
294 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_FLOWTABLE_HOOK_PRIORITYcxx . . $ NFTA_FLOWTABLE_HOOK_PRIORITY., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(c->prio));
295
296 if (c->flagscxx . . $ nftnl_flowtable#flags. & (1 << NFTNL_FLOWTABLE_DEVICEScxx . . $ NFTNL_FLOWTABLE_DEVICES.)) {
297 struct nlattrcxx . . $ nlattr# *nest_dev;
298 const char *dev;
299
300 nest_dev = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_FLOWTABLE_HOOK_DEVScxx . . $ NFTA_FLOWTABLE_HOOK_DEVS.);
301 nftnl_str_array_foreachcxx . . $ `include/str_array.h:17:9`!(dev, &c->dev_array, i)
302 nftnl_attr_put_ifnamecxx . . $ nftnl_attr_put_ifname(96236743ed9497eb).(nlh, dev);
303 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest_dev);
304 }
305
306 if (nest)
307 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest);
308
309 if (c->flagscxx . . $ nftnl_flowtable#flags. & (1 << NFTNL_FLOWTABLE_FLAGScxx . . $ NFTNL_FLOWTABLE_FLAGS.))
310 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_FLOWTABLE_FLAGScxx . . $ NFTA_FLOWTABLE_FLAGS., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(c->ft_flags));
311 if (c->flagscxx . . $ nftnl_flowtable#flags. & (1 << NFTNL_FLOWTABLE_USEcxx . . $ NFTNL_FLOWTABLE_USE.))
312 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_FLOWTABLE_USEcxx . . $ NFTA_FLOWTABLE_USE., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(c->use));
313 if (c->flagscxx . . $ nftnl_flowtable#flags. & (1 << NFTNL_FLOWTABLE_HANDLEcxx . . $ NFTNL_FLOWTABLE_HANDLE.))
314 mnl_attr_put_u64cxx . . $ mnl_attr_put_u64(6d753f4d486e3a2f).(nlh, NFTA_FLOWTABLE_HANDLEcxx . . $ NFTA_FLOWTABLE_HANDLE., htobe64cxx . . $ `<external>/15855202785537844739/endian.h:49:11`!(c->handle));
315 }
316
317 static int nftnl_flowtable_parse_attr_cbcxx . . $ nftnl_flowtable_parse_attr_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data)
318 {
319 const struct nlattrcxx . . $ nlattr# **tb = data;
320 int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr);
321
322 if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_FLOWTABLE_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1731:9`!) < 0)
323 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
324
325 switch(type) {
326 case NFTA_FLOWTABLE_NAMEcxx . . $ NFTA_FLOWTABLE_NAME.:
327 case NFTA_FLOWTABLE_TABLEcxx . . $ NFTA_FLOWTABLE_TABLE.:
328 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_STRINGcxx . . $ MNL_TYPE_STRING.) < 0)
329 abi_breakagecxx . . $ `include/utils.h:28:9`!();
330 break;
331 case NFTA_FLOWTABLE_HOOKcxx . . $ NFTA_FLOWTABLE_HOOK.:
332 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_NESTEDcxx . . $ MNL_TYPE_NESTED.) < 0)
333 abi_breakagecxx . . $ `include/utils.h:28:9`!();
334 break;
335 case NFTA_FLOWTABLE_FLAGScxx . . $ NFTA_FLOWTABLE_FLAGS.:
336 case NFTA_FLOWTABLE_USEcxx . . $ NFTA_FLOWTABLE_USE.:
337 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U32cxx . . $ MNL_TYPE_U32.) < 0)
338 abi_breakagecxx . . $ `include/utils.h:28:9`!();
339 break;
340 case NFTA_FLOWTABLE_HANDLEcxx . . $ NFTA_FLOWTABLE_HANDLE.:
341 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U64cxx . . $ MNL_TYPE_U64.) < 0)
342 abi_breakagecxx . . $ `include/utils.h:28:9`!();
343 break;
344 }
345
346 tb[type] = attr;
347 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
348 }
349
350 static int nftnl_flowtable_parse_hook_cbcxx . . $ nftnl_flowtable_parse_hook_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data)
351 {
352 const struct nlattrcxx . . $ nlattr# **tb = data;
353 int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr);
354
355 if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_FLOWTABLE_HOOK_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1747:9`!) < 0)
356 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
357
358 switch(type) {
359 case NFTA_FLOWTABLE_HOOK_NUMcxx . . $ NFTA_FLOWTABLE_HOOK_NUM.:
360 case NFTA_FLOWTABLE_HOOK_PRIORITYcxx . . $ NFTA_FLOWTABLE_HOOK_PRIORITY.:
361 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U32cxx . . $ MNL_TYPE_U32.) < 0)
362 abi_breakagecxx . . $ `include/utils.h:28:9`!();
363 break;
364 case NFTA_FLOWTABLE_HOOK_DEVScxx . . $ NFTA_FLOWTABLE_HOOK_DEVS.:
365 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_NESTEDcxx . . $ MNL_TYPE_NESTED.) < 0)
366 abi_breakagecxx . . $ `include/utils.h:28:9`!();
367 break;
368 }
369
370 tb[type] = attr;
371 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
372 }
373
374 static int nftnl_flowtable_parse_hookcxx . . $ nftnl_flowtable_parse_hook(b280106a6de08bf3).(struct nlattrcxx . . $ nlattr# *attr, struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c)
375 {
376 struct nlattrcxx . . $ nlattr# *tb[NFTA_FLOWTABLE_HOOK_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1747:9`! + 1] = {};
377 int ret;
378
379 if (mnl_attr_parse_nestedcxx . . $ mnl_attr_parse_nested(f99c0e9fa94f99d9).(attr, nftnl_flowtable_parse_hook_cbcxx . . $ nftnl_flowtable_parse_hook_cb(de2ef18c48fd675c)., tb) < 0)
380 return -1;
381
382 if (tb[NFTA_FLOWTABLE_HOOK_NUMcxx . . $ NFTA_FLOWTABLE_HOOK_NUM.]) {
383 c->hooknumcxx . . $ nftnl_flowtable#hooknum. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_FLOWTABLE_HOOK_NUM]));
384 c->flagscxx . . $ nftnl_flowtable#flags. |= (1 << NFTNL_FLOWTABLE_HOOKNUMcxx . . $ NFTNL_FLOWTABLE_HOOKNUM.);
385 }
386 if (tb[NFTA_FLOWTABLE_HOOK_PRIORITYcxx . . $ NFTA_FLOWTABLE_HOOK_PRIORITY.]) {
387 c->priocxx . . $ nftnl_flowtable#prio. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_FLOWTABLE_HOOK_PRIORITY]));
388 c->flagscxx . . $ nftnl_flowtable#flags. |= (1 << NFTNL_FLOWTABLE_PRIOcxx . . $ NFTNL_FLOWTABLE_PRIO.);
389 }
390 if (tb[NFTA_FLOWTABLE_HOOK_DEVScxx . . $ NFTA_FLOWTABLE_HOOK_DEVS.]) {
391 ret = nftnl_parse_devscxx . . $ nftnl_parse_devs(2b1f6624489517c0).(&c->dev_arraycxx . . $ nftnl_flowtable#dev_array.,
392 tb[NFTA_FLOWTABLE_HOOK_DEVScxx . . $ NFTA_FLOWTABLE_HOOK_DEVS.]);
393 if (ret < 0)
394 return -1;
395 c->flagscxx . . $ nftnl_flowtable#flags. |= (1 << NFTNL_FLOWTABLE_DEVICEScxx . . $ NFTNL_FLOWTABLE_DEVICES.);
396 }
397
398 return 0;
399 }
400
401 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_nlmsg_parse);
402 int nftnl_flowtable_nlmsg_parsecxx . . $ nftnl_flowtable_nlmsg_parse(88346b1d15b84a53).(const struct nlmsghdrcxx . . $ nlmsghdr# *nlh, struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c)
403 {
404 struct nlattrcxx . . $ nlattr# *tb[NFTA_FLOWTABLE_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1731:9`! + 1] = {};
405 struct nfgenmsgcxx . . $ nfgenmsg# *nfg = mnl_nlmsg_get_payloadcxx . . $ mnl_nlmsg_get_payload(33f780b45aa89a18).(nlh);
406 int ret = 0;
407
408 if (mnl_attr_parsecxx . . $ mnl_attr_parse(8b80a5a12c5e6592).(nlh, sizeof(*nfg), nftnl_flowtable_parse_attr_cbcxx . . $ nftnl_flowtable_parse_attr_cb(de2ef18c48fd675c)., tb) < 0)
409 return -1;
410
411 if (nftnl_parse_str_attrcxx . . $ nftnl_parse_str_attr(2002c8408bf98f7f).(tb[NFTA_FLOWTABLE_NAMEcxx . . $ NFTA_FLOWTABLE_NAME.],
412 NFTNL_FLOWTABLE_NAMEcxx . . $ NFTNL_FLOWTABLE_NAME.,
413 &c->namecxx . . $ nftnl_flowtable#name., &c->flagscxx . . $ nftnl_flowtable#flags.) < 0)
414 return -1;
415 if (nftnl_parse_str_attrcxx . . $ nftnl_parse_str_attr(2002c8408bf98f7f).(tb[NFTA_FLOWTABLE_TABLEcxx . . $ NFTA_FLOWTABLE_TABLE.],
416 NFTNL_FLOWTABLE_TABLEcxx . . $ NFTNL_FLOWTABLE_TABLE.,
417 &c->tablecxx . . $ nftnl_flowtable#table., &c->flagscxx . . $ nftnl_flowtable#flags.) < 0)
418 return -1;
419 if (tb[NFTA_FLOWTABLE_HOOKcxx . . $ NFTA_FLOWTABLE_HOOK.]) {
420 ret = nftnl_flowtable_parse_hookcxx . . $ nftnl_flowtable_parse_hook(b280106a6de08bf3).(tb[NFTA_FLOWTABLE_HOOKcxx . . $ NFTA_FLOWTABLE_HOOK.], c);
421 if (ret < 0)
422 return ret;
423 }
424 if (tb[NFTA_FLOWTABLE_FLAGScxx . . $ NFTA_FLOWTABLE_FLAGS.]) {
425 c->ft_flagscxx . . $ nftnl_flowtable#ft_flags. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_FLOWTABLE_FLAGS]));
426 c->flagscxx . . $ nftnl_flowtable#flags. |= (1 << NFTNL_FLOWTABLE_FLAGScxx . . $ NFTNL_FLOWTABLE_FLAGS.);
427 }
428 if (tb[NFTA_FLOWTABLE_USEcxx . . $ NFTA_FLOWTABLE_USE.]) {
429 c->usecxx . . $ nftnl_flowtable#use. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_FLOWTABLE_USE]));
430 c->flagscxx . . $ nftnl_flowtable#flags. |= (1 << NFTNL_FLOWTABLE_USEcxx . . $ NFTNL_FLOWTABLE_USE.);
431 }
432 if (tb[NFTA_FLOWTABLE_HANDLEcxx . . $ NFTA_FLOWTABLE_HANDLE.]) {
433 c->handlecxx . . $ nftnl_flowtable#handle. = be64tohcxx . . $ `<external>/15855202785537844739/endian.h:51:11`!(mnl_attr_get_u64(tb[NFTA_FLOWTABLE_HANDLE]));
434 c->flagscxx . . $ nftnl_flowtable#flags. |= (1 << NFTNL_FLOWTABLE_HANDLEcxx . . $ NFTNL_FLOWTABLE_HANDLE.);
435 }
436
437 c->familycxx . . $ nftnl_flowtable#family. = nfg->nfgen_familycxx . . $ nfgenmsg#nfgen_family.;
438 c->flagscxx . . $ nftnl_flowtable#flags. |= (1 << NFTNL_FLOWTABLE_FAMILYcxx . . $ NFTNL_FLOWTABLE_FAMILY.);
439
440 return ret;
441 }
442
443 static const char *nftnl_hooknum2strcxx . . $ nftnl_hooknum2str(bd5db3388d838e27).(int family, int hooknum)
444 {
445 switch (family) {
446 case NFPROTO_IPV4cxx . . $ NFPROTO_IPV4.:
447 case NFPROTO_IPV6cxx . . $ NFPROTO_IPV6.:
448 case NFPROTO_INETcxx . . $ NFPROTO_INET.:
449 case NFPROTO_BRIDGEcxx . . $ NFPROTO_BRIDGE.:
450 switch (hooknum) {
451 case NF_INET_PRE_ROUTINGcxx . . $ NF_INET_PRE_ROUTING.:
452 return "prerouting";
453 case NF_INET_LOCAL_INcxx . . $ NF_INET_LOCAL_IN.:
454 return "input";
455 case NF_INET_FORWARDcxx . . $ NF_INET_FORWARD.:
456 return "forward";
457 case NF_INET_LOCAL_OUTcxx . . $ NF_INET_LOCAL_OUT.:
458 return "output";
459 case NF_INET_POST_ROUTINGcxx . . $ NF_INET_POST_ROUTING.:
460 return "postrouting";
461 }
462 break;
463 case NFPROTO_ARPcxx . . $ NFPROTO_ARP.:
464 switch (hooknum) {
465 case NF_ARP_INcxx . . $ `<external>/3547350308491103602/netfilter_arp.h:15:9`!:
466 return "input";
467 case NF_ARP_OUTcxx . . $ `<external>/3547350308491103602/netfilter_arp.h:16:9`!:
468 return "output";
469 case NF_ARP_FORWARDcxx . . $ `<external>/3547350308491103602/netfilter_arp.h:17:9`!:
470 return "forward";
471 }
472 break;
473 case NFPROTO_NETDEVcxx . . $ NFPROTO_NETDEV.:
474 switch (hooknum) {
475 case NF_NETDEV_INGRESScxx . . $ NF_NETDEV_INGRESS.:
476 return "ingress";
477 }
478 break;
479 }
480 return "unknown";
481 }
482
483 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_parse);
484 int nftnl_flowtable_parsecxx . . $ nftnl_flowtable_parse(9f99fbd4ac9a3f69).(struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c, enum nftnl_parse_typecxx . . $ nftnl_parse_type# type,
485 const char *data, struct nftnl_parse_errcxx . . $ nftnl_parse_err# *err)
486 {
487 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!;
488 return -1;
489 }
490
491 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_parse_file);
492 int nftnl_flowtable_parse_filecxx . . $ nftnl_flowtable_parse_file(2b67fac3100e3a0f).(struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c,
493 enum nftnl_parse_typecxx . . $ nftnl_parse_type# type,
494 FILEcxx . . $ FILE# *fp, struct nftnl_parse_errcxx . . $ nftnl_parse_err# *err)
495 {
496 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!;
497 return -1;
498 }
499
500 static int nftnl_flowtable_snprintf_defaultcxx . . $ nftnl_flowtable_snprintf_default(d4cc1bc94f1a96e0).(char *buf, size_t remain,
501 const struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c)
502 {
503 int ret, offset = 0, i;
504 const char *dev;
505
506 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf, remain, "flow table %s %s use %u size %u flags %x",
507 c->tablecxx . . $ nftnl_flowtable#table., c->namecxx . . $ nftnl_flowtable#name., c->usecxx . . $ nftnl_flowtable#use., c->sizecxx . . $ nftnl_flowtable#size., c->ft_flagscxx . . $ nftnl_flowtable#ft_flags.);
508 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
509
510 if (c->flagscxx . . $ nftnl_flowtable#flags. & (1 << NFTNL_FLOWTABLE_HOOKNUMcxx . . $ NFTNL_FLOWTABLE_HOOKNUM.)) {
511 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " hook %s prio %d ",
512 nftnl_hooknum2strcxx . . $ nftnl_hooknum2str(bd5db3388d838e27).(c->familycxx . . $ nftnl_flowtable#family., c->hooknumcxx . . $ nftnl_flowtable#hooknum.),
513 c->priocxx . . $ nftnl_flowtable#prio.);
514 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
515
516 if (c->flagscxx . . $ nftnl_flowtable#flags. & (1 << NFTNL_FLOWTABLE_DEVICEScxx . . $ NFTNL_FLOWTABLE_DEVICES.)) {
517 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " dev { ");
518 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
519
520 nftnl_str_array_foreachcxx . . $ `include/str_array.h:17:9`!(dev, &c->dev_array, i) {
521 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " %s ",
522 dev);
523 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
524 }
525 ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf + offset, remain, " } ");
526 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
527 }
528 }
529
530 return offset;
531 }
532
533 static int nftnl_flowtable_cmd_snprintfcxx . . $ nftnl_flowtable_cmd_snprintf(651ba37c04e2bff8).(char *buf, size_t remain,
534 const struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c,
535 uint32_tcxx . . $ uint32_t# cmd, uint32_tcxx . . $ uint32_t# type,
536 uint32_tcxx . . $ uint32_t# flags)
537 {
538 int ret, offset = 0;
539
540 if (type != NFTNL_OUTPUT_DEFAULTcxx . . $ NFTNL_OUTPUT_DEFAULT.)
541 return -1;
542
543 ret = nftnl_flowtable_snprintf_defaultcxx . . $ nftnl_flowtable_snprintf_default(d4cc1bc94f1a96e0).(buf + offset, remain, c);
544 SNPRINTF_BUFFER_SIZEcxx . . $ `include/utils.h:55:9`!(ret, remain, offset);
545 return offset;
546 }
547
548 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_snprintf);
549 int nftnl_flowtable_snprintfcxx . . $ nftnl_flowtable_snprintf(60df6b74e572464b).(char *buf, size_t size, const struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c,
550 uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags)
551 {
552 if (size)
553 buf[0] = '\0';
554
555 return nftnl_flowtable_cmd_snprintfcxx . . $ nftnl_flowtable_cmd_snprintf(651ba37c04e2bff8).(buf, size, c, nftnl_flag2cmdcxx . . $ nftnl_flag2cmd(73b61a9477c235b4).(flags),
556 type, flags);
557 }
558
559 static int nftnl_flowtable_do_snprintfcxx . . $ nftnl_flowtable_do_snprintf(809f16203406eb30).(char *buf, size_t size, const void *c,
560 uint32_tcxx . . $ uint32_t# cmd, uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags)
561 {
562 return nftnl_flowtable_snprintfcxx . . $ nftnl_flowtable_snprintf(60df6b74e572464b).(buf, size, c, type, flags);
563 }
564
565 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_fprintf);
566 int nftnl_flowtable_fprintfcxx . . $ nftnl_flowtable_fprintf(76258362457bf327).(FILEcxx . . $ FILE# *fp, const struct nftnl_flowtablecxx . . $ nftnl_flowtable# *c,
567 uint32_tcxx . . $ uint32_t# type, uint32_tcxx . . $ uint32_t# flags)
568 {
569 return nftnl_fprintfcxx . . $ nftnl_fprintf(959aea809fde9589).(fp, c, NFTNL_CMD_UNSPECcxx . . $ NFTNL_CMD_UNSPEC., type, flags,
570 nftnl_flowtable_do_snprintfcxx . . $ nftnl_flowtable_do_snprintf(809f16203406eb30).);
571 }
572
573 struct nftnl_flowtable_listcxx . . $ nftnl_flowtable_list# {
574 struct list_headcxx . . $ list_head# listcxx . . $ nftnl_flowtable_list#list.;
575 };
576
577 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_list_alloc);
578 struct nftnl_flowtable_listcxx . . $ nftnl_flowtable_list# *nftnl_flowtable_list_alloccxx . . $ nftnl_flowtable_list_alloc(be4b190c96de0c90).(void)
579 {
580 struct nftnl_flowtable_listcxx . . $ nftnl_flowtable_list# *list;
581
582 list = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_flowtable_listcxx . . $ nftnl_flowtable_list#));
583 if (list == NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!)
584 return NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
585
586 INIT_LIST_HEADcxx . . $ `include/linux_list.h:66:9`!(&list->list);
587
588 return list;
589 }
590
591 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_list_free);
592 void nftnl_flowtable_list_freecxx . . $ nftnl_flowtable_list_free(11e3b5b6632d7eb4).(struct nftnl_flowtable_listcxx . . $ nftnl_flowtable_list# *list)
593 {
594 struct nftnl_flowtablecxx . . $ nftnl_flowtable# *s, *tmp;
595
596 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(s, tmp, &list->list, head) {
597 list_delcxx . . $ list_del(35ab6d74de6aba0a).(&s->headcxx . . $ nftnl_flowtable#head.);
598 nftnl_flowtable_freecxx . . $ nftnl_flowtable_free(a50942fa1cec3053).(s);
599 }
600 xfreecxx . . $ `include/utils.h:22:9`!(list);
601 }
602
603 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_list_is_empty);
604 int nftnl_flowtable_list_is_emptycxx . . $ nftnl_flowtable_list_is_empty(c21fde13ccd144e7).(const struct nftnl_flowtable_listcxx . . $ nftnl_flowtable_list# *list)
605 {
606 return list_emptycxx . . $ list_empty(df525b6afabf24a2).(&list->listcxx . . $ nftnl_flowtable_list#list.);
607 }
608
609 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_list_add);
610 void nftnl_flowtable_list_addcxx . . $ nftnl_flowtable_list_add(4c1db12ef0e61b0f).(struct nftnl_flowtablecxx . . $ nftnl_flowtable# *s,
611 struct nftnl_flowtable_listcxx . . $ nftnl_flowtable_list# *list)
612 {
613 list_addcxx . . $ list_add(6c3f7387ec573de3).(&s->headcxx . . $ nftnl_flowtable#head., &list->listcxx . . $ nftnl_flowtable_list#list.);
614 }
615
616 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_list_add_tail);
617 void nftnl_flowtable_list_add_tailcxx . . $ nftnl_flowtable_list_add_tail(4c1db12ef0e61b0f).(struct nftnl_flowtablecxx . . $ nftnl_flowtable# *s,
618 struct nftnl_flowtable_listcxx . . $ nftnl_flowtable_list# *list)
619 {
620 list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&s->headcxx . . $ nftnl_flowtable#head., &list->listcxx . . $ nftnl_flowtable_list#list.);
621 }
622
623 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_list_del);
624 void nftnl_flowtable_list_delcxx . . $ nftnl_flowtable_list_del(389ef0ad5712b8c4).(struct nftnl_flowtablecxx . . $ nftnl_flowtable# *s)
625 {
626 list_delcxx . . $ list_del(35ab6d74de6aba0a).(&s->headcxx . . $ nftnl_flowtable#head.);
627 }
628
629 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_flowtable_list_foreach);
630 int nftnl_flowtable_list_foreachcxx . . $ nftnl_flowtable_list_foreach(612ffe91478f3fbc).(struct nftnl_flowtable_listcxx . . $ nftnl_flowtable_list# *flowtable_list,
631 int (*cb)(struct nftnl_flowtablecxx . . $ nftnl_flowtable# *t, void *data), void *data)
632 {
633 struct nftnl_flowtablecxx . . $ nftnl_flowtable# *cur, *tmp;
634 int ret;
635
636 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(cur, tmp, &flowtable_list->list, head) {
637 ret = cb(cur, data);
638 if (ret < 0)
639 return ret;
640 }
641 return 0;
642 }