/Linux-v6.6/lib/ |
D | nlattr.c | 62 static int validate_nla_bitfield32(const struct nlattr *nla, in validate_nla_bitfield32() argument 65 const struct nla_bitfield32 *bf = nla_data(nla); in validate_nla_bitfield32() 166 const struct nlattr *nla, in nla_validate_range_unsigned() argument 175 value = nla_get_u8(nla); in nla_validate_range_unsigned() 178 value = nla_get_u16(nla); in nla_validate_range_unsigned() 181 value = nla_get_u32(nla); in nla_validate_range_unsigned() 184 value = nla_get_u64(nla); in nla_validate_range_unsigned() 187 value = nla_get_u64(nla); in nla_validate_range_unsigned() 190 value = nla_len(nla); in nla_validate_range_unsigned() 193 value = ntohs(nla_get_be16(nla)); in nla_validate_range_unsigned() [all …]
|
/Linux-v6.6/tools/lib/bpf/ |
D | nlattr.c | 25 static struct nlattr *nla_next(const struct nlattr *nla, int *remaining) in nla_next() argument 27 int totlen = NLA_ALIGN(nla->nla_len); in nla_next() 30 return (struct nlattr *)((void *)nla + totlen); in nla_next() 33 static int nla_ok(const struct nlattr *nla, int remaining) in nla_ok() argument 35 return remaining >= (int)sizeof(*nla) && in nla_ok() 36 nla->nla_len >= sizeof(*nla) && in nla_ok() 37 nla->nla_len <= remaining; in nla_ok() 40 static int nla_type(const struct nlattr *nla) in nla_type() argument 42 return nla->nla_type & NLA_TYPE_MASK; in nla_type() 45 static int validate_nla(struct nlattr *nla, int maxtype, in validate_nla() argument [all …]
|
D | nlattr.h | 84 static inline void *libbpf_nla_data(const struct nlattr *nla) in libbpf_nla_data() argument 86 return (void *)nla + NLA_HDRLEN; in libbpf_nla_data() 89 static inline uint8_t libbpf_nla_getattr_u8(const struct nlattr *nla) in libbpf_nla_getattr_u8() argument 91 return *(uint8_t *)libbpf_nla_data(nla); in libbpf_nla_getattr_u8() 94 static inline uint16_t libbpf_nla_getattr_u16(const struct nlattr *nla) in libbpf_nla_getattr_u16() argument 96 return *(uint16_t *)libbpf_nla_data(nla); in libbpf_nla_getattr_u16() 99 static inline uint32_t libbpf_nla_getattr_u32(const struct nlattr *nla) in libbpf_nla_getattr_u32() argument 101 return *(uint32_t *)libbpf_nla_data(nla); in libbpf_nla_getattr_u32() 104 static inline uint64_t libbpf_nla_getattr_u64(const struct nlattr *nla) in libbpf_nla_getattr_u64() argument 106 return *(uint64_t *)libbpf_nla_data(nla); in libbpf_nla_getattr_u64() [all …]
|
/Linux-v6.6/drivers/block/drbd/ |
D | drbd_nla.c | 7 static int drbd_nla_check_mandatory(int maxtype, struct nlattr *nla) in drbd_nla_check_mandatory() argument 9 struct nlattr *head = nla_data(nla); in drbd_nla_check_mandatory() 10 int len = nla_len(nla); in drbd_nla_check_mandatory() 21 nla_for_each_attr(nla, head, len, rem) { in drbd_nla_check_mandatory() 22 if (nla->nla_type & DRBD_GENLA_F_MANDATORY) { in drbd_nla_check_mandatory() 23 nla->nla_type &= ~DRBD_GENLA_F_MANDATORY; in drbd_nla_check_mandatory() 24 if (nla_type(nla) > maxtype) in drbd_nla_check_mandatory() 31 int drbd_nla_parse_nested(struct nlattr *tb[], int maxtype, struct nlattr *nla, in drbd_nla_parse_nested() argument 36 err = drbd_nla_check_mandatory(maxtype, nla); in drbd_nla_parse_nested() 38 err = nla_parse_nested_deprecated(tb, maxtype, nla, policy, in drbd_nla_parse_nested() [all …]
|
D | drbd_nla.h | 5 extern int drbd_nla_parse_nested(struct nlattr *tb[], int maxtype, struct nlattr *nla, 7 extern struct nlattr *drbd_nla_find_nested(int maxtype, struct nlattr *nla, int attrtype);
|
/Linux-v6.6/include/net/ |
D | netlink.h | 521 ssize_t nla_strscpy(char *dst, const struct nlattr *nla, size_t dstsize); 522 char *nla_strdup(const struct nlattr *nla, gfp_t flags); 524 int nla_memcmp(const struct nlattr *nla, const void *data, size_t size); 525 int nla_strcmp(const struct nlattr *nla, const char *str); 1174 static inline int nla_type(const struct nlattr *nla) in nla_type() argument 1176 return nla->nla_type & NLA_TYPE_MASK; in nla_type() 1183 static inline void *nla_data(const struct nlattr *nla) in nla_data() argument 1185 return (char *) nla + NLA_HDRLEN; in nla_data() 1192 static inline int nla_len(const struct nlattr *nla) in nla_len() argument 1194 return nla->nla_len - NLA_HDRLEN; in nla_len() [all …]
|
/Linux-v6.6/net/netfilter/ |
D | nf_tables_api.c | 136 const struct nlattr * const *nla) in nft_ctx_init() argument 143 ctx->nla = nla; in nft_ctx_init() 429 if (ctx->nla[NFTA_CHAIN_ID]) { in nft_trans_chain_add() 431 ntohl(nla_get_be32(ctx->nla[NFTA_CHAIN_ID])); in nft_trans_chain_add() 502 if (msg_type == NFT_MSG_NEWRULE && ctx->nla[NFTA_RULE_ID] != NULL) { in nft_trans_rule_add() 504 ntohl(nla_get_be32(ctx->nla[NFTA_RULE_ID])); in nft_trans_rule_add() 568 if (msg_type == NFT_MSG_NEWSET && ctx->nla[NFTA_SET_ID] && !desc) { in __nft_trans_set_add() 570 ntohl(nla_get_be32(ctx->nla[NFTA_SET_ID])); in __nft_trans_set_add() 780 const struct nlattr *nla, in nft_table_lookup() argument 786 if (nla == NULL) in nft_table_lookup() [all …]
|
D | nft_log.c | 151 const struct nlattr *nla; in nft_log_init() local 164 nla = tb[NFTA_LOG_PREFIX]; in nft_log_init() 165 if (nla != NULL) { in nft_log_init() 166 priv->prefix = kmalloc(nla_len(nla) + 1, GFP_KERNEL); in nft_log_init() 169 nla_strscpy(priv->prefix, nla, nla_len(nla) + 1); in nft_log_init()
|
D | nfnetlink_hook.c | 346 const struct nlattr * const *nla = cb->data; in nfnl_hook_dump_start() local 354 hooknum = ntohl(nla_get_be32(nla[NFNLA_HOOK_HOOKNUM])); in nfnl_hook_dump_start() 359 if (!nla[NFNLA_HOOK_DEV]) in nfnl_hook_dump_start() 362 nla_strscpy(name, nla[NFNLA_HOOK_DEV], sizeof(name)); in nfnl_hook_dump_start() 395 const struct nlattr * const nla[]) in nfnl_hook_get() argument 397 if (!nla[NFNLA_HOOK_HOOKNUM]) in nfnl_hook_get() 406 .data = (void *)nla, in nfnl_hook_get()
|
/Linux-v6.6/net/ipv4/ |
D | metrics.c | 15 struct nlattr *nla; in ip_metrics_convert() local 18 nla_for_each_attr(nla, fc_mx, fc_mx_len, remaining) { in ip_metrics_convert() 19 int type = nla_type(nla); in ip_metrics_convert() 33 nla_strscpy(tmp, nla, sizeof(tmp)); in ip_metrics_convert() 40 if (nla_len(nla) != sizeof(u32)) { in ip_metrics_convert() 41 NL_SET_ERR_MSG_ATTR(extack, nla, in ip_metrics_convert() 45 val = nla_get_u32(nla); in ip_metrics_convert()
|
D | fib_semantics.c | 677 static int fib_gw_from_attr(__be32 *gw, struct nlattr *nla, in fib_gw_from_attr() argument 680 if (nla_len(nla) < sizeof(*gw)) { in fib_gw_from_attr() 685 *gw = nla_get_in_addr(nla); in fib_gw_from_attr() 722 struct nlattr *nla, *nlav, *attrs = rtnh_attrs(rtnh); in fib_get_nhs() local 724 nla = nla_find(attrs, attrlen, RTA_GATEWAY); in fib_get_nhs() 726 if (nla && nlav) { in fib_get_nhs() 731 if (nla) { in fib_get_nhs() 732 ret = fib_gw_from_attr(&fib_cfg.fc_gw4, nla, in fib_get_nhs() 745 nla = nla_find(attrs, attrlen, RTA_FLOW); in fib_get_nhs() 746 if (nla) { in fib_get_nhs() [all …]
|
/Linux-v6.6/include/linux/ |
D | genl_magic_func.h | 102 #define DPRINT_FIELD(dir, nla_type, name, s, nla) \ argument 106 else if (nla) \ 109 : nla_data(nla)); \ 112 #define DPRINT_ARRAY(dir, nla_type, name, s, nla) \ argument 117 else if (nla) \ 119 nla_data(nla), nla_len(nla)); \ 123 #define DPRINT_FIELD(dir, nla_type, name, s, nla) do {} while (0) argument 124 #define DPRINT_ARRAY(dir, nla_type, name, s, nla) do {} while (0) argument 146 struct nlattr *nla; \ 171 nla = ntb[attr_nr]; \ [all …]
|
/Linux-v6.6/net/sched/ |
D | act_tunnel_key.c | 88 tunnel_key_copy_geneve_opt(const struct nlattr *nla, void *dst, int dst_len, in tunnel_key_copy_geneve_opt() argument 97 nla, geneve_opt_policy, extack); in tunnel_key_copy_geneve_opt() 140 tunnel_key_copy_vxlan_opt(const struct nlattr *nla, void *dst, int dst_len, in tunnel_key_copy_vxlan_opt() argument 146 err = nla_parse_nested(tb, TCA_TUNNEL_KEY_ENC_OPT_VXLAN_MAX, nla, in tunnel_key_copy_vxlan_opt() 167 tunnel_key_copy_erspan_opt(const struct nlattr *nla, void *dst, int dst_len, in tunnel_key_copy_erspan_opt() argument 174 err = nla_parse_nested(tb, TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_MAX, nla, in tunnel_key_copy_erspan_opt() 206 nla = tb[TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_INDEX]; in tunnel_key_copy_erspan_opt() 207 md->u.index = nla_get_be32(nla); in tunnel_key_copy_erspan_opt() 209 nla = tb[TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_DIR]; in tunnel_key_copy_erspan_opt() 210 md->u.md2.dir = nla_get_u8(nla); in tunnel_key_copy_erspan_opt() [all …]
|
D | act_bpf.c | 102 struct nlattr *nla; in tcf_bpf_dump_bpf_info() local 107 nla = nla_reserve(skb, TCA_ACT_BPF_OPS, prog->bpf_num_ops * in tcf_bpf_dump_bpf_info() 109 if (nla == NULL) in tcf_bpf_dump_bpf_info() 112 memcpy(nla_data(nla), prog->bpf_ops, nla_len(nla)); in tcf_bpf_dump_bpf_info() 120 struct nlattr *nla; in tcf_bpf_dump_ebpf_info() local 129 nla = nla_reserve(skb, TCA_ACT_BPF_TAG, sizeof(prog->filter->tag)); in tcf_bpf_dump_ebpf_info() 130 if (nla == NULL) in tcf_bpf_dump_ebpf_info() 133 memcpy(nla_data(nla), prog->filter->tag, nla_len(nla)); in tcf_bpf_dump_ebpf_info() 279 static int tcf_bpf_init(struct net *net, struct nlattr *nla, in tcf_bpf_init() argument 295 if (!nla) in tcf_bpf_init() [all …]
|
D | sch_fifo.c | 229 struct nlattr *nla; in fifo_set_limit() local 239 nla = kmalloc(nla_attr_size(sizeof(struct tc_fifo_qopt)), GFP_KERNEL); in fifo_set_limit() 240 if (nla) { in fifo_set_limit() 241 nla->nla_type = RTM_NEWQDISC; in fifo_set_limit() 242 nla->nla_len = nla_attr_size(sizeof(struct tc_fifo_qopt)); in fifo_set_limit() 243 ((struct tc_fifo_qopt *)nla_data(nla))->limit = limit; in fifo_set_limit() 245 ret = q->ops->change(q, nla, NULL); in fifo_set_limit() 246 kfree(nla); in fifo_set_limit()
|
D | em_meta.c | 695 static int meta_var_change(struct meta_value *dst, struct nlattr *nla) in meta_var_change() argument 697 int len = nla_len(nla); in meta_var_change() 699 dst->val = (unsigned long)kmemdup(nla_data(nla), len, GFP_KERNEL); in meta_var_change() 748 static int meta_int_change(struct meta_value *dst, struct nlattr *nla) in meta_int_change() argument 750 if (nla_len(nla) >= sizeof(unsigned long)) { in meta_int_change() 751 dst->val = *(unsigned long *) nla_data(nla); in meta_int_change() 753 } else if (nla_len(nla) == sizeof(u32)) { in meta_int_change() 754 dst->val = nla_get_u32(nla); in meta_int_change() 885 static inline int meta_change_data(struct meta_value *dst, struct nlattr *nla) in meta_change_data() argument 887 if (nla) { in meta_change_data() [all …]
|
/Linux-v6.6/drivers/net/vxlan/ |
D | vxlan_private.h | 89 const struct nlattr *nla) in vxlan_nla_get_addr() argument 91 if (nla_len(nla) >= sizeof(struct in6_addr)) { in vxlan_nla_get_addr() 92 ip->sin6.sin6_addr = nla_get_in6_addr(nla); in vxlan_nla_get_addr() 95 } else if (nla_len(nla) >= sizeof(__be32)) { in vxlan_nla_get_addr() 96 ip->sin.sin_addr.s_addr = nla_get_in_addr(nla); in vxlan_nla_get_addr() 130 const struct nlattr *nla) in vxlan_nla_get_addr() argument 132 if (nla_len(nla) >= sizeof(struct in6_addr)) { in vxlan_nla_get_addr() 134 } else if (nla_len(nla) >= sizeof(__be32)) { in vxlan_nla_get_addr() 135 ip->sin.sin_addr.s_addr = nla_get_in_addr(nla); in vxlan_nla_get_addr()
|
/Linux-v6.6/net/xfrm/ |
D | xfrm_compat.c | 292 const struct nlattr *nla, *attrs; in xfrm_xlate64() local 303 nla_for_each_attr(nla, attrs, len, remaining) { in xfrm_xlate64() 308 err = xfrm_nla_cpy(dst, nla, nla_len(nla)); in xfrm_xlate64() 311 err = xfrm_xlate64_attr(dst, nla); in xfrm_xlate64() 403 struct nlattr *nla; in xfrm_attr_cpy32() local 415 nla = dst + *pos; in xfrm_attr_cpy32() 417 memcpy(nla, src, nla_attr_size(copy_len)); in xfrm_attr_cpy32() 418 nla->nla_len = nla_attr_size(payload); in xfrm_attr_cpy32() 420 nlmsg->nlmsg_len += nla->nla_len; in xfrm_attr_cpy32() 428 static int xfrm_xlate32_attr(void *dst, const struct nlattr *nla, in xfrm_xlate32_attr() argument [all …]
|
/Linux-v6.6/net/openvswitch/ |
D | vport.c | 313 struct nlattr *nla; in ovs_vport_get_upcall_stats() local 331 nla = nla_nest_start_noflag(skb, OVS_VPORT_ATTR_UPCALL_STATS); in ovs_vport_get_upcall_stats() 332 if (!nla) in ovs_vport_get_upcall_stats() 337 nla_nest_cancel(skb, nla); in ovs_vport_get_upcall_stats() 343 nla_nest_cancel(skb, nla); in ovs_vport_get_upcall_stats() 346 nla_nest_end(skb, nla); in ovs_vport_get_upcall_stats() 369 struct nlattr *nla; in ovs_vport_get_options() local 375 nla = nla_nest_start_noflag(skb, OVS_VPORT_ATTR_OPTIONS); in ovs_vport_get_options() 376 if (!nla) in ovs_vport_get_options() 381 nla_nest_cancel(skb, nla); in ovs_vport_get_options() [all …]
|
D | flow_netlink.c | 54 struct nlattr *nla; in actions_may_change_flow() local 57 nla_for_each_nested(nla, actions, rem) { in actions_may_change_flow() 58 u16 action = nla_type(nla); in actions_may_change_flow() 472 const struct nlattr *nla; in __parse_flow_nlattrs() local 477 nla_for_each_nested(nla, attr, rem) { in __parse_flow_nlattrs() 478 u16 type = nla_type(nla); in __parse_flow_nlattrs() 500 if (!check_attr_len(nla_len(nla), expected_len)) { in __parse_flow_nlattrs() 502 type, nla_len(nla), expected_len); in __parse_flow_nlattrs() 506 if (!nz || !is_all_zero(nla_data(nla), nla_len(nla))) { in __parse_flow_nlattrs() 508 a[type] = nla; in __parse_flow_nlattrs() [all …]
|
D | meter.c | 235 struct nlattr *nla; in ovs_meter_cmd_reply_stats() local 250 nla = nla_nest_start_noflag(reply, OVS_METER_ATTR_BANDS); in ovs_meter_cmd_reply_stats() 251 if (!nla) in ovs_meter_cmd_reply_stats() 266 nla_nest_end(reply, nla); in ovs_meter_cmd_reply_stats() 277 struct nlattr *nla, *band_nla; in ovs_meter_cmd_features() local 303 nla = nla_nest_start_noflag(reply, OVS_METER_ATTR_BANDS); in ovs_meter_cmd_features() 304 if (!nla) in ovs_meter_cmd_features() 314 nla_nest_end(reply, nla); in ovs_meter_cmd_features() 328 struct nlattr *nla; in dp_meter_create() local 339 nla_for_each_nested(nla, a[OVS_METER_ATTR_BANDS], rem) in dp_meter_create() [all …]
|
/Linux-v6.6/net/mpls/ |
D | af_mpls.c | 720 static int nla_get_via(const struct nlattr *nla, u8 *via_alen, u8 *via_table, in nla_get_via() argument 723 struct rtvia *via = nla_data(nla); in nla_get_via() 727 if (nla_len(nla) < offsetof(struct rtvia, rtvia_addr)) { in nla_get_via() 728 NL_SET_ERR_MSG_ATTR(extack, nla, in nla_get_via() 732 alen = nla_len(nla) - in nla_get_via() 735 NL_SET_ERR_MSG_ATTR(extack, nla, in nla_get_via() 847 struct nlattr *nla, *attrs = rtnh_attrs(rtnh); in mpls_count_nexthops() local 852 nla = nla_find(attrs, attrlen, RTA_VIA); in mpls_count_nexthops() 853 if (nla && nla_len(nla) >= in mpls_count_nexthops() 855 int via_alen = nla_len(nla) - in mpls_count_nexthops() [all …]
|
/Linux-v6.6/net/psample/ |
D | psample.c | 291 struct nlattr *nla; in psample_ip_tun_to_nlattr() local 294 nla = nla_nest_start_noflag(skb, PSAMPLE_ATTR_TUNNEL); in psample_ip_tun_to_nlattr() 295 if (!nla) in psample_ip_tun_to_nlattr() 300 nla_nest_cancel(skb, nla); in psample_ip_tun_to_nlattr() 304 nla_nest_end(skb, nla); in psample_ip_tun_to_nlattr() 468 struct nlattr *nla; in psample_sample_packet() local 470 nla = skb_put(nl_skb, nla_len); in psample_sample_packet() 471 nla->nla_type = PSAMPLE_ATTR_DATA; in psample_sample_packet() 472 nla->nla_len = nla_attr_size(data_len); in psample_sample_packet() 474 if (skb_copy_bits(skb, 0, nla_data(nla), data_len)) in psample_sample_packet()
|
/Linux-v6.6/net/ipv6/ |
D | rpl_iptunnel.c | 67 static int rpl_build_state(struct net *net, struct nlattr *nla, in rpl_build_state() argument 81 err = nla_parse_nested(tb, RPL_IPTUNNEL_MAX, nla, in rpl_build_state() 300 struct nlattr *nla; in nla_put_rpl_srh() local 305 nla = nla_reserve(skb, attrtype, len); in nla_put_rpl_srh() 306 if (!nla) in nla_put_rpl_srh() 309 data = nla_data(nla); in nla_put_rpl_srh()
|
/Linux-v6.6/net/handshake/ |
D | tlshd.c | 66 struct nlattr *nla; in tls_handshake_remote_peerids() local 70 nla_for_each_attr(nla, head, len, rem) { in tls_handshake_remote_peerids() 71 if (nla_type(nla) == HANDSHAKE_A_DONE_REMOTE_AUTH) in tls_handshake_remote_peerids() 80 nla_for_each_attr(nla, head, len, rem) { in tls_handshake_remote_peerids() 81 if (nla_type(nla) == HANDSHAKE_A_DONE_REMOTE_AUTH) in tls_handshake_remote_peerids() 82 treq->th_peerid[i++] = nla_get_u32(nla); in tls_handshake_remote_peerids()
|