10 #include "internal/internal.h"
12 static const void *get_attr_orig_ipv4_src(
const struct nf_conntrack *ct)
14 return &ct->head.orig.src.v4;
17 static const void *get_attr_orig_ipv4_dst(
const struct nf_conntrack *ct)
19 return &ct->head.orig.dst.v4;
22 static const void *get_attr_repl_ipv4_src(
const struct nf_conntrack *ct)
24 return &ct->repl.src.v4;
27 static const void *get_attr_repl_ipv4_dst(
const struct nf_conntrack *ct)
29 return &ct->repl.dst.v4;
32 static const void *get_attr_orig_ipv6_src(
const struct nf_conntrack *ct)
34 return &ct->head.orig.src.v6;
37 static const void *get_attr_orig_ipv6_dst(
const struct nf_conntrack *ct)
39 return &ct->head.orig.dst.v6;
42 static const void *get_attr_repl_ipv6_src(
const struct nf_conntrack *ct)
44 return &ct->repl.src.v6;
47 static const void *get_attr_repl_ipv6_dst(
const struct nf_conntrack *ct)
49 return &ct->repl.dst.v6;
52 static const void *get_attr_orig_port_src(
const struct nf_conntrack *ct)
54 return &ct->head.orig.l4src.all;
57 static const void *get_attr_orig_port_dst(
const struct nf_conntrack *ct)
59 return &ct->head.orig.l4dst.all;
62 static const void *get_attr_repl_port_src(
const struct nf_conntrack *ct)
64 return &ct->repl.l4src.all;
67 static const void *get_attr_repl_port_dst(
const struct nf_conntrack *ct)
69 return &ct->repl.l4dst.all;
72 static const void *get_attr_orig_zone(
const struct nf_conntrack *ct)
74 return &ct->head.orig.zone;
77 static const void *get_attr_repl_zone(
const struct nf_conntrack *ct)
79 return &ct->repl.zone;
82 static const void *get_attr_icmp_type(
const struct nf_conntrack *ct)
84 return &ct->head.orig.l4dst.icmp.type;
87 static const void *get_attr_icmp_code(
const struct nf_conntrack *ct)
89 return &ct->head.orig.l4dst.icmp.code;
92 static const void *get_attr_icmp_id(
const struct nf_conntrack *ct)
94 return &ct->head.orig.l4src.icmp.id;
97 static const void *get_attr_orig_l3proto(
const struct nf_conntrack *ct)
99 return &ct->head.orig.l3protonum;
102 static const void *get_attr_repl_l3proto(
const struct nf_conntrack *ct)
104 return &ct->repl.l3protonum;
107 static const void *get_attr_orig_l4proto(
const struct nf_conntrack *ct)
109 return &ct->head.orig.protonum;
112 static const void *get_attr_repl_l4proto(
const struct nf_conntrack *ct)
114 return &ct->repl.protonum;
117 static const void *get_attr_master_ipv4_src(
const struct nf_conntrack *ct)
119 return &ct->master.src.v4;
122 static const void *get_attr_master_ipv4_dst(
const struct nf_conntrack *ct)
124 return &ct->master.dst.v4;
127 static const void *get_attr_master_ipv6_src(
const struct nf_conntrack *ct)
129 return &ct->master.src.v6;
132 static const void *get_attr_master_ipv6_dst(
const struct nf_conntrack *ct)
134 return &ct->master.dst.v6;
137 static const void *get_attr_master_port_src(
const struct nf_conntrack *ct)
139 return &ct->master.l4src.all;
142 static const void *get_attr_master_port_dst(
const struct nf_conntrack *ct)
144 return &ct->master.l4dst.all;
147 static const void *get_attr_master_l3proto(
const struct nf_conntrack *ct)
149 return &ct->master.l3protonum;
152 static const void *get_attr_master_l4proto(
const struct nf_conntrack *ct)
154 return &ct->master.protonum;
157 static const void *get_attr_tcp_state(
const struct nf_conntrack *ct)
159 return &ct->protoinfo.tcp.state;
162 static const void *get_attr_tcp_flags_orig(
const struct nf_conntrack *ct)
164 return &ct->protoinfo.tcp.flags[__DIR_ORIG].value;
167 static const void *get_attr_tcp_mask_orig(
const struct nf_conntrack *ct)
169 return &ct->protoinfo.tcp.flags[__DIR_ORIG].mask;
172 static const void *get_attr_tcp_flags_repl(
const struct nf_conntrack *ct)
174 return &ct->protoinfo.tcp.flags[__DIR_REPL].value;
177 static const void *get_attr_tcp_mask_repl(
const struct nf_conntrack *ct)
179 return &ct->protoinfo.tcp.flags[__DIR_REPL].mask;
182 static const void *get_attr_tcp_wscale_orig(
const struct nf_conntrack *ct)
184 return &ct->protoinfo.tcp.wscale[__DIR_ORIG];
187 static const void *get_attr_tcp_wscale_repl(
const struct nf_conntrack *ct)
189 return &ct->protoinfo.tcp.wscale[__DIR_REPL];
192 static const void *get_attr_sctp_state(
const struct nf_conntrack *ct)
194 return &ct->protoinfo.sctp.state;
197 static const void *get_attr_sctp_vtag_orig(
const struct nf_conntrack *ct)
199 return &ct->protoinfo.sctp.vtag[__DIR_ORIG];
202 static const void *get_attr_sctp_vtag_repl(
const struct nf_conntrack *ct)
204 return &ct->protoinfo.sctp.vtag[__DIR_REPL];
207 static const void *get_attr_snat_ipv4(
const struct nf_conntrack *ct)
209 return &ct->snat.min_ip.v4;
212 static const void *get_attr_dnat_ipv4(
const struct nf_conntrack *ct)
214 return &ct->dnat.min_ip.v4;
217 static const void *get_attr_snat_ipv6(
const struct nf_conntrack *ct)
219 return &ct->snat.min_ip.v6;
222 static const void *get_attr_dnat_ipv6(
const struct nf_conntrack *ct)
224 return &ct->dnat.min_ip.v6;
227 static const void *get_attr_snat_port(
const struct nf_conntrack *ct)
229 return &ct->snat.l4min.all;
232 static const void *get_attr_dnat_port(
const struct nf_conntrack *ct)
234 return &ct->dnat.l4min.all;
237 static const void *get_attr_timeout(
const struct nf_conntrack *ct)
242 static const void *get_attr_mark(
const struct nf_conntrack *ct)
247 static const void *get_attr_secmark(
const struct nf_conntrack *ct)
252 static const void *get_attr_orig_counter_packets(
const struct nf_conntrack *ct)
254 return &ct->counters[__DIR_ORIG].packets;
257 static const void *get_attr_orig_counter_bytes(
const struct nf_conntrack *ct)
259 return &ct->counters[__DIR_ORIG].bytes;
262 static const void *get_attr_repl_counter_packets(
const struct nf_conntrack *ct)
264 return &ct->counters[__DIR_REPL].packets;
267 static const void *get_attr_repl_counter_bytes(
const struct nf_conntrack *ct)
269 return &ct->counters[__DIR_REPL].bytes;
272 static const void *get_attr_status(
const struct nf_conntrack *ct)
277 static const void *get_attr_use(
const struct nf_conntrack *ct)
282 static const void *get_attr_id(
const struct nf_conntrack *ct)
287 static const void *get_attr_orig_cor_pos(
const struct nf_conntrack *ct)
289 return &ct->natseq[__DIR_ORIG].correction_pos;
292 static const void *get_attr_orig_off_bfr(
const struct nf_conntrack *ct)
294 return &ct->natseq[__DIR_ORIG].offset_before;
297 static const void *get_attr_orig_off_aft(
const struct nf_conntrack *ct)
299 return &ct->natseq[__DIR_ORIG].offset_after;
302 static const void *get_attr_repl_cor_pos(
const struct nf_conntrack *ct)
304 return &ct->natseq[__DIR_REPL].correction_pos;
307 static const void *get_attr_repl_off_bfr(
const struct nf_conntrack *ct)
309 return &ct->natseq[__DIR_REPL].offset_before;
312 static const void *get_attr_repl_off_aft(
const struct nf_conntrack *ct)
314 return &ct->natseq[__DIR_REPL].offset_after;
317 static const void *get_attr_helper_name(
const struct nf_conntrack *ct)
319 return ct->helper_name;
322 static const void *get_attr_dccp_state(
const struct nf_conntrack *ct)
324 return &ct->protoinfo.dccp.state;
327 static const void *get_attr_dccp_role(
const struct nf_conntrack *ct)
329 return &ct->protoinfo.dccp.role;
332 static const void *get_attr_dccp_handshake_seq(
const struct nf_conntrack *ct)
334 return &ct->protoinfo.dccp.handshake_seq;
337 static const void *get_attr_zone(
const struct nf_conntrack *ct)
342 static const void *get_attr_secctx(
const struct nf_conntrack *ct)
347 static const void *get_attr_timestamp_start(
const struct nf_conntrack *ct)
349 return &ct->timestamp.start;
352 static const void *get_attr_timestamp_stop(
const struct nf_conntrack *ct)
354 return &ct->timestamp.stop;
357 static const void *get_attr_helper_info(
const struct nf_conntrack *ct)
359 return ct->helper_info;
362 static const void *get_attr_connlabels(
const struct nf_conntrack *ct)
364 return ct->connlabels;
367 static const void *get_attr_connlabels_mask(
const struct nf_conntrack *ct)
369 return ct->connlabels_mask;
372 const get_attr get_attr_array[ATTR_MAX] = {
373 [ATTR_ORIG_IPV4_SRC] = get_attr_orig_ipv4_src,
374 [ATTR_ORIG_IPV4_DST] = get_attr_orig_ipv4_dst,
375 [ATTR_REPL_IPV4_SRC] = get_attr_repl_ipv4_src,
376 [ATTR_REPL_IPV4_DST] = get_attr_repl_ipv4_dst,
377 [ATTR_ORIG_IPV6_SRC] = get_attr_orig_ipv6_src,
378 [ATTR_ORIG_IPV6_DST] = get_attr_orig_ipv6_dst,
379 [ATTR_REPL_IPV6_SRC] = get_attr_repl_ipv6_src,
380 [ATTR_REPL_IPV6_DST] = get_attr_repl_ipv6_dst,
381 [ATTR_ORIG_PORT_SRC] = get_attr_orig_port_src,
382 [ATTR_ORIG_PORT_DST] = get_attr_orig_port_dst,
383 [ATTR_REPL_PORT_SRC] = get_attr_repl_port_src,
384 [ATTR_REPL_PORT_DST] = get_attr_repl_port_dst,
385 [ATTR_ICMP_TYPE] = get_attr_icmp_type,
386 [ATTR_ICMP_CODE] = get_attr_icmp_code,
387 [ATTR_ICMP_ID] = get_attr_icmp_id,
388 [ATTR_ORIG_L3PROTO] = get_attr_orig_l3proto,
389 [ATTR_REPL_L3PROTO] = get_attr_repl_l3proto,
390 [ATTR_ORIG_L4PROTO] = get_attr_orig_l4proto,
391 [ATTR_REPL_L4PROTO] = get_attr_repl_l4proto,
392 [ATTR_TCP_STATE] = get_attr_tcp_state,
393 [ATTR_SNAT_IPV4] = get_attr_snat_ipv4,
394 [ATTR_DNAT_IPV4] = get_attr_dnat_ipv4,
395 [ATTR_SNAT_PORT] = get_attr_snat_port,
396 [ATTR_DNAT_PORT] = get_attr_dnat_port,
397 [ATTR_TIMEOUT] = get_attr_timeout,
398 [ATTR_MARK] = get_attr_mark,
399 [ATTR_ORIG_COUNTER_PACKETS] = get_attr_orig_counter_packets,
400 [ATTR_ORIG_COUNTER_BYTES] = get_attr_orig_counter_bytes,
401 [ATTR_REPL_COUNTER_PACKETS] = get_attr_repl_counter_packets,
402 [ATTR_REPL_COUNTER_BYTES] = get_attr_repl_counter_bytes,
403 [ATTR_USE] = get_attr_use,
404 [ATTR_ID] = get_attr_id,
405 [ATTR_STATUS] = get_attr_status,
406 [ATTR_TCP_FLAGS_ORIG] = get_attr_tcp_flags_orig,
407 [ATTR_TCP_FLAGS_REPL] = get_attr_tcp_flags_repl,
408 [ATTR_TCP_MASK_ORIG] = get_attr_tcp_mask_orig,
409 [ATTR_TCP_MASK_REPL] = get_attr_tcp_mask_repl,
410 [ATTR_MASTER_IPV4_SRC] = get_attr_master_ipv4_src,
411 [ATTR_MASTER_IPV4_DST] = get_attr_master_ipv4_dst,
412 [ATTR_MASTER_IPV6_SRC] = get_attr_master_ipv6_src,
413 [ATTR_MASTER_IPV6_DST] = get_attr_master_ipv6_dst,
414 [ATTR_MASTER_PORT_SRC] = get_attr_master_port_src,
415 [ATTR_MASTER_PORT_DST] = get_attr_master_port_dst,
416 [ATTR_MASTER_L3PROTO] = get_attr_master_l3proto,
417 [ATTR_MASTER_L4PROTO] = get_attr_master_l4proto,
418 [ATTR_SECMARK] = get_attr_secmark,
419 [ATTR_ORIG_NAT_SEQ_CORRECTION_POS] = get_attr_orig_cor_pos,
420 [ATTR_ORIG_NAT_SEQ_OFFSET_BEFORE] = get_attr_orig_off_bfr,
421 [ATTR_ORIG_NAT_SEQ_OFFSET_AFTER] = get_attr_orig_off_aft,
422 [ATTR_REPL_NAT_SEQ_CORRECTION_POS] = get_attr_repl_cor_pos,
423 [ATTR_REPL_NAT_SEQ_OFFSET_BEFORE] = get_attr_repl_off_bfr,
424 [ATTR_REPL_NAT_SEQ_OFFSET_AFTER] = get_attr_repl_off_aft,
425 [ATTR_SCTP_STATE] = get_attr_sctp_state,
426 [ATTR_SCTP_VTAG_ORIG] = get_attr_sctp_vtag_orig,
427 [ATTR_SCTP_VTAG_REPL] = get_attr_sctp_vtag_repl,
428 [ATTR_HELPER_NAME] = get_attr_helper_name,
429 [ATTR_DCCP_STATE] = get_attr_dccp_state,
430 [ATTR_DCCP_ROLE] = get_attr_dccp_role,
431 [ATTR_DCCP_HANDSHAKE_SEQ] = get_attr_dccp_handshake_seq,
432 [ATTR_TCP_WSCALE_ORIG] = get_attr_tcp_wscale_orig,
433 [ATTR_TCP_WSCALE_REPL] = get_attr_tcp_wscale_repl,
434 [ATTR_ZONE] = get_attr_zone,
435 [ATTR_ORIG_ZONE] = get_attr_orig_zone,
436 [ATTR_REPL_ZONE] = get_attr_repl_zone,
437 [ATTR_SECCTX] = get_attr_secctx,
438 [ATTR_TIMESTAMP_START] = get_attr_timestamp_start,
439 [ATTR_TIMESTAMP_STOP] = get_attr_timestamp_stop,
440 [ATTR_HELPER_INFO] = get_attr_helper_info,
441 [ATTR_CONNLABELS] = get_attr_connlabels,
442 [ATTR_CONNLABELS_MASK] = get_attr_connlabels_mask,
443 [ATTR_SNAT_IPV6] = get_attr_snat_ipv6,
444 [ATTR_DNAT_IPV6] = get_attr_dnat_ipv6,