/linux/lib/ |
A D | nlattr.c | 172 value = nla_get_u8(nla); in nla_validate_range_unsigned() 185 value = nla_len(nla); in nla_validate_range_unsigned() 276 value = nla_get_s8(nla); in nla_validate_int_range_signed() 363 int minlen = 0, attrlen = nla_len(nla), type = nla_type(nla); in validate_nla() 466 err = __nla_validate_parse(nla_data(nla), nla_len(nla), in validate_nla() 490 err = nla_validate_array(nla_data(nla), nla_len(nla), in validate_nla() 857 struct nlattr *nla; in __nla_reserve() local 863 memset((unsigned char *) nla + nla->nla_len, 0, nla_padlen(attrlen)); in __nla_reserve() 865 return nla; in __nla_reserve() 991 struct nlattr *nla; in __nla_put() local [all …]
|
/linux/tools/lib/bpf/ |
A D | nlattr.c | 27 int totlen = NLA_ALIGN(nla->nla_len); in nla_next() 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() 50 int type = nla_type(nla); in validate_nla() 65 if (libbpf_nla_len(nla) < minlen) in validate_nla() 107 struct nlattr *nla; in libbpf_nla_parse() local 113 int type = nla_type(nla); in libbpf_nla_parse() 128 tb[type] = nla; in libbpf_nla_parse() 150 struct nlattr *nla, in libbpf_nla_parse_nested() argument [all …]
|
A D | nlattr.h | 84 return (void *)nla + NLA_HDRLEN; in libbpf_nla_data() 89 return *(uint8_t *)libbpf_nla_data(nla); in libbpf_nla_getattr_u8() 94 return *(uint32_t *)libbpf_nla_data(nla); in libbpf_nla_getattr_u32() 99 return (const char *)libbpf_nla_data(nla); in libbpf_nla_getattr_str() 108 return nla->nla_len - NLA_HDRLEN; in libbpf_nla_len() 114 struct nlattr *nla, 132 struct nlattr *nla; in nlattr_add() local 139 nla = req_tail(req); in nlattr_add() 140 nla->nla_type = type; in nlattr_add() 141 nla->nla_len = NLA_HDRLEN + len; in nlattr_add() [all …]
|
/linux/drivers/block/drbd/ |
A 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() 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() 52 err = drbd_nla_check_mandatory(maxtype, nla); in drbd_nla_find_nested() [all …]
|
A 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/include/net/ |
A D | netlink.h | 1159 nla->nla_len >= sizeof(*nla) && in nla_ok() 1189 return nla_find(nla_data(nla), nla_len(nla), attrtype); in nla_find_nested() 1212 return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy, in nla_parse_nested() 1231 return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy, in nla_parse_nested_deprecated() 1554 return *(u32 *) nla_data(nla); in nla_get_u32() 1608 return *(u8 *) nla_data(nla); in nla_get_u8() 1670 return *(s8 *) nla_data(nla); in nla_get_s8() 1692 return !!nla; in nla_get_flag() 1703 u64 msecs = nla_get_u64(nla); in nla_get_msecs() 1932 nla_for_each_attr(pos, nla_data(nla), nla_len(nla), rem) [all …]
|
/linux/net/netfilter/ |
A D | nf_tables_api.c | 140 ctx->nla = nla; in nft_ctx_init() 1240 const struct nlattr * const *nla = ctx->nla; in nft_flush() local 1283 (!nla[NFTA_TABLE_NAME] && !nla[NFTA_TABLE_HANDLE])) in nf_tables_deltable() 2088 const struct nlattr * const *nla = ctx->nla; in nf_tables_addchain() local 2245 const struct nlattr * const *nla = ctx->nla; in nf_tables_updchain() local 3082 if (nla[NFTA_RULE_TABLE] || nla[NFTA_RULE_CHAIN]) { in nf_tables_dump_rules_start() 4323 if (nla[NFTA_SET_EXPR] || nla[NFTA_SET_EXPRESSIONS]) in nf_tables_newset() 6784 if (nla[NFTA_OBJ_TABLE] || nla[NFTA_OBJ_TYPE]) { in nf_tables_dump_obj_start() 6921 (!nla[NFTA_OBJ_NAME] && !nla[NFTA_OBJ_HANDLE])) in nf_tables_delobj() 7271 const struct nlattr * const *nla = ctx->nla; in nft_flowtable_update() local [all …]
|
A D | nfnetlink_hook.c | 297 const struct nlattr * const *nla = cb->data; in nfnl_hook_dump_start() local 305 hooknum = ntohl(nla_get_be32(nla[NFNLA_HOOK_HOOKNUM])); in nfnl_hook_dump_start() 310 if (!nla[NFNLA_HOOK_DEV]) in nfnl_hook_dump_start() 313 nla_strscpy(name, nla[NFNLA_HOOK_DEV], sizeof(name)); in nfnl_hook_dump_start() 346 const struct nlattr * const nla[]) in nfnl_hook_get() argument 348 if (!nla[NFNLA_HOOK_HOOKNUM]) in nfnl_hook_get() 357 .data = (void *)nla, in nfnl_hook_get()
|
A 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()
|
/linux/net/ipv4/ |
A D | metrics.c | 14 struct nlattr *nla; in ip_metrics_convert() local 20 nla_for_each_attr(nla, fc_mx, fc_mx_len, remaining) { in ip_metrics_convert() 21 int type = nla_type(nla); in ip_metrics_convert() 34 nla_strscpy(tmp, nla, sizeof(tmp)); in ip_metrics_convert() 41 if (nla_len(nla) != sizeof(u32)) { in ip_metrics_convert() 42 NL_SET_ERR_MSG_ATTR(extack, nla, in ip_metrics_convert() 46 val = nla_get_u32(nla); in ip_metrics_convert()
|
A D | fib_semantics.c | 714 if (nla && nlav) { in fib_get_nhs() 719 if (nla) { in fib_get_nhs() 734 if (nla) { in fib_get_nhs() 747 if (nla) in fib_get_nhs() 934 if (nla && nlav) { in fib_nh_match() 940 if (nla) { in fib_nh_match() 974 if (nla) { in fib_nh_match() 993 struct nlattr *nla; in fib_metrics_match() local 1663 struct nlattr *nla; in fib_nexthop_info() local 1667 if (!nla) in fib_nexthop_info() [all …]
|
/linux/include/linux/ |
A D | genl_magic_func.h | 105 else if (nla) \ 108 : nla_data(nla)); \ 116 else if (nla) \ 118 nla_data(nla), nla_len(nla)); \ 145 struct nlattr *nla; \ 170 nla = ntb[attr_nr]; \ 171 if (nla) { \ 190 s->name = __get(nla); \ 191 DPRINT_FIELD("<<", nla_type, name, s, nla)) 200 __get(s->name, nla, maxlen); \ [all …]
|
/linux/net/sched/ |
A D | act_tunnel_key.c | 96 nla, geneve_opt_policy, extack); in tunnel_key_copy_geneve_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() 210 nla = tb[TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_HWID]; in tunnel_key_copy_erspan_opt() 211 set_hwid(&md->u.md2, nla_get_u8(nla)); in tunnel_key_copy_erspan_opt() 222 const struct nlattr *attr, *head = nla_data(nla); in tunnel_key_copy_opts() 294 return tunnel_key_copy_opts(nla, NULL, 0, extack); in tunnel_key_get_opts_len() 301 switch (nla_type(nla_data(nla))) { in tunnel_key_opts_set() [all …]
|
A D | act_bpf.c | 99 struct nlattr *nla; in tcf_bpf_dump_bpf_info() local 104 nla = nla_reserve(skb, TCA_ACT_BPF_OPS, prog->bpf_num_ops * in tcf_bpf_dump_bpf_info() 106 if (nla == NULL) in tcf_bpf_dump_bpf_info() 109 memcpy(nla_data(nla), prog->bpf_ops, nla_len(nla)); in tcf_bpf_dump_bpf_info() 117 struct nlattr *nla; in tcf_bpf_dump_ebpf_info() local 126 nla = nla_reserve(skb, TCA_ACT_BPF_TAG, sizeof(prog->filter->tag)); in tcf_bpf_dump_ebpf_info() 127 if (nla == NULL) in tcf_bpf_dump_ebpf_info() 130 memcpy(nla_data(nla), prog->filter->tag, nla_len(nla)); in tcf_bpf_dump_ebpf_info() 276 static int tcf_bpf_init(struct net *net, struct nlattr *nla, in tcf_bpf_init() argument 292 if (!nla) in tcf_bpf_init() [all …]
|
A 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()
|
A 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() 884 if (nla) { in meta_change_data() 885 if (nla_len(nla) == 0) in meta_change_data() [all …]
|
A 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() 303 int tcf_em_tree_validate(struct tcf_proto *tp, struct nlattr *nla, in tcf_em_tree_validate() argument 313 if (!nla) in tcf_em_tree_validate() 316 err = nla_parse_nested_deprecated(tb, TCA_EMATCH_TREE_MAX, nla, in tcf_em_tree_validate()
|
A D | act_ipt.c | 95 static int __tcf_ipt_init(struct net *net, unsigned int id, struct nlattr *nla, in __tcf_ipt_init() argument 111 if (nla == NULL) in __tcf_ipt_init() 114 err = nla_parse_nested_deprecated(tb, TCA_IPT_MAX, nla, ipt_policy, in __tcf_ipt_init() 204 static int tcf_ipt_init(struct net *net, struct nlattr *nla, in tcf_ipt_init() argument 209 return __tcf_ipt_init(net, ipt_net_id, nla, est, a, &act_ipt_ops, in tcf_ipt_init() 213 static int tcf_xt_init(struct net *net, struct nlattr *nla, in tcf_xt_init() argument 218 return __tcf_ipt_init(net, xt_net_id, nla, est, a, &act_xt_ops, in tcf_xt_init()
|
/linux/net/xfrm/ |
A D | xfrm_compat.c | 289 const struct nlattr *nla, *attrs; in xfrm_xlate64() local 305 err = xfrm_nla_cpy(dst, nla, nla_len(nla)); in xfrm_xlate64() 308 err = xfrm_xlate64_attr(dst, nla); in xfrm_xlate64() 400 struct nlattr *nla; in xfrm_attr_cpy32() local 412 nla = dst + *pos; in xfrm_attr_cpy32() 414 memcpy(nla, src, nla_attr_size(copy_len)); in xfrm_attr_cpy32() 415 nla->nla_len = nla_attr_size(payload); in xfrm_attr_cpy32() 417 nlmsg->nlmsg_len += nla->nla_len; in xfrm_attr_cpy32() 429 int type = nla_type(nla); in xfrm_xlate32_attr() 438 if (nla_len(nla) < compat_policy[type].len) { in xfrm_xlate32_attr() [all …]
|
/linux/net/openvswitch/ |
A D | flow_netlink.c | 494 if (!nz || !is_all_zero(nla_data(nla), nla_len(nla))) { in __parse_flow_nlattrs() 849 if (!nla) in vxlan_opt_to_nlattr() 941 if (!nla) in ip_tun_to_nlattr() 1747 memset(nla_data(nla), val, nla_len(nla)); in nlattr_set() 2037 if (!nla) in __ovs_nla_put_key() 2091 if (!nla) in __ovs_nla_put_key() 2104 if (!nla) in __ovs_nla_put_key() 2124 if (!nla) in __ovs_nla_put_key() 2140 if (!nla) in __ovs_nla_put_key() 2240 if (!nla) in ovs_nla_put_key() [all …]
|
A D | meter.c | 237 struct nlattr *nla; in ovs_meter_cmd_reply_stats() local 253 if (!nla) in ovs_meter_cmd_reply_stats() 268 nla_nest_end(reply, nla); in ovs_meter_cmd_reply_stats() 279 struct nlattr *nla, *band_nla; in ovs_meter_cmd_features() local 306 if (!nla) in ovs_meter_cmd_features() 316 nla_nest_end(reply, nla); in ovs_meter_cmd_features() 330 struct nlattr *nla; in dp_meter_create() local 341 nla_for_each_nested(nla, a[OVS_METER_ATTR_BANDS], rem) in dp_meter_create() 363 nla_for_each_nested(nla, a[OVS_METER_ATTR_BANDS], rem) { in dp_meter_create() 368 OVS_BAND_ATTR_MAX, nla_data(nla), in dp_meter_create() [all …]
|
/linux/net/mpls/ |
A D | af_mpls.c | 731 alen = nla_len(nla) - in nla_get_via() 852 if (nla && nla_len(nla) >= in mpls_count_nexthops() 863 if (nla && in mpls_count_nexthops() 1103 struct nlattr *nla; in mpls_fill_stats_af() local 1112 if (!nla) in mpls_fill_stats_af() 1682 struct nlattr *nla; in nla_put_via() local 1687 if (!nla) in nla_put_via() 1693 via = nla_data(nla); in nla_put_via() 1702 struct nlattr *nla; in nla_put_labels() local 1707 if (!nla) in nla_put_labels() [all …]
|
/linux/net/psample/ |
A D | psample.c | 290 struct nlattr *nla; in psample_ip_tun_to_nlattr() local 293 nla = nla_nest_start_noflag(skb, PSAMPLE_ATTR_TUNNEL); in psample_ip_tun_to_nlattr() 294 if (!nla) in psample_ip_tun_to_nlattr() 299 nla_nest_cancel(skb, nla); in psample_ip_tun_to_nlattr() 303 nla_nest_end(skb, nla); in psample_ip_tun_to_nlattr() 467 struct nlattr *nla; in psample_sample_packet() local 469 nla = skb_put(nl_skb, nla_len); in psample_sample_packet() 470 nla->nla_type = PSAMPLE_ATTR_DATA; in psample_sample_packet() 471 nla->nla_len = nla_attr_size(data_len); in psample_sample_packet() 473 if (skb_copy_bits(skb, 0, nla_data(nla), data_len)) in psample_sample_packet()
|
/linux/net/ipv6/ |
A 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() 301 struct nlattr *nla; in nla_put_rpl_srh() local 306 nla = nla_reserve(skb, attrtype, len); in nla_put_rpl_srh() 307 if (!nla) in nla_put_rpl_srh() 310 data = nla_data(nla); in nla_put_rpl_srh()
|
/linux/drivers/net/ |
A D | gtp.c | 896 if (nla[GTPA_NET_NS_FD]) in gtp_find_dev() 1116 struct nlattr *nla[]) in gtp_find_pdp_by_link() argument 1120 gtp = gtp_find_dev(net, nla); in gtp_find_pdp_by_link() 1124 if (nla[GTPA_MS_ADDRESS]) { in gtp_find_pdp_by_link() 1125 __be32 ip = nla_get_be32(nla[GTPA_MS_ADDRESS]); in gtp_find_pdp_by_link() 1128 } else if (nla[GTPA_VERSION]) { in gtp_find_pdp_by_link() 1129 u32 gtp_version = nla_get_u32(nla[GTPA_VERSION]); in gtp_find_pdp_by_link() 1131 if (gtp_version == GTP_V0 && nla[GTPA_TID]) in gtp_find_pdp_by_link() 1133 else if (gtp_version == GTP_V1 && nla[GTPA_I_TEI]) in gtp_find_pdp_by_link() 1144 if (nla[GTPA_LINK]) in gtp_find_pdp() [all …]
|