| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */cxx . . $ `<file>/src/expr/payload.c`/ |
| 2 | /* |
| 3 | * (C) 2012 by Pablo Neira Ayuso <[email protected]> |
| 4 | * |
| 5 | * This code has been sponsored by Sophos Astaro <http://www.sophos.com> |
| 6 | */ |
| 7 | |
| 8 | #include "internal.h"cxx . . $ `<file>/include/internal.h`/ |
| 9 | |
| 10 | #include <stdio.h> |
| 11 | #include <stdint.h> |
| 12 | #include <string.h> |
| 13 | #include <limits.h> |
| 14 | #include <arpa/inet.h> |
| 15 | #include <errno.h> |
| 16 | #include <libmnl/libmnl.h> |
| 17 | |
| 18 | #include <linux/netfilter/nf_tables.h>cxx . . $ `<file>/include/linux/netfilter/nf_tables.h`/ |
| 19 | |
| 20 | #include <libnftnl/expr.h>cxx . . $ `<file>/include/libnftnl/expr.h`/ |
| 21 | #include <libnftnl/rule.h>cxx . . $ `<file>/include/libnftnl/rule.h`/ |
| 22 | |
| 23 | struct nftnl_expr_payloadcxx . . $ nftnl_expr_payload# { |
| 24 | enum nft_registerscxx . . $ nft_registers# sregcxx . . $ nftnl_expr_payload#sreg.; |
| 25 | enum nft_registerscxx . . $ nft_registers# dregcxx . . $ nftnl_expr_payload#dreg.; |
| 26 | enum nft_payload_basescxx . . $ nft_payload_bases# basecxx . . $ nftnl_expr_payload#base.; |
| 27 | uint32_tcxx . . $ uint32_t# offsetcxx . . $ nftnl_expr_payload#offset.; |
| 28 | uint32_tcxx . . $ uint32_t# lencxx . . $ nftnl_expr_payload#len.; |
| 29 | uint32_tcxx . . $ uint32_t# csum_typecxx . . $ nftnl_expr_payload#csum_type.; |
| 30 | uint32_tcxx . . $ uint32_t# csum_offsetcxx . . $ nftnl_expr_payload#csum_offset.; |
| 31 | uint32_tcxx . . $ uint32_t# csum_flagscxx . . $ nftnl_expr_payload#csum_flags.; |
| 32 | }; |
| 33 | |
| 34 | static int |
| 35 | nftnl_expr_payload_setcxx . . $ nftnl_expr_payload_set(211371a3e3842127).(struct nftnl_exprcxx . . $ nftnl_expr# *e, uint16_tcxx . . $ uint16_t# type, |
| 36 | const void *data, uint32_tcxx . . $ uint32_t# data_len, uint32_tcxx . . $ uint32_t# byteorder) |
| 37 | { |
| 38 | struct nftnl_expr_payloadcxx . . $ nftnl_expr_payload# *payload = nftnl_expr_datacxx . . $ `include/expr_ops.h:31:9`!(e); |
| 39 | |
| 40 | switch(type) { |
| 41 | case NFTNL_EXPR_PAYLOAD_SREGcxx . . $ NFTNL_EXPR_PAYLOAD_SREG.: |
| 42 | memcpycxx . . $ memcpy(cc817cb175f282d).(&payload->sregcxx . . $ nftnl_expr_payload#sreg., data, data_len); |
| 43 | break; |
| 44 | case NFTNL_EXPR_PAYLOAD_DREGcxx . . $ NFTNL_EXPR_PAYLOAD_DREG.: |
| 45 | memcpycxx . . $ memcpy(cc817cb175f282d).(&payload->dregcxx . . $ nftnl_expr_payload#dreg., data, data_len); |
| 46 | break; |
| 47 | case NFTNL_EXPR_PAYLOAD_BASEcxx . . $ NFTNL_EXPR_PAYLOAD_BASE.: |
| 48 | memcpycxx . . $ memcpy(cc817cb175f282d).(&payload->basecxx . . $ nftnl_expr_payload#base., data, data_len); |
| 49 | break; |
| 50 | case NFTNL_EXPR_PAYLOAD_OFFSETcxx . . $ NFTNL_EXPR_PAYLOAD_OFFSET.: |
| 51 | memcpycxx . . $ memcpy(cc817cb175f282d).(&payload->offsetcxx . . $ nftnl_expr_payload#offset., data, data_len); |
| 52 | break; |
| 53 | case NFTNL_EXPR_PAYLOAD_LENcxx . . $ NFTNL_EXPR_PAYLOAD_LEN.: |
| 54 | memcpycxx . . $ memcpy(cc817cb175f282d).(&payload->lencxx . . $ nftnl_expr_payload#len., data, data_len); |
| 55 | break; |
| 56 | case NFTNL_EXPR_PAYLOAD_CSUM_TYPEcxx . . $ NFTNL_EXPR_PAYLOAD_CSUM_TYPE.: |
| 57 | memcpycxx . . $ memcpy(cc817cb175f282d).(&payload->csum_typecxx . . $ nftnl_expr_payload#csum_type., data, data_len); |
| 58 | break; |
| 59 | case NFTNL_EXPR_PAYLOAD_CSUM_OFFSETcxx . . $ NFTNL_EXPR_PAYLOAD_CSUM_OFFSET.: |
| 60 | memcpycxx . . $ memcpy(cc817cb175f282d).(&payload->csum_offsetcxx . . $ nftnl_expr_payload#csum_offset., data, data_len); |
| 61 | break; |
| 62 | case NFTNL_EXPR_PAYLOAD_FLAGScxx . . $ NFTNL_EXPR_PAYLOAD_FLAGS.: |
| 63 | memcpycxx . . $ memcpy(cc817cb175f282d).(&payload->csum_flagscxx . . $ nftnl_expr_payload#csum_flags., data, data_len); |
| 64 | break; |
| 65 | } |
| 66 | return 0; |
| 67 | } |
| 68 | |
| 69 | static const void * |
| 70 | nftnl_expr_payload_getcxx . . $ nftnl_expr_payload_get(9de263c4f9e71c4b).(const struct nftnl_exprcxx . . $ nftnl_expr# *e, uint16_tcxx . . $ uint16_t# type, |
| 71 | uint32_tcxx . . $ uint32_t# *data_len) |
| 72 | { |
| 73 | struct nftnl_expr_payloadcxx . . $ nftnl_expr_payload# *payload = nftnl_expr_datacxx . . $ `include/expr_ops.h:31:9`!(e); |
| 74 | |
| 75 | switch(type) { |
| 76 | case NFTNL_EXPR_PAYLOAD_SREGcxx . . $ NFTNL_EXPR_PAYLOAD_SREG.: |
| 77 | *data_len = sizeof(payload->sregcxx . . $ nftnl_expr_payload#sreg.); |
| 78 | return &payload->sregcxx . . $ nftnl_expr_payload#sreg.; |
| 79 | case NFTNL_EXPR_PAYLOAD_DREGcxx . . $ NFTNL_EXPR_PAYLOAD_DREG.: |
| 80 | *data_len = sizeof(payload->dregcxx . . $ nftnl_expr_payload#dreg.); |
| 81 | return &payload->dregcxx . . $ nftnl_expr_payload#dreg.; |
| 82 | case NFTNL_EXPR_PAYLOAD_BASEcxx . . $ NFTNL_EXPR_PAYLOAD_BASE.: |
| 83 | *data_len = sizeof(payload->basecxx . . $ nftnl_expr_payload#base.); |
| 84 | return &payload->basecxx . . $ nftnl_expr_payload#base.; |
| 85 | case NFTNL_EXPR_PAYLOAD_OFFSETcxx . . $ NFTNL_EXPR_PAYLOAD_OFFSET.: |
| 86 | *data_len = sizeof(payload->offsetcxx . . $ nftnl_expr_payload#offset.); |
| 87 | return &payload->offsetcxx . . $ nftnl_expr_payload#offset.; |
| 88 | case NFTNL_EXPR_PAYLOAD_LENcxx . . $ NFTNL_EXPR_PAYLOAD_LEN.: |
| 89 | *data_len = sizeof(payload->lencxx . . $ nftnl_expr_payload#len.); |
| 90 | return &payload->lencxx . . $ nftnl_expr_payload#len.; |
| 91 | case NFTNL_EXPR_PAYLOAD_CSUM_TYPEcxx . . $ NFTNL_EXPR_PAYLOAD_CSUM_TYPE.: |
| 92 | *data_len = sizeof(payload->csum_typecxx . . $ nftnl_expr_payload#csum_type.); |
| 93 | return &payload->csum_typecxx . . $ nftnl_expr_payload#csum_type.; |
| 94 | case NFTNL_EXPR_PAYLOAD_CSUM_OFFSETcxx . . $ NFTNL_EXPR_PAYLOAD_CSUM_OFFSET.: |
| 95 | *data_len = sizeof(payload->csum_offsetcxx . . $ nftnl_expr_payload#csum_offset.); |
| 96 | return &payload->csum_offsetcxx . . $ nftnl_expr_payload#csum_offset.; |
| 97 | case NFTNL_EXPR_PAYLOAD_FLAGScxx . . $ NFTNL_EXPR_PAYLOAD_FLAGS.: |
| 98 | *data_len = sizeof(payload->csum_flagscxx . . $ nftnl_expr_payload#csum_flags.); |
| 99 | return &payload->csum_flagscxx . . $ nftnl_expr_payload#csum_flags.; |
| 100 | } |
| 101 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 102 | } |
| 103 | |
| 104 | static int nftnl_expr_payload_cbcxx . . $ nftnl_expr_payload_cb(de2ef18c48fd675c).(const struct nlattrcxx . . $ nlattr# *attr, void *data) |
| 105 | { |
| 106 | const struct nlattrcxx . . $ nlattr# **tb = data; |
| 107 | int type = mnl_attr_get_typecxx . . $ mnl_attr_get_type(1da47bcc4c4b975).(attr); |
| 108 | |
| 109 | if (mnl_attr_type_validcxx . . $ mnl_attr_type_valid(47df1cce1c7be855).(attr, NFTA_PAYLOAD_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:874:9`!) < 0) |
| 110 | return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!; |
| 111 | |
| 112 | switch(type) { |
| 113 | case NFTA_PAYLOAD_SREGcxx . . $ NFTA_PAYLOAD_SREG.: |
| 114 | case NFTA_PAYLOAD_DREGcxx . . $ NFTA_PAYLOAD_DREG.: |
| 115 | case NFTA_PAYLOAD_BASEcxx . . $ NFTA_PAYLOAD_BASE.: |
| 116 | case NFTA_PAYLOAD_OFFSETcxx . . $ NFTA_PAYLOAD_OFFSET.: |
| 117 | case NFTA_PAYLOAD_LENcxx . . $ NFTA_PAYLOAD_LEN.: |
| 118 | case NFTA_PAYLOAD_CSUM_TYPEcxx . . $ NFTA_PAYLOAD_CSUM_TYPE.: |
| 119 | case NFTA_PAYLOAD_CSUM_OFFSETcxx . . $ NFTA_PAYLOAD_CSUM_OFFSET.: |
| 120 | case NFTA_PAYLOAD_CSUM_FLAGScxx . . $ NFTA_PAYLOAD_CSUM_FLAGS.: |
| 121 | if (mnl_attr_validatecxx . . $ mnl_attr_validate(e419697a5e1ae2b1).(attr, MNL_TYPE_U32cxx . . $ MNL_TYPE_U32.) < 0) |
| 122 | abi_breakagecxx . . $ `include/utils.h:28:9`!(); |
| 123 | break; |
| 124 | } |
| 125 | |
| 126 | tb[type] = attr; |
| 127 | return MNL_CB_OKcxx . . $ `<external>/12386019527593959648/libmnl.h:174:9`!; |
| 128 | } |
| 129 | |
| 130 | static void |
| 131 | nftnl_expr_payload_buildcxx . . $ nftnl_expr_payload_build(93c7528a9cf90b41).(struct nlmsghdrcxx . . $ nlmsghdr# *nlh, const struct nftnl_exprcxx . . $ nftnl_expr# *e) |
| 132 | { |
| 133 | struct nftnl_expr_payloadcxx . . $ nftnl_expr_payload# *payload = nftnl_expr_datacxx . . $ `include/expr_ops.h:31:9`!(e); |
| 134 | |
| 135 | if (e->flagscxx . . $ nftnl_expr#flags. & (1 << NFTNL_EXPR_PAYLOAD_SREGcxx . . $ NFTNL_EXPR_PAYLOAD_SREG.)) |
| 136 | mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_PAYLOAD_SREGcxx . . $ NFTA_PAYLOAD_SREG., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(payload->sreg)); |
| 137 | if (e->flagscxx . . $ nftnl_expr#flags. & (1 << NFTNL_EXPR_PAYLOAD_DREGcxx . . $ NFTNL_EXPR_PAYLOAD_DREG.)) |
| 138 | mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_PAYLOAD_DREGcxx . . $ NFTA_PAYLOAD_DREG., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(payload->dreg)); |
| 139 | if (e->flagscxx . . $ nftnl_expr#flags. & (1 << NFTNL_EXPR_PAYLOAD_BASEcxx . . $ NFTNL_EXPR_PAYLOAD_BASE.)) |
| 140 | mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_PAYLOAD_BASEcxx . . $ NFTA_PAYLOAD_BASE., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(payload->base)); |
| 141 | if (e->flagscxx . . $ nftnl_expr#flags. & (1 << NFTNL_EXPR_PAYLOAD_OFFSETcxx . . $ NFTNL_EXPR_PAYLOAD_OFFSET.)) |
| 142 | mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_PAYLOAD_OFFSETcxx . . $ NFTA_PAYLOAD_OFFSET., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(payload->offset)); |
| 143 | if (e->flagscxx . . $ nftnl_expr#flags. & (1 << NFTNL_EXPR_PAYLOAD_LENcxx . . $ NFTNL_EXPR_PAYLOAD_LEN.)) |
| 144 | mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_PAYLOAD_LENcxx . . $ NFTA_PAYLOAD_LEN., htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(payload->len)); |
| 145 | if (e->flagscxx . . $ nftnl_expr#flags. & (1 << NFTNL_EXPR_PAYLOAD_CSUM_TYPEcxx . . $ NFTNL_EXPR_PAYLOAD_CSUM_TYPE.)) |
| 146 | mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_PAYLOAD_CSUM_TYPEcxx . . $ NFTA_PAYLOAD_CSUM_TYPE., |
| 147 | htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(payload->csum_type)); |
| 148 | if (e->flagscxx . . $ nftnl_expr#flags. & (1 << NFTNL_EXPR_PAYLOAD_CSUM_OFFSETcxx . . $ NFTNL_EXPR_PAYLOAD_CSUM_OFFSET.)) |
| 149 | mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_PAYLOAD_CSUM_OFFSETcxx . . $ NFTA_PAYLOAD_CSUM_OFFSET., |
| 150 | htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(payload->csum_offset)); |
| 151 | if (e->flagscxx . . $ nftnl_expr#flags. & (1 << NFTNL_EXPR_PAYLOAD_FLAGScxx . . $ NFTNL_EXPR_PAYLOAD_FLAGS.)) |
| 152 | mnl_attr_put_u32cxx . . $ mnl_attr_put_u32(b46fd0aeb0cfb96d).(nlh, NFTA_PAYLOAD_CSUM_FLAGScxx . . $ NFTA_PAYLOAD_CSUM_FLAGS., |
| 153 | htonlcxx . . $ `<external>/9581057695539925927/in.h:430:12`!(payload->csum_flags)); |
| 154 | } |
| 155 | |
| 156 | static int |
| 157 | nftnl_expr_payload_parsecxx . . $ nftnl_expr_payload_parse(ed61207049d8af9a).(struct nftnl_exprcxx . . $ nftnl_expr# *e, struct nlattrcxx . . $ nlattr# *attr) |
| 158 | { |
| 159 | struct nftnl_expr_payloadcxx . . $ nftnl_expr_payload# *payload = nftnl_expr_datacxx . . $ `include/expr_ops.h:31:9`!(e); |
| 160 | struct nlattrcxx . . $ nlattr# *tb[NFTA_PAYLOAD_MAXcxx . . $ `include/linux/netfilter/nf_tables.h:874:9`!+1] = {}; |
| 161 | |
| 162 | if (mnl_attr_parse_nestedcxx . . $ mnl_attr_parse_nested(f99c0e9fa94f99d9).(attr, nftnl_expr_payload_cbcxx . . $ nftnl_expr_payload_cb(de2ef18c48fd675c)., tb) < 0) |
| 163 | return -1; |
| 164 | |
| 165 | if (tb[NFTA_PAYLOAD_SREGcxx . . $ NFTA_PAYLOAD_SREG.]) { |
| 166 | payload->sregcxx . . $ nftnl_expr_payload#sreg. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_PAYLOAD_SREG])); |
| 167 | e->flagscxx . . $ nftnl_expr#flags. |= (1 << NFTNL_EXPR_PAYLOAD_SREGcxx . . $ NFTNL_EXPR_PAYLOAD_SREG.); |
| 168 | } |
| 169 | if (tb[NFTA_PAYLOAD_DREGcxx . . $ NFTA_PAYLOAD_DREG.]) { |
| 170 | payload->dregcxx . . $ nftnl_expr_payload#dreg. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_PAYLOAD_DREG])); |
| 171 | e->flagscxx . . $ nftnl_expr#flags. |= (1 << NFTNL_EXPR_PAYLOAD_DREGcxx . . $ NFTNL_EXPR_PAYLOAD_DREG.); |
| 172 | } |
| 173 | if (tb[NFTA_PAYLOAD_BASEcxx . . $ NFTA_PAYLOAD_BASE.]) { |
| 174 | payload->basecxx . . $ nftnl_expr_payload#base. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_PAYLOAD_BASE])); |
| 175 | e->flagscxx . . $ nftnl_expr#flags. |= (1 << NFTNL_EXPR_PAYLOAD_BASEcxx . . $ NFTNL_EXPR_PAYLOAD_BASE.); |
| 176 | } |
| 177 | if (tb[NFTA_PAYLOAD_OFFSETcxx . . $ NFTA_PAYLOAD_OFFSET.]) { |
| 178 | payload->offsetcxx . . $ nftnl_expr_payload#offset. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_PAYLOAD_OFFSET])); |
| 179 | e->flagscxx . . $ nftnl_expr#flags. |= (1 << NFTNL_EXPR_PAYLOAD_OFFSETcxx . . $ NFTNL_EXPR_PAYLOAD_OFFSET.); |
| 180 | } |
| 181 | if (tb[NFTA_PAYLOAD_LENcxx . . $ NFTA_PAYLOAD_LEN.]) { |
| 182 | payload->lencxx . . $ nftnl_expr_payload#len. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_PAYLOAD_LEN])); |
| 183 | e->flagscxx . . $ nftnl_expr#flags. |= (1 << NFTNL_EXPR_PAYLOAD_LENcxx . . $ NFTNL_EXPR_PAYLOAD_LEN.); |
| 184 | } |
| 185 | if (tb[NFTA_PAYLOAD_CSUM_TYPEcxx . . $ NFTA_PAYLOAD_CSUM_TYPE.]) { |
| 186 | payload->csum_typecxx . . $ nftnl_expr_payload#csum_type. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_PAYLOAD_CSUM_TYPE])); |
| 187 | e->flagscxx . . $ nftnl_expr#flags. |= (1 << NFTNL_EXPR_PAYLOAD_CSUM_TYPEcxx . . $ NFTNL_EXPR_PAYLOAD_CSUM_TYPE.); |
| 188 | } |
| 189 | if (tb[NFTA_PAYLOAD_CSUM_OFFSETcxx . . $ NFTA_PAYLOAD_CSUM_OFFSET.]) { |
| 190 | payload->csum_offsetcxx . . $ nftnl_expr_payload#csum_offset. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_PAYLOAD_CSUM_OFFSET])); |
| 191 | e->flagscxx . . $ nftnl_expr#flags. |= (1 << NFTNL_EXPR_PAYLOAD_CSUM_OFFSETcxx . . $ NFTNL_EXPR_PAYLOAD_CSUM_OFFSET.); |
| 192 | } |
| 193 | if (tb[NFTA_PAYLOAD_CSUM_FLAGScxx . . $ NFTA_PAYLOAD_CSUM_FLAGS.]) { |
| 194 | payload->csum_flagscxx . . $ nftnl_expr_payload#csum_flags. = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(mnl_attr_get_u32(tb[NFTA_PAYLOAD_CSUM_FLAGS])); |
| 195 | e->flagscxx . . $ nftnl_expr#flags. |= (1 << NFTNL_EXPR_PAYLOAD_FLAGScxx . . $ NFTNL_EXPR_PAYLOAD_FLAGS.); |
| 196 | } |
| 197 | return 0; |
| 198 | } |
| 199 | |
| 200 | static const char *base2str_arraycxx . . $ base2str_array.[NFT_PAYLOAD_TUN_HEADERcxx . . $ NFT_PAYLOAD_TUN_HEADER. + 1] = { |
| 201 | [NFT_PAYLOAD_LL_HEADERcxx . . $ NFT_PAYLOAD_LL_HEADER.] = "link", |
| 202 | [NFT_PAYLOAD_NETWORK_HEADERcxx . . $ NFT_PAYLOAD_NETWORK_HEADER.] = "network", |
| 203 | [NFT_PAYLOAD_TRANSPORT_HEADERcxx . . $ NFT_PAYLOAD_TRANSPORT_HEADER.] = "transport", |
| 204 | [NFT_PAYLOAD_INNER_HEADERcxx . . $ NFT_PAYLOAD_INNER_HEADER.] = "inner", |
| 205 | [NFT_PAYLOAD_TUN_HEADERcxx . . $ NFT_PAYLOAD_TUN_HEADER.] = "tunnel", |
| 206 | }; |
| 207 | |
| 208 | static const char *base2strcxx . . $ base2str(8c4c36c5bcb3fb8c).(enum nft_payload_basescxx . . $ nft_payload_bases# base) |
| 209 | { |
| 210 | if (base >= array_sizecxx . . $ `include/utils.h:69:9`!(base2str_array)) |
| 211 | return "unknown"; |
| 212 | |
| 213 | return base2str_arraycxx . . $ base2str_array.[base]; |
| 214 | } |
| 215 | |
| 216 | static int |
| 217 | nftnl_expr_payload_snprintfcxx . . $ nftnl_expr_payload_snprintf(2b4af69501aef780).(char *buf, size_t len, |
| 218 | uint32_tcxx . . $ uint32_t# flags, const struct nftnl_exprcxx . . $ nftnl_expr# *e) |
| 219 | { |
| 220 | struct nftnl_expr_payloadcxx . . $ nftnl_expr_payload# *payload = nftnl_expr_datacxx . . $ `include/expr_ops.h:31:9`!(e); |
| 221 | |
| 222 | if (payload->sregcxx . . $ nftnl_expr_payload#sreg.) |
| 223 | return snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf, len, "write reg %u => %ub @ %s header + %u csum_type %u csum_off %u csum_flags 0x%x ", |
| 224 | payload->sregcxx . . $ nftnl_expr_payload#sreg., |
| 225 | payload->lencxx . . $ nftnl_expr_payload#len., base2strcxx . . $ base2str(8c4c36c5bcb3fb8c).(payload->basecxx . . $ nftnl_expr_payload#base.), |
| 226 | payload->offsetcxx . . $ nftnl_expr_payload#offset., payload->csum_typecxx . . $ nftnl_expr_payload#csum_type., |
| 227 | payload->csum_offsetcxx . . $ nftnl_expr_payload#csum_offset., |
| 228 | payload->csum_flagscxx . . $ nftnl_expr_payload#csum_flags.); |
| 229 | else |
| 230 | return snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf, len, "load %ub @ %s header + %u => reg %u ", |
| 231 | payload->lencxx . . $ nftnl_expr_payload#len., base2strcxx . . $ base2str(8c4c36c5bcb3fb8c).(payload->basecxx . . $ nftnl_expr_payload#base.), |
| 232 | payload->offsetcxx . . $ nftnl_expr_payload#offset., payload->dregcxx . . $ nftnl_expr_payload#dreg.); |
| 233 | } |
| 234 | |
| 235 | static struct attr_policycxx . . $ attr_policy# payload_attr_policycxx . . $ payload_attr_policy.[__NFTNL_EXPR_PAYLOAD_MAXcxx . . $ __NFTNL_EXPR_PAYLOAD_MAX.] = { |
| 236 | [NFTNL_EXPR_PAYLOAD_DREGcxx . . $ NFTNL_EXPR_PAYLOAD_DREG.] = { .maxlen = sizeof(uint32_tcxx . . $ uint32_t#) }, |
| 237 | [NFTNL_EXPR_PAYLOAD_BASEcxx . . $ NFTNL_EXPR_PAYLOAD_BASE.] = { .maxlen = sizeof(uint32_tcxx . . $ uint32_t#) }, |
| 238 | [NFTNL_EXPR_PAYLOAD_OFFSETcxx . . $ NFTNL_EXPR_PAYLOAD_OFFSET.] = { .maxlen = sizeof(uint32_tcxx . . $ uint32_t#) }, |
| 239 | [NFTNL_EXPR_PAYLOAD_LENcxx . . $ NFTNL_EXPR_PAYLOAD_LEN.] = { .maxlen = sizeof(uint32_tcxx . . $ uint32_t#) }, |
| 240 | [NFTNL_EXPR_PAYLOAD_SREGcxx . . $ NFTNL_EXPR_PAYLOAD_SREG.] = { .maxlen = sizeof(uint32_tcxx . . $ uint32_t#) }, |
| 241 | [NFTNL_EXPR_PAYLOAD_CSUM_TYPEcxx . . $ NFTNL_EXPR_PAYLOAD_CSUM_TYPE.] = { .maxlen = sizeof(uint32_tcxx . . $ uint32_t#) }, |
| 242 | [NFTNL_EXPR_PAYLOAD_CSUM_OFFSETcxx . . $ NFTNL_EXPR_PAYLOAD_CSUM_OFFSET.] = { .maxlen = sizeof(uint32_tcxx . . $ uint32_t#) }, |
| 243 | [NFTNL_EXPR_PAYLOAD_FLAGScxx . . $ NFTNL_EXPR_PAYLOAD_FLAGS.] = { .maxlen = sizeof(uint32_tcxx . . $ uint32_t#) }, |
| 244 | }; |
| 245 | |
| 246 | struct expr_opscxx . . $ expr_ops# expr_ops_payloadcxx . . $ expr_ops_payload. = { |
| 247 | .name = "payload", |
| 248 | .alloc_len = sizeof(struct nftnl_expr_payloadcxx . . $ nftnl_expr_payload#), |
| 249 | .nftnl_max_attr = __NFTNL_EXPR_PAYLOAD_MAXcxx . . $ __NFTNL_EXPR_PAYLOAD_MAX. - 1, |
| 250 | .attr_policy = payload_attr_policycxx . . $ payload_attr_policy., |
| 251 | .set = nftnl_expr_payload_setcxx . . $ nftnl_expr_payload_set(211371a3e3842127)., |
| 252 | .get = nftnl_expr_payload_getcxx . . $ nftnl_expr_payload_get(9de263c4f9e71c4b)., |
| 253 | .parse = nftnl_expr_payload_parsecxx . . $ nftnl_expr_payload_parse(ed61207049d8af9a)., |
| 254 | .build = nftnl_expr_payload_buildcxx . . $ nftnl_expr_payload_build(93c7528a9cf90b41)., |
| 255 | .output = nftnl_expr_payload_snprintfcxx . . $ nftnl_expr_payload_snprintf(2b4af69501aef780)., |
| 256 | }; |