esp4.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. #include <crypto/aead.h>
  2. #include <crypto/authenc.h>
  3. #include <linux/err.h>
  4. #include <linux/module.h>
  5. #include <net/ip.h>
  6. #include <net/xfrm.h>
  7. #include <net/esp.h>
  8. #include <linux/scatterlist.h>
  9. #include <linux/kernel.h>
  10. #include <linux/pfkeyv2.h>
  11. #include <linux/rtnetlink.h>
  12. #include <linux/slab.h>
  13. #include <linux/spinlock.h>
  14. #include <linux/in6.h>
  15. #include <net/icmp.h>
  16. #include <net/protocol.h>
  17. #include <net/udp.h>
  18. struct esp_skb_cb {
  19. struct xfrm_skb_cb xfrm;
  20. void *tmp;
  21. };
  22. #define ESP_SKB_CB(__skb) ((struct esp_skb_cb *)&((__skb)->cb[0]))
  23. static u32 esp4_get_mtu(struct xfrm_state *x, int mtu);
  24. /*
  25. * Allocate an AEAD request structure with extra space for SG and IV.
  26. *
  27. * For alignment considerations the IV is placed at the front, followed
  28. * by the request and finally the SG list.
  29. *
  30. * TODO: Use spare space in skb for this where possible.
  31. */
  32. static void *esp_alloc_tmp(struct crypto_aead *aead, int nfrags)
  33. {
  34. unsigned int len;
  35. len = crypto_aead_ivsize(aead);
  36. if (len) {
  37. len += crypto_aead_alignmask(aead) &
  38. ~(crypto_tfm_ctx_alignment() - 1);
  39. len = ALIGN(len, crypto_tfm_ctx_alignment());
  40. }
  41. len += sizeof(struct aead_givcrypt_request) + crypto_aead_reqsize(aead);
  42. len = ALIGN(len, __alignof__(struct scatterlist));
  43. len += sizeof(struct scatterlist) * nfrags;
  44. return kmalloc(len, GFP_ATOMIC);
  45. }
  46. static inline u8 *esp_tmp_iv(struct crypto_aead *aead, void *tmp)
  47. {
  48. return crypto_aead_ivsize(aead) ?
  49. PTR_ALIGN((u8 *)tmp, crypto_aead_alignmask(aead) + 1) : tmp;
  50. }
  51. static inline struct aead_givcrypt_request *esp_tmp_givreq(
  52. struct crypto_aead *aead, u8 *iv)
  53. {
  54. struct aead_givcrypt_request *req;
  55. req = (void *)PTR_ALIGN(iv + crypto_aead_ivsize(aead),
  56. crypto_tfm_ctx_alignment());
  57. aead_givcrypt_set_tfm(req, aead);
  58. return req;
  59. }
  60. static inline struct aead_request *esp_tmp_req(struct crypto_aead *aead, u8 *iv)
  61. {
  62. struct aead_request *req;
  63. req = (void *)PTR_ALIGN(iv + crypto_aead_ivsize(aead),
  64. crypto_tfm_ctx_alignment());
  65. aead_request_set_tfm(req, aead);
  66. return req;
  67. }
  68. static inline struct scatterlist *esp_req_sg(struct crypto_aead *aead,
  69. struct aead_request *req)
  70. {
  71. return (void *)ALIGN((unsigned long)(req + 1) +
  72. crypto_aead_reqsize(aead),
  73. __alignof__(struct scatterlist));
  74. }
  75. static inline struct scatterlist *esp_givreq_sg(
  76. struct crypto_aead *aead, struct aead_givcrypt_request *req)
  77. {
  78. return (void *)ALIGN((unsigned long)(req + 1) +
  79. crypto_aead_reqsize(aead),
  80. __alignof__(struct scatterlist));
  81. }
  82. static void esp_output_done(struct crypto_async_request *base, int err)
  83. {
  84. struct sk_buff *skb = base->data;
  85. kfree(ESP_SKB_CB(skb)->tmp);
  86. xfrm_output_resume(skb, err);
  87. }
  88. static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
  89. {
  90. int err;
  91. struct ip_esp_hdr *esph;
  92. struct crypto_aead *aead;
  93. struct aead_givcrypt_request *req;
  94. struct scatterlist *sg;
  95. struct scatterlist *asg;
  96. struct esp_data *esp;
  97. struct sk_buff *trailer;
  98. void *tmp;
  99. u8 *iv;
  100. u8 *tail;
  101. int blksize;
  102. int clen;
  103. int alen;
  104. int plen;
  105. int tfclen;
  106. int nfrags;
  107. /* skb is pure payload to encrypt */
  108. err = -ENOMEM;
  109. esp = x->data;
  110. aead = esp->aead;
  111. alen = crypto_aead_authsize(aead);
  112. tfclen = 0;
  113. if (x->tfcpad) {
  114. struct xfrm_dst *dst = (struct xfrm_dst *)skb_dst(skb);
  115. u32 padto;
  116. padto = min(x->tfcpad, esp4_get_mtu(x, dst->child_mtu_cached));
  117. if (skb->len < padto)
  118. tfclen = padto - skb->len;
  119. }
  120. blksize = ALIGN(crypto_aead_blocksize(aead), 4);
  121. clen = ALIGN(skb->len + 2 + tfclen, blksize);
  122. if (esp->padlen)
  123. clen = ALIGN(clen, esp->padlen);
  124. plen = clen - skb->len - tfclen;
  125. err = skb_cow_data(skb, tfclen + plen + alen, &trailer);
  126. if (err < 0)
  127. goto error;
  128. nfrags = err;
  129. tmp = esp_alloc_tmp(aead, nfrags + 1);
  130. if (!tmp)
  131. goto error;
  132. iv = esp_tmp_iv(aead, tmp);
  133. req = esp_tmp_givreq(aead, iv);
  134. asg = esp_givreq_sg(aead, req);
  135. sg = asg + 1;
  136. /* Fill padding... */
  137. tail = skb_tail_pointer(trailer);
  138. if (tfclen) {
  139. memset(tail, 0, tfclen);
  140. tail += tfclen;
  141. }
  142. do {
  143. int i;
  144. for (i = 0; i < plen - 2; i++)
  145. tail[i] = i + 1;
  146. } while (0);
  147. tail[plen - 2] = plen - 2;
  148. tail[plen - 1] = *skb_mac_header(skb);
  149. pskb_put(skb, trailer, clen - skb->len + alen);
  150. skb_push(skb, -skb_network_offset(skb));
  151. esph = ip_esp_hdr(skb);
  152. *skb_mac_header(skb) = IPPROTO_ESP;
  153. /* this is non-NULL only with UDP Encapsulation */
  154. if (x->encap) {
  155. struct xfrm_encap_tmpl *encap = x->encap;
  156. struct udphdr *uh;
  157. __be32 *udpdata32;
  158. __be16 sport, dport;
  159. int encap_type;
  160. spin_lock_bh(&x->lock);
  161. sport = encap->encap_sport;
  162. dport = encap->encap_dport;
  163. encap_type = encap->encap_type;
  164. spin_unlock_bh(&x->lock);
  165. uh = (struct udphdr *)esph;
  166. uh->source = sport;
  167. uh->dest = dport;
  168. uh->len = htons(skb->len - skb_transport_offset(skb));
  169. uh->check = 0;
  170. switch (encap_type) {
  171. default:
  172. case UDP_ENCAP_ESPINUDP:
  173. esph = (struct ip_esp_hdr *)(uh + 1);
  174. break;
  175. case UDP_ENCAP_ESPINUDP_NON_IKE:
  176. udpdata32 = (__be32 *)(uh + 1);
  177. udpdata32[0] = udpdata32[1] = 0;
  178. esph = (struct ip_esp_hdr *)(udpdata32 + 2);
  179. break;
  180. }
  181. *skb_mac_header(skb) = IPPROTO_UDP;
  182. }
  183. esph->spi = x->id.spi;
  184. esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq.output);
  185. sg_init_table(sg, nfrags);
  186. skb_to_sgvec(skb, sg,
  187. esph->enc_data + crypto_aead_ivsize(aead) - skb->data,
  188. clen + alen);
  189. sg_init_one(asg, esph, sizeof(*esph));
  190. aead_givcrypt_set_callback(req, 0, esp_output_done, skb);
  191. aead_givcrypt_set_crypt(req, sg, sg, clen, iv);
  192. aead_givcrypt_set_assoc(req, asg, sizeof(*esph));
  193. aead_givcrypt_set_giv(req, esph->enc_data,
  194. XFRM_SKB_CB(skb)->seq.output);
  195. ESP_SKB_CB(skb)->tmp = tmp;
  196. err = crypto_aead_givencrypt(req);
  197. if (err == -EINPROGRESS)
  198. goto error;
  199. if (err == -EBUSY)
  200. err = NET_XMIT_DROP;
  201. kfree(tmp);
  202. error:
  203. return err;
  204. }
  205. static int esp_input_done2(struct sk_buff *skb, int err)
  206. {
  207. struct iphdr *iph;
  208. struct xfrm_state *x = xfrm_input_state(skb);
  209. struct esp_data *esp = x->data;
  210. struct crypto_aead *aead = esp->aead;
  211. int alen = crypto_aead_authsize(aead);
  212. int hlen = sizeof(struct ip_esp_hdr) + crypto_aead_ivsize(aead);
  213. int elen = skb->len - hlen;
  214. int ihl;
  215. u8 nexthdr[2];
  216. int padlen;
  217. kfree(ESP_SKB_CB(skb)->tmp);
  218. if (unlikely(err))
  219. goto out;
  220. if (skb_copy_bits(skb, skb->len-alen-2, nexthdr, 2))
  221. BUG();
  222. err = -EINVAL;
  223. padlen = nexthdr[0];
  224. if (padlen + 2 + alen >= elen)
  225. goto out;
  226. /* ... check padding bits here. Silly. :-) */
  227. iph = ip_hdr(skb);
  228. ihl = iph->ihl * 4;
  229. if (x->encap) {
  230. struct xfrm_encap_tmpl *encap = x->encap;
  231. struct udphdr *uh = (void *)(skb_network_header(skb) + ihl);
  232. /*
  233. * 1) if the NAT-T peer's IP or port changed then
  234. * advertize the change to the keying daemon.
  235. * This is an inbound SA, so just compare
  236. * SRC ports.
  237. */
  238. if (iph->saddr != x->props.saddr.a4 ||
  239. uh->source != encap->encap_sport) {
  240. xfrm_address_t ipaddr;
  241. ipaddr.a4 = iph->saddr;
  242. km_new_mapping(x, &ipaddr, uh->source);
  243. /* XXX: perhaps add an extra
  244. * policy check here, to see
  245. * if we should allow or
  246. * reject a packet from a
  247. * different source
  248. * address/port.
  249. */
  250. }
  251. /*
  252. * 2) ignore UDP/TCP checksums in case
  253. * of NAT-T in Transport Mode, or
  254. * perform other post-processing fixes
  255. * as per draft-ietf-ipsec-udp-encaps-06,
  256. * section 3.1.2
  257. */
  258. if (x->props.mode == XFRM_MODE_TRANSPORT)
  259. skb->ip_summed = CHECKSUM_UNNECESSARY;
  260. }
  261. pskb_trim(skb, skb->len - alen - padlen - 2);
  262. __skb_pull(skb, hlen);
  263. skb_set_transport_header(skb, -ihl);
  264. err = nexthdr[1];
  265. /* RFC4303: Drop dummy packets without any error */
  266. if (err == IPPROTO_NONE)
  267. err = -EINVAL;
  268. out:
  269. return err;
  270. }
  271. static void esp_input_done(struct crypto_async_request *base, int err)
  272. {
  273. struct sk_buff *skb = base->data;
  274. xfrm_input_resume(skb, esp_input_done2(skb, err));
  275. }
  276. /*
  277. * Note: detecting truncated vs. non-truncated authentication data is very
  278. * expensive, so we only support truncated data, which is the recommended
  279. * and common case.
  280. */
  281. static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
  282. {
  283. struct ip_esp_hdr *esph;
  284. struct esp_data *esp = x->data;
  285. struct crypto_aead *aead = esp->aead;
  286. struct aead_request *req;
  287. struct sk_buff *trailer;
  288. int elen = skb->len - sizeof(*esph) - crypto_aead_ivsize(aead);
  289. int nfrags;
  290. void *tmp;
  291. u8 *iv;
  292. struct scatterlist *sg;
  293. struct scatterlist *asg;
  294. int err = -EINVAL;
  295. if (!pskb_may_pull(skb, sizeof(*esph) + crypto_aead_ivsize(aead)))
  296. goto out;
  297. if (elen <= 0)
  298. goto out;
  299. if ((err = skb_cow_data(skb, 0, &trailer)) < 0)
  300. goto out;
  301. nfrags = err;
  302. err = -ENOMEM;
  303. tmp = esp_alloc_tmp(aead, nfrags + 1);
  304. if (!tmp)
  305. goto out;
  306. ESP_SKB_CB(skb)->tmp = tmp;
  307. iv = esp_tmp_iv(aead, tmp);
  308. req = esp_tmp_req(aead, iv);
  309. asg = esp_req_sg(aead, req);
  310. sg = asg + 1;
  311. skb->ip_summed = CHECKSUM_NONE;
  312. esph = (struct ip_esp_hdr *)skb->data;
  313. /* Get ivec. This can be wrong, check against another impls. */
  314. iv = esph->enc_data;
  315. sg_init_table(sg, nfrags);
  316. skb_to_sgvec(skb, sg, sizeof(*esph) + crypto_aead_ivsize(aead), elen);
  317. sg_init_one(asg, esph, sizeof(*esph));
  318. aead_request_set_callback(req, 0, esp_input_done, skb);
  319. aead_request_set_crypt(req, sg, sg, elen, iv);
  320. aead_request_set_assoc(req, asg, sizeof(*esph));
  321. err = crypto_aead_decrypt(req);
  322. if (err == -EINPROGRESS)
  323. goto out;
  324. err = esp_input_done2(skb, err);
  325. out:
  326. return err;
  327. }
  328. static u32 esp4_get_mtu(struct xfrm_state *x, int mtu)
  329. {
  330. struct esp_data *esp = x->data;
  331. u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4);
  332. u32 align = max_t(u32, blksize, esp->padlen);
  333. u32 rem;
  334. mtu -= x->props.header_len + crypto_aead_authsize(esp->aead);
  335. rem = mtu & (align - 1);
  336. mtu &= ~(align - 1);
  337. switch (x->props.mode) {
  338. case XFRM_MODE_TUNNEL:
  339. break;
  340. default:
  341. case XFRM_MODE_TRANSPORT:
  342. /* The worst case */
  343. mtu -= blksize - 4;
  344. mtu += min_t(u32, blksize - 4, rem);
  345. break;
  346. case XFRM_MODE_BEET:
  347. /* The worst case. */
  348. mtu += min_t(u32, IPV4_BEET_PHMAXLEN, rem);
  349. break;
  350. }
  351. return mtu - 2;
  352. }
  353. static void esp4_err(struct sk_buff *skb, u32 info)
  354. {
  355. struct net *net = dev_net(skb->dev);
  356. struct iphdr *iph = (struct iphdr *)skb->data;
  357. struct ip_esp_hdr *esph = (struct ip_esp_hdr *)(skb->data+(iph->ihl<<2));
  358. struct xfrm_state *x;
  359. if (icmp_hdr(skb)->type != ICMP_DEST_UNREACH ||
  360. icmp_hdr(skb)->code != ICMP_FRAG_NEEDED)
  361. return;
  362. x = xfrm_state_lookup(net, skb->mark, (xfrm_address_t *)&iph->daddr, esph->spi, IPPROTO_ESP, AF_INET);
  363. if (!x)
  364. return;
  365. NETDEBUG(KERN_DEBUG "pmtu discovery on SA ESP/%08x/%08x\n",
  366. ntohl(esph->spi), ntohl(iph->daddr));
  367. xfrm_state_put(x);
  368. }
  369. static void esp_destroy(struct xfrm_state *x)
  370. {
  371. struct esp_data *esp = x->data;
  372. if (!esp)
  373. return;
  374. crypto_free_aead(esp->aead);
  375. kfree(esp);
  376. }
  377. static int esp_init_aead(struct xfrm_state *x)
  378. {
  379. struct esp_data *esp = x->data;
  380. struct crypto_aead *aead;
  381. int err;
  382. aead = crypto_alloc_aead(x->aead->alg_name, 0, 0);
  383. err = PTR_ERR(aead);
  384. if (IS_ERR(aead))
  385. goto error;
  386. esp->aead = aead;
  387. err = crypto_aead_setkey(aead, x->aead->alg_key,
  388. (x->aead->alg_key_len + 7) / 8);
  389. if (err)
  390. goto error;
  391. err = crypto_aead_setauthsize(aead, x->aead->alg_icv_len / 8);
  392. if (err)
  393. goto error;
  394. error:
  395. return err;
  396. }
  397. static int esp_init_authenc(struct xfrm_state *x)
  398. {
  399. struct esp_data *esp = x->data;
  400. struct crypto_aead *aead;
  401. struct crypto_authenc_key_param *param;
  402. struct rtattr *rta;
  403. char *key;
  404. char *p;
  405. char authenc_name[CRYPTO_MAX_ALG_NAME];
  406. unsigned int keylen;
  407. int err;
  408. err = -EINVAL;
  409. if (x->ealg == NULL)
  410. goto error;
  411. err = -ENAMETOOLONG;
  412. if (snprintf(authenc_name, CRYPTO_MAX_ALG_NAME, "authenc(%s,%s)",
  413. x->aalg ? x->aalg->alg_name : "digest_null",
  414. x->ealg->alg_name) >= CRYPTO_MAX_ALG_NAME)
  415. goto error;
  416. aead = crypto_alloc_aead(authenc_name, 0, 0);
  417. err = PTR_ERR(aead);
  418. if (IS_ERR(aead))
  419. goto error;
  420. esp->aead = aead;
  421. keylen = (x->aalg ? (x->aalg->alg_key_len + 7) / 8 : 0) +
  422. (x->ealg->alg_key_len + 7) / 8 + RTA_SPACE(sizeof(*param));
  423. err = -ENOMEM;
  424. key = kmalloc(keylen, GFP_KERNEL);
  425. if (!key)
  426. goto error;
  427. p = key;
  428. rta = (void *)p;
  429. rta->rta_type = CRYPTO_AUTHENC_KEYA_PARAM;
  430. rta->rta_len = RTA_LENGTH(sizeof(*param));
  431. param = RTA_DATA(rta);
  432. p += RTA_SPACE(sizeof(*param));
  433. if (x->aalg) {
  434. struct xfrm_algo_desc *aalg_desc;
  435. memcpy(p, x->aalg->alg_key, (x->aalg->alg_key_len + 7) / 8);
  436. p += (x->aalg->alg_key_len + 7) / 8;
  437. aalg_desc = xfrm_aalg_get_byname(x->aalg->alg_name, 0);
  438. BUG_ON(!aalg_desc);
  439. err = -EINVAL;
  440. if (aalg_desc->uinfo.auth.icv_fullbits/8 !=
  441. crypto_aead_authsize(aead)) {
  442. NETDEBUG(KERN_INFO "ESP: %s digestsize %u != %hu\n",
  443. x->aalg->alg_name,
  444. crypto_aead_authsize(aead),
  445. aalg_desc->uinfo.auth.icv_fullbits/8);
  446. goto free_key;
  447. }
  448. err = crypto_aead_setauthsize(
  449. aead, x->aalg->alg_trunc_len / 8);
  450. if (err)
  451. goto free_key;
  452. }
  453. param->enckeylen = cpu_to_be32((x->ealg->alg_key_len + 7) / 8);
  454. memcpy(p, x->ealg->alg_key, (x->ealg->alg_key_len + 7) / 8);
  455. err = crypto_aead_setkey(aead, key, keylen);
  456. free_key:
  457. kfree(key);
  458. error:
  459. return err;
  460. }
  461. static int esp_init_state(struct xfrm_state *x)
  462. {
  463. struct esp_data *esp;
  464. struct crypto_aead *aead;
  465. u32 align;
  466. int err;
  467. esp = kzalloc(sizeof(*esp), GFP_KERNEL);
  468. if (esp == NULL)
  469. return -ENOMEM;
  470. x->data = esp;
  471. if (x->aead)
  472. err = esp_init_aead(x);
  473. else
  474. err = esp_init_authenc(x);
  475. if (err)
  476. goto error;
  477. aead = esp->aead;
  478. esp->padlen = 0;
  479. x->props.header_len = sizeof(struct ip_esp_hdr) +
  480. crypto_aead_ivsize(aead);
  481. if (x->props.mode == XFRM_MODE_TUNNEL)
  482. x->props.header_len += sizeof(struct iphdr);
  483. else if (x->props.mode == XFRM_MODE_BEET && x->sel.family != AF_INET6)
  484. x->props.header_len += IPV4_BEET_PHMAXLEN;
  485. if (x->encap) {
  486. struct xfrm_encap_tmpl *encap = x->encap;
  487. switch (encap->encap_type) {
  488. default:
  489. goto error;
  490. case UDP_ENCAP_ESPINUDP:
  491. x->props.header_len += sizeof(struct udphdr);
  492. break;
  493. case UDP_ENCAP_ESPINUDP_NON_IKE:
  494. x->props.header_len += sizeof(struct udphdr) + 2 * sizeof(u32);
  495. break;
  496. }
  497. }
  498. align = ALIGN(crypto_aead_blocksize(aead), 4);
  499. if (esp->padlen)
  500. align = max_t(u32, align, esp->padlen);
  501. x->props.trailer_len = align + 1 + crypto_aead_authsize(esp->aead);
  502. error:
  503. return err;
  504. }
  505. static const struct xfrm_type esp_type =
  506. {
  507. .description = "ESP4",
  508. .owner = THIS_MODULE,
  509. .proto = IPPROTO_ESP,
  510. .flags = XFRM_TYPE_REPLAY_PROT,
  511. .init_state = esp_init_state,
  512. .destructor = esp_destroy,
  513. .get_mtu = esp4_get_mtu,
  514. .input = esp_input,
  515. .output = esp_output
  516. };
  517. static const struct net_protocol esp4_protocol = {
  518. .handler = xfrm4_rcv,
  519. .err_handler = esp4_err,
  520. .no_policy = 1,
  521. .netns_ok = 1,
  522. };
  523. static int __init esp4_init(void)
  524. {
  525. if (xfrm_register_type(&esp_type, AF_INET) < 0) {
  526. printk(KERN_INFO "ip esp init: can't add xfrm type\n");
  527. return -EAGAIN;
  528. }
  529. if (inet_add_protocol(&esp4_protocol, IPPROTO_ESP) < 0) {
  530. printk(KERN_INFO "ip esp init: can't add protocol\n");
  531. xfrm_unregister_type(&esp_type, AF_INET);
  532. return -EAGAIN;
  533. }
  534. return 0;
  535. }
  536. static void __exit esp4_fini(void)
  537. {
  538. if (inet_del_protocol(&esp4_protocol, IPPROTO_ESP) < 0)
  539. printk(KERN_INFO "ip esp close: can't remove protocol\n");
  540. if (xfrm_unregister_type(&esp_type, AF_INET) < 0)
  541. printk(KERN_INFO "ip esp close: can't remove xfrm type\n");
  542. }
  543. module_init(esp4_init);
  544. module_exit(esp4_fini);
  545. MODULE_LICENSE("GPL");
  546. MODULE_ALIAS_XFRM_TYPE(AF_INET, XFRM_PROTO_ESP);