act_csum.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. /*
  2. * Checksum updating actions
  3. *
  4. * Copyright (c) 2010 Gregoire Baron <baronchon@n7mm.org>
  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. */
  12. #include <linux/types.h>
  13. #include <linux/init.h>
  14. #include <linux/kernel.h>
  15. #include <linux/module.h>
  16. #include <linux/spinlock.h>
  17. #include <linux/netlink.h>
  18. #include <net/netlink.h>
  19. #include <linux/rtnetlink.h>
  20. #include <linux/skbuff.h>
  21. #include <net/ip.h>
  22. #include <net/ipv6.h>
  23. #include <net/icmp.h>
  24. #include <linux/icmpv6.h>
  25. #include <linux/igmp.h>
  26. #include <net/tcp.h>
  27. #include <net/udp.h>
  28. #include <net/ip6_checksum.h>
  29. #include <net/sctp/checksum.h>
  30. #include <net/act_api.h>
  31. #include <linux/tc_act/tc_csum.h>
  32. #include <net/tc_act/tc_csum.h>
  33. static const struct nla_policy csum_policy[TCA_CSUM_MAX + 1] = {
  34. [TCA_CSUM_PARMS] = { .len = sizeof(struct tc_csum), },
  35. };
  36. static unsigned int csum_net_id;
  37. static struct tc_action_ops act_csum_ops;
  38. static int tcf_csum_init(struct net *net, struct nlattr *nla,
  39. struct nlattr *est, struct tc_action **a, int ovr,
  40. int bind)
  41. {
  42. struct tc_action_net *tn = net_generic(net, csum_net_id);
  43. struct nlattr *tb[TCA_CSUM_MAX + 1];
  44. struct tc_csum *parm;
  45. struct tcf_csum *p;
  46. int ret = 0, err;
  47. if (nla == NULL)
  48. return -EINVAL;
  49. err = nla_parse_nested(tb, TCA_CSUM_MAX, nla, csum_policy, NULL);
  50. if (err < 0)
  51. return err;
  52. if (tb[TCA_CSUM_PARMS] == NULL)
  53. return -EINVAL;
  54. parm = nla_data(tb[TCA_CSUM_PARMS]);
  55. if (!tcf_idr_check(tn, parm->index, a, bind)) {
  56. ret = tcf_idr_create(tn, parm->index, est, a,
  57. &act_csum_ops, bind, false);
  58. if (ret)
  59. return ret;
  60. ret = ACT_P_CREATED;
  61. } else {
  62. if (bind)/* dont override defaults */
  63. return 0;
  64. tcf_idr_release(*a, bind);
  65. if (!ovr)
  66. return -EEXIST;
  67. }
  68. p = to_tcf_csum(*a);
  69. spin_lock_bh(&p->tcf_lock);
  70. p->tcf_action = parm->action;
  71. p->update_flags = parm->update_flags;
  72. spin_unlock_bh(&p->tcf_lock);
  73. if (ret == ACT_P_CREATED)
  74. tcf_idr_insert(tn, *a);
  75. return ret;
  76. }
  77. /**
  78. * tcf_csum_skb_nextlayer - Get next layer pointer
  79. * @skb: sk_buff to use
  80. * @ihl: previous summed headers length
  81. * @ipl: complete packet length
  82. * @jhl: next header length
  83. *
  84. * Check the expected next layer availability in the specified sk_buff.
  85. * Return the next layer pointer if pass, NULL otherwise.
  86. */
  87. static void *tcf_csum_skb_nextlayer(struct sk_buff *skb,
  88. unsigned int ihl, unsigned int ipl,
  89. unsigned int jhl)
  90. {
  91. int ntkoff = skb_network_offset(skb);
  92. int hl = ihl + jhl;
  93. if (!pskb_may_pull(skb, ipl + ntkoff) || (ipl < hl) ||
  94. skb_try_make_writable(skb, hl + ntkoff))
  95. return NULL;
  96. else
  97. return (void *)(skb_network_header(skb) + ihl);
  98. }
  99. static int tcf_csum_ipv4_icmp(struct sk_buff *skb, unsigned int ihl,
  100. unsigned int ipl)
  101. {
  102. struct icmphdr *icmph;
  103. icmph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*icmph));
  104. if (icmph == NULL)
  105. return 0;
  106. icmph->checksum = 0;
  107. skb->csum = csum_partial(icmph, ipl - ihl, 0);
  108. icmph->checksum = csum_fold(skb->csum);
  109. skb->ip_summed = CHECKSUM_NONE;
  110. return 1;
  111. }
  112. static int tcf_csum_ipv4_igmp(struct sk_buff *skb,
  113. unsigned int ihl, unsigned int ipl)
  114. {
  115. struct igmphdr *igmph;
  116. igmph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*igmph));
  117. if (igmph == NULL)
  118. return 0;
  119. igmph->csum = 0;
  120. skb->csum = csum_partial(igmph, ipl - ihl, 0);
  121. igmph->csum = csum_fold(skb->csum);
  122. skb->ip_summed = CHECKSUM_NONE;
  123. return 1;
  124. }
  125. static int tcf_csum_ipv6_icmp(struct sk_buff *skb, unsigned int ihl,
  126. unsigned int ipl)
  127. {
  128. struct icmp6hdr *icmp6h;
  129. const struct ipv6hdr *ip6h;
  130. icmp6h = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*icmp6h));
  131. if (icmp6h == NULL)
  132. return 0;
  133. ip6h = ipv6_hdr(skb);
  134. icmp6h->icmp6_cksum = 0;
  135. skb->csum = csum_partial(icmp6h, ipl - ihl, 0);
  136. icmp6h->icmp6_cksum = csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
  137. ipl - ihl, IPPROTO_ICMPV6,
  138. skb->csum);
  139. skb->ip_summed = CHECKSUM_NONE;
  140. return 1;
  141. }
  142. static int tcf_csum_ipv4_tcp(struct sk_buff *skb, unsigned int ihl,
  143. unsigned int ipl)
  144. {
  145. struct tcphdr *tcph;
  146. const struct iphdr *iph;
  147. if (skb_is_gso(skb) && skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4)
  148. return 1;
  149. tcph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*tcph));
  150. if (tcph == NULL)
  151. return 0;
  152. iph = ip_hdr(skb);
  153. tcph->check = 0;
  154. skb->csum = csum_partial(tcph, ipl - ihl, 0);
  155. tcph->check = tcp_v4_check(ipl - ihl,
  156. iph->saddr, iph->daddr, skb->csum);
  157. skb->ip_summed = CHECKSUM_NONE;
  158. return 1;
  159. }
  160. static int tcf_csum_ipv6_tcp(struct sk_buff *skb, unsigned int ihl,
  161. unsigned int ipl)
  162. {
  163. struct tcphdr *tcph;
  164. const struct ipv6hdr *ip6h;
  165. if (skb_is_gso(skb) && skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)
  166. return 1;
  167. tcph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*tcph));
  168. if (tcph == NULL)
  169. return 0;
  170. ip6h = ipv6_hdr(skb);
  171. tcph->check = 0;
  172. skb->csum = csum_partial(tcph, ipl - ihl, 0);
  173. tcph->check = csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
  174. ipl - ihl, IPPROTO_TCP,
  175. skb->csum);
  176. skb->ip_summed = CHECKSUM_NONE;
  177. return 1;
  178. }
  179. static int tcf_csum_ipv4_udp(struct sk_buff *skb, unsigned int ihl,
  180. unsigned int ipl, int udplite)
  181. {
  182. struct udphdr *udph;
  183. const struct iphdr *iph;
  184. u16 ul;
  185. /*
  186. * Support both UDP and UDPLITE checksum algorithms, Don't use
  187. * udph->len to get the real length without any protocol check,
  188. * UDPLITE uses udph->len for another thing,
  189. * Use iph->tot_len, or just ipl.
  190. */
  191. udph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*udph));
  192. if (udph == NULL)
  193. return 0;
  194. iph = ip_hdr(skb);
  195. ul = ntohs(udph->len);
  196. if (udplite || udph->check) {
  197. udph->check = 0;
  198. if (udplite) {
  199. if (ul == 0)
  200. skb->csum = csum_partial(udph, ipl - ihl, 0);
  201. else if ((ul >= sizeof(*udph)) && (ul <= ipl - ihl))
  202. skb->csum = csum_partial(udph, ul, 0);
  203. else
  204. goto ignore_obscure_skb;
  205. } else {
  206. if (ul != ipl - ihl)
  207. goto ignore_obscure_skb;
  208. skb->csum = csum_partial(udph, ul, 0);
  209. }
  210. udph->check = csum_tcpudp_magic(iph->saddr, iph->daddr,
  211. ul, iph->protocol,
  212. skb->csum);
  213. if (!udph->check)
  214. udph->check = CSUM_MANGLED_0;
  215. }
  216. skb->ip_summed = CHECKSUM_NONE;
  217. ignore_obscure_skb:
  218. return 1;
  219. }
  220. static int tcf_csum_ipv6_udp(struct sk_buff *skb, unsigned int ihl,
  221. unsigned int ipl, int udplite)
  222. {
  223. struct udphdr *udph;
  224. const struct ipv6hdr *ip6h;
  225. u16 ul;
  226. /*
  227. * Support both UDP and UDPLITE checksum algorithms, Don't use
  228. * udph->len to get the real length without any protocol check,
  229. * UDPLITE uses udph->len for another thing,
  230. * Use ip6h->payload_len + sizeof(*ip6h) ... , or just ipl.
  231. */
  232. udph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*udph));
  233. if (udph == NULL)
  234. return 0;
  235. ip6h = ipv6_hdr(skb);
  236. ul = ntohs(udph->len);
  237. udph->check = 0;
  238. if (udplite) {
  239. if (ul == 0)
  240. skb->csum = csum_partial(udph, ipl - ihl, 0);
  241. else if ((ul >= sizeof(*udph)) && (ul <= ipl - ihl))
  242. skb->csum = csum_partial(udph, ul, 0);
  243. else
  244. goto ignore_obscure_skb;
  245. } else {
  246. if (ul != ipl - ihl)
  247. goto ignore_obscure_skb;
  248. skb->csum = csum_partial(udph, ul, 0);
  249. }
  250. udph->check = csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr, ul,
  251. udplite ? IPPROTO_UDPLITE : IPPROTO_UDP,
  252. skb->csum);
  253. if (!udph->check)
  254. udph->check = CSUM_MANGLED_0;
  255. skb->ip_summed = CHECKSUM_NONE;
  256. ignore_obscure_skb:
  257. return 1;
  258. }
  259. static int tcf_csum_sctp(struct sk_buff *skb, unsigned int ihl,
  260. unsigned int ipl)
  261. {
  262. struct sctphdr *sctph;
  263. if (skb_is_gso(skb) && skb_shinfo(skb)->gso_type & SKB_GSO_SCTP)
  264. return 1;
  265. sctph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*sctph));
  266. if (!sctph)
  267. return 0;
  268. sctph->checksum = sctp_compute_cksum(skb,
  269. skb_network_offset(skb) + ihl);
  270. skb->ip_summed = CHECKSUM_NONE;
  271. skb->csum_not_inet = 0;
  272. return 1;
  273. }
  274. static int tcf_csum_ipv4(struct sk_buff *skb, u32 update_flags)
  275. {
  276. const struct iphdr *iph;
  277. int ntkoff;
  278. ntkoff = skb_network_offset(skb);
  279. if (!pskb_may_pull(skb, sizeof(*iph) + ntkoff))
  280. goto fail;
  281. iph = ip_hdr(skb);
  282. switch (iph->frag_off & htons(IP_OFFSET) ? 0 : iph->protocol) {
  283. case IPPROTO_ICMP:
  284. if (update_flags & TCA_CSUM_UPDATE_FLAG_ICMP)
  285. if (!tcf_csum_ipv4_icmp(skb, iph->ihl * 4,
  286. ntohs(iph->tot_len)))
  287. goto fail;
  288. break;
  289. case IPPROTO_IGMP:
  290. if (update_flags & TCA_CSUM_UPDATE_FLAG_IGMP)
  291. if (!tcf_csum_ipv4_igmp(skb, iph->ihl * 4,
  292. ntohs(iph->tot_len)))
  293. goto fail;
  294. break;
  295. case IPPROTO_TCP:
  296. if (update_flags & TCA_CSUM_UPDATE_FLAG_TCP)
  297. if (!tcf_csum_ipv4_tcp(skb, iph->ihl * 4,
  298. ntohs(iph->tot_len)))
  299. goto fail;
  300. break;
  301. case IPPROTO_UDP:
  302. if (update_flags & TCA_CSUM_UPDATE_FLAG_UDP)
  303. if (!tcf_csum_ipv4_udp(skb, iph->ihl * 4,
  304. ntohs(iph->tot_len), 0))
  305. goto fail;
  306. break;
  307. case IPPROTO_UDPLITE:
  308. if (update_flags & TCA_CSUM_UPDATE_FLAG_UDPLITE)
  309. if (!tcf_csum_ipv4_udp(skb, iph->ihl * 4,
  310. ntohs(iph->tot_len), 1))
  311. goto fail;
  312. break;
  313. case IPPROTO_SCTP:
  314. if ((update_flags & TCA_CSUM_UPDATE_FLAG_SCTP) &&
  315. !tcf_csum_sctp(skb, iph->ihl * 4, ntohs(iph->tot_len)))
  316. goto fail;
  317. break;
  318. }
  319. if (update_flags & TCA_CSUM_UPDATE_FLAG_IPV4HDR) {
  320. if (skb_try_make_writable(skb, sizeof(*iph) + ntkoff))
  321. goto fail;
  322. ip_send_check(ip_hdr(skb));
  323. }
  324. return 1;
  325. fail:
  326. return 0;
  327. }
  328. static int tcf_csum_ipv6_hopopts(struct ipv6_opt_hdr *ip6xh, unsigned int ixhl,
  329. unsigned int *pl)
  330. {
  331. int off, len, optlen;
  332. unsigned char *xh = (void *)ip6xh;
  333. off = sizeof(*ip6xh);
  334. len = ixhl - off;
  335. while (len > 1) {
  336. switch (xh[off]) {
  337. case IPV6_TLV_PAD1:
  338. optlen = 1;
  339. break;
  340. case IPV6_TLV_JUMBO:
  341. optlen = xh[off + 1] + 2;
  342. if (optlen != 6 || len < 6 || (off & 3) != 2)
  343. /* wrong jumbo option length/alignment */
  344. return 0;
  345. *pl = ntohl(*(__be32 *)(xh + off + 2));
  346. goto done;
  347. default:
  348. optlen = xh[off + 1] + 2;
  349. if (optlen > len)
  350. /* ignore obscure options */
  351. goto done;
  352. break;
  353. }
  354. off += optlen;
  355. len -= optlen;
  356. }
  357. done:
  358. return 1;
  359. }
  360. static int tcf_csum_ipv6(struct sk_buff *skb, u32 update_flags)
  361. {
  362. struct ipv6hdr *ip6h;
  363. struct ipv6_opt_hdr *ip6xh;
  364. unsigned int hl, ixhl;
  365. unsigned int pl;
  366. int ntkoff;
  367. u8 nexthdr;
  368. ntkoff = skb_network_offset(skb);
  369. hl = sizeof(*ip6h);
  370. if (!pskb_may_pull(skb, hl + ntkoff))
  371. goto fail;
  372. ip6h = ipv6_hdr(skb);
  373. pl = ntohs(ip6h->payload_len);
  374. nexthdr = ip6h->nexthdr;
  375. do {
  376. switch (nexthdr) {
  377. case NEXTHDR_FRAGMENT:
  378. goto ignore_skb;
  379. case NEXTHDR_ROUTING:
  380. case NEXTHDR_HOP:
  381. case NEXTHDR_DEST:
  382. if (!pskb_may_pull(skb, hl + sizeof(*ip6xh) + ntkoff))
  383. goto fail;
  384. ip6xh = (void *)(skb_network_header(skb) + hl);
  385. ixhl = ipv6_optlen(ip6xh);
  386. if (!pskb_may_pull(skb, hl + ixhl + ntkoff))
  387. goto fail;
  388. ip6xh = (void *)(skb_network_header(skb) + hl);
  389. if ((nexthdr == NEXTHDR_HOP) &&
  390. !(tcf_csum_ipv6_hopopts(ip6xh, ixhl, &pl)))
  391. goto fail;
  392. nexthdr = ip6xh->nexthdr;
  393. hl += ixhl;
  394. break;
  395. case IPPROTO_ICMPV6:
  396. if (update_flags & TCA_CSUM_UPDATE_FLAG_ICMP)
  397. if (!tcf_csum_ipv6_icmp(skb,
  398. hl, pl + sizeof(*ip6h)))
  399. goto fail;
  400. goto done;
  401. case IPPROTO_TCP:
  402. if (update_flags & TCA_CSUM_UPDATE_FLAG_TCP)
  403. if (!tcf_csum_ipv6_tcp(skb,
  404. hl, pl + sizeof(*ip6h)))
  405. goto fail;
  406. goto done;
  407. case IPPROTO_UDP:
  408. if (update_flags & TCA_CSUM_UPDATE_FLAG_UDP)
  409. if (!tcf_csum_ipv6_udp(skb, hl,
  410. pl + sizeof(*ip6h), 0))
  411. goto fail;
  412. goto done;
  413. case IPPROTO_UDPLITE:
  414. if (update_flags & TCA_CSUM_UPDATE_FLAG_UDPLITE)
  415. if (!tcf_csum_ipv6_udp(skb, hl,
  416. pl + sizeof(*ip6h), 1))
  417. goto fail;
  418. goto done;
  419. case IPPROTO_SCTP:
  420. if ((update_flags & TCA_CSUM_UPDATE_FLAG_SCTP) &&
  421. !tcf_csum_sctp(skb, hl, pl + sizeof(*ip6h)))
  422. goto fail;
  423. goto done;
  424. default:
  425. goto ignore_skb;
  426. }
  427. } while (pskb_may_pull(skb, hl + 1 + ntkoff));
  428. done:
  429. ignore_skb:
  430. return 1;
  431. fail:
  432. return 0;
  433. }
  434. static int tcf_csum(struct sk_buff *skb, const struct tc_action *a,
  435. struct tcf_result *res)
  436. {
  437. struct tcf_csum *p = to_tcf_csum(a);
  438. int action;
  439. u32 update_flags;
  440. spin_lock(&p->tcf_lock);
  441. tcf_lastuse_update(&p->tcf_tm);
  442. bstats_update(&p->tcf_bstats, skb);
  443. action = p->tcf_action;
  444. update_flags = p->update_flags;
  445. spin_unlock(&p->tcf_lock);
  446. if (unlikely(action == TC_ACT_SHOT))
  447. goto drop;
  448. switch (tc_skb_protocol(skb)) {
  449. case cpu_to_be16(ETH_P_IP):
  450. if (!tcf_csum_ipv4(skb, update_flags))
  451. goto drop;
  452. break;
  453. case cpu_to_be16(ETH_P_IPV6):
  454. if (!tcf_csum_ipv6(skb, update_flags))
  455. goto drop;
  456. break;
  457. }
  458. return action;
  459. drop:
  460. spin_lock(&p->tcf_lock);
  461. p->tcf_qstats.drops++;
  462. spin_unlock(&p->tcf_lock);
  463. return TC_ACT_SHOT;
  464. }
  465. static int tcf_csum_dump(struct sk_buff *skb, struct tc_action *a, int bind,
  466. int ref)
  467. {
  468. unsigned char *b = skb_tail_pointer(skb);
  469. struct tcf_csum *p = to_tcf_csum(a);
  470. struct tc_csum opt = {
  471. .update_flags = p->update_flags,
  472. .index = p->tcf_index,
  473. .action = p->tcf_action,
  474. .refcnt = p->tcf_refcnt - ref,
  475. .bindcnt = p->tcf_bindcnt - bind,
  476. };
  477. struct tcf_t t;
  478. if (nla_put(skb, TCA_CSUM_PARMS, sizeof(opt), &opt))
  479. goto nla_put_failure;
  480. tcf_tm_dump(&t, &p->tcf_tm);
  481. if (nla_put_64bit(skb, TCA_CSUM_TM, sizeof(t), &t, TCA_CSUM_PAD))
  482. goto nla_put_failure;
  483. return skb->len;
  484. nla_put_failure:
  485. nlmsg_trim(skb, b);
  486. return -1;
  487. }
  488. static int tcf_csum_walker(struct net *net, struct sk_buff *skb,
  489. struct netlink_callback *cb, int type,
  490. const struct tc_action_ops *ops)
  491. {
  492. struct tc_action_net *tn = net_generic(net, csum_net_id);
  493. return tcf_generic_walker(tn, skb, cb, type, ops);
  494. }
  495. static int tcf_csum_search(struct net *net, struct tc_action **a, u32 index)
  496. {
  497. struct tc_action_net *tn = net_generic(net, csum_net_id);
  498. return tcf_idr_search(tn, a, index);
  499. }
  500. static struct tc_action_ops act_csum_ops = {
  501. .kind = "csum",
  502. .type = TCA_ACT_CSUM,
  503. .owner = THIS_MODULE,
  504. .act = tcf_csum,
  505. .dump = tcf_csum_dump,
  506. .init = tcf_csum_init,
  507. .walk = tcf_csum_walker,
  508. .lookup = tcf_csum_search,
  509. .size = sizeof(struct tcf_csum),
  510. };
  511. static __net_init int csum_init_net(struct net *net)
  512. {
  513. struct tc_action_net *tn = net_generic(net, csum_net_id);
  514. return tc_action_net_init(tn, &act_csum_ops);
  515. }
  516. static void __net_exit csum_exit_net(struct net *net)
  517. {
  518. struct tc_action_net *tn = net_generic(net, csum_net_id);
  519. tc_action_net_exit(tn);
  520. }
  521. static struct pernet_operations csum_net_ops = {
  522. .init = csum_init_net,
  523. .exit = csum_exit_net,
  524. .id = &csum_net_id,
  525. .size = sizeof(struct tc_action_net),
  526. };
  527. MODULE_DESCRIPTION("Checksum updating actions");
  528. MODULE_LICENSE("GPL");
  529. static int __init csum_init_module(void)
  530. {
  531. return tcf_register_action(&act_csum_ops, &csum_net_ops);
  532. }
  533. static void __exit csum_cleanup_module(void)
  534. {
  535. tcf_unregister_action(&act_csum_ops, &csum_net_ops);
  536. }
  537. module_init(csum_init_module);
  538. module_exit(csum_cleanup_module);