nlattr.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * NETLINK Netlink attributes
  4. *
  5. * Authors: Thomas Graf <tgraf@suug.ch>
  6. * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
  7. */
  8. #include <linux/export.h>
  9. #include <linux/kernel.h>
  10. #include <linux/errno.h>
  11. #include <linux/jiffies.h>
  12. #include <linux/skbuff.h>
  13. #include <linux/string.h>
  14. #include <linux/types.h>
  15. #include <net/netlink.h>
  16. static const u8 nla_attr_minlen[NLA_TYPE_MAX+1] = {
  17. [NLA_U8] = sizeof(u8),
  18. [NLA_U16] = sizeof(u16),
  19. [NLA_U32] = sizeof(u32),
  20. [NLA_U64] = sizeof(u64),
  21. [NLA_MSECS] = sizeof(u64),
  22. [NLA_NESTED] = NLA_HDRLEN,
  23. [NLA_S8] = sizeof(s8),
  24. [NLA_S16] = sizeof(s16),
  25. [NLA_S32] = sizeof(s32),
  26. [NLA_S64] = sizeof(s64),
  27. };
  28. static int validate_nla_bitfield32(const struct nlattr *nla,
  29. u32 *valid_flags_allowed)
  30. {
  31. const struct nla_bitfield32 *bf = nla_data(nla);
  32. u32 *valid_flags_mask = valid_flags_allowed;
  33. if (!valid_flags_allowed)
  34. return -EINVAL;
  35. /*disallow invalid bit selector */
  36. if (bf->selector & ~*valid_flags_mask)
  37. return -EINVAL;
  38. /*disallow invalid bit values */
  39. if (bf->value & ~*valid_flags_mask)
  40. return -EINVAL;
  41. /*disallow valid bit values that are not selected*/
  42. if (bf->value & ~bf->selector)
  43. return -EINVAL;
  44. return 0;
  45. }
  46. static int validate_nla(const struct nlattr *nla, int maxtype,
  47. const struct nla_policy *policy)
  48. {
  49. const struct nla_policy *pt;
  50. int minlen = 0, attrlen = nla_len(nla), type = nla_type(nla);
  51. if (type <= 0 || type > maxtype)
  52. return 0;
  53. pt = &policy[type];
  54. BUG_ON(pt->type > NLA_TYPE_MAX);
  55. switch (pt->type) {
  56. case NLA_FLAG:
  57. if (attrlen > 0)
  58. return -ERANGE;
  59. break;
  60. case NLA_BITFIELD32:
  61. if (attrlen != sizeof(struct nla_bitfield32))
  62. return -ERANGE;
  63. return validate_nla_bitfield32(nla, pt->validation_data);
  64. case NLA_NUL_STRING:
  65. if (pt->len)
  66. minlen = min_t(int, attrlen, pt->len + 1);
  67. else
  68. minlen = attrlen;
  69. if (!minlen || memchr(nla_data(nla), '\0', minlen) == NULL)
  70. return -EINVAL;
  71. /* fall through */
  72. case NLA_STRING:
  73. if (attrlen < 1)
  74. return -ERANGE;
  75. if (pt->len) {
  76. char *buf = nla_data(nla);
  77. if (buf[attrlen - 1] == '\0')
  78. attrlen--;
  79. if (attrlen > pt->len)
  80. return -ERANGE;
  81. }
  82. break;
  83. case NLA_BINARY:
  84. if (pt->len && attrlen > pt->len)
  85. return -ERANGE;
  86. break;
  87. case NLA_NESTED_COMPAT:
  88. if (attrlen < pt->len)
  89. return -ERANGE;
  90. if (attrlen < NLA_ALIGN(pt->len))
  91. break;
  92. if (attrlen < NLA_ALIGN(pt->len) + NLA_HDRLEN)
  93. return -ERANGE;
  94. nla = nla_data(nla) + NLA_ALIGN(pt->len);
  95. if (attrlen < NLA_ALIGN(pt->len) + NLA_HDRLEN + nla_len(nla))
  96. return -ERANGE;
  97. break;
  98. case NLA_NESTED:
  99. /* a nested attributes is allowed to be empty; if its not,
  100. * it must have a size of at least NLA_HDRLEN.
  101. */
  102. if (attrlen == 0)
  103. break;
  104. default:
  105. if (pt->len)
  106. minlen = pt->len;
  107. else if (pt->type != NLA_UNSPEC)
  108. minlen = nla_attr_minlen[pt->type];
  109. if (attrlen < minlen)
  110. return -ERANGE;
  111. }
  112. return 0;
  113. }
  114. /**
  115. * nla_validate - Validate a stream of attributes
  116. * @head: head of attribute stream
  117. * @len: length of attribute stream
  118. * @maxtype: maximum attribute type to be expected
  119. * @policy: validation policy
  120. * @extack: extended ACK report struct
  121. *
  122. * Validates all attributes in the specified attribute stream against the
  123. * specified policy. Attributes with a type exceeding maxtype will be
  124. * ignored. See documenation of struct nla_policy for more details.
  125. *
  126. * Returns 0 on success or a negative error code.
  127. */
  128. int nla_validate(const struct nlattr *head, int len, int maxtype,
  129. const struct nla_policy *policy,
  130. struct netlink_ext_ack *extack)
  131. {
  132. const struct nlattr *nla;
  133. int rem;
  134. nla_for_each_attr(nla, head, len, rem) {
  135. int err = validate_nla(nla, maxtype, policy);
  136. if (err < 0) {
  137. if (extack)
  138. extack->bad_attr = nla;
  139. return err;
  140. }
  141. }
  142. return 0;
  143. }
  144. EXPORT_SYMBOL(nla_validate);
  145. /**
  146. * nla_policy_len - Determin the max. length of a policy
  147. * @policy: policy to use
  148. * @n: number of policies
  149. *
  150. * Determines the max. length of the policy. It is currently used
  151. * to allocated Netlink buffers roughly the size of the actual
  152. * message.
  153. *
  154. * Returns 0 on success or a negative error code.
  155. */
  156. int
  157. nla_policy_len(const struct nla_policy *p, int n)
  158. {
  159. int i, len = 0;
  160. for (i = 0; i < n; i++, p++) {
  161. if (p->len)
  162. len += nla_total_size(p->len);
  163. else if (nla_attr_minlen[p->type])
  164. len += nla_total_size(nla_attr_minlen[p->type]);
  165. }
  166. return len;
  167. }
  168. EXPORT_SYMBOL(nla_policy_len);
  169. /**
  170. * nla_parse - Parse a stream of attributes into a tb buffer
  171. * @tb: destination array with maxtype+1 elements
  172. * @maxtype: maximum attribute type to be expected
  173. * @head: head of attribute stream
  174. * @len: length of attribute stream
  175. * @policy: validation policy
  176. *
  177. * Parses a stream of attributes and stores a pointer to each attribute in
  178. * the tb array accessible via the attribute type. Attributes with a type
  179. * exceeding maxtype will be silently ignored for backwards compatibility
  180. * reasons. policy may be set to NULL if no validation is required.
  181. *
  182. * Returns 0 on success or a negative error code.
  183. */
  184. int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head,
  185. int len, const struct nla_policy *policy,
  186. struct netlink_ext_ack *extack)
  187. {
  188. const struct nlattr *nla;
  189. int rem, err;
  190. memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1));
  191. nla_for_each_attr(nla, head, len, rem) {
  192. u16 type = nla_type(nla);
  193. if (type > 0 && type <= maxtype) {
  194. if (policy) {
  195. err = validate_nla(nla, maxtype, policy);
  196. if (err < 0) {
  197. if (extack)
  198. extack->bad_attr = nla;
  199. goto errout;
  200. }
  201. }
  202. tb[type] = (struct nlattr *)nla;
  203. }
  204. }
  205. if (unlikely(rem > 0))
  206. pr_warn_ratelimited("netlink: %d bytes leftover after parsing attributes in process `%s'.\n",
  207. rem, current->comm);
  208. err = 0;
  209. errout:
  210. return err;
  211. }
  212. EXPORT_SYMBOL(nla_parse);
  213. /**
  214. * nla_find - Find a specific attribute in a stream of attributes
  215. * @head: head of attribute stream
  216. * @len: length of attribute stream
  217. * @attrtype: type of attribute to look for
  218. *
  219. * Returns the first attribute in the stream matching the specified type.
  220. */
  221. struct nlattr *nla_find(const struct nlattr *head, int len, int attrtype)
  222. {
  223. const struct nlattr *nla;
  224. int rem;
  225. nla_for_each_attr(nla, head, len, rem)
  226. if (nla_type(nla) == attrtype)
  227. return (struct nlattr *)nla;
  228. return NULL;
  229. }
  230. EXPORT_SYMBOL(nla_find);
  231. /**
  232. * nla_strlcpy - Copy string attribute payload into a sized buffer
  233. * @dst: where to copy the string to
  234. * @nla: attribute to copy the string from
  235. * @dstsize: size of destination buffer
  236. *
  237. * Copies at most dstsize - 1 bytes into the destination buffer.
  238. * The result is always a valid NUL-terminated string. Unlike
  239. * strlcpy the destination buffer is always padded out.
  240. *
  241. * Returns the length of the source buffer.
  242. */
  243. size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize)
  244. {
  245. size_t srclen = nla_len(nla);
  246. char *src = nla_data(nla);
  247. if (srclen > 0 && src[srclen - 1] == '\0')
  248. srclen--;
  249. if (dstsize > 0) {
  250. size_t len = (srclen >= dstsize) ? dstsize - 1 : srclen;
  251. memset(dst, 0, dstsize);
  252. memcpy(dst, src, len);
  253. }
  254. return srclen;
  255. }
  256. EXPORT_SYMBOL(nla_strlcpy);
  257. /**
  258. * nla_strdup - Copy string attribute payload into a newly allocated buffer
  259. * @nla: attribute to copy the string from
  260. * @flags: the type of memory to allocate (see kmalloc).
  261. *
  262. * Returns a pointer to the allocated buffer or NULL on error.
  263. */
  264. char *nla_strdup(const struct nlattr *nla, gfp_t flags)
  265. {
  266. size_t srclen = nla_len(nla);
  267. char *src = nla_data(nla), *dst;
  268. if (srclen > 0 && src[srclen - 1] == '\0')
  269. srclen--;
  270. dst = kmalloc(srclen + 1, flags);
  271. if (dst != NULL) {
  272. memcpy(dst, src, srclen);
  273. dst[srclen] = '\0';
  274. }
  275. return dst;
  276. }
  277. EXPORT_SYMBOL(nla_strdup);
  278. /**
  279. * nla_memcpy - Copy a netlink attribute into another memory area
  280. * @dest: where to copy to memcpy
  281. * @src: netlink attribute to copy from
  282. * @count: size of the destination area
  283. *
  284. * Note: The number of bytes copied is limited by the length of
  285. * attribute's payload. memcpy
  286. *
  287. * Returns the number of bytes copied.
  288. */
  289. int nla_memcpy(void *dest, const struct nlattr *src, int count)
  290. {
  291. int minlen = min_t(int, count, nla_len(src));
  292. memcpy(dest, nla_data(src), minlen);
  293. if (count > minlen)
  294. memset(dest + minlen, 0, count - minlen);
  295. return minlen;
  296. }
  297. EXPORT_SYMBOL(nla_memcpy);
  298. /**
  299. * nla_memcmp - Compare an attribute with sized memory area
  300. * @nla: netlink attribute
  301. * @data: memory area
  302. * @size: size of memory area
  303. */
  304. int nla_memcmp(const struct nlattr *nla, const void *data,
  305. size_t size)
  306. {
  307. int d = nla_len(nla) - size;
  308. if (d == 0)
  309. d = memcmp(nla_data(nla), data, size);
  310. return d;
  311. }
  312. EXPORT_SYMBOL(nla_memcmp);
  313. /**
  314. * nla_strcmp - Compare a string attribute against a string
  315. * @nla: netlink string attribute
  316. * @str: another string
  317. */
  318. int nla_strcmp(const struct nlattr *nla, const char *str)
  319. {
  320. size_t len = strlen(str);
  321. char *buf = nla_data(nla);
  322. int attrlen = nla_len(nla);
  323. int d;
  324. while (attrlen > 0 && buf[attrlen - 1] == '\0')
  325. attrlen--;
  326. d = attrlen - len;
  327. if (d == 0)
  328. d = memcmp(nla_data(nla), str, len);
  329. return d;
  330. }
  331. EXPORT_SYMBOL(nla_strcmp);
  332. #ifdef CONFIG_NET
  333. /**
  334. * __nla_reserve - reserve room for attribute on the skb
  335. * @skb: socket buffer to reserve room on
  336. * @attrtype: attribute type
  337. * @attrlen: length of attribute payload
  338. *
  339. * Adds a netlink attribute header to a socket buffer and reserves
  340. * room for the payload but does not copy it.
  341. *
  342. * The caller is responsible to ensure that the skb provides enough
  343. * tailroom for the attribute header and payload.
  344. */
  345. struct nlattr *__nla_reserve(struct sk_buff *skb, int attrtype, int attrlen)
  346. {
  347. struct nlattr *nla;
  348. nla = skb_put(skb, nla_total_size(attrlen));
  349. nla->nla_type = attrtype;
  350. nla->nla_len = nla_attr_size(attrlen);
  351. memset((unsigned char *) nla + nla->nla_len, 0, nla_padlen(attrlen));
  352. return nla;
  353. }
  354. EXPORT_SYMBOL(__nla_reserve);
  355. /**
  356. * __nla_reserve_64bit - reserve room for attribute on the skb and align it
  357. * @skb: socket buffer to reserve room on
  358. * @attrtype: attribute type
  359. * @attrlen: length of attribute payload
  360. * @padattr: attribute type for the padding
  361. *
  362. * Adds a netlink attribute header to a socket buffer and reserves
  363. * room for the payload but does not copy it. It also ensure that this
  364. * attribute will have a 64-bit aligned nla_data() area.
  365. *
  366. * The caller is responsible to ensure that the skb provides enough
  367. * tailroom for the attribute header and payload.
  368. */
  369. struct nlattr *__nla_reserve_64bit(struct sk_buff *skb, int attrtype,
  370. int attrlen, int padattr)
  371. {
  372. if (nla_need_padding_for_64bit(skb))
  373. nla_align_64bit(skb, padattr);
  374. return __nla_reserve(skb, attrtype, attrlen);
  375. }
  376. EXPORT_SYMBOL(__nla_reserve_64bit);
  377. /**
  378. * __nla_reserve_nohdr - reserve room for attribute without header
  379. * @skb: socket buffer to reserve room on
  380. * @attrlen: length of attribute payload
  381. *
  382. * Reserves room for attribute payload without a header.
  383. *
  384. * The caller is responsible to ensure that the skb provides enough
  385. * tailroom for the payload.
  386. */
  387. void *__nla_reserve_nohdr(struct sk_buff *skb, int attrlen)
  388. {
  389. return skb_put_zero(skb, NLA_ALIGN(attrlen));
  390. }
  391. EXPORT_SYMBOL(__nla_reserve_nohdr);
  392. /**
  393. * nla_reserve - reserve room for attribute on the skb
  394. * @skb: socket buffer to reserve room on
  395. * @attrtype: attribute type
  396. * @attrlen: length of attribute payload
  397. *
  398. * Adds a netlink attribute header to a socket buffer and reserves
  399. * room for the payload but does not copy it.
  400. *
  401. * Returns NULL if the tailroom of the skb is insufficient to store
  402. * the attribute header and payload.
  403. */
  404. struct nlattr *nla_reserve(struct sk_buff *skb, int attrtype, int attrlen)
  405. {
  406. if (unlikely(skb_tailroom(skb) < nla_total_size(attrlen)))
  407. return NULL;
  408. return __nla_reserve(skb, attrtype, attrlen);
  409. }
  410. EXPORT_SYMBOL(nla_reserve);
  411. /**
  412. * nla_reserve_64bit - reserve room for attribute on the skb and align it
  413. * @skb: socket buffer to reserve room on
  414. * @attrtype: attribute type
  415. * @attrlen: length of attribute payload
  416. * @padattr: attribute type for the padding
  417. *
  418. * Adds a netlink attribute header to a socket buffer and reserves
  419. * room for the payload but does not copy it. It also ensure that this
  420. * attribute will have a 64-bit aligned nla_data() area.
  421. *
  422. * Returns NULL if the tailroom of the skb is insufficient to store
  423. * the attribute header and payload.
  424. */
  425. struct nlattr *nla_reserve_64bit(struct sk_buff *skb, int attrtype, int attrlen,
  426. int padattr)
  427. {
  428. size_t len;
  429. if (nla_need_padding_for_64bit(skb))
  430. len = nla_total_size_64bit(attrlen);
  431. else
  432. len = nla_total_size(attrlen);
  433. if (unlikely(skb_tailroom(skb) < len))
  434. return NULL;
  435. return __nla_reserve_64bit(skb, attrtype, attrlen, padattr);
  436. }
  437. EXPORT_SYMBOL(nla_reserve_64bit);
  438. /**
  439. * nla_reserve_nohdr - reserve room for attribute without header
  440. * @skb: socket buffer to reserve room on
  441. * @attrlen: length of attribute payload
  442. *
  443. * Reserves room for attribute payload without a header.
  444. *
  445. * Returns NULL if the tailroom of the skb is insufficient to store
  446. * the attribute payload.
  447. */
  448. void *nla_reserve_nohdr(struct sk_buff *skb, int attrlen)
  449. {
  450. if (unlikely(skb_tailroom(skb) < NLA_ALIGN(attrlen)))
  451. return NULL;
  452. return __nla_reserve_nohdr(skb, attrlen);
  453. }
  454. EXPORT_SYMBOL(nla_reserve_nohdr);
  455. /**
  456. * __nla_put - Add a netlink attribute to a socket buffer
  457. * @skb: socket buffer to add attribute to
  458. * @attrtype: attribute type
  459. * @attrlen: length of attribute payload
  460. * @data: head of attribute payload
  461. *
  462. * The caller is responsible to ensure that the skb provides enough
  463. * tailroom for the attribute header and payload.
  464. */
  465. void __nla_put(struct sk_buff *skb, int attrtype, int attrlen,
  466. const void *data)
  467. {
  468. struct nlattr *nla;
  469. nla = __nla_reserve(skb, attrtype, attrlen);
  470. memcpy(nla_data(nla), data, attrlen);
  471. }
  472. EXPORT_SYMBOL(__nla_put);
  473. /**
  474. * __nla_put_64bit - Add a netlink attribute to a socket buffer and align it
  475. * @skb: socket buffer to add attribute to
  476. * @attrtype: attribute type
  477. * @attrlen: length of attribute payload
  478. * @data: head of attribute payload
  479. * @padattr: attribute type for the padding
  480. *
  481. * The caller is responsible to ensure that the skb provides enough
  482. * tailroom for the attribute header and payload.
  483. */
  484. void __nla_put_64bit(struct sk_buff *skb, int attrtype, int attrlen,
  485. const void *data, int padattr)
  486. {
  487. struct nlattr *nla;
  488. nla = __nla_reserve_64bit(skb, attrtype, attrlen, padattr);
  489. memcpy(nla_data(nla), data, attrlen);
  490. }
  491. EXPORT_SYMBOL(__nla_put_64bit);
  492. /**
  493. * __nla_put_nohdr - Add a netlink attribute without header
  494. * @skb: socket buffer to add attribute to
  495. * @attrlen: length of attribute payload
  496. * @data: head of attribute payload
  497. *
  498. * The caller is responsible to ensure that the skb provides enough
  499. * tailroom for the attribute payload.
  500. */
  501. void __nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data)
  502. {
  503. void *start;
  504. start = __nla_reserve_nohdr(skb, attrlen);
  505. memcpy(start, data, attrlen);
  506. }
  507. EXPORT_SYMBOL(__nla_put_nohdr);
  508. /**
  509. * nla_put - Add a netlink attribute to a socket buffer
  510. * @skb: socket buffer to add attribute to
  511. * @attrtype: attribute type
  512. * @attrlen: length of attribute payload
  513. * @data: head of attribute payload
  514. *
  515. * Returns -EMSGSIZE if the tailroom of the skb is insufficient to store
  516. * the attribute header and payload.
  517. */
  518. int nla_put(struct sk_buff *skb, int attrtype, int attrlen, const void *data)
  519. {
  520. if (unlikely(skb_tailroom(skb) < nla_total_size(attrlen)))
  521. return -EMSGSIZE;
  522. __nla_put(skb, attrtype, attrlen, data);
  523. return 0;
  524. }
  525. EXPORT_SYMBOL(nla_put);
  526. /**
  527. * nla_put_64bit - Add a netlink attribute to a socket buffer and align it
  528. * @skb: socket buffer to add attribute to
  529. * @attrtype: attribute type
  530. * @attrlen: length of attribute payload
  531. * @data: head of attribute payload
  532. * @padattr: attribute type for the padding
  533. *
  534. * Returns -EMSGSIZE if the tailroom of the skb is insufficient to store
  535. * the attribute header and payload.
  536. */
  537. int nla_put_64bit(struct sk_buff *skb, int attrtype, int attrlen,
  538. const void *data, int padattr)
  539. {
  540. size_t len;
  541. if (nla_need_padding_for_64bit(skb))
  542. len = nla_total_size_64bit(attrlen);
  543. else
  544. len = nla_total_size(attrlen);
  545. if (unlikely(skb_tailroom(skb) < len))
  546. return -EMSGSIZE;
  547. __nla_put_64bit(skb, attrtype, attrlen, data, padattr);
  548. return 0;
  549. }
  550. EXPORT_SYMBOL(nla_put_64bit);
  551. /**
  552. * nla_put_nohdr - Add a netlink attribute without header
  553. * @skb: socket buffer to add attribute to
  554. * @attrlen: length of attribute payload
  555. * @data: head of attribute payload
  556. *
  557. * Returns -EMSGSIZE if the tailroom of the skb is insufficient to store
  558. * the attribute payload.
  559. */
  560. int nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data)
  561. {
  562. if (unlikely(skb_tailroom(skb) < NLA_ALIGN(attrlen)))
  563. return -EMSGSIZE;
  564. __nla_put_nohdr(skb, attrlen, data);
  565. return 0;
  566. }
  567. EXPORT_SYMBOL(nla_put_nohdr);
  568. /**
  569. * nla_append - Add a netlink attribute without header or padding
  570. * @skb: socket buffer to add attribute to
  571. * @attrlen: length of attribute payload
  572. * @data: head of attribute payload
  573. *
  574. * Returns -EMSGSIZE if the tailroom of the skb is insufficient to store
  575. * the attribute payload.
  576. */
  577. int nla_append(struct sk_buff *skb, int attrlen, const void *data)
  578. {
  579. if (unlikely(skb_tailroom(skb) < NLA_ALIGN(attrlen)))
  580. return -EMSGSIZE;
  581. skb_put_data(skb, data, attrlen);
  582. return 0;
  583. }
  584. EXPORT_SYMBOL(nla_append);
  585. #endif