xfrm_algo.c 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755
  1. /*
  2. * xfrm algorithm interface
  3. *
  4. * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the Free
  8. * Software Foundation; either version 2 of the License, or (at your option)
  9. * any later version.
  10. */
  11. #include <linux/module.h>
  12. #include <linux/kernel.h>
  13. #include <linux/pfkeyv2.h>
  14. #include <linux/crypto.h>
  15. #include <linux/scatterlist.h>
  16. #include <net/xfrm.h>
  17. #if defined(CONFIG_INET_AH) || defined(CONFIG_INET_AH_MODULE) || defined(CONFIG_INET6_AH) || defined(CONFIG_INET6_AH_MODULE)
  18. #include <net/ah.h>
  19. #endif
  20. #if defined(CONFIG_INET_ESP) || defined(CONFIG_INET_ESP_MODULE) || defined(CONFIG_INET6_ESP) || defined(CONFIG_INET6_ESP_MODULE)
  21. #include <net/esp.h>
  22. #endif
  23. /*
  24. * Algorithms supported by IPsec. These entries contain properties which
  25. * are used in key negotiation and xfrm processing, and are used to verify
  26. * that instantiated crypto transforms have correct parameters for IPsec
  27. * purposes.
  28. */
  29. static struct xfrm_algo_desc aead_list[] = {
  30. {
  31. .name = "rfc4106(gcm(aes))",
  32. .uinfo = {
  33. .aead = {
  34. .icv_truncbits = 64,
  35. }
  36. },
  37. .desc = {
  38. .sadb_alg_id = SADB_X_EALG_AES_GCM_ICV8,
  39. .sadb_alg_ivlen = 8,
  40. .sadb_alg_minbits = 128,
  41. .sadb_alg_maxbits = 256
  42. }
  43. },
  44. {
  45. .name = "rfc4106(gcm(aes))",
  46. .uinfo = {
  47. .aead = {
  48. .icv_truncbits = 96,
  49. }
  50. },
  51. .desc = {
  52. .sadb_alg_id = SADB_X_EALG_AES_GCM_ICV12,
  53. .sadb_alg_ivlen = 8,
  54. .sadb_alg_minbits = 128,
  55. .sadb_alg_maxbits = 256
  56. }
  57. },
  58. {
  59. .name = "rfc4106(gcm(aes))",
  60. .uinfo = {
  61. .aead = {
  62. .icv_truncbits = 128,
  63. }
  64. },
  65. .desc = {
  66. .sadb_alg_id = SADB_X_EALG_AES_GCM_ICV16,
  67. .sadb_alg_ivlen = 8,
  68. .sadb_alg_minbits = 128,
  69. .sadb_alg_maxbits = 256
  70. }
  71. },
  72. {
  73. .name = "rfc4309(ccm(aes))",
  74. .uinfo = {
  75. .aead = {
  76. .icv_truncbits = 64,
  77. }
  78. },
  79. .desc = {
  80. .sadb_alg_id = SADB_X_EALG_AES_CCM_ICV8,
  81. .sadb_alg_ivlen = 8,
  82. .sadb_alg_minbits = 128,
  83. .sadb_alg_maxbits = 256
  84. }
  85. },
  86. {
  87. .name = "rfc4309(ccm(aes))",
  88. .uinfo = {
  89. .aead = {
  90. .icv_truncbits = 96,
  91. }
  92. },
  93. .desc = {
  94. .sadb_alg_id = SADB_X_EALG_AES_CCM_ICV12,
  95. .sadb_alg_ivlen = 8,
  96. .sadb_alg_minbits = 128,
  97. .sadb_alg_maxbits = 256
  98. }
  99. },
  100. {
  101. .name = "rfc4309(ccm(aes))",
  102. .uinfo = {
  103. .aead = {
  104. .icv_truncbits = 128,
  105. }
  106. },
  107. .desc = {
  108. .sadb_alg_id = SADB_X_EALG_AES_CCM_ICV16,
  109. .sadb_alg_ivlen = 8,
  110. .sadb_alg_minbits = 128,
  111. .sadb_alg_maxbits = 256
  112. }
  113. },
  114. {
  115. .name = "rfc4543(gcm(aes))",
  116. .uinfo = {
  117. .aead = {
  118. .icv_truncbits = 128,
  119. }
  120. },
  121. .desc = {
  122. .sadb_alg_id = SADB_X_EALG_NULL_AES_GMAC,
  123. .sadb_alg_ivlen = 8,
  124. .sadb_alg_minbits = 128,
  125. .sadb_alg_maxbits = 256
  126. }
  127. },
  128. };
  129. static struct xfrm_algo_desc aalg_list[] = {
  130. {
  131. .name = "digest_null",
  132. .uinfo = {
  133. .auth = {
  134. .icv_truncbits = 0,
  135. .icv_fullbits = 0,
  136. }
  137. },
  138. .desc = {
  139. .sadb_alg_id = SADB_X_AALG_NULL,
  140. .sadb_alg_ivlen = 0,
  141. .sadb_alg_minbits = 0,
  142. .sadb_alg_maxbits = 0
  143. }
  144. },
  145. {
  146. .name = "hmac(md5)",
  147. .compat = "md5",
  148. .uinfo = {
  149. .auth = {
  150. .icv_truncbits = 96,
  151. .icv_fullbits = 128,
  152. }
  153. },
  154. .desc = {
  155. .sadb_alg_id = SADB_AALG_MD5HMAC,
  156. .sadb_alg_ivlen = 0,
  157. .sadb_alg_minbits = 128,
  158. .sadb_alg_maxbits = 128
  159. }
  160. },
  161. {
  162. .name = "hmac(sha1)",
  163. .compat = "sha1",
  164. .uinfo = {
  165. .auth = {
  166. .icv_truncbits = 96,
  167. .icv_fullbits = 160,
  168. }
  169. },
  170. .desc = {
  171. .sadb_alg_id = SADB_AALG_SHA1HMAC,
  172. .sadb_alg_ivlen = 0,
  173. .sadb_alg_minbits = 160,
  174. .sadb_alg_maxbits = 160
  175. }
  176. },
  177. {
  178. .name = "hmac(sha256)",
  179. .compat = "sha256",
  180. .uinfo = {
  181. .auth = {
  182. .icv_truncbits = 96,
  183. .icv_fullbits = 256,
  184. }
  185. },
  186. .desc = {
  187. .sadb_alg_id = SADB_X_AALG_SHA2_256HMAC,
  188. .sadb_alg_ivlen = 0,
  189. .sadb_alg_minbits = 256,
  190. .sadb_alg_maxbits = 256
  191. }
  192. },
  193. {
  194. .name = "hmac(sha384)",
  195. .uinfo = {
  196. .auth = {
  197. .icv_truncbits = 192,
  198. .icv_fullbits = 384,
  199. }
  200. },
  201. .desc = {
  202. .sadb_alg_id = SADB_X_AALG_SHA2_384HMAC,
  203. .sadb_alg_ivlen = 0,
  204. .sadb_alg_minbits = 384,
  205. .sadb_alg_maxbits = 384
  206. }
  207. },
  208. {
  209. .name = "hmac(sha512)",
  210. .uinfo = {
  211. .auth = {
  212. .icv_truncbits = 256,
  213. .icv_fullbits = 512,
  214. }
  215. },
  216. .desc = {
  217. .sadb_alg_id = SADB_X_AALG_SHA2_512HMAC,
  218. .sadb_alg_ivlen = 0,
  219. .sadb_alg_minbits = 512,
  220. .sadb_alg_maxbits = 512
  221. }
  222. },
  223. {
  224. .name = "hmac(rmd160)",
  225. .compat = "rmd160",
  226. .uinfo = {
  227. .auth = {
  228. .icv_truncbits = 96,
  229. .icv_fullbits = 160,
  230. }
  231. },
  232. .desc = {
  233. .sadb_alg_id = SADB_X_AALG_RIPEMD160HMAC,
  234. .sadb_alg_ivlen = 0,
  235. .sadb_alg_minbits = 160,
  236. .sadb_alg_maxbits = 160
  237. }
  238. },
  239. {
  240. .name = "xcbc(aes)",
  241. .uinfo = {
  242. .auth = {
  243. .icv_truncbits = 96,
  244. .icv_fullbits = 128,
  245. }
  246. },
  247. .desc = {
  248. .sadb_alg_id = SADB_X_AALG_AES_XCBC_MAC,
  249. .sadb_alg_ivlen = 0,
  250. .sadb_alg_minbits = 128,
  251. .sadb_alg_maxbits = 128
  252. }
  253. },
  254. };
  255. static struct xfrm_algo_desc ealg_list[] = {
  256. {
  257. .name = "ecb(cipher_null)",
  258. .compat = "cipher_null",
  259. .uinfo = {
  260. .encr = {
  261. .blockbits = 8,
  262. .defkeybits = 0,
  263. }
  264. },
  265. .desc = {
  266. .sadb_alg_id = SADB_EALG_NULL,
  267. .sadb_alg_ivlen = 0,
  268. .sadb_alg_minbits = 0,
  269. .sadb_alg_maxbits = 0
  270. }
  271. },
  272. {
  273. .name = "cbc(des)",
  274. .compat = "des",
  275. .uinfo = {
  276. .encr = {
  277. .blockbits = 64,
  278. .defkeybits = 64,
  279. }
  280. },
  281. .desc = {
  282. .sadb_alg_id = SADB_EALG_DESCBC,
  283. .sadb_alg_ivlen = 8,
  284. .sadb_alg_minbits = 64,
  285. .sadb_alg_maxbits = 64
  286. }
  287. },
  288. {
  289. .name = "cbc(des3_ede)",
  290. .compat = "des3_ede",
  291. .uinfo = {
  292. .encr = {
  293. .blockbits = 64,
  294. .defkeybits = 192,
  295. }
  296. },
  297. .desc = {
  298. .sadb_alg_id = SADB_EALG_3DESCBC,
  299. .sadb_alg_ivlen = 8,
  300. .sadb_alg_minbits = 192,
  301. .sadb_alg_maxbits = 192
  302. }
  303. },
  304. {
  305. .name = "cbc(cast5)",
  306. .compat = "cast5",
  307. .uinfo = {
  308. .encr = {
  309. .blockbits = 64,
  310. .defkeybits = 128,
  311. }
  312. },
  313. .desc = {
  314. .sadb_alg_id = SADB_X_EALG_CASTCBC,
  315. .sadb_alg_ivlen = 8,
  316. .sadb_alg_minbits = 40,
  317. .sadb_alg_maxbits = 128
  318. }
  319. },
  320. {
  321. .name = "cbc(blowfish)",
  322. .compat = "blowfish",
  323. .uinfo = {
  324. .encr = {
  325. .blockbits = 64,
  326. .defkeybits = 128,
  327. }
  328. },
  329. .desc = {
  330. .sadb_alg_id = SADB_X_EALG_BLOWFISHCBC,
  331. .sadb_alg_ivlen = 8,
  332. .sadb_alg_minbits = 40,
  333. .sadb_alg_maxbits = 448
  334. }
  335. },
  336. {
  337. .name = "cbc(aes)",
  338. .compat = "aes",
  339. .uinfo = {
  340. .encr = {
  341. .blockbits = 128,
  342. .defkeybits = 128,
  343. }
  344. },
  345. .desc = {
  346. .sadb_alg_id = SADB_X_EALG_AESCBC,
  347. .sadb_alg_ivlen = 8,
  348. .sadb_alg_minbits = 128,
  349. .sadb_alg_maxbits = 256
  350. }
  351. },
  352. {
  353. .name = "cbc(serpent)",
  354. .compat = "serpent",
  355. .uinfo = {
  356. .encr = {
  357. .blockbits = 128,
  358. .defkeybits = 128,
  359. }
  360. },
  361. .desc = {
  362. .sadb_alg_id = SADB_X_EALG_SERPENTCBC,
  363. .sadb_alg_ivlen = 8,
  364. .sadb_alg_minbits = 128,
  365. .sadb_alg_maxbits = 256,
  366. }
  367. },
  368. {
  369. .name = "cbc(camellia)",
  370. .compat = "camellia",
  371. .uinfo = {
  372. .encr = {
  373. .blockbits = 128,
  374. .defkeybits = 128,
  375. }
  376. },
  377. .desc = {
  378. .sadb_alg_id = SADB_X_EALG_CAMELLIACBC,
  379. .sadb_alg_ivlen = 8,
  380. .sadb_alg_minbits = 128,
  381. .sadb_alg_maxbits = 256
  382. }
  383. },
  384. {
  385. .name = "cbc(twofish)",
  386. .compat = "twofish",
  387. .uinfo = {
  388. .encr = {
  389. .blockbits = 128,
  390. .defkeybits = 128,
  391. }
  392. },
  393. .desc = {
  394. .sadb_alg_id = SADB_X_EALG_TWOFISHCBC,
  395. .sadb_alg_ivlen = 8,
  396. .sadb_alg_minbits = 128,
  397. .sadb_alg_maxbits = 256
  398. }
  399. },
  400. {
  401. .name = "rfc3686(ctr(aes))",
  402. .uinfo = {
  403. .encr = {
  404. .blockbits = 128,
  405. .defkeybits = 160, /* 128-bit key + 32-bit nonce */
  406. }
  407. },
  408. .desc = {
  409. .sadb_alg_id = SADB_X_EALG_AESCTR,
  410. .sadb_alg_ivlen = 8,
  411. .sadb_alg_minbits = 160,
  412. .sadb_alg_maxbits = 288
  413. }
  414. },
  415. };
  416. static struct xfrm_algo_desc calg_list[] = {
  417. {
  418. .name = "deflate",
  419. .uinfo = {
  420. .comp = {
  421. .threshold = 90,
  422. }
  423. },
  424. .desc = { .sadb_alg_id = SADB_X_CALG_DEFLATE }
  425. },
  426. {
  427. .name = "lzs",
  428. .uinfo = {
  429. .comp = {
  430. .threshold = 90,
  431. }
  432. },
  433. .desc = { .sadb_alg_id = SADB_X_CALG_LZS }
  434. },
  435. {
  436. .name = "lzjh",
  437. .uinfo = {
  438. .comp = {
  439. .threshold = 50,
  440. }
  441. },
  442. .desc = { .sadb_alg_id = SADB_X_CALG_LZJH }
  443. },
  444. };
  445. static inline int aead_entries(void)
  446. {
  447. return ARRAY_SIZE(aead_list);
  448. }
  449. static inline int aalg_entries(void)
  450. {
  451. return ARRAY_SIZE(aalg_list);
  452. }
  453. static inline int ealg_entries(void)
  454. {
  455. return ARRAY_SIZE(ealg_list);
  456. }
  457. static inline int calg_entries(void)
  458. {
  459. return ARRAY_SIZE(calg_list);
  460. }
  461. struct xfrm_algo_list {
  462. struct xfrm_algo_desc *algs;
  463. int entries;
  464. u32 type;
  465. u32 mask;
  466. };
  467. static const struct xfrm_algo_list xfrm_aead_list = {
  468. .algs = aead_list,
  469. .entries = ARRAY_SIZE(aead_list),
  470. .type = CRYPTO_ALG_TYPE_AEAD,
  471. .mask = CRYPTO_ALG_TYPE_MASK,
  472. };
  473. static const struct xfrm_algo_list xfrm_aalg_list = {
  474. .algs = aalg_list,
  475. .entries = ARRAY_SIZE(aalg_list),
  476. .type = CRYPTO_ALG_TYPE_HASH,
  477. .mask = CRYPTO_ALG_TYPE_HASH_MASK,
  478. };
  479. static const struct xfrm_algo_list xfrm_ealg_list = {
  480. .algs = ealg_list,
  481. .entries = ARRAY_SIZE(ealg_list),
  482. .type = CRYPTO_ALG_TYPE_BLKCIPHER,
  483. .mask = CRYPTO_ALG_TYPE_BLKCIPHER_MASK,
  484. };
  485. static const struct xfrm_algo_list xfrm_calg_list = {
  486. .algs = calg_list,
  487. .entries = ARRAY_SIZE(calg_list),
  488. .type = CRYPTO_ALG_TYPE_COMPRESS,
  489. .mask = CRYPTO_ALG_TYPE_MASK,
  490. };
  491. static struct xfrm_algo_desc *xfrm_find_algo(
  492. const struct xfrm_algo_list *algo_list,
  493. int match(const struct xfrm_algo_desc *entry, const void *data),
  494. const void *data, int probe)
  495. {
  496. struct xfrm_algo_desc *list = algo_list->algs;
  497. int i, status;
  498. for (i = 0; i < algo_list->entries; i++) {
  499. if (!match(list + i, data))
  500. continue;
  501. if (list[i].available)
  502. return &list[i];
  503. if (!probe)
  504. break;
  505. status = crypto_has_alg(list[i].name, algo_list->type,
  506. algo_list->mask);
  507. if (!status)
  508. break;
  509. list[i].available = status;
  510. return &list[i];
  511. }
  512. return NULL;
  513. }
  514. static int xfrm_alg_id_match(const struct xfrm_algo_desc *entry,
  515. const void *data)
  516. {
  517. return entry->desc.sadb_alg_id == (unsigned long)data;
  518. }
  519. struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id)
  520. {
  521. return xfrm_find_algo(&xfrm_aalg_list, xfrm_alg_id_match,
  522. (void *)(unsigned long)alg_id, 1);
  523. }
  524. EXPORT_SYMBOL_GPL(xfrm_aalg_get_byid);
  525. struct xfrm_algo_desc *xfrm_ealg_get_byid(int alg_id)
  526. {
  527. return xfrm_find_algo(&xfrm_ealg_list, xfrm_alg_id_match,
  528. (void *)(unsigned long)alg_id, 1);
  529. }
  530. EXPORT_SYMBOL_GPL(xfrm_ealg_get_byid);
  531. struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id)
  532. {
  533. return xfrm_find_algo(&xfrm_calg_list, xfrm_alg_id_match,
  534. (void *)(unsigned long)alg_id, 1);
  535. }
  536. EXPORT_SYMBOL_GPL(xfrm_calg_get_byid);
  537. static int xfrm_alg_name_match(const struct xfrm_algo_desc *entry,
  538. const void *data)
  539. {
  540. const char *name = data;
  541. return name && (!strcmp(name, entry->name) ||
  542. (entry->compat && !strcmp(name, entry->compat)));
  543. }
  544. struct xfrm_algo_desc *xfrm_aalg_get_byname(const char *name, int probe)
  545. {
  546. return xfrm_find_algo(&xfrm_aalg_list, xfrm_alg_name_match, name,
  547. probe);
  548. }
  549. EXPORT_SYMBOL_GPL(xfrm_aalg_get_byname);
  550. struct xfrm_algo_desc *xfrm_ealg_get_byname(const char *name, int probe)
  551. {
  552. return xfrm_find_algo(&xfrm_ealg_list, xfrm_alg_name_match, name,
  553. probe);
  554. }
  555. EXPORT_SYMBOL_GPL(xfrm_ealg_get_byname);
  556. struct xfrm_algo_desc *xfrm_calg_get_byname(const char *name, int probe)
  557. {
  558. return xfrm_find_algo(&xfrm_calg_list, xfrm_alg_name_match, name,
  559. probe);
  560. }
  561. EXPORT_SYMBOL_GPL(xfrm_calg_get_byname);
  562. struct xfrm_aead_name {
  563. const char *name;
  564. int icvbits;
  565. };
  566. static int xfrm_aead_name_match(const struct xfrm_algo_desc *entry,
  567. const void *data)
  568. {
  569. const struct xfrm_aead_name *aead = data;
  570. const char *name = aead->name;
  571. return aead->icvbits == entry->uinfo.aead.icv_truncbits && name &&
  572. !strcmp(name, entry->name);
  573. }
  574. struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len, int probe)
  575. {
  576. struct xfrm_aead_name data = {
  577. .name = name,
  578. .icvbits = icv_len,
  579. };
  580. return xfrm_find_algo(&xfrm_aead_list, xfrm_aead_name_match, &data,
  581. probe);
  582. }
  583. EXPORT_SYMBOL_GPL(xfrm_aead_get_byname);
  584. struct xfrm_algo_desc *xfrm_aalg_get_byidx(unsigned int idx)
  585. {
  586. if (idx >= aalg_entries())
  587. return NULL;
  588. return &aalg_list[idx];
  589. }
  590. EXPORT_SYMBOL_GPL(xfrm_aalg_get_byidx);
  591. struct xfrm_algo_desc *xfrm_ealg_get_byidx(unsigned int idx)
  592. {
  593. if (idx >= ealg_entries())
  594. return NULL;
  595. return &ealg_list[idx];
  596. }
  597. EXPORT_SYMBOL_GPL(xfrm_ealg_get_byidx);
  598. /*
  599. * Probe for the availability of crypto algorithms, and set the available
  600. * flag for any algorithms found on the system. This is typically called by
  601. * pfkey during userspace SA add, update or register.
  602. */
  603. void xfrm_probe_algs(void)
  604. {
  605. int i, status;
  606. BUG_ON(in_softirq());
  607. for (i = 0; i < aalg_entries(); i++) {
  608. status = crypto_has_hash(aalg_list[i].name, 0,
  609. CRYPTO_ALG_ASYNC);
  610. if (aalg_list[i].available != status)
  611. aalg_list[i].available = status;
  612. }
  613. for (i = 0; i < ealg_entries(); i++) {
  614. status = crypto_has_blkcipher(ealg_list[i].name, 0,
  615. CRYPTO_ALG_ASYNC);
  616. if (ealg_list[i].available != status)
  617. ealg_list[i].available = status;
  618. }
  619. for (i = 0; i < calg_entries(); i++) {
  620. status = crypto_has_comp(calg_list[i].name, 0,
  621. CRYPTO_ALG_ASYNC);
  622. if (calg_list[i].available != status)
  623. calg_list[i].available = status;
  624. }
  625. }
  626. EXPORT_SYMBOL_GPL(xfrm_probe_algs);
  627. int xfrm_count_auth_supported(void)
  628. {
  629. int i, n;
  630. for (i = 0, n = 0; i < aalg_entries(); i++)
  631. if (aalg_list[i].available)
  632. n++;
  633. return n;
  634. }
  635. EXPORT_SYMBOL_GPL(xfrm_count_auth_supported);
  636. int xfrm_count_enc_supported(void)
  637. {
  638. int i, n;
  639. for (i = 0, n = 0; i < ealg_entries(); i++)
  640. if (ealg_list[i].available)
  641. n++;
  642. return n;
  643. }
  644. EXPORT_SYMBOL_GPL(xfrm_count_enc_supported);
  645. #if defined(CONFIG_INET_ESP) || defined(CONFIG_INET_ESP_MODULE) || defined(CONFIG_INET6_ESP) || defined(CONFIG_INET6_ESP_MODULE)
  646. void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len)
  647. {
  648. if (tail != skb) {
  649. skb->data_len += len;
  650. skb->len += len;
  651. }
  652. return skb_put(tail, len);
  653. }
  654. EXPORT_SYMBOL_GPL(pskb_put);
  655. #endif