Debian Codegraph @

src/obj/tunnel.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-or-later */cxx . . $ `<file>/src/obj/tunnel.c`/
2 /*
3 * (C) 2018 by Pablo Neira Ayuso <[email protected]>
4 */
5
6 #include <stdio.h>
7 #include <stdint.h>
8 #include <arpa/inet.h>
9 #include <errno.h>
10 #include <inttypes.h>
11
12 #include <linux/netfilter/nf_tables.h>cxx . . $ `<file>/include/linux/netfilter/nf_tables.h`/
13
14 #include <libmnl/libmnl.h>
15 #include <libnftnl/object.h>cxx . . $ `<file>/include/libnftnl/object.h`/
16
17 #include "internal.h"cxx . . $ `<file>/include/internal.h`/
18 #include "obj.h"cxx . . $ `<file>/include/obj.h`/
19
20 static int
21 nftnl_obj_tunnel_setcxx . . $ nftnl_obj_tunnel_set(96c901c785434bf1).(struct nftnl_objcxx . . $ nftnl_obj# *e, uint16_tcxx . . $ uint16_t# type,
22 const void *data, uint32_tcxx . . $ uint32_t# data_len)
23 {
24 struct nftnl_obj_tunnelcxx . . $ nftnl_obj_tunnel# *tun = nftnl_obj_datacxx . . $ `include/obj.h:117:9`!(e);
25
26 switch (type) {
27 case NFTNL_OBJ_TUNNEL_IDcxx . . $ NFTNL_OBJ_TUNNEL_ID.:
28 memcpycxx . . $ memcpy(cc817cb175f282d).(&tun->idcxx . . $ nftnl_obj_tunnel#id., data, data_len);
29 break;
30 case NFTNL_OBJ_TUNNEL_IPV4_SRCcxx . . $ NFTNL_OBJ_TUNNEL_IPV4_SRC.:
31 memcpycxx . . $ memcpy(cc817cb175f282d).(&tun->src_v4cxx . . $ nftnl_obj_tunnel#src_v4., data, data_len);
32 break;
33 case NFTNL_OBJ_TUNNEL_IPV4_DSTcxx . . $ NFTNL_OBJ_TUNNEL_IPV4_DST.:
34 memcpycxx . . $ memcpy(cc817cb175f282d).(&tun->dst_v4cxx . . $ nftnl_obj_tunnel#dst_v4., data, data_len);
35 break;
36 case NFTNL_OBJ_TUNNEL_IPV6_SRCcxx . . $ NFTNL_OBJ_TUNNEL_IPV6_SRC.:
37 memcpycxx . . $ memcpy(cc817cb175f282d).(&tun->src_v6cxx . . $ nftnl_obj_tunnel#src_v6., data, data_len);
38 break;
39 case NFTNL_OBJ_TUNNEL_IPV6_DSTcxx . . $ NFTNL_OBJ_TUNNEL_IPV6_DST.:
40 memcpycxx . . $ memcpy(cc817cb175f282d).(&tun->dst_v6cxx . . $ nftnl_obj_tunnel#dst_v6., data, data_len);
41 break;
42 case NFTNL_OBJ_TUNNEL_IPV6_FLOWLABELcxx . . $ NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL.:
43 memcpycxx . . $ memcpy(cc817cb175f282d).(&tun->flowlabelcxx . . $ nftnl_obj_tunnel#flowlabel., data, data_len);
44 break;
45 case NFTNL_OBJ_TUNNEL_SPORTcxx . . $ NFTNL_OBJ_TUNNEL_SPORT.:
46 memcpycxx . . $ memcpy(cc817cb175f282d).(&tun->sportcxx . . $ nftnl_obj_tunnel#sport., data, data_len);
47 break;
48 case NFTNL_OBJ_TUNNEL_DPORTcxx . . $ NFTNL_OBJ_TUNNEL_DPORT.:
49 memcpycxx . . $ memcpy(cc817cb175f282d).(&tun->dportcxx . . $ nftnl_obj_tunnel#dport., data, data_len);
50 break;
51 case NFTNL_OBJ_TUNNEL_FLAGScxx . . $ NFTNL_OBJ_TUNNEL_FLAGS.:
52 memcpycxx . . $ memcpy(cc817cb175f282d).(&tun->tun_flagscxx . . $ nftnl_obj_tunnel#tun_flags., data, data_len);
53 break;
54 case NFTNL_OBJ_TUNNEL_TOScxx . . $ NFTNL_OBJ_TUNNEL_TOS.:
55 memcpycxx . . $ memcpy(cc817cb175f282d).(&tun->tun_toscxx . . $ nftnl_obj_tunnel#tun_tos., data, data_len);
56 break;
57 case NFTNL_OBJ_TUNNEL_TTLcxx . . $ NFTNL_OBJ_TUNNEL_TTL.:
58 memcpycxx . . $ memcpy(cc817cb175f282d).(&tun->tun_ttlcxx . . $ nftnl_obj_tunnel#tun_ttl., data, data_len);
59 break;
60 case NFTNL_OBJ_TUNNEL_OPTScxx . . $ NFTNL_OBJ_TUNNEL_OPTS.:
61 memcpycxx . . $ memcpy(cc817cb175f282d).(&tun->tun_optscxx . . $ nftnl_obj_tunnel#tun_opts., data, data_len);
62 break;
63 }
64 return 0;
65 }
66
67 static const void *
68 nftnl_obj_tunnel_getcxx . . $ nftnl_obj_tunnel_get(d22e54b888e7c4b).(const struct nftnl_objcxx . . $ nftnl_obj# *e, uint16_tcxx . . $ uint16_t# type,
69 uint32_tcxx . . $ uint32_t# *data_len)
70 {
71 struct nftnl_obj_tunnelcxx . . $ nftnl_obj_tunnel# *tun = nftnl_obj_datacxx . . $ `include/obj.h:117:9`!(e);
72
73 switch (type) {
74 case NFTNL_OBJ_TUNNEL_IDcxx . . $ NFTNL_OBJ_TUNNEL_ID.:
75 *data_len = sizeof(tun->idcxx . . $ nftnl_obj_tunnel#id.);
76 return &tun->idcxx . . $ nftnl_obj_tunnel#id.;
77 case NFTNL_OBJ_TUNNEL_IPV4_SRCcxx . . $ NFTNL_OBJ_TUNNEL_IPV4_SRC.:
78 *data_len = sizeof(tun->src_v4cxx . . $ nftnl_obj_tunnel#src_v4.);
79 return &tun->src_v4cxx . . $ nftnl_obj_tunnel#src_v4.;
80 case NFTNL_OBJ_TUNNEL_IPV4_DSTcxx . . $ NFTNL_OBJ_TUNNEL_IPV4_DST.:
81 *data_len = sizeof(tun->dst_v4cxx . . $ nftnl_obj_tunnel#dst_v4.);
82 return &tun->dst_v4cxx . . $ nftnl_obj_tunnel#dst_v4.;
83 case NFTNL_OBJ_TUNNEL_IPV6_SRCcxx . . $ NFTNL_OBJ_TUNNEL_IPV6_SRC.:
84 *data_len = sizeof(tun->src_v6cxx . . $ nftnl_obj_tunnel#src_v6.);
85 return &tun->src_v6cxx . . $ nftnl_obj_tunnel#src_v6.;
86 case NFTNL_OBJ_TUNNEL_IPV6_DSTcxx . . $ NFTNL_OBJ_TUNNEL_IPV6_DST.:
87 *data_len = sizeof(tun->dst_v6cxx . . $ nftnl_obj_tunnel#dst_v6.);
88 return &tun->dst_v6cxx . . $ nftnl_obj_tunnel#dst_v6.;
89 case NFTNL_OBJ_TUNNEL_IPV6_FLOWLABELcxx . . $ NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL.:
90 *data_len = sizeof(tun->flowlabelcxx . . $ nftnl_obj_tunnel#flowlabel.);
91 return &tun->flowlabelcxx . . $ nftnl_obj_tunnel#flowlabel.;
92 case NFTNL_OBJ_TUNNEL_SPORTcxx . . $ NFTNL_OBJ_TUNNEL_SPORT.:
93 *data_len = sizeof(tun->sportcxx . . $ nftnl_obj_tunnel#sport.);
94 return &tun->sportcxx . . $ nftnl_obj_tunnel#sport.;
95 case NFTNL_OBJ_TUNNEL_DPORTcxx . . $ NFTNL_OBJ_TUNNEL_DPORT.:
96 *data_len = sizeof(tun->dportcxx . . $ nftnl_obj_tunnel#dport.);
97 return &tun->dportcxx . . $ nftnl_obj_tunnel#dport.;
98 case NFTNL_OBJ_TUNNEL_FLAGScxx . . $ NFTNL_OBJ_TUNNEL_FLAGS.:
99 *data_len = sizeof(tun->tun_flagscxx . . $ nftnl_obj_tunnel#tun_flags.);
100 return &tun->tun_flagscxx . . $ nftnl_obj_tunnel#tun_flags.;
101 case NFTNL_OBJ_TUNNEL_TOScxx . . $ NFTNL_OBJ_TUNNEL_TOS.:
102 *data_len = sizeof(tun->tun_toscxx . . $ nftnl_obj_tunnel#tun_tos.);
103 return &tun->tun_toscxx . . $ nftnl_obj_tunnel#tun_tos.;
104 case NFTNL_OBJ_TUNNEL_TTLcxx . . $ NFTNL_OBJ_TUNNEL_TTL.:
105 *data_len = sizeof(tun->tun_ttlcxx . . $ nftnl_obj_tunnel#tun_ttl.);
106 return &tun->tun_ttlcxx . . $ nftnl_obj_tunnel#tun_ttl.;
107 case NFTNL_OBJ_TUNNEL_OPTScxx . . $ NFTNL_OBJ_TUNNEL_OPTS.:
108 *data_len = sizeof(tun->tun_optscxx . . $ nftnl_obj_tunnel#tun_opts.);
109 return &tun->tun_optscxx . . $ nftnl_obj_tunnel#tun_opts.;
110 }
111 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
112 }
113
114 static int nftnl_obj_tunnel_cbcxx . . $ nftnl_obj_tunnel_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data)
115 {
116 const struct nlattrcxx . . $ nlattr# **tb = data;
117 int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr);
118
119 if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_TUNNEL_KEY_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1992:9`!) < 0)
120 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
121
122 switch(type) {
123 case NFTA_TUNNEL_KEY_IDcxx . . $ NFTA_TUNNEL_KEY_ID.:
124 case NFTA_TUNNEL_KEY_FLAGScxx . . $ NFTA_TUNNEL_KEY_FLAGS.:
125 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U32cxx . . $ MNL_TYPE_U32.) < 0)
126 abi_breakagecxx . . $ `include/utils.h:28:9`!();
127 break;
128 case NFTA_TUNNEL_KEY_IPcxx . . $ NFTA_TUNNEL_KEY_IP.:
129 case NFTA_TUNNEL_KEY_IP6cxx . . $ NFTA_TUNNEL_KEY_IP6.:
130 case NFTA_TUNNEL_KEY_OPTScxx . . $ NFTA_TUNNEL_KEY_OPTS.:
131 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_NESTEDcxx . . $ MNL_TYPE_NESTED.) < 0)
132 abi_breakagecxx . . $ `include/utils.h:28:9`!();
133 break;
134 case NFTA_TUNNEL_KEY_SPORTcxx . . $ NFTA_TUNNEL_KEY_SPORT.:
135 case NFTA_TUNNEL_KEY_DPORTcxx . . $ NFTA_TUNNEL_KEY_DPORT.:
136 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U16cxx . . $ MNL_TYPE_U16.) < 0)
137 abi_breakagecxx . . $ `include/utils.h:28:9`!();
138 break;
139 case NFTA_TUNNEL_KEY_TOScxx . . $ NFTA_TUNNEL_KEY_TOS.:
140 case NFTA_TUNNEL_KEY_TTLcxx . . $ NFTA_TUNNEL_KEY_TTL.:
141 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U8cxx . . $ MNL_TYPE_U8.) < 0)
142 abi_breakagecxx . . $ `include/utils.h:28:9`!();
143 break;
144 }
145
146 tb[type] = attr;
147 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
148 }
149
150 static void nftnl_tunnel_opts_buildcxx . . $ nftnl_tunnel_opts_build(62a92ac34af48c74).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh,
151 struct nftnl_tunnel_optscxx . . $ nftnl_tunnel_opts# *opts);
152
153 static void
154 nftnl_obj_tunnel_buildcxx . . $ nftnl_obj_tunnel_build(3650aba98805b449).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh, const struct nftnl_objcxx . . $ nftnl_obj# *e)
155 {
156 struct nftnl_obj_tunnelcxx . . $ nftnl_obj_tunnel# *tun = nftnl_obj_datacxx . . $ `include/obj.h:117:9`!(e);
157 struct nlattrcxx . . $ nlattr# *nest;
158
159 if (e->flagscxx . . $ nftnl_obj#flags. & (1 << NFTNL_OBJ_TUNNEL_IDcxx . . $ NFTNL_OBJ_TUNNEL_ID.))
160 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_TUNNEL_KEY_IDcxx . . $ NFTA_TUNNEL_KEY_ID., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(tun->id));
161 if (e->flagscxx . . $ nftnl_obj#flags. & (1 << NFTNL_OBJ_TUNNEL_IPV4_SRCcxx . . $ NFTNL_OBJ_TUNNEL_IPV4_SRC.) ||
162 e->flagscxx . . $ nftnl_obj#flags. & (1 << NFTNL_OBJ_TUNNEL_IPV4_DSTcxx . . $ NFTNL_OBJ_TUNNEL_IPV4_DST.)) {
163 nest = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_TUNNEL_KEY_IPcxx . . $ NFTA_TUNNEL_KEY_IP.);
164 if (e->flagscxx . . $ nftnl_obj#flags. & (1 << NFTNL_OBJ_TUNNEL_IPV4_SRCcxx . . $ NFTNL_OBJ_TUNNEL_IPV4_SRC.))
165 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_TUNNEL_KEY_IP_SRCcxx . . $ NFTA_TUNNEL_KEY_IP_SRC., tun->src_v4cxx . . $ nftnl_obj_tunnel#src_v4.);
166 if (e->flagscxx . . $ nftnl_obj#flags. & (1 << NFTNL_OBJ_TUNNEL_IPV4_DSTcxx . . $ NFTNL_OBJ_TUNNEL_IPV4_DST.))
167 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_TUNNEL_KEY_IP_DSTcxx . . $ NFTA_TUNNEL_KEY_IP_DST., tun->dst_v4cxx . . $ nftnl_obj_tunnel#dst_v4.);
168 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest);
169 }
170 if (e->flagscxx . . $ nftnl_obj#flags. & (1 << NFTNL_OBJ_TUNNEL_IPV6_SRCcxx . . $ NFTNL_OBJ_TUNNEL_IPV6_SRC.) ||
171 e->flagscxx . . $ nftnl_obj#flags. & (1 << NFTNL_OBJ_TUNNEL_IPV6_DSTcxx . . $ NFTNL_OBJ_TUNNEL_IPV6_DST.)) {
172 nest = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_TUNNEL_KEY_IP6cxx . . $ NFTA_TUNNEL_KEY_IP6.);
173 if (e->flagscxx . . $ nftnl_obj#flags. & (1 << NFTNL_OBJ_TUNNEL_IPV6_SRCcxx . . $ NFTNL_OBJ_TUNNEL_IPV6_SRC.))
174 mnl_attr_putcxx . . $ mnl_attr_put(612d908c39ff741d).(nlh, NFTA_TUNNEL_KEY_IP6_SRCcxx . . $ NFTA_TUNNEL_KEY_IP6_SRC.,
175 sizeof(tun->src_v6cxx . . $ nftnl_obj_tunnel#src_v6.), &tun->src_v6cxx . . $ nftnl_obj_tunnel#src_v6.);
176 if (e->flagscxx . . $ nftnl_obj#flags. & (1 << NFTNL_OBJ_TUNNEL_IPV6_DSTcxx . . $ NFTNL_OBJ_TUNNEL_IPV6_DST.))
177 mnl_attr_putcxx . . $ mnl_attr_put(612d908c39ff741d).(nlh, NFTA_TUNNEL_KEY_IP6_DSTcxx . . $ NFTA_TUNNEL_KEY_IP6_DST.,
178 sizeof(tun->dst_v6cxx . . $ nftnl_obj_tunnel#dst_v6.), &tun->dst_v6cxx . . $ nftnl_obj_tunnel#dst_v6.);
179 if (e->flagscxx . . $ nftnl_obj#flags. & (1 << NFTNL_OBJ_TUNNEL_IPV6_FLOWLABELcxx . . $ NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL.))
180 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_TUNNEL_KEY_IP6_FLOWLABELcxx . . $ NFTA_TUNNEL_KEY_IP6_FLOWLABEL.,
181 htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(tun->flowlabel));
182 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest);
183 }
184 if (e->flagscxx . . $ nftnl_obj#flags. & (1 << NFTNL_OBJ_TUNNEL_SPORTcxx . . $ NFTNL_OBJ_TUNNEL_SPORT.))
185 mnl_attr_put_u16cxx . . $ mnl_attr_put_u16(951fb5ebe92f4b45).(nlh, NFTA_TUNNEL_KEY_SPORTcxx . . $ NFTA_TUNNEL_KEY_SPORT., htonscxx . . $ `<external>/9581057695539925927/in.h:431:12`!(tun->sport));
186 if (e->flagscxx . . $ nftnl_obj#flags. & (1 << NFTNL_OBJ_TUNNEL_DPORTcxx . . $ NFTNL_OBJ_TUNNEL_DPORT.))
187 mnl_attr_put_u16cxx . . $ mnl_attr_put_u16(951fb5ebe92f4b45).(nlh, NFTA_TUNNEL_KEY_DPORTcxx . . $ NFTA_TUNNEL_KEY_DPORT., htonscxx . . $ `<external>/9581057695539925927/in.h:431:12`!(tun->dport));
188 if (e->flagscxx . . $ nftnl_obj#flags. & (1 << NFTNL_OBJ_TUNNEL_TOScxx . . $ NFTNL_OBJ_TUNNEL_TOS.))
189 mnl_attr_put_u8cxx . . $ mnl_attr_put_u8(897b09f57801d77).(nlh, NFTA_TUNNEL_KEY_TOScxx . . $ NFTA_TUNNEL_KEY_TOS., tun->tun_toscxx . . $ nftnl_obj_tunnel#tun_tos.);
190 if (e->flagscxx . . $ nftnl_obj#flags. & (1 << NFTNL_OBJ_TUNNEL_TTLcxx . . $ NFTNL_OBJ_TUNNEL_TTL.))
191 mnl_attr_put_u8cxx . . $ mnl_attr_put_u8(897b09f57801d77).(nlh, NFTA_TUNNEL_KEY_TTLcxx . . $ NFTA_TUNNEL_KEY_TTL., tun->tun_ttlcxx . . $ nftnl_obj_tunnel#tun_ttl.);
192 if (e->flagscxx . . $ nftnl_obj#flags. & (1 << NFTNL_OBJ_TUNNEL_FLAGScxx . . $ NFTNL_OBJ_TUNNEL_FLAGS.))
193 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_TUNNEL_KEY_FLAGScxx . . $ NFTA_TUNNEL_KEY_FLAGS., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(tun->tun_flags));
194 if (e->flagscxx . . $ nftnl_obj#flags. & (1 << NFTNL_OBJ_TUNNEL_OPTScxx . . $ NFTNL_OBJ_TUNNEL_OPTS.))
195 nftnl_tunnel_opts_buildcxx . . $ nftnl_tunnel_opts_build(62a92ac34af48c74).(nlh, tun->tun_optscxx . . $ nftnl_obj_tunnel#tun_opts.);
196 }
197
198 static int nftnl_obj_tunnel_ip_cbcxx . . $ nftnl_obj_tunnel_ip_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data)
199 {
200 const struct nlattrcxx . . $ nlattr# **tb = data;
201 int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr);
202
203 if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_TUNNEL_KEY_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1992:9`!) < 0)
204 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
205
206 switch (type) {
207 case NFTA_TUNNEL_KEY_IP_SRCcxx . . $ NFTA_TUNNEL_KEY_IP_SRC.:
208 case NFTA_TUNNEL_KEY_IP_DSTcxx . . $ NFTA_TUNNEL_KEY_IP_DST.:
209 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U32cxx . . $ MNL_TYPE_U32.) < 0)
210 abi_breakagecxx . . $ `include/utils.h:28:9`!();
211 break;
212 }
213
214 tb[type] = attr;
215 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
216 }
217
218 static int nftnl_obj_tunnel_parse_ipcxx . . $ nftnl_obj_tunnel_parse_ip(f88537db298080c9).(struct nftnl_objcxx . . $ nftnl_obj# *e, struct nlattrcxx . . $ nlattr# *attr,
219 struct nftnl_obj_tunnelcxx . . $ nftnl_obj_tunnel# *tun)
220 {
221 struct nlattrcxx . . $ nlattr# *tb[NFTA_TUNNEL_KEY_IP_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1924:9`! + 1] = {};
222
223 if (mnl_attr_parse_nestedcxx . . $ mnl_attr_parse_nested(f99c0e9fa94f99d9).(attr, nftnl_obj_tunnel_ip_cbcxx . . $ nftnl_obj_tunnel_ip_cb(de2ef18c48fd675c)., tb) < 0)
224 return -1;
225
226 if (tb[NFTA_TUNNEL_KEY_IP_SRCcxx . . $ NFTA_TUNNEL_KEY_IP_SRC.]) {
227 tun->src_v4cxx . . $ nftnl_obj_tunnel#src_v4. = mnl_attr_get_u32cxx . . $ mnl_attr_get_u32(8ff03795c1a92ca7).(tb[NFTA_TUNNEL_KEY_IP_SRCcxx . . $ NFTA_TUNNEL_KEY_IP_SRC.]);
228 e->flagscxx . . $ nftnl_obj#flags. |= (1 << NFTNL_OBJ_TUNNEL_IPV4_SRCcxx . . $ NFTNL_OBJ_TUNNEL_IPV4_SRC.);
229 }
230 if (tb[NFTA_TUNNEL_KEY_IP_DSTcxx . . $ NFTA_TUNNEL_KEY_IP_DST.]) {
231 tun->dst_v4cxx . . $ nftnl_obj_tunnel#dst_v4. = mnl_attr_get_u32cxx . . $ mnl_attr_get_u32(8ff03795c1a92ca7).(tb[NFTA_TUNNEL_KEY_IP_DSTcxx . . $ NFTA_TUNNEL_KEY_IP_DST.]);
232 e->flagscxx . . $ nftnl_obj#flags. |= (1 << NFTNL_OBJ_TUNNEL_IPV4_DSTcxx . . $ NFTNL_OBJ_TUNNEL_IPV4_DST.);
233 }
234
235 return 0;
236 }
237
238 static int nftnl_obj_tunnel_ip6_cbcxx . . $ nftnl_obj_tunnel_ip6_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data)
239 {
240 const struct nlattrcxx . . $ nlattr# **tb = data;
241 int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr);
242
243 if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_TUNNEL_KEY_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1992:9`!) < 0)
244 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
245
246 switch(type) {
247 case NFTA_TUNNEL_KEY_IP6_SRCcxx . . $ NFTA_TUNNEL_KEY_IP6_SRC.:
248 case NFTA_TUNNEL_KEY_IP6_DSTcxx . . $ NFTA_TUNNEL_KEY_IP6_DST.:
249 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_BINARYcxx . . $ MNL_TYPE_BINARY.) < 0)
250 abi_breakagecxx . . $ `include/utils.h:28:9`!();
251 break;
252 case NFTA_TUNNEL_KEY_IP6_FLOWLABELcxx . . $ NFTA_TUNNEL_KEY_IP6_FLOWLABEL.:
253 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U32cxx . . $ MNL_TYPE_U32.) < 0)
254 abi_breakagecxx . . $ `include/utils.h:28:9`!();
255 break;
256 }
257
258 tb[type] = attr;
259 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
260 }
261
262 static int nftnl_obj_tunnel_parse_ip6cxx . . $ nftnl_obj_tunnel_parse_ip6(f88537db298080c9).(struct nftnl_objcxx . . $ nftnl_obj# *e, struct nlattrcxx . . $ nlattr# *attr,
263 struct nftnl_obj_tunnelcxx . . $ nftnl_obj_tunnel# *tun)
264 {
265 struct nlattrcxx . . $ nlattr# *tb[NFTA_TUNNEL_KEY_IP6_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1933:9`! + 1] = {};
266
267 if (mnl_attr_parse_nestedcxx . . $ mnl_attr_parse_nested(f99c0e9fa94f99d9).(attr, nftnl_obj_tunnel_ip6_cbcxx . . $ nftnl_obj_tunnel_ip6_cb(de2ef18c48fd675c)., tb) < 0)
268 return -1;
269
270 if (tb[NFTA_TUNNEL_KEY_IP6_SRCcxx . . $ NFTA_TUNNEL_KEY_IP6_SRC.]) {
271 memcpycxx . . $ memcpy(cc817cb175f282d).(&tun->src_v6cxx . . $ nftnl_obj_tunnel#src_v6.,
272 mnl_attr_get_payloadcxx . . $ mnl_attr_get_payload(cbbcdcb61d3bc7e8).(tb[NFTA_TUNNEL_KEY_IP6_SRCcxx . . $ NFTA_TUNNEL_KEY_IP6_SRC.]),
273 sizeof(struct in6_addrcxx . . $ in6_addr#));
274 e->flagscxx . . $ nftnl_obj#flags. |= (1 << NFTNL_OBJ_TUNNEL_IPV6_SRCcxx . . $ NFTNL_OBJ_TUNNEL_IPV6_SRC.);
275 }
276 if (tb[NFTA_TUNNEL_KEY_IP6_DSTcxx . . $ NFTA_TUNNEL_KEY_IP6_DST.]) {
277 memcpycxx . . $ memcpy(cc817cb175f282d).(&tun->dst_v6cxx . . $ nftnl_obj_tunnel#dst_v6.,
278 mnl_attr_get_payloadcxx . . $ mnl_attr_get_payload(cbbcdcb61d3bc7e8).(tb[NFTA_TUNNEL_KEY_IP6_DSTcxx . . $ NFTA_TUNNEL_KEY_IP6_DST.]),
279 sizeof(struct in6_addrcxx . . $ in6_addr#));
280 e->flagscxx . . $ nftnl_obj#flags. |= (1 << NFTNL_OBJ_TUNNEL_IPV6_DSTcxx . . $ NFTNL_OBJ_TUNNEL_IPV6_DST.);
281 }
282 if (tb[NFTA_TUNNEL_KEY_IP6_FLOWLABELcxx . . $ NFTA_TUNNEL_KEY_IP6_FLOWLABEL.]) {
283 tun->flowlabelcxx . . $ nftnl_obj_tunnel#flowlabel. =
284 ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_TUNNEL_KEY_IP6_FLOWLABEL]));
285 e->flagscxx . . $ nftnl_obj#flags. |= (1 << NFTNL_OBJ_TUNNEL_IPV6_FLOWLABELcxx . . $ NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL.);
286 }
287
288 return 0;
289 }
290
291 struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# {
292 struct list_headcxx . . $ list_head# listcxx . . $ nftnl_tunnel_opt#list.;
293
294 enum nftnl_tunnel_typecxx . . $ nftnl_tunnel_type# typecxx . . $ nftnl_tunnel_opt#type.;
295 uint32_tcxx . . $ uint32_t# flagscxx . . $ nftnl_tunnel_opt#flags.;
296
297 unioncxx . . $ nftnl_tunnel_opt#$anonymous_type_0# {
298 structcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_1# {
299 uint32_tcxx . . $ uint32_t# gbpcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_1#gbp.;
300 } vxlancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#vxlan.;
301 structcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2# {
302 uint32_tcxx . . $ uint32_t# versioncxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#version.;
303 structcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#$anonymous_type_3# {
304 uint32_tcxx . . $ uint32_t# indexcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#$anonymous_type_3#index.;
305 } v1cxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#v1.;
306 structcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#$anonymous_type_4# {
307 uint8_tcxx . . $ uint8_t# hwidcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#$anonymous_type_4#hwid.;
308 uint8_tcxx . . $ uint8_t# dircxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#$anonymous_type_4#dir.;
309 } v2cxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#v2.;
310 } erspancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#erspan.;
311 structcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5# {
312 uint16_tcxx . . $ uint16_t# geneve_classcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#geneve_class.;
313 uint8_tcxx . . $ uint8_t# typecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#type.;
314 uint8_tcxx . . $ uint8_t# datacxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#data.[NFTNL_TUNNEL_GENEVE_DATA_MAXLENcxx . . $ `include/libnftnl/object.h:122:9`!];
315 uint32_tcxx . . $ uint32_t# data_lencxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#data_len.;
316 } genevecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#geneve.;
317 };
318 };
319
320 struct nftnl_tunnel_optscxx . . $ nftnl_tunnel_opts# {
321 enum nftnl_tunnel_typecxx . . $ nftnl_tunnel_type# typecxx . . $ nftnl_tunnel_opts#type.;
322 uint32_tcxx . . $ uint32_t# numcxx . . $ nftnl_tunnel_opts#num.;
323 struct list_headcxx . . $ list_head# opts_listcxx . . $ nftnl_tunnel_opts#opts_list.;
324 };
325
326 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_tunnel_opt_get_data);
327 const void *nftnl_tunnel_opt_get_datacxx . . $ nftnl_tunnel_opt_get_data(ba1d505e579c93d8).(const struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *ne,
328 uint16_tcxx . . $ uint16_t# attr, uint32_tcxx . . $ uint32_t# *data_len)
329 {
330 if (!(ne->flagscxx . . $ nftnl_tunnel_opt#flags. & (1 << attr)))
331 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
332
333 switch (ne->typecxx . . $ nftnl_tunnel_opt#type.) {
334 case NFTNL_TUNNEL_TYPE_ERSPANcxx . . $ NFTNL_TUNNEL_TYPE_ERSPAN.:
335 switch (attr) {
336 case NFTNL_TUNNEL_ERSPAN_VERSIONcxx . . $ NFTNL_TUNNEL_ERSPAN_VERSION.:
337 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
338 return &ne->erspancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#erspan..versioncxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#version.;
339 case NFTNL_TUNNEL_ERSPAN_V1_INDEXcxx . . $ NFTNL_TUNNEL_ERSPAN_V1_INDEX.:
340 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
341 return &ne->erspancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#erspan..v1cxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#v1..indexcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#$anonymous_type_3#index.;
342 case NFTNL_TUNNEL_ERSPAN_V2_HWIDcxx . . $ NFTNL_TUNNEL_ERSPAN_V2_HWID.:
343 *data_len = sizeof(uint8_tcxx . . $ uint8_t#);
344 return &ne->erspancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#erspan..v2cxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#v2..hwidcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#$anonymous_type_4#hwid.;
345 case NFTNL_TUNNEL_ERSPAN_V2_DIRcxx . . $ NFTNL_TUNNEL_ERSPAN_V2_DIR.:
346 *data_len = sizeof(uint8_tcxx . . $ uint8_t#);
347 return &ne->erspancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#erspan..v2cxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#v2..dircxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#$anonymous_type_4#dir.;
348 }
349 break;
350 case NFTNL_TUNNEL_TYPE_VXLANcxx . . $ NFTNL_TUNNEL_TYPE_VXLAN.:
351 switch (attr) {
352 case NFTNL_TUNNEL_VXLAN_GBPcxx . . $ NFTNL_TUNNEL_VXLAN_GBP.:
353 *data_len = sizeof(uint32_tcxx . . $ uint32_t#);
354 return &ne->vxlancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#vxlan..gbpcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_1#gbp.;
355 }
356 break;
357 case NFTNL_TUNNEL_TYPE_GENEVEcxx . . $ NFTNL_TUNNEL_TYPE_GENEVE.:
358 switch (attr) {
359 case NFTNL_TUNNEL_GENEVE_CLASScxx . . $ NFTNL_TUNNEL_GENEVE_CLASS.:
360 *data_len = sizeof(uint16_tcxx . . $ uint16_t#);
361 return &ne->genevecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#geneve..geneve_classcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#geneve_class.;
362 case NFTNL_TUNNEL_GENEVE_TYPEcxx . . $ NFTNL_TUNNEL_GENEVE_TYPE.:
363 *data_len = sizeof(uint8_tcxx . . $ uint8_t#);
364 return &ne->genevecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#geneve..typecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#type.;
365 case NFTNL_TUNNEL_GENEVE_DATAcxx . . $ NFTNL_TUNNEL_GENEVE_DATA.:
366 *data_len = ne->genevecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#geneve..data_lencxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#data_len.;
367 return &ne->genevecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#geneve..datacxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#data.;
368 }
369 break;
370 }
371
372 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!;
373 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
374 }
375
376 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_tunnel_opt_get);
377 const void *
378 nftnl_tunnel_opt_getcxx . . $ nftnl_tunnel_opt_get(bb3ab65faf20793b).(const struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *ne, uint16_tcxx . . $ uint16_t# attr)
379 {
380 uint32_tcxx . . $ uint32_t# data_len;
381 return nftnl_tunnel_opt_get_datacxx . . $ nftnl_tunnel_opt_get_data(ba1d505e579c93d8).(ne, attr, &data_len);
382 }
383
384 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_tunnel_opt_get_u8);
385 uint8_tcxx . . $ uint8_t# nftnl_tunnel_opt_get_u8cxx . . $ nftnl_tunnel_opt_get_u8(9ae163c32c425d12).(const struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *ne, uint16_tcxx . . $ uint16_t# attr)
386 {
387 const void *ret = nftnl_tunnel_opt_getcxx . . $ nftnl_tunnel_opt_get(bb3ab65faf20793b).(ne, attr);
388 return ret == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! ? 0 : *((uint8_tcxx . . $ uint8_t# *)ret);
389 }
390
391 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_tunnel_opt_get_u16);
392 uint16_tcxx . . $ uint16_t# nftnl_tunnel_opt_get_u16cxx . . $ nftnl_tunnel_opt_get_u16(b60923c5b034cb47).(const struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *ne, uint16_tcxx . . $ uint16_t# attr)
393 {
394 const void *ret = nftnl_tunnel_opt_getcxx . . $ nftnl_tunnel_opt_get(bb3ab65faf20793b).(ne, attr);
395 return ret == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! ? 0 : *((uint16_tcxx . . $ uint16_t# *)ret);
396 }
397
398 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_tunnel_opt_get_u32);
399 uint32_tcxx . . $ uint32_t# nftnl_tunnel_opt_get_u32cxx . . $ nftnl_tunnel_opt_get_u32(55a08116c8fe912b).(const struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *ne, uint16_tcxx . . $ uint16_t# attr)
400 {
401 const void *ret = nftnl_tunnel_opt_getcxx . . $ nftnl_tunnel_opt_get(bb3ab65faf20793b).(ne, attr);
402 return ret == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! ? 0 : *((uint32_tcxx . . $ uint32_t# *)ret);
403 }
404
405 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_tunnel_opt_get_type);
406 enum nftnl_tunnel_typecxx . . $ nftnl_tunnel_type# nftnl_tunnel_opt_get_typecxx . . $ nftnl_tunnel_opt_get_type(3d52a1a3912e4d85).(const struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *ne)
407 {
408 return ne->typecxx . . $ nftnl_tunnel_opt#type.;
409 }
410
411 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_tunnel_opt_get_flags);
412 uint32_tcxx . . $ uint32_t# nftnl_tunnel_opt_get_flagscxx . . $ nftnl_tunnel_opt_get_flags(a603a5118180e5e3).(const struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *ne)
413 {
414 return ne->flagscxx . . $ nftnl_tunnel_opt#flags.;
415 }
416
417 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_obj_tunnel_opts_foreach);
418 int nftnl_obj_tunnel_opts_foreachcxx . . $ nftnl_obj_tunnel_opts_foreach(d5e19ece50efc559).(const struct nftnl_objcxx . . $ nftnl_obj# *ne,
419 int (*cb)(struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *opt, void *data),
420 void *data)
421 {
422 struct nftnl_obj_tunnelcxx . . $ nftnl_obj_tunnel# *tun = nftnl_obj_datacxx . . $ `include/obj.h:117:9`!(ne);
423 struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *cur, *tmp;
424 int ret;
425
426 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(cur, tmp, &tun->tun_opts->opts_list, list) {
427 ret = cb(cur, data);
428 if (ret < 0)
429 return ret;
430 }
431
432 return 0;
433 }
434
435 static int nftnl_obj_tunnel_vxlan_cbcxx . . $ nftnl_obj_tunnel_vxlan_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data)
436 {
437 const struct nlattrcxx . . $ nlattr# **tb = data;
438 int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr);
439
440 if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_TUNNEL_KEY_VXLAN_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1949:9`!) < 0)
441 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
442
443 switch (type) {
444 case NFTA_TUNNEL_KEY_VXLAN_GBPcxx . . $ NFTA_TUNNEL_KEY_VXLAN_GBP.:
445 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U32cxx . . $ MNL_TYPE_U32.) < 0)
446 abi_breakagecxx . . $ `include/utils.h:28:9`!();
447 break;
448 }
449
450 tb[type] = attr;
451 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
452 }
453
454 struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *nftnl_tunnel_opt_alloccxx . . $ nftnl_tunnel_opt_alloc(6b2c576aa125169b).(enum nftnl_tunnel_typecxx . . $ nftnl_tunnel_type# type);
455
456 static int
457 nftnl_obj_tunnel_parse_vxlancxx . . $ nftnl_obj_tunnel_parse_vxlan(7c00ce8ca8f024a2).(struct nftnl_tunnel_optscxx . . $ nftnl_tunnel_opts# *opts, struct nlattrcxx . . $ nlattr# *attr)
458 {
459 struct nlattrcxx . . $ nlattr# *tb[NFTA_TUNNEL_KEY_VXLAN_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1949:9`! + 1] = {};
460 struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *opt;
461
462 if (mnl_attr_parse_nestedcxx . . $ mnl_attr_parse_nested(f99c0e9fa94f99d9).(attr, nftnl_obj_tunnel_vxlan_cbcxx . . $ nftnl_obj_tunnel_vxlan_cb(de2ef18c48fd675c)., tb) < 0)
463 return -1;
464
465 opt = nftnl_tunnel_opt_alloccxx . . $ nftnl_tunnel_opt_alloc(6b2c576aa125169b).(NFTNL_TUNNEL_TYPE_VXLANcxx . . $ NFTNL_TUNNEL_TYPE_VXLAN.);
466 if (!opt)
467 return -1;
468
469 if (tb[NFTA_TUNNEL_KEY_VXLAN_GBPcxx . . $ NFTA_TUNNEL_KEY_VXLAN_GBP.]) {
470 opt->vxlancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#vxlan..gbpcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_1#gbp. =
471 ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_TUNNEL_KEY_VXLAN_GBP]));
472 opt->flagscxx . . $ nftnl_tunnel_opt#flags. |= (1 << NFTNL_TUNNEL_VXLAN_GBPcxx . . $ NFTNL_TUNNEL_VXLAN_GBP.);
473 }
474
475 list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&opt->listcxx . . $ nftnl_tunnel_opt#list., &opts->opts_listcxx . . $ nftnl_tunnel_opts#opts_list.);
476
477 return 0;
478 }
479
480 static int nftnl_obj_tunnel_erspan_cbcxx . . $ nftnl_obj_tunnel_erspan_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data)
481 {
482 const struct nlattrcxx . . $ nlattr# **tb = data;
483 int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr);
484
485 if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_TUNNEL_KEY_ERSPAN_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1959:9`!) < 0)
486 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
487
488 switch (type) {
489 case NFTA_TUNNEL_KEY_ERSPAN_VERSIONcxx . . $ NFTA_TUNNEL_KEY_ERSPAN_VERSION.:
490 case NFTA_TUNNEL_KEY_ERSPAN_V1_INDEXcxx . . $ NFTA_TUNNEL_KEY_ERSPAN_V1_INDEX.:
491 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U32cxx . . $ MNL_TYPE_U32.) < 0)
492 abi_breakagecxx . . $ `include/utils.h:28:9`!();
493 break;
494 case NFTA_TUNNEL_KEY_ERSPAN_V2_HWIDcxx . . $ NFTA_TUNNEL_KEY_ERSPAN_V2_HWID.:
495 case NFTA_TUNNEL_KEY_ERSPAN_V2_DIRcxx . . $ NFTA_TUNNEL_KEY_ERSPAN_V2_DIR.:
496 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U8cxx . . $ MNL_TYPE_U8.) < 0)
497 abi_breakagecxx . . $ `include/utils.h:28:9`!();
498 break;
499 }
500
501 tb[type] = attr;
502 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
503 }
504
505 static int
506 nftnl_obj_tunnel_parse_erspancxx . . $ nftnl_obj_tunnel_parse_erspan(7c00ce8ca8f024a2).(struct nftnl_tunnel_optscxx . . $ nftnl_tunnel_opts# *opts, struct nlattrcxx . . $ nlattr# *attr)
507 {
508 struct nlattrcxx . . $ nlattr# *tb[NFTA_TUNNEL_KEY_ERSPAN_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1959:9`! + 1] = {};
509 struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *opt;
510
511 if (mnl_attr_parse_nestedcxx . . $ mnl_attr_parse_nested(f99c0e9fa94f99d9).(attr, nftnl_obj_tunnel_erspan_cbcxx . . $ nftnl_obj_tunnel_erspan_cb(de2ef18c48fd675c)., tb) < 0)
512 return -1;
513
514 opt = nftnl_tunnel_opt_alloccxx . . $ nftnl_tunnel_opt_alloc(6b2c576aa125169b).(NFTNL_TUNNEL_TYPE_ERSPANcxx . . $ NFTNL_TUNNEL_TYPE_ERSPAN.);
515 if (!opt)
516 return -1;
517
518 if (tb[NFTA_TUNNEL_KEY_ERSPAN_VERSIONcxx . . $ NFTA_TUNNEL_KEY_ERSPAN_VERSION.]) {
519 opt->erspancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#erspan..versioncxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#version. =
520 ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_TUNNEL_KEY_ERSPAN_VERSION]));
521 opt->flagscxx . . $ nftnl_tunnel_opt#flags. |= (1 << NFTNL_TUNNEL_ERSPAN_VERSIONcxx . . $ NFTNL_TUNNEL_ERSPAN_VERSION.);
522 }
523 if (tb[NFTA_TUNNEL_KEY_ERSPAN_V1_INDEXcxx . . $ NFTA_TUNNEL_KEY_ERSPAN_V1_INDEX.]) {
524 opt->erspancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#erspan..v1cxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#v1..indexcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#$anonymous_type_3#index. =
525 ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_TUNNEL_KEY_ERSPAN_V1_INDEX]));
526 opt->flagscxx . . $ nftnl_tunnel_opt#flags. |= (1 << NFTNL_TUNNEL_ERSPAN_V1_INDEXcxx . . $ NFTNL_TUNNEL_ERSPAN_V1_INDEX.);
527 }
528 if (tb[NFTA_TUNNEL_KEY_ERSPAN_V2_HWIDcxx . . $ NFTA_TUNNEL_KEY_ERSPAN_V2_HWID.]) {
529 opt->erspancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#erspan..v2cxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#v2..hwidcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#$anonymous_type_4#hwid. =
530 mnl_attr_get_u8cxx . . $ mnl_attr_get_u8(68d72702597f1127).(tb[NFTA_TUNNEL_KEY_ERSPAN_V2_HWIDcxx . . $ NFTA_TUNNEL_KEY_ERSPAN_V2_HWID.]);
531 opt->flagscxx . . $ nftnl_tunnel_opt#flags. |= (1 << NFTNL_TUNNEL_ERSPAN_V2_HWIDcxx . . $ NFTNL_TUNNEL_ERSPAN_V2_HWID.);
532 }
533 if (tb[NFTA_TUNNEL_KEY_ERSPAN_V2_DIRcxx . . $ NFTA_TUNNEL_KEY_ERSPAN_V2_DIR.]) {
534 opt->erspancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#erspan..v2cxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#v2..dircxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#$anonymous_type_4#dir. =
535 mnl_attr_get_u8cxx . . $ mnl_attr_get_u8(68d72702597f1127).(tb[NFTA_TUNNEL_KEY_ERSPAN_V2_DIRcxx . . $ NFTA_TUNNEL_KEY_ERSPAN_V2_DIR.]);
536 opt->flagscxx . . $ nftnl_tunnel_opt#flags. |= (1 << NFTNL_TUNNEL_ERSPAN_V2_DIRcxx . . $ NFTNL_TUNNEL_ERSPAN_V2_DIR.);
537 }
538
539 list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&opt->listcxx . . $ nftnl_tunnel_opt#list., &opts->opts_listcxx . . $ nftnl_tunnel_opts#opts_list.);
540
541 return 0;
542 }
543
544 static int nftnl_obj_tunnel_geneve_cbcxx . . $ nftnl_obj_tunnel_geneve_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data)
545 {
546 const struct nlattrcxx . . $ nlattr# **tb = data;
547 int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr);
548
549 if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_TUNNEL_KEY_GENEVE_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1968:9`!) < 0)
550 return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!;
551
552 switch (type) {
553 case NFTA_TUNNEL_KEY_GENEVE_CLASScxx . . $ NFTA_TUNNEL_KEY_GENEVE_CLASS.:
554 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U16cxx . . $ MNL_TYPE_U16.) < 0)
555 abi_breakagecxx . . $ `include/utils.h:28:9`!();
556 break;
557 case NFTA_TUNNEL_KEY_GENEVE_TYPEcxx . . $ NFTA_TUNNEL_KEY_GENEVE_TYPE.:
558 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U8cxx . . $ MNL_TYPE_U8.) < 0)
559 abi_breakagecxx . . $ `include/utils.h:28:9`!();
560 break;
561 case NFTA_TUNNEL_KEY_GENEVE_DATAcxx . . $ NFTA_TUNNEL_KEY_GENEVE_DATA.:
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
572 nftnl_obj_tunnel_parse_genevecxx . . $ nftnl_obj_tunnel_parse_geneve(7c00ce8ca8f024a2).(struct nftnl_tunnel_optscxx . . $ nftnl_tunnel_opts# *opts, struct nlattrcxx . . $ nlattr# *attr)
573 {
574 struct nlattrcxx . . $ nlattr# *tb[NFTA_TUNNEL_KEY_GENEVE_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1968:9`! + 1] = {};
575 struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *opt;
576
577 if (mnl_attr_parse_nestedcxx . . $ mnl_attr_parse_nested(f99c0e9fa94f99d9).(attr, nftnl_obj_tunnel_geneve_cbcxx . . $ nftnl_obj_tunnel_geneve_cb(de2ef18c48fd675c)., tb) < 0)
578 return -1;
579
580 opt = nftnl_tunnel_opt_alloccxx . . $ nftnl_tunnel_opt_alloc(6b2c576aa125169b).(NFTNL_TUNNEL_TYPE_GENEVEcxx . . $ NFTNL_TUNNEL_TYPE_GENEVE.);
581 if (!opt)
582 return -1;
583
584 if (tb[NFTA_TUNNEL_KEY_GENEVE_CLASScxx . . $ NFTA_TUNNEL_KEY_GENEVE_CLASS.]) {
585 opt->genevecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#geneve..geneve_classcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#geneve_class. =
586 ntohscxx . . $ `<external>/9581057695539925927/in.h:429:12`!(mnl_attr_get_u16(tb[NFTA_TUNNEL_KEY_GENEVE_CLASS]));
587 opt->flagscxx . . $ nftnl_tunnel_opt#flags. |= (1 << NFTNL_TUNNEL_GENEVE_CLASScxx . . $ NFTNL_TUNNEL_GENEVE_CLASS.);
588 }
589
590 if (tb[NFTA_TUNNEL_KEY_GENEVE_TYPEcxx . . $ NFTA_TUNNEL_KEY_GENEVE_TYPE.]) {
591 opt->genevecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#geneve..typecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#type. =
592 mnl_attr_get_u8cxx . . $ mnl_attr_get_u8(68d72702597f1127).(tb[NFTA_TUNNEL_KEY_GENEVE_TYPEcxx . . $ NFTA_TUNNEL_KEY_GENEVE_TYPE.]);
593 opt->flagscxx . . $ nftnl_tunnel_opt#flags. |= (1 << NFTNL_TUNNEL_GENEVE_TYPEcxx . . $ NFTNL_TUNNEL_GENEVE_TYPE.);
594 }
595
596 if (tb[NFTA_TUNNEL_KEY_GENEVE_DATAcxx . . $ NFTA_TUNNEL_KEY_GENEVE_DATA.]) {
597 uint32_tcxx . . $ uint32_t# len = mnl_attr_get_payload_lencxx . . $ mnl_attr_get_payload_len(1da47bcc4c4b975).(tb[NFTA_TUNNEL_KEY_GENEVE_DATAcxx . . $ NFTA_TUNNEL_KEY_GENEVE_DATA.]);
598
599 if (len > NFTNL_TUNNEL_GENEVE_DATA_MAXLENcxx . . $ `include/libnftnl/object.h:122:9`!) {
600 freecxx . . $ free(5d22bdacc48458e8).(opt);
601 return -1;
602 }
603
604 memcpycxx . . $ memcpy(cc817cb175f282d).(opt->genevecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#geneve..datacxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#data.,
605 mnl_attr_get_payloadcxx . . $ mnl_attr_get_payload(cbbcdcb61d3bc7e8).(tb[NFTA_TUNNEL_KEY_GENEVE_DATAcxx . . $ NFTA_TUNNEL_KEY_GENEVE_DATA.]),
606 len);
607 opt->genevecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#geneve..data_lencxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#data_len. = len;
608 opt->flagscxx . . $ nftnl_tunnel_opt#flags. |= (1 << NFTNL_TUNNEL_GENEVE_DATAcxx . . $ NFTNL_TUNNEL_GENEVE_DATA.);
609 }
610
611 list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&opt->listcxx . . $ nftnl_tunnel_opt#list., &opts->opts_listcxx . . $ nftnl_tunnel_opts#opts_list.);
612
613 return 0;
614 }
615
616 struct nftnl_tunnel_optscxx . . $ nftnl_tunnel_opts# *nftnl_tunnel_opts_alloccxx . . $ nftnl_tunnel_opts_alloc(d5e5f6c12db4c8a3).(enum nftnl_tunnel_typecxx . . $ nftnl_tunnel_type# type);
617
618 static int
619 nftnl_obj_tunnel_parse_optscxx . . $ nftnl_obj_tunnel_parse_opts(f88537db298080c9).(struct nftnl_objcxx . . $ nftnl_obj# *e, struct nlattrcxx . . $ nlattr# *nest,
620 struct nftnl_obj_tunnelcxx . . $ nftnl_obj_tunnel# *tun)
621 {
622 struct nlattrcxx . . $ nlattr# *attr;
623 struct nftnl_tunnel_optscxx . . $ nftnl_tunnel_opts# *opts = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
624 int err = 0;
625
626 mnl_attr_for_each_nestedcxx . . $ `<external>/12386019527593959648/libmnl.h:152:9`!(attr, nest) {
627 if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_NESTEDcxx . . $ MNL_TYPE_NESTED.) < 0)
628 abi_breakagecxx . . $ `include/utils.h:28:9`!();
629
630 switch(mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr)) {
631 case NFTA_TUNNEL_KEY_OPTS_VXLANcxx . . $ NFTA_TUNNEL_KEY_OPTS_VXLAN.:
632 opts = nftnl_tunnel_opts_alloccxx . . $ nftnl_tunnel_opts_alloc(d5e5f6c12db4c8a3).(NFTNL_TUNNEL_TYPE_VXLANcxx . . $ NFTNL_TUNNEL_TYPE_VXLAN.);
633 if (!opts)
634 return -1;
635
636 err = nftnl_obj_tunnel_parse_vxlancxx . . $ nftnl_obj_tunnel_parse_vxlan(7c00ce8ca8f024a2).(opts, attr);
637 break;
638 case NFTA_TUNNEL_KEY_OPTS_ERSPANcxx . . $ NFTA_TUNNEL_KEY_OPTS_ERSPAN.:
639 opts = nftnl_tunnel_opts_alloccxx . . $ nftnl_tunnel_opts_alloc(d5e5f6c12db4c8a3).(NFTNL_TUNNEL_TYPE_ERSPANcxx . . $ NFTNL_TUNNEL_TYPE_ERSPAN.);
640 if (!opts)
641 return -1;
642
643 err = nftnl_obj_tunnel_parse_erspancxx . . $ nftnl_obj_tunnel_parse_erspan(7c00ce8ca8f024a2).(opts, attr);
644 break;
645 case NFTA_TUNNEL_KEY_OPTS_GENEVEcxx . . $ NFTA_TUNNEL_KEY_OPTS_GENEVE.:
646 if (!opts)
647 opts = nftnl_tunnel_opts_alloccxx . . $ nftnl_tunnel_opts_alloc(d5e5f6c12db4c8a3).(NFTNL_TUNNEL_TYPE_GENEVEcxx . . $ NFTNL_TUNNEL_TYPE_GENEVE.);
648
649 if (!opts)
650 return -1;
651
652 err = nftnl_obj_tunnel_parse_genevecxx . . $ nftnl_obj_tunnel_parse_geneve(7c00ce8ca8f024a2).(opts, attr);
653 break;
654 }
655 }
656
657 if (opts) {
658 tun->tun_optscxx . . $ nftnl_obj_tunnel#tun_opts. = opts;
659 e->flagscxx . . $ nftnl_obj#flags. |= (1 << NFTNL_OBJ_TUNNEL_OPTScxx . . $ NFTNL_OBJ_TUNNEL_OPTS.);
660 }
661
662 return err;
663 }
664
665 static int
666 nftnl_obj_tunnel_parsecxx . . $ nftnl_obj_tunnel_parse(f22ac2b7a2342b3a).(struct nftnl_objcxx . . $ nftnl_obj# *e, struct nlattrcxx . . $ nlattr# *attr)
667 {
668 struct nftnl_obj_tunnelcxx . . $ nftnl_obj_tunnel# *tun = nftnl_obj_datacxx . . $ `include/obj.h:117:9`!(e);
669 struct nlattrcxx . . $ nlattr# *tb[NFTA_TUNNEL_KEY_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:1992:9`! + 1] = {};
670 int err;
671
672 if (mnl_attr_parse_nestedcxx . . $ mnl_attr_parse_nested(f99c0e9fa94f99d9).(attr, nftnl_obj_tunnel_cbcxx . . $ nftnl_obj_tunnel_cb(de2ef18c48fd675c)., tb) < 0)
673 return -1;
674
675 if (tb[NFTA_TUNNEL_KEY_IDcxx . . $ NFTA_TUNNEL_KEY_ID.]) {
676 tun->idcxx . . $ nftnl_obj_tunnel#id. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_TUNNEL_KEY_ID]));
677 e->flagscxx . . $ nftnl_obj#flags. |= (1 << NFTNL_OBJ_TUNNEL_IDcxx . . $ NFTNL_OBJ_TUNNEL_ID.);
678 }
679 if (tb[NFTA_TUNNEL_KEY_IPcxx . . $ NFTA_TUNNEL_KEY_IP.]) {
680 err = nftnl_obj_tunnel_parse_ipcxx . . $ nftnl_obj_tunnel_parse_ip(f88537db298080c9).(e, tb[NFTA_TUNNEL_KEY_IPcxx . . $ NFTA_TUNNEL_KEY_IP.], tun);
681 if (err < 0)
682 return err;
683 } else if (tb[NFTA_TUNNEL_KEY_IP6cxx . . $ NFTA_TUNNEL_KEY_IP6.]) {
684 err = nftnl_obj_tunnel_parse_ip6cxx . . $ nftnl_obj_tunnel_parse_ip6(f88537db298080c9).(e, tb[NFTA_TUNNEL_KEY_IP6cxx . . $ NFTA_TUNNEL_KEY_IP6.], tun);
685 if (err < 0)
686 return err;
687 }
688
689 if (tb[NFTA_TUNNEL_KEY_SPORTcxx . . $ NFTA_TUNNEL_KEY_SPORT.]) {
690 tun->sportcxx . . $ nftnl_obj_tunnel#sport. = ntohscxx . . $ `<external>/9581057695539925927/in.h:429:12`!(mnl_attr_get_u16(tb[NFTA_TUNNEL_KEY_SPORT]));
691 e->flagscxx . . $ nftnl_obj#flags. |= (1 << NFTNL_OBJ_TUNNEL_SPORTcxx . . $ NFTNL_OBJ_TUNNEL_SPORT.);
692 }
693 if (tb[NFTA_TUNNEL_KEY_DPORTcxx . . $ NFTA_TUNNEL_KEY_DPORT.]) {
694 tun->dportcxx . . $ nftnl_obj_tunnel#dport. = ntohscxx . . $ `<external>/9581057695539925927/in.h:429:12`!(mnl_attr_get_u16(tb[NFTA_TUNNEL_KEY_DPORT]));
695 e->flagscxx . . $ nftnl_obj#flags. |= (1 << NFTNL_OBJ_TUNNEL_DPORTcxx . . $ NFTNL_OBJ_TUNNEL_DPORT.);
696 }
697 if (tb[NFTA_TUNNEL_KEY_TOScxx . . $ NFTA_TUNNEL_KEY_TOS.]) {
698 tun->tun_toscxx . . $ nftnl_obj_tunnel#tun_tos. = mnl_attr_get_u8cxx . . $ mnl_attr_get_u8(68d72702597f1127).(tb[NFTA_TUNNEL_KEY_TOScxx . . $ NFTA_TUNNEL_KEY_TOS.]);
699 e->flagscxx . . $ nftnl_obj#flags. |= (1 << NFTNL_OBJ_TUNNEL_TOScxx . . $ NFTNL_OBJ_TUNNEL_TOS.);
700 }
701 if (tb[NFTA_TUNNEL_KEY_TTLcxx . . $ NFTA_TUNNEL_KEY_TTL.]) {
702 tun->tun_ttlcxx . . $ nftnl_obj_tunnel#tun_ttl. = mnl_attr_get_u8cxx . . $ mnl_attr_get_u8(68d72702597f1127).(tb[NFTA_TUNNEL_KEY_TTLcxx . . $ NFTA_TUNNEL_KEY_TTL.]);
703 e->flagscxx . . $ nftnl_obj#flags. |= (1 << NFTNL_OBJ_TUNNEL_TTLcxx . . $ NFTNL_OBJ_TUNNEL_TTL.);
704 }
705 if (tb[NFTA_TUNNEL_KEY_FLAGScxx . . $ NFTA_TUNNEL_KEY_FLAGS.]) {
706 tun->tun_flagscxx . . $ nftnl_obj_tunnel#tun_flags. = mnl_attr_get_u8cxx . . $ mnl_attr_get_u8(68d72702597f1127).(tb[NFTA_TUNNEL_KEY_FLAGScxx . . $ NFTA_TUNNEL_KEY_FLAGS.]);
707 e->flagscxx . . $ nftnl_obj#flags. |= (1 << NFTNL_OBJ_TUNNEL_FLAGScxx . . $ NFTNL_OBJ_TUNNEL_FLAGS.);
708 }
709 if (tb[NFTA_TUNNEL_KEY_OPTScxx . . $ NFTA_TUNNEL_KEY_OPTS.]) {
710 err = nftnl_obj_tunnel_parse_optscxx . . $ nftnl_obj_tunnel_parse_opts(f88537db298080c9).(e, tb[NFTA_TUNNEL_KEY_OPTScxx . . $ NFTA_TUNNEL_KEY_OPTS.], tun);
711 if (err < 0)
712 return err;
713 }
714
715 return 0;
716 }
717
718 static int nftnl_obj_tunnel_snprintfcxx . . $ nftnl_obj_tunnel_snprintf(58da6fcd2536b16e).(char *buf, size_t len,
719 uint32_tcxx . . $ uint32_t# flags, const struct nftnl_objcxx . . $ nftnl_obj# *e)
720 {
721 struct nftnl_obj_tunnelcxx . . $ nftnl_obj_tunnel# *tun = nftnl_obj_datacxx . . $ `include/obj.h:117:9`!(e);
722
723 return snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf, len, "id %u ", tun->idcxx . . $ nftnl_obj_tunnel#id.);
724 }
725
726 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_tunnel_opts_alloc);
727 struct nftnl_tunnel_optscxx . . $ nftnl_tunnel_opts# *nftnl_tunnel_opts_alloccxx . . $ nftnl_tunnel_opts_alloc(d5e5f6c12db4c8a3).(enum nftnl_tunnel_typecxx . . $ nftnl_tunnel_type# type)
728 {
729 struct nftnl_tunnel_optscxx . . $ nftnl_tunnel_opts# *opts;
730
731 switch (type) {
732 case NFTNL_TUNNEL_TYPE_VXLANcxx . . $ NFTNL_TUNNEL_TYPE_VXLAN.:
733 case NFTNL_TUNNEL_TYPE_ERSPANcxx . . $ NFTNL_TUNNEL_TYPE_ERSPAN.:
734 case NFTNL_TUNNEL_TYPE_GENEVEcxx . . $ NFTNL_TUNNEL_TYPE_GENEVE.:
735 break;
736 default:
737 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!;
738 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
739 }
740
741 opts = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_tunnel_optscxx . . $ nftnl_tunnel_opts#));
742 if (!opts)
743 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
744
745 opts->typecxx . . $ nftnl_tunnel_opts#type. = type;
746 INIT_LIST_HEADcxx . . $ `include/linux_list.h:66:9`!(&opts->opts_list);
747
748 return opts;
749 }
750
751 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_tunnel_opts_add);
752 int nftnl_tunnel_opts_addcxx . . $ nftnl_tunnel_opts_add(d5e69efd7e5863fd).(struct nftnl_tunnel_optscxx . . $ nftnl_tunnel_opts# *opts,
753 struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *opt)
754 {
755 if (opt->typecxx . . $ nftnl_tunnel_opt#type. != opts->typecxx . . $ nftnl_tunnel_opts#type.) {
756 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!;
757 return -1;
758 }
759
760 switch (opts->typecxx . . $ nftnl_tunnel_opts#type.) {
761 case NFTNL_TUNNEL_TYPE_VXLANcxx . . $ NFTNL_TUNNEL_TYPE_VXLAN.:
762 case NFTNL_TUNNEL_TYPE_ERSPANcxx . . $ NFTNL_TUNNEL_TYPE_ERSPAN.:
763 if (opts->numcxx . . $ nftnl_tunnel_opts#num. > 0) {
764 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EEXISTcxx . . $ `<external>/8987895939074593727/errno-base.h:21:9`!;
765 return -1;
766 }
767 break;
768 case NFTNL_TUNNEL_TYPE_GENEVEcxx . . $ NFTNL_TUNNEL_TYPE_GENEVE.:
769 break;
770 default:
771 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!;
772 return -1;
773 }
774
775 list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(&opt->listcxx . . $ nftnl_tunnel_opt#list., &opts->opts_listcxx . . $ nftnl_tunnel_opts#opts_list.);
776
777 return 0;
778 }
779
780 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_tunnel_opts_free);
781 void nftnl_tunnel_opts_freecxx . . $ nftnl_tunnel_opts_free(b478d88dbab346e7).(struct nftnl_tunnel_optscxx . . $ nftnl_tunnel_opts# *opts)
782 {
783 struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *opt, *next;
784
785 list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(opt, next, &opts->opts_list, list) {
786 switch(opts->typecxx . . $ nftnl_tunnel_opts#type.) {
787 case NFTNL_TUNNEL_TYPE_VXLANcxx . . $ NFTNL_TUNNEL_TYPE_VXLAN.:
788 case NFTNL_TUNNEL_TYPE_ERSPANcxx . . $ NFTNL_TUNNEL_TYPE_ERSPAN.:
789 case NFTNL_TUNNEL_TYPE_GENEVEcxx . . $ NFTNL_TUNNEL_TYPE_GENEVE.:
790 list_delcxx . . $ list_del(35ab6d74de6aba0a).(&opt->listcxx . . $ nftnl_tunnel_opt#list.);
791 xfreecxx . . $ `include/utils.h:22:9`!(opt);
792 break;
793 }
794 }
795 }
796
797 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_tunnel_opt_alloc);
798 struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *nftnl_tunnel_opt_alloccxx . . $ nftnl_tunnel_opt_alloc(6b2c576aa125169b).(enum nftnl_tunnel_typecxx . . $ nftnl_tunnel_type# type)
799 {
800 struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *opt;
801
802 switch (type) {
803 case NFTNL_TUNNEL_TYPE_VXLANcxx . . $ NFTNL_TUNNEL_TYPE_VXLAN.:
804 case NFTNL_TUNNEL_TYPE_ERSPANcxx . . $ NFTNL_TUNNEL_TYPE_ERSPAN.:
805 case NFTNL_TUNNEL_TYPE_GENEVEcxx . . $ NFTNL_TUNNEL_TYPE_GENEVE.:
806 break;
807 default:
808 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!;
809 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
810 }
811
812 opt = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt#));
813 if (!opt)
814 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
815
816 opt->typecxx . . $ nftnl_tunnel_opt#type. = type;
817
818 return opt;
819 }
820
821 static int nftnl_tunnel_opt_vxlan_setcxx . . $ nftnl_tunnel_opt_vxlan_set(b533b55a9ee9aa66).(struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *opt, uint16_tcxx . . $ uint16_t# type,
822 const void *data, uint32_tcxx . . $ uint32_t# data_len)
823 {
824 switch (type) {
825 case NFTNL_TUNNEL_VXLAN_GBPcxx . . $ NFTNL_TUNNEL_VXLAN_GBP.:
826 memcpycxx . . $ memcpy(cc817cb175f282d).(&opt->vxlancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#vxlan..gbpcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_1#gbp., data, data_len);
827 break;
828 default:
829 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!;
830 return -1;
831 }
832
833 opt->flagscxx . . $ nftnl_tunnel_opt#flags. |= (1 << type);
834
835 return 0;
836 }
837
838 static int nftnl_tunnel_opt_erspan_setcxx . . $ nftnl_tunnel_opt_erspan_set(b533b55a9ee9aa66).(struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *opt, uint16_tcxx . . $ uint16_t# type,
839 const void *data, uint32_tcxx . . $ uint32_t# data_len)
840 {
841 switch (type) {
842 case NFTNL_TUNNEL_ERSPAN_VERSIONcxx . . $ NFTNL_TUNNEL_ERSPAN_VERSION.:
843 memcpycxx . . $ memcpy(cc817cb175f282d).(&opt->erspancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#erspan..versioncxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#version., data, data_len);
844 break;
845 case NFTNL_TUNNEL_ERSPAN_V1_INDEXcxx . . $ NFTNL_TUNNEL_ERSPAN_V1_INDEX.:
846 memcpycxx . . $ memcpy(cc817cb175f282d).(&opt->erspancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#erspan..v1cxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#v1..indexcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#$anonymous_type_3#index., data, data_len);
847 break;
848 case NFTNL_TUNNEL_ERSPAN_V2_HWIDcxx . . $ NFTNL_TUNNEL_ERSPAN_V2_HWID.:
849 memcpycxx . . $ memcpy(cc817cb175f282d).(&opt->erspancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#erspan..v2cxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#v2..hwidcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#$anonymous_type_4#hwid., data, data_len);
850 break;
851 case NFTNL_TUNNEL_ERSPAN_V2_DIRcxx . . $ NFTNL_TUNNEL_ERSPAN_V2_DIR.:
852 memcpycxx . . $ memcpy(cc817cb175f282d).(&opt->erspancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#erspan..v2cxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#v2..dircxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#$anonymous_type_4#dir., data, data_len);
853 break;
854 default:
855 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!;
856 return -1;
857 }
858
859 opt->flagscxx . . $ nftnl_tunnel_opt#flags. |= (1 << type);
860
861 return 0;
862 }
863
864 static int nftnl_tunnel_opt_geneve_setcxx . . $ nftnl_tunnel_opt_geneve_set(b533b55a9ee9aa66).(struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *opt, uint16_tcxx . . $ uint16_t# type,
865 const void *data, uint32_tcxx . . $ uint32_t# data_len)
866 {
867 switch(type) {
868 case NFTNL_TUNNEL_GENEVE_CLASScxx . . $ NFTNL_TUNNEL_GENEVE_CLASS.:
869 if (data_len != sizeof(uint16_tcxx . . $ uint16_t#)) {
870 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
871 return -1;
872 }
873 memcpycxx . . $ memcpy(cc817cb175f282d).(&opt->genevecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#geneve..geneve_classcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#geneve_class., data, data_len);
874 break;
875 case NFTNL_TUNNEL_GENEVE_TYPEcxx . . $ NFTNL_TUNNEL_GENEVE_TYPE.:
876 if (data_len != sizeof(uint8_tcxx . . $ uint8_t#)) {
877 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
878 return -1;
879 }
880 memcpycxx . . $ memcpy(cc817cb175f282d).(&opt->genevecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#geneve..typecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#type., data, data_len);
881 break;
882 case NFTNL_TUNNEL_GENEVE_DATAcxx . . $ NFTNL_TUNNEL_GENEVE_DATA.:
883 if (data_len > NFTNL_TUNNEL_GENEVE_DATA_MAXLENcxx . . $ `include/libnftnl/object.h:122:9`!) {
884 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
885 return -1;
886 }
887 memcpycxx . . $ memcpy(cc817cb175f282d).(&opt->genevecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#geneve..datacxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#data., data, data_len);
888 opt->genevecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#geneve..data_lencxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#data_len. = data_len;
889 break;
890 default:
891 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!;
892 return -1;
893 }
894
895 opt->flagscxx . . $ nftnl_tunnel_opt#flags. |= (1 << type);
896
897 return 0;
898 }
899
900 EXPORT_SYMBOLcxx . . $ `include/utils.h:14:10`!(nftnl_tunnel_opt_set);
901 int nftnl_tunnel_opt_setcxx . . $ nftnl_tunnel_opt_set(b533b55a9ee9aa66).(struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *opt, uint16_tcxx . . $ uint16_t# type,
902 const void *data, uint32_tcxx . . $ uint32_t# data_len)
903 {
904 switch (opt->typecxx . . $ nftnl_tunnel_opt#type.) {
905 case NFTNL_TUNNEL_TYPE_VXLANcxx . . $ NFTNL_TUNNEL_TYPE_VXLAN.:
906 return nftnl_tunnel_opt_vxlan_setcxx . . $ nftnl_tunnel_opt_vxlan_set(b533b55a9ee9aa66).(opt, type, data, data_len);
907 case NFTNL_TUNNEL_TYPE_ERSPANcxx . . $ NFTNL_TUNNEL_TYPE_ERSPAN.:
908 return nftnl_tunnel_opt_erspan_setcxx . . $ nftnl_tunnel_opt_erspan_set(b533b55a9ee9aa66).(opt, type, data, data_len);
909 case NFTNL_TUNNEL_TYPE_GENEVEcxx . . $ NFTNL_TUNNEL_TYPE_GENEVE.:
910 return nftnl_tunnel_opt_geneve_setcxx . . $ nftnl_tunnel_opt_geneve_set(b533b55a9ee9aa66).(opt, type, data, data_len);
911 default:
912 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!;
913 return -1;
914 }
915
916 return 0;
917 }
918
919 static void nftnl_tunnel_opt_build_vxlancxx . . $ nftnl_tunnel_opt_build_vxlan(f428bf4141f3b706).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh,
920 const struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *opt)
921 {
922 struct nlattrcxx . . $ nlattr# *nest_inner;
923
924 if (opt->flagscxx . . $ nftnl_tunnel_opt#flags. & (1 << NFTNL_TUNNEL_VXLAN_GBPcxx . . $ NFTNL_TUNNEL_VXLAN_GBP.)) {
925 nest_inner = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_TUNNEL_KEY_OPTS_VXLANcxx . . $ NFTA_TUNNEL_KEY_OPTS_VXLAN.);
926 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_TUNNEL_KEY_VXLAN_GBPcxx . . $ NFTA_TUNNEL_KEY_VXLAN_GBP.,
927 htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(opt->vxlan.gbp));
928 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest_inner);
929 }
930 }
931
932 static void nftnl_tunnel_opt_build_erspancxx . . $ nftnl_tunnel_opt_build_erspan(f428bf4141f3b706).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh,
933 const struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *opt)
934 {
935 struct nlattrcxx . . $ nlattr# *nest_inner;
936
937 if (opt->flagscxx . . $ nftnl_tunnel_opt#flags. & (1 << NFTNL_TUNNEL_ERSPAN_VERSIONcxx . . $ NFTNL_TUNNEL_ERSPAN_VERSION.) &&
938 (opt->flagscxx . . $ nftnl_tunnel_opt#flags. & (1 << NFTNL_TUNNEL_ERSPAN_V1_INDEXcxx . . $ NFTNL_TUNNEL_ERSPAN_V1_INDEX.) ||
939 (opt->flagscxx . . $ nftnl_tunnel_opt#flags. & (1 << NFTNL_TUNNEL_ERSPAN_V2_HWIDcxx . . $ NFTNL_TUNNEL_ERSPAN_V2_HWID.) &&
940 opt->flagscxx . . $ nftnl_tunnel_opt#flags. & (1 << NFTNL_TUNNEL_ERSPAN_V2_DIRcxx . . $ NFTNL_TUNNEL_ERSPAN_V2_DIR.)))) {
941 nest_inner = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_TUNNEL_KEY_OPTS_ERSPANcxx . . $ NFTA_TUNNEL_KEY_OPTS_ERSPAN.);
942 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_TUNNEL_KEY_ERSPAN_VERSIONcxx . . $ NFTA_TUNNEL_KEY_ERSPAN_VERSION.,
943 htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(opt->erspan.version));
944 if (opt->flagscxx . . $ nftnl_tunnel_opt#flags. & (1 << NFTNL_TUNNEL_ERSPAN_V1_INDEXcxx . . $ NFTNL_TUNNEL_ERSPAN_V1_INDEX.))
945 mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_TUNNEL_KEY_ERSPAN_V1_INDEXcxx . . $ NFTA_TUNNEL_KEY_ERSPAN_V1_INDEX.,
946 htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(opt->erspan.v1.index));
947 if (opt->flagscxx . . $ nftnl_tunnel_opt#flags. & (1 << NFTNL_TUNNEL_ERSPAN_V2_HWIDcxx . . $ NFTNL_TUNNEL_ERSPAN_V2_HWID.))
948 mnl_attr_put_u8cxx . . $ mnl_attr_put_u8(897b09f57801d77).(nlh, NFTA_TUNNEL_KEY_ERSPAN_V2_HWIDcxx . . $ NFTA_TUNNEL_KEY_ERSPAN_V2_HWID.,
949 opt->erspancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#erspan..v2cxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#v2..hwidcxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#$anonymous_type_4#hwid.);
950 if (opt->flagscxx . . $ nftnl_tunnel_opt#flags. & (1 << NFTNL_TUNNEL_ERSPAN_V2_DIRcxx . . $ NFTNL_TUNNEL_ERSPAN_V2_DIR.))
951 mnl_attr_put_u8cxx . . $ mnl_attr_put_u8(897b09f57801d77).(nlh, NFTA_TUNNEL_KEY_ERSPAN_V2_DIRcxx . . $ NFTA_TUNNEL_KEY_ERSPAN_V2_DIR.,
952 opt->erspancxx . . $ nftnl_tunnel_opt#$anonymous_type_0#erspan..v2cxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#v2..dircxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_2#$anonymous_type_4#dir.);
953 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest_inner);
954 }
955 }
956
957 static void nftnl_tunnel_opt_build_genevecxx . . $ nftnl_tunnel_opt_build_geneve(f428bf4141f3b706).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh,
958 const struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *opt)
959 {
960 struct nlattrcxx . . $ nlattr# *nest_inner;
961
962 if (opt->flagscxx . . $ nftnl_tunnel_opt#flags. & (1 << NFTNL_TUNNEL_GENEVE_CLASScxx . . $ NFTNL_TUNNEL_GENEVE_CLASS.) &&
963 opt->flagscxx . . $ nftnl_tunnel_opt#flags. & (1 << NFTNL_TUNNEL_GENEVE_TYPEcxx . . $ NFTNL_TUNNEL_GENEVE_TYPE.) &&
964 opt->flagscxx . . $ nftnl_tunnel_opt#flags. & (1 << NFTNL_TUNNEL_GENEVE_DATAcxx . . $ NFTNL_TUNNEL_GENEVE_DATA.)) {
965 nest_inner = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_TUNNEL_KEY_OPTS_GENEVEcxx . . $ NFTA_TUNNEL_KEY_OPTS_GENEVE.);
966 mnl_attr_put_u16cxx . . $ mnl_attr_put_u16(951fb5ebe92f4b45).(nlh, NFTA_TUNNEL_KEY_GENEVE_CLASScxx . . $ NFTA_TUNNEL_KEY_GENEVE_CLASS.,
967 htonscxx . . $ `<external>/9581057695539925927/in.h:431:12`!(opt->geneve.geneve_class));
968 mnl_attr_put_u8cxx . . $ mnl_attr_put_u8(897b09f57801d77).(nlh, NFTA_TUNNEL_KEY_GENEVE_TYPEcxx . . $ NFTA_TUNNEL_KEY_GENEVE_TYPE.,
969 opt->genevecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#geneve..typecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#type.);
970 mnl_attr_putcxx . . $ mnl_attr_put(612d908c39ff741d).(nlh, NFTA_TUNNEL_KEY_GENEVE_DATAcxx . . $ NFTA_TUNNEL_KEY_GENEVE_DATA.,
971 opt->genevecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#geneve..data_lencxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#data_len.,
972 opt->genevecxx . . $ nftnl_tunnel_opt#$anonymous_type_0#geneve..datacxx . . $ nftnl_tunnel_opt#$anonymous_type_0#$anonymous_type_5#data.);
973 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest_inner);
974 }
975 }
976
977 void nftnl_tunnel_opts_buildcxx . . $ nftnl_tunnel_opts_build(62a92ac34af48c74).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh,
978 struct nftnl_tunnel_optscxx . . $ nftnl_tunnel_opts# *opts)
979 {
980 const struct nftnl_tunnel_optcxx . . $ nftnl_tunnel_opt# *opt;
981 struct nlattrcxx . . $ nlattr# *nest;
982
983 nest = mnl_attr_nest_startcxx . . $ mnl_attr_nest_start(c8ed348a075426e7).(nlh, NFTA_TUNNEL_KEY_OPTScxx . . $ NFTA_TUNNEL_KEY_OPTS.);
984
985 list_for_each_entrycxx . . $ `include/linux_list.h:384:9`!(opt, &opts->opts_list, list) {
986 switch (opts->typecxx . . $ nftnl_tunnel_opts#type.) {
987 case NFTNL_TUNNEL_TYPE_VXLANcxx . . $ NFTNL_TUNNEL_TYPE_VXLAN.:
988 nftnl_tunnel_opt_build_vxlancxx . . $ nftnl_tunnel_opt_build_vxlan(f428bf4141f3b706).(nlh, opt);
989 break;
990 case NFTNL_TUNNEL_TYPE_ERSPANcxx . . $ NFTNL_TUNNEL_TYPE_ERSPAN.:
991 nftnl_tunnel_opt_build_erspancxx . . $ nftnl_tunnel_opt_build_erspan(f428bf4141f3b706).(nlh, opt);
992 break;
993 case NFTNL_TUNNEL_TYPE_GENEVEcxx . . $ NFTNL_TUNNEL_TYPE_GENEVE.:
994 nftnl_tunnel_opt_build_genevecxx . . $ nftnl_tunnel_opt_build_geneve(f428bf4141f3b706).(nlh, opt);
995 break;
996 }
997 }
998 mnl_attr_nest_endcxx . . $ mnl_attr_nest_end(564f73625c62ba58).(nlh, nest);
999 }
1000
1001 static struct attr_policycxx . . $ attr_policy# obj_tunnel_attr_policycxx . . $ obj_tunnel_attr_policy.[__NFTNL_OBJ_TUNNEL_MAXcxx . . $ __NFTNL_OBJ_TUNNEL_MAX.] = {
1002 [NFTNL_OBJ_TUNNEL_IDcxx . . $ NFTNL_OBJ_TUNNEL_ID.] = { .maxlen = sizeof(uint32_tcxx . . $ uint32_t#) },
1003 [NFTNL_OBJ_TUNNEL_IPV4_SRCcxx . . $ NFTNL_OBJ_TUNNEL_IPV4_SRC.] = { .maxlen = sizeof(uint32_tcxx . . $ uint32_t#) },
1004 [NFTNL_OBJ_TUNNEL_IPV4_DSTcxx . . $ NFTNL_OBJ_TUNNEL_IPV4_DST.] = { .maxlen = sizeof(uint32_tcxx . . $ uint32_t#) },
1005 [NFTNL_OBJ_TUNNEL_IPV6_SRCcxx . . $ NFTNL_OBJ_TUNNEL_IPV6_SRC.] = { .maxlen = sizeof(struct in6_addrcxx . . $ in6_addr#) },
1006 [NFTNL_OBJ_TUNNEL_IPV6_DSTcxx . . $ NFTNL_OBJ_TUNNEL_IPV6_DST.] = { .maxlen = sizeof(struct in6_addrcxx . . $ in6_addr#) },
1007 [NFTNL_OBJ_TUNNEL_IPV6_FLOWLABELcxx . . $ NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL.] = { .maxlen = sizeof(uint32_tcxx . . $ uint32_t#) },
1008 [NFTNL_OBJ_TUNNEL_SPORTcxx . . $ NFTNL_OBJ_TUNNEL_SPORT.] = { .maxlen = sizeof(uint16_tcxx . . $ uint16_t#) },
1009 [NFTNL_OBJ_TUNNEL_DPORTcxx . . $ NFTNL_OBJ_TUNNEL_DPORT.] = { .maxlen = sizeof(uint16_tcxx . . $ uint16_t#) },
1010 [NFTNL_OBJ_TUNNEL_FLAGScxx . . $ NFTNL_OBJ_TUNNEL_FLAGS.] = { .maxlen = sizeof(uint32_tcxx . . $ uint32_t#) },
1011 [NFTNL_OBJ_TUNNEL_TOScxx . . $ NFTNL_OBJ_TUNNEL_TOS.] = { .maxlen = sizeof(uint8_tcxx . . $ uint8_t#) },
1012 [NFTNL_OBJ_TUNNEL_TTLcxx . . $ NFTNL_OBJ_TUNNEL_TTL.] = { .maxlen = sizeof(uint8_tcxx . . $ uint8_t#) },
1013 [NFTNL_OBJ_TUNNEL_OPTScxx . . $ NFTNL_OBJ_TUNNEL_OPTS.] = { .maxlen = sizeof(struct nftnl_tunnel_optscxx . . $ nftnl_tunnel_opts# *) },
1014 };
1015
1016 struct obj_opscxx . . $ obj_ops# obj_ops_tunnelcxx . . $ obj_ops_tunnel. = {
1017 .name = "tunnel",
1018 .type = NFT_OBJECT_TUNNELcxx . . $ `include/linux/netfilter/nf_tables.h:1664:9`!,
1019 .alloc_len = sizeof(struct nftnl_obj_tunnelcxx . . $ nftnl_obj_tunnel#),
1020 .nftnl_max_attr = __NFTNL_OBJ_TUNNEL_MAXcxx . . $ __NFTNL_OBJ_TUNNEL_MAX. - 1,
1021 .attr_policy = obj_tunnel_attr_policycxx . . $ obj_tunnel_attr_policy.,
1022 .set = nftnl_obj_tunnel_setcxx . . $ nftnl_obj_tunnel_set(96c901c785434bf1).,
1023 .get = nftnl_obj_tunnel_getcxx . . $ nftnl_obj_tunnel_get(d22e54b888e7c4b).,
1024 .parse = nftnl_obj_tunnel_parsecxx . . $ nftnl_obj_tunnel_parse(f22ac2b7a2342b3a).,
1025 .build = nftnl_obj_tunnel_buildcxx . . $ nftnl_obj_tunnel_build(3650aba98805b449).,
1026 .output = nftnl_obj_tunnel_snprintfcxx . . $ nftnl_obj_tunnel_snprintf(58da6fcd2536b16e).,
1027 };