/kernel/linux/linux-5.10/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() 164 const struct nlattr *nla, in nla_validate_range_unsigned() argument 173 value = nla_get_u8(nla); in nla_validate_range_unsigned() 176 value = nla_get_u16(nla); in nla_validate_range_unsigned() 179 value = nla_get_u32(nla); in nla_validate_range_unsigned() 183 value = nla_get_u64(nla); in nla_validate_range_unsigned() 186 value = nla_len(nla); in nla_validate_range_unsigned() 199 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in nla_validate_range_unsigned() 212 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in nla_validate_range_unsigned() [all …]
|
/kernel/linux/linux-5.10/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 *) ((char *) nla + totlen); in nla_next() 33 static int nla_ok(const struct nlattr *nla, int remaining) in nla_ok() argument 35 return remaining >= 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 | 69 static inline void *libbpf_nla_data(const struct nlattr *nla) in libbpf_nla_data() argument 71 return (char *) nla + NLA_HDRLEN; in libbpf_nla_data() 74 static inline uint8_t libbpf_nla_getattr_u8(const struct nlattr *nla) in libbpf_nla_getattr_u8() argument 76 return *(uint8_t *)libbpf_nla_data(nla); in libbpf_nla_getattr_u8() 79 static inline uint32_t libbpf_nla_getattr_u32(const struct nlattr *nla) in libbpf_nla_getattr_u32() argument 81 return *(uint32_t *)libbpf_nla_data(nla); in libbpf_nla_getattr_u32() 84 static inline const char *libbpf_nla_getattr_str(const struct nlattr *nla) in libbpf_nla_getattr_str() argument 86 return (const char *)libbpf_nla_data(nla); in libbpf_nla_getattr_str() 93 static inline int libbpf_nla_len(const struct nlattr *nla) in libbpf_nla_len() argument 95 return nla->nla_len - NLA_HDRLEN; in libbpf_nla_len() [all …]
|
D | netlink.c | 138 struct nlattr *nla, *nla_xdp; in __bpf_set_link_xdp_fd_replace() local 160 nla = (struct nlattr *)(((char *)&req) in __bpf_set_link_xdp_fd_replace() 162 nla->nla_type = NLA_F_NESTED | IFLA_XDP; in __bpf_set_link_xdp_fd_replace() 163 nla->nla_len = NLA_HDRLEN; in __bpf_set_link_xdp_fd_replace() 166 nla_xdp = (struct nlattr *)((char *)nla + nla->nla_len); in __bpf_set_link_xdp_fd_replace() 170 nla->nla_len += nla_xdp->nla_len; in __bpf_set_link_xdp_fd_replace() 174 nla_xdp = (struct nlattr *)((char *)nla + nla->nla_len); in __bpf_set_link_xdp_fd_replace() 178 nla->nla_len += nla_xdp->nla_len; in __bpf_set_link_xdp_fd_replace() 182 nla_xdp = (struct nlattr *)((char *)nla + nla->nla_len); in __bpf_set_link_xdp_fd_replace() 186 nla->nla_len += nla_xdp->nla_len; in __bpf_set_link_xdp_fd_replace() [all …]
|
/kernel/linux/linux-5.10/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);
|
/kernel/linux/linux-5.10/include/net/ |
D | netlink.h | 509 size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize); 510 char *nla_strdup(const struct nlattr *nla, gfp_t flags); 512 int nla_memcmp(const struct nlattr *nla, const void *data, size_t size); 513 int nla_strcmp(const struct nlattr *nla, const char *str); 1128 static inline int nla_type(const struct nlattr *nla) in nla_type() argument 1130 return nla->nla_type & NLA_TYPE_MASK; in nla_type() 1137 static inline void *nla_data(const struct nlattr *nla) in nla_data() argument 1139 return (char *) nla + NLA_HDRLEN; in nla_data() 1146 static inline int nla_len(const struct nlattr *nla) in nla_len() argument 1148 return nla->nla_len - NLA_HDRLEN; in nla_len() [all …]
|
/kernel/linux/linux-5.10/net/netfilter/ |
D | nf_tables_api.c | 134 const struct nlattr * const *nla) in nft_ctx_init() argument 141 ctx->nla = nla; in nft_ctx_init() 413 if (ctx->nla[NFTA_CHAIN_ID]) { in nft_trans_chain_add() 415 ntohl(nla_get_be32(ctx->nla[NFTA_CHAIN_ID])); in nft_trans_chain_add() 486 if (msg_type == NFT_MSG_NEWRULE && ctx->nla[NFTA_RULE_ID] != NULL) { in nft_trans_rule_add() 488 ntohl(nla_get_be32(ctx->nla[NFTA_RULE_ID])); in nft_trans_rule_add() 551 if (msg_type == NFT_MSG_NEWSET && ctx->nla[NFTA_SET_ID] != NULL) { in nft_trans_set_add() 553 ntohl(nla_get_be32(ctx->nla[NFTA_SET_ID])); in nft_trans_set_add() 676 const struct nlattr *nla, in nft_table_lookup() argument 682 if (nla == NULL) in nft_table_lookup() [all …]
|
D | nft_log.c | 137 const struct nlattr *nla; in nft_log_init() local 150 nla = tb[NFTA_LOG_PREFIX]; in nft_log_init() 151 if (nla != NULL) { in nft_log_init() 152 priv->prefix = kmalloc(nla_len(nla) + 1, GFP_KERNEL); in nft_log_init() 155 nla_strlcpy(priv->prefix, nla, nla_len(nla) + 1); in nft_log_init()
|
/kernel/linux/linux-5.10/net/wimax/ |
D | op-msg.c | 172 struct nlattr *nla; in wimax_msg_data_len() local 174 nla = nlmsg_find_attr(nlh, sizeof(struct genlmsghdr), in wimax_msg_data_len() 176 if (nla == NULL) { in wimax_msg_data_len() 180 *size = nla_len(nla); in wimax_msg_data_len() 181 return nla_data(nla); in wimax_msg_data_len() 194 struct nlattr *nla; in wimax_msg_data() local 196 nla = nlmsg_find_attr(nlh, sizeof(struct genlmsghdr), in wimax_msg_data() 198 if (nla == NULL) { in wimax_msg_data() 202 return nla_data(nla); in wimax_msg_data() 215 struct nlattr *nla; in wimax_msg_len() local [all …]
|
/kernel/linux/linux-5.10/net/ipv4/ |
D | metrics.c | 15 struct nlattr *nla; in ip_metrics_convert() local 21 nla_for_each_attr(nla, fc_mx, fc_mx_len, remaining) { in ip_metrics_convert() 22 int type = nla_type(nla); in ip_metrics_convert() 36 nla_strlcpy(tmp, nla, sizeof(tmp)); in ip_metrics_convert() 43 if (nla_len(nla) != sizeof(u32)) { in ip_metrics_convert() 44 NL_SET_ERR_MSG_ATTR(extack, nla, in ip_metrics_convert() 48 val = nla_get_u32(nla); in ip_metrics_convert()
|
D | fib_semantics.c | 675 static int fib_gw_from_attr(__be32 *gw, struct nlattr *nla, in fib_gw_from_attr() argument 678 if (nla_len(nla) < sizeof(*gw)) { in fib_gw_from_attr() 683 *gw = nla_get_in_addr(nla); in fib_gw_from_attr() 720 struct nlattr *nla, *nlav, *attrs = rtnh_attrs(rtnh); in fib_get_nhs() local 722 nla = nla_find(attrs, attrlen, RTA_GATEWAY); in fib_get_nhs() 724 if (nla && nlav) { in fib_get_nhs() 729 if (nla) { in fib_get_nhs() 730 ret = fib_gw_from_attr(&fib_cfg.fc_gw4, nla, in fib_get_nhs() 743 nla = nla_find(attrs, attrlen, RTA_FLOW); in fib_get_nhs() 744 if (nla) { in fib_get_nhs() [all …]
|
/kernel/linux/linux-5.10/include/linux/ |
D | genl_magic_func.h | 101 #define DPRINT_FIELD(dir, nla_type, name, s, nla) \ argument 105 else if (nla) \ 108 : nla_data(nla)); \ 111 #define DPRINT_ARRAY(dir, nla_type, name, s, nla) \ argument 116 else if (nla) \ 118 nla_data(nla), nla_len(nla)); \ 122 #define DPRINT_FIELD(dir, nla_type, name, s, nla) do {} while (0) argument 123 #define DPRINT_ARRAY(dir, nla_type, name, s, nla) do {} while (0) argument 145 struct nlattr *nla; \ 170 nla = ntb[attr_nr]; \ [all …]
|
/kernel/linux/linux-5.10/net/sched/ |
D | act_tunnel_key.c | 87 tunnel_key_copy_geneve_opt(const struct nlattr *nla, void *dst, int dst_len, in tunnel_key_copy_geneve_opt() argument 96 nla, geneve_opt_policy, extack); in tunnel_key_copy_geneve_opt() 139 tunnel_key_copy_vxlan_opt(const struct nlattr *nla, void *dst, int dst_len, in tunnel_key_copy_vxlan_opt() argument 145 err = nla_parse_nested(tb, TCA_TUNNEL_KEY_ENC_OPT_VXLAN_MAX, nla, in tunnel_key_copy_vxlan_opt() 166 tunnel_key_copy_erspan_opt(const struct nlattr *nla, void *dst, int dst_len, in tunnel_key_copy_erspan_opt() argument 173 err = nla_parse_nested(tb, TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_MAX, nla, in tunnel_key_copy_erspan_opt() 205 nla = tb[TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_INDEX]; in tunnel_key_copy_erspan_opt() 206 md->u.index = nla_get_be32(nla); in tunnel_key_copy_erspan_opt() 208 nla = tb[TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_DIR]; in tunnel_key_copy_erspan_opt() 209 md->u.md2.dir = nla_get_u8(nla); in tunnel_key_copy_erspan_opt() [all …]
|
D | act_bpf.c | 101 struct nlattr *nla; in tcf_bpf_dump_bpf_info() local 106 nla = nla_reserve(skb, TCA_ACT_BPF_OPS, prog->bpf_num_ops * in tcf_bpf_dump_bpf_info() 108 if (nla == NULL) in tcf_bpf_dump_bpf_info() 111 memcpy(nla_data(nla), prog->bpf_ops, nla_len(nla)); in tcf_bpf_dump_bpf_info() 119 struct nlattr *nla; in tcf_bpf_dump_ebpf_info() local 128 nla = nla_reserve(skb, TCA_ACT_BPF_TAG, sizeof(prog->filter->tag)); in tcf_bpf_dump_ebpf_info() 129 if (nla == NULL) in tcf_bpf_dump_ebpf_info() 132 memcpy(nla_data(nla), prog->filter->tag, nla_len(nla)); in tcf_bpf_dump_ebpf_info() 278 static int tcf_bpf_init(struct net *net, struct nlattr *nla, in tcf_bpf_init() argument 294 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 | 692 static int meta_var_change(struct meta_value *dst, struct nlattr *nla) in meta_var_change() argument 694 int len = nla_len(nla); in meta_var_change() 696 dst->val = (unsigned long)kmemdup(nla_data(nla), len, GFP_KERNEL); in meta_var_change() 745 static int meta_int_change(struct meta_value *dst, struct nlattr *nla) in meta_int_change() argument 747 if (nla_len(nla) >= sizeof(unsigned long)) { in meta_int_change() 748 dst->val = *(unsigned long *) nla_data(nla); in meta_int_change() 750 } else if (nla_len(nla) == sizeof(u32)) { in meta_int_change() 751 dst->val = nla_get_u32(nla); in meta_int_change() 882 static inline int meta_change_data(struct meta_value *dst, struct nlattr *nla) in meta_change_data() argument 884 if (nla) { in meta_change_data() [all …]
|
D | ematch.c | 171 struct tcf_ematch *em, struct nlattr *nla, int idx) in tcf_em_validate() argument 174 struct tcf_ematch_hdr *em_hdr = nla_data(nla); in tcf_em_validate() 175 int data_len = nla_len(nla) - sizeof(*em_hdr); in tcf_em_validate() 305 int tcf_em_tree_validate(struct tcf_proto *tp, struct nlattr *nla, in tcf_em_tree_validate() argument 315 if (!nla) in tcf_em_tree_validate() 318 err = nla_parse_nested_deprecated(tb, TCA_EMATCH_TREE_MAX, nla, in tcf_em_tree_validate()
|
/kernel/linux/linux-5.10/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 …]
|
/kernel/linux/linux-5.10/net/openvswitch/ |
D | flow_netlink.c | 53 struct nlattr *nla; in actions_may_change_flow() local 56 nla_for_each_nested(nla, actions, rem) { in actions_may_change_flow() 57 u16 action = nla_type(nla); in actions_may_change_flow() 467 const struct nlattr *nla; in __parse_flow_nlattrs() local 472 nla_for_each_nested(nla, attr, rem) { in __parse_flow_nlattrs() 473 u16 type = nla_type(nla); in __parse_flow_nlattrs() 488 if (!check_attr_len(nla_len(nla), expected_len)) { in __parse_flow_nlattrs() 490 type, nla_len(nla), expected_len); in __parse_flow_nlattrs() 494 if (!nz || !is_all_zero(nla_data(nla), nla_len(nla))) { in __parse_flow_nlattrs() 496 a[type] = nla; in __parse_flow_nlattrs() [all …]
|
D | meter.c | 238 struct nlattr *nla; in ovs_meter_cmd_reply_stats() local 253 nla = nla_nest_start_noflag(reply, OVS_METER_ATTR_BANDS); in ovs_meter_cmd_reply_stats() 254 if (!nla) in ovs_meter_cmd_reply_stats() 269 nla_nest_end(reply, nla); in ovs_meter_cmd_reply_stats() 280 struct nlattr *nla, *band_nla; in ovs_meter_cmd_features() local 306 nla = nla_nest_start_noflag(reply, OVS_METER_ATTR_BANDS); in ovs_meter_cmd_features() 307 if (!nla) in ovs_meter_cmd_features() 317 nla_nest_end(reply, nla); in ovs_meter_cmd_features() 331 struct nlattr *nla; in dp_meter_create() local 342 nla_for_each_nested(nla, a[OVS_METER_ATTR_BANDS], rem) in dp_meter_create() [all …]
|
/kernel/linux/linux-5.10/net/psample/ |
D | psample.c | 289 struct nlattr *nla; in psample_ip_tun_to_nlattr() local 292 nla = nla_nest_start_noflag(skb, PSAMPLE_ATTR_TUNNEL); in psample_ip_tun_to_nlattr() 293 if (!nla) in psample_ip_tun_to_nlattr() 298 nla_nest_cancel(skb, nla); in psample_ip_tun_to_nlattr() 302 nla_nest_end(skb, nla); in psample_ip_tun_to_nlattr() 428 struct nlattr *nla; in psample_sample_packet() local 430 nla = skb_put(nl_skb, nla_len); in psample_sample_packet() 431 nla->nla_type = PSAMPLE_ATTR_DATA; in psample_sample_packet() 432 nla->nla_len = nla_attr_size(data_len); in psample_sample_packet() 434 if (skb_copy_bits(skb, 0, nla_data(nla), data_len)) in psample_sample_packet()
|
/kernel/linux/linux-5.10/net/mpls/ |
D | af_mpls.c | 717 static int nla_get_via(const struct nlattr *nla, u8 *via_alen, u8 *via_table, in nla_get_via() argument 720 struct rtvia *via = nla_data(nla); in nla_get_via() 724 if (nla_len(nla) < offsetof(struct rtvia, rtvia_addr)) { in nla_get_via() 725 NL_SET_ERR_MSG_ATTR(extack, nla, in nla_get_via() 729 alen = nla_len(nla) - in nla_get_via() 732 NL_SET_ERR_MSG_ATTR(extack, nla, in nla_get_via() 844 struct nlattr *nla, *attrs = rtnh_attrs(rtnh); in mpls_count_nexthops() local 849 nla = nla_find(attrs, attrlen, RTA_VIA); in mpls_count_nexthops() 850 if (nla && nla_len(nla) >= in mpls_count_nexthops() 852 int via_alen = nla_len(nla) - in mpls_count_nexthops() [all …]
|
/kernel/linux/linux-5.10/net/ipv6/ |
D | seg6_local.c | 686 struct nlattr *nla; in put_nla_srh() local 692 nla = nla_reserve(skb, SEG6_LOCAL_SRH, len); in put_nla_srh() 693 if (!nla) in put_nla_srh() 696 memcpy(nla_data(nla), srh, len); in put_nla_srh() 744 struct nlattr *nla; in put_nla_nh4() local 746 nla = nla_reserve(skb, SEG6_LOCAL_NH4, sizeof(struct in_addr)); in put_nla_nh4() 747 if (!nla) in put_nla_nh4() 750 memcpy(nla_data(nla), &slwt->nh4, sizeof(struct in_addr)); in put_nla_nh4() 770 struct nlattr *nla; in put_nla_nh6() local 772 nla = nla_reserve(skb, SEG6_LOCAL_NH6, sizeof(struct in6_addr)); in put_nla_nh6() [all …]
|
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() 306 struct nlattr *nla; in nla_put_rpl_srh() local 311 nla = nla_reserve(skb, attrtype, len); in nla_put_rpl_srh() 312 if (!nla) in nla_put_rpl_srh() 315 data = nla_data(nla); in nla_put_rpl_srh()
|