Lines Matching refs:nla
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
50 int type = nla_type(nla); in validate_nla()
65 if (libbpf_nla_len(nla) < minlen) in validate_nla()
68 if (pt->maxlen && libbpf_nla_len(nla) > pt->maxlen) in validate_nla()
72 char *data = libbpf_nla_data(nla); in validate_nla()
74 if (data[libbpf_nla_len(nla) - 1] != '\0') in validate_nla()
107 struct nlattr *nla; in libbpf_nla_parse() local
112 libbpf_nla_for_each_attr(nla, head, len, rem) { in libbpf_nla_parse()
113 int type = nla_type(nla); in libbpf_nla_parse()
119 err = validate_nla(nla, maxtype, policy); in libbpf_nla_parse()
128 tb[type] = nla; in libbpf_nla_parse()
150 struct nlattr *nla, in libbpf_nla_parse_nested() argument
153 return libbpf_nla_parse(tb, maxtype, libbpf_nla_data(nla), in libbpf_nla_parse_nested()
154 libbpf_nla_len(nla), policy); in libbpf_nla_parse_nested()