Lines Matching refs:nla

66 static int validate_nla_bitfield32(const struct nlattr *nla,  in validate_nla_bitfield32()  argument
69 const struct nla_bitfield32 *bf = nla_data(nla); in validate_nla_bitfield32()
171 const struct nlattr *nla, in nla_validate_range_unsigned() argument
180 value = nla_get_u8(nla); in nla_validate_range_unsigned()
183 value = nla_get_u16(nla); in nla_validate_range_unsigned()
186 value = nla_get_u32(nla); in nla_validate_range_unsigned()
189 value = nla_get_u64(nla); in nla_validate_range_unsigned()
192 value = nla_get_uint(nla); in nla_validate_range_unsigned()
195 value = nla_get_u64(nla); in nla_validate_range_unsigned()
198 value = nla_len(nla); in nla_validate_range_unsigned()
201 value = ntohs(nla_get_be16(nla)); in nla_validate_range_unsigned()
204 value = ntohl(nla_get_be32(nla)); in nla_validate_range_unsigned()
217 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in nla_validate_range_unsigned()
230 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in nla_validate_range_unsigned()
233 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in nla_validate_range_unsigned()
288 const struct nlattr *nla, in nla_validate_int_range_signed() argument
296 value = nla_get_s8(nla); in nla_validate_int_range_signed()
299 value = nla_get_s16(nla); in nla_validate_int_range_signed()
302 value = nla_get_s32(nla); in nla_validate_int_range_signed()
305 value = nla_get_s64(nla); in nla_validate_int_range_signed()
308 value = nla_get_sint(nla); in nla_validate_int_range_signed()
317 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in nla_validate_int_range_signed()
326 const struct nlattr *nla, in nla_validate_int_range() argument
340 return nla_validate_range_unsigned(pt, nla, extack, validate); in nla_validate_int_range()
346 return nla_validate_int_range_signed(pt, nla, extack); in nla_validate_int_range()
354 const struct nlattr *nla, in nla_validate_mask() argument
361 value = nla_get_u8(nla); in nla_validate_mask()
364 value = nla_get_u16(nla); in nla_validate_mask()
367 value = nla_get_u32(nla); in nla_validate_mask()
370 value = nla_get_u64(nla); in nla_validate_mask()
373 value = nla_get_uint(nla); in nla_validate_mask()
376 value = ntohs(nla_get_be16(nla)); in nla_validate_mask()
379 value = ntohl(nla_get_be32(nla)); in nla_validate_mask()
386 NL_SET_ERR_MSG_ATTR(extack, nla, "reserved bit set"); in nla_validate_mask()
393 static int validate_nla(const struct nlattr *nla, int maxtype, in validate_nla() argument
399 int minlen = 0, attrlen = nla_len(nla), type = nla_type(nla); in validate_nla()
417 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in validate_nla()
425 !(nla->nla_type & NLA_F_NESTED)) { in validate_nla()
426 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in validate_nla()
431 pt->type != NLA_UNSPEC && (nla->nla_type & NLA_F_NESTED)) { in validate_nla()
432 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in validate_nla()
441 NL_SET_BAD_ATTR(extack, nla); in validate_nla()
456 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in validate_nla()
466 err = validate_nla_bitfield32(nla, pt->bitfield32_valid); in validate_nla()
477 if (!minlen || memchr(nla_data(nla), '\0', minlen) == NULL) { in validate_nla()
488 char *buf = nla_data(nla); in validate_nla()
512 err = __nla_validate_parse(nla_data(nla), nla_len(nla), in validate_nla()
536 err = nla_validate_array(nla_data(nla), nla_len(nla), in validate_nla()
551 NL_SET_ERR_MSG_ATTR(extack, nla, in validate_nla()
579 err = nla_validate_int_range(pt, nla, extack, validate); in validate_nla()
584 err = nla_validate_mask(pt, nla, extack); in validate_nla()
590 err = pt->validate(nla, extack); in validate_nla()
599 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in validate_nla()
610 const struct nlattr *nla; in __nla_validate_parse() local
622 nla_for_each_attr(nla, head, len, rem) { in __nla_validate_parse()
623 u16 type = nla_type(nla); in __nla_validate_parse()
627 NL_SET_ERR_MSG_ATTR(extack, nla, in __nla_validate_parse()
635 int err = validate_nla(nla, maxtype, policy, in __nla_validate_parse()
643 tb[type] = (struct nlattr *)nla; in __nla_validate_parse()
747 const struct nlattr *nla; in nla_find() local
750 nla_for_each_attr(nla, head, len, rem) in nla_find()
751 if (nla_type(nla) == attrtype) in nla_find()
752 return (struct nlattr *)nla; in nla_find()
772 ssize_t nla_strscpy(char *dst, const struct nlattr *nla, size_t dstsize) in nla_strscpy() argument
774 size_t srclen = nla_len(nla); in nla_strscpy()
775 char *src = nla_data(nla); in nla_strscpy()
808 char *nla_strdup(const struct nlattr *nla, gfp_t flags) in nla_strdup() argument
810 size_t srclen = nla_len(nla); in nla_strdup()
811 char *src = nla_data(nla), *dst; in nla_strdup()
854 int nla_memcmp(const struct nlattr *nla, const void *data, in nla_memcmp() argument
857 int d = nla_len(nla) - size; in nla_memcmp()
860 d = memcmp(nla_data(nla), data, size); in nla_memcmp()
871 int nla_strcmp(const struct nlattr *nla, const char *str) in nla_strcmp() argument
874 char *buf = nla_data(nla); in nla_strcmp()
875 int attrlen = nla_len(nla); in nla_strcmp()
883 d = memcmp(nla_data(nla), str, len); in nla_strcmp()
904 struct nlattr *nla; in __nla_reserve() local
906 nla = skb_put(skb, nla_total_size(attrlen)); in __nla_reserve()
907 nla->nla_type = attrtype; in __nla_reserve()
908 nla->nla_len = nla_attr_size(attrlen); in __nla_reserve()
910 memset((unsigned char *) nla + nla->nla_len, 0, nla_padlen(attrlen)); in __nla_reserve()
912 return nla; in __nla_reserve()
1038 struct nlattr *nla; in __nla_put() local
1040 nla = __nla_reserve(skb, attrtype, attrlen); in __nla_put()
1041 memcpy(nla_data(nla), data, attrlen); in __nla_put()
1059 struct nlattr *nla; in __nla_put_64bit() local
1061 nla = __nla_reserve_64bit(skb, attrtype, attrlen, padattr); in __nla_put_64bit()
1062 memcpy(nla_data(nla), data, attrlen); in __nla_put_64bit()