xt_TPROXY.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. /*
  2. * Transparent proxy support for Linux/iptables
  3. *
  4. * Copyright (c) 2006-2010 BalaBit IT Ltd.
  5. * Author: Balazs Scheidler, Krisztian Kovacs
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. */
  12. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  13. #include <linux/module.h>
  14. #include <linux/skbuff.h>
  15. #include <linux/ip.h>
  16. #include <net/checksum.h>
  17. #include <net/udp.h>
  18. #include <net/tcp.h>
  19. #include <net/inet_sock.h>
  20. #include <net/inet_hashtables.h>
  21. #include <linux/inetdevice.h>
  22. #include <linux/netfilter/x_tables.h>
  23. #include <linux/netfilter_ipv4/ip_tables.h>
  24. #include <net/netfilter/ipv4/nf_defrag_ipv4.h>
  25. #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
  26. #define XT_TPROXY_HAVE_IPV6 1
  27. #include <net/if_inet6.h>
  28. #include <net/addrconf.h>
  29. #include <net/inet6_hashtables.h>
  30. #include <linux/netfilter_ipv6/ip6_tables.h>
  31. #include <net/netfilter/ipv6/nf_defrag_ipv6.h>
  32. #endif
  33. #include <linux/netfilter/xt_TPROXY.h>
  34. enum nf_tproxy_lookup_t {
  35. NFT_LOOKUP_LISTENER,
  36. NFT_LOOKUP_ESTABLISHED,
  37. };
  38. static bool tproxy_sk_is_transparent(struct sock *sk)
  39. {
  40. switch (sk->sk_state) {
  41. case TCP_TIME_WAIT:
  42. if (inet_twsk(sk)->tw_transparent)
  43. return true;
  44. break;
  45. case TCP_NEW_SYN_RECV:
  46. if (inet_rsk(inet_reqsk(sk))->no_srccheck)
  47. return true;
  48. break;
  49. default:
  50. if (inet_sk(sk)->transparent)
  51. return true;
  52. }
  53. sock_gen_put(sk);
  54. return false;
  55. }
  56. static inline __be32
  57. tproxy_laddr4(struct sk_buff *skb, __be32 user_laddr, __be32 daddr)
  58. {
  59. struct in_device *indev;
  60. __be32 laddr;
  61. if (user_laddr)
  62. return user_laddr;
  63. laddr = 0;
  64. rcu_read_lock();
  65. indev = __in_dev_get_rcu(skb->dev);
  66. for_primary_ifa(indev) {
  67. laddr = ifa->ifa_local;
  68. break;
  69. } endfor_ifa(indev);
  70. rcu_read_unlock();
  71. return laddr ? laddr : daddr;
  72. }
  73. /*
  74. * This is used when the user wants to intercept a connection matching
  75. * an explicit iptables rule. In this case the sockets are assumed
  76. * matching in preference order:
  77. *
  78. * - match: if there's a fully established connection matching the
  79. * _packet_ tuple, it is returned, assuming the redirection
  80. * already took place and we process a packet belonging to an
  81. * established connection
  82. *
  83. * - match: if there's a listening socket matching the redirection
  84. * (e.g. on-port & on-ip of the connection), it is returned,
  85. * regardless if it was bound to 0.0.0.0 or an explicit
  86. * address. The reasoning is that if there's an explicit rule, it
  87. * does not really matter if the listener is bound to an interface
  88. * or to 0. The user already stated that he wants redirection
  89. * (since he added the rule).
  90. *
  91. * Please note that there's an overlap between what a TPROXY target
  92. * and a socket match will match. Normally if you have both rules the
  93. * "socket" match will be the first one, effectively all packets
  94. * belonging to established connections going through that one.
  95. */
  96. static inline struct sock *
  97. nf_tproxy_get_sock_v4(struct net *net, const u8 protocol,
  98. const __be32 saddr, const __be32 daddr,
  99. const __be16 sport, const __be16 dport,
  100. const struct net_device *in,
  101. const enum nf_tproxy_lookup_t lookup_type)
  102. {
  103. struct sock *sk;
  104. switch (protocol) {
  105. case IPPROTO_TCP:
  106. switch (lookup_type) {
  107. case NFT_LOOKUP_LISTENER:
  108. sk = inet_lookup_listener(net, &tcp_hashinfo,
  109. saddr, sport,
  110. daddr, dport,
  111. in->ifindex);
  112. /* NOTE: we return listeners even if bound to
  113. * 0.0.0.0, those are filtered out in
  114. * xt_socket, since xt_TPROXY needs 0 bound
  115. * listeners too
  116. */
  117. break;
  118. case NFT_LOOKUP_ESTABLISHED:
  119. sk = inet_lookup_established(net, &tcp_hashinfo,
  120. saddr, sport, daddr, dport,
  121. in->ifindex);
  122. break;
  123. default:
  124. BUG();
  125. }
  126. break;
  127. case IPPROTO_UDP:
  128. sk = udp4_lib_lookup(net, saddr, sport, daddr, dport,
  129. in->ifindex);
  130. if (sk) {
  131. int connected = (sk->sk_state == TCP_ESTABLISHED);
  132. int wildcard = (inet_sk(sk)->inet_rcv_saddr == 0);
  133. /* NOTE: we return listeners even if bound to
  134. * 0.0.0.0, those are filtered out in
  135. * xt_socket, since xt_TPROXY needs 0 bound
  136. * listeners too
  137. */
  138. if ((lookup_type == NFT_LOOKUP_ESTABLISHED && (!connected || wildcard)) ||
  139. (lookup_type == NFT_LOOKUP_LISTENER && connected)) {
  140. sock_put(sk);
  141. sk = NULL;
  142. }
  143. }
  144. break;
  145. default:
  146. WARN_ON(1);
  147. sk = NULL;
  148. }
  149. pr_debug("tproxy socket lookup: proto %u %08x:%u -> %08x:%u, lookup type: %d, sock %p\n",
  150. protocol, ntohl(saddr), ntohs(sport), ntohl(daddr), ntohs(dport), lookup_type, sk);
  151. return sk;
  152. }
  153. #ifdef XT_TPROXY_HAVE_IPV6
  154. static inline struct sock *
  155. nf_tproxy_get_sock_v6(struct net *net, const u8 protocol,
  156. const struct in6_addr *saddr, const struct in6_addr *daddr,
  157. const __be16 sport, const __be16 dport,
  158. const struct net_device *in,
  159. const enum nf_tproxy_lookup_t lookup_type)
  160. {
  161. struct sock *sk;
  162. switch (protocol) {
  163. case IPPROTO_TCP:
  164. switch (lookup_type) {
  165. case NFT_LOOKUP_LISTENER:
  166. sk = inet6_lookup_listener(net, &tcp_hashinfo,
  167. saddr, sport,
  168. daddr, ntohs(dport),
  169. in->ifindex);
  170. /* NOTE: we return listeners even if bound to
  171. * 0.0.0.0, those are filtered out in
  172. * xt_socket, since xt_TPROXY needs 0 bound
  173. * listeners too
  174. */
  175. break;
  176. case NFT_LOOKUP_ESTABLISHED:
  177. sk = __inet6_lookup_established(net, &tcp_hashinfo,
  178. saddr, sport, daddr, ntohs(dport),
  179. in->ifindex);
  180. break;
  181. default:
  182. BUG();
  183. }
  184. break;
  185. case IPPROTO_UDP:
  186. sk = udp6_lib_lookup(net, saddr, sport, daddr, dport,
  187. in->ifindex);
  188. if (sk) {
  189. int connected = (sk->sk_state == TCP_ESTABLISHED);
  190. int wildcard = ipv6_addr_any(&sk->sk_v6_rcv_saddr);
  191. /* NOTE: we return listeners even if bound to
  192. * 0.0.0.0, those are filtered out in
  193. * xt_socket, since xt_TPROXY needs 0 bound
  194. * listeners too
  195. */
  196. if ((lookup_type == NFT_LOOKUP_ESTABLISHED && (!connected || wildcard)) ||
  197. (lookup_type == NFT_LOOKUP_LISTENER && connected)) {
  198. sock_put(sk);
  199. sk = NULL;
  200. }
  201. }
  202. break;
  203. default:
  204. WARN_ON(1);
  205. sk = NULL;
  206. }
  207. pr_debug("tproxy socket lookup: proto %u %pI6:%u -> %pI6:%u, lookup type: %d, sock %p\n",
  208. protocol, saddr, ntohs(sport), daddr, ntohs(dport), lookup_type, sk);
  209. return sk;
  210. }
  211. #endif
  212. /**
  213. * tproxy_handle_time_wait4 - handle IPv4 TCP TIME_WAIT reopen redirections
  214. * @skb: The skb being processed.
  215. * @laddr: IPv4 address to redirect to or zero.
  216. * @lport: TCP port to redirect to or zero.
  217. * @sk: The TIME_WAIT TCP socket found by the lookup.
  218. *
  219. * We have to handle SYN packets arriving to TIME_WAIT sockets
  220. * differently: instead of reopening the connection we should rather
  221. * redirect the new connection to the proxy if there's a listener
  222. * socket present.
  223. *
  224. * tproxy_handle_time_wait4() consumes the socket reference passed in.
  225. *
  226. * Returns the listener socket if there's one, the TIME_WAIT socket if
  227. * no such listener is found, or NULL if the TCP header is incomplete.
  228. */
  229. static struct sock *
  230. tproxy_handle_time_wait4(struct net *net, struct sk_buff *skb,
  231. __be32 laddr, __be16 lport, struct sock *sk)
  232. {
  233. const struct iphdr *iph = ip_hdr(skb);
  234. struct tcphdr _hdr, *hp;
  235. hp = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_hdr), &_hdr);
  236. if (hp == NULL) {
  237. inet_twsk_put(inet_twsk(sk));
  238. return NULL;
  239. }
  240. if (hp->syn && !hp->rst && !hp->ack && !hp->fin) {
  241. /* SYN to a TIME_WAIT socket, we'd rather redirect it
  242. * to a listener socket if there's one */
  243. struct sock *sk2;
  244. sk2 = nf_tproxy_get_sock_v4(net, iph->protocol,
  245. iph->saddr, laddr ? laddr : iph->daddr,
  246. hp->source, lport ? lport : hp->dest,
  247. skb->dev, NFT_LOOKUP_LISTENER);
  248. if (sk2) {
  249. inet_twsk_deschedule_put(inet_twsk(sk));
  250. sk = sk2;
  251. }
  252. }
  253. return sk;
  254. }
  255. /* assign a socket to the skb -- consumes sk */
  256. static void
  257. nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk)
  258. {
  259. skb_orphan(skb);
  260. skb->sk = sk;
  261. skb->destructor = sock_edemux;
  262. }
  263. static unsigned int
  264. tproxy_tg4(struct net *net, struct sk_buff *skb, __be32 laddr, __be16 lport,
  265. u_int32_t mark_mask, u_int32_t mark_value)
  266. {
  267. const struct iphdr *iph = ip_hdr(skb);
  268. struct udphdr _hdr, *hp;
  269. struct sock *sk;
  270. hp = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_hdr), &_hdr);
  271. if (hp == NULL)
  272. return NF_DROP;
  273. /* check if there's an ongoing connection on the packet
  274. * addresses, this happens if the redirect already happened
  275. * and the current packet belongs to an already established
  276. * connection */
  277. sk = nf_tproxy_get_sock_v4(net, iph->protocol,
  278. iph->saddr, iph->daddr,
  279. hp->source, hp->dest,
  280. skb->dev, NFT_LOOKUP_ESTABLISHED);
  281. laddr = tproxy_laddr4(skb, laddr, iph->daddr);
  282. if (!lport)
  283. lport = hp->dest;
  284. /* UDP has no TCP_TIME_WAIT state, so we never enter here */
  285. if (sk && sk->sk_state == TCP_TIME_WAIT)
  286. /* reopening a TIME_WAIT connection needs special handling */
  287. sk = tproxy_handle_time_wait4(net, skb, laddr, lport, sk);
  288. else if (!sk)
  289. /* no, there's no established connection, check if
  290. * there's a listener on the redirected addr/port */
  291. sk = nf_tproxy_get_sock_v4(net, iph->protocol,
  292. iph->saddr, laddr,
  293. hp->source, lport,
  294. skb->dev, NFT_LOOKUP_LISTENER);
  295. /* NOTE: assign_sock consumes our sk reference */
  296. if (sk && tproxy_sk_is_transparent(sk)) {
  297. /* This should be in a separate target, but we don't do multiple
  298. targets on the same rule yet */
  299. skb->mark = (skb->mark & ~mark_mask) ^ mark_value;
  300. pr_debug("redirecting: proto %hhu %pI4:%hu -> %pI4:%hu, mark: %x\n",
  301. iph->protocol, &iph->daddr, ntohs(hp->dest),
  302. &laddr, ntohs(lport), skb->mark);
  303. nf_tproxy_assign_sock(skb, sk);
  304. return NF_ACCEPT;
  305. }
  306. pr_debug("no socket, dropping: proto %hhu %pI4:%hu -> %pI4:%hu, mark: %x\n",
  307. iph->protocol, &iph->saddr, ntohs(hp->source),
  308. &iph->daddr, ntohs(hp->dest), skb->mark);
  309. return NF_DROP;
  310. }
  311. static unsigned int
  312. tproxy_tg4_v0(struct sk_buff *skb, const struct xt_action_param *par)
  313. {
  314. const struct xt_tproxy_target_info *tgi = par->targinfo;
  315. return tproxy_tg4(par->net, skb, tgi->laddr, tgi->lport, tgi->mark_mask, tgi->mark_value);
  316. }
  317. static unsigned int
  318. tproxy_tg4_v1(struct sk_buff *skb, const struct xt_action_param *par)
  319. {
  320. const struct xt_tproxy_target_info_v1 *tgi = par->targinfo;
  321. return tproxy_tg4(par->net, skb, tgi->laddr.ip, tgi->lport, tgi->mark_mask, tgi->mark_value);
  322. }
  323. #ifdef XT_TPROXY_HAVE_IPV6
  324. static inline const struct in6_addr *
  325. tproxy_laddr6(struct sk_buff *skb, const struct in6_addr *user_laddr,
  326. const struct in6_addr *daddr)
  327. {
  328. struct inet6_dev *indev;
  329. struct inet6_ifaddr *ifa;
  330. struct in6_addr *laddr;
  331. if (!ipv6_addr_any(user_laddr))
  332. return user_laddr;
  333. laddr = NULL;
  334. rcu_read_lock();
  335. indev = __in6_dev_get(skb->dev);
  336. if (indev)
  337. list_for_each_entry(ifa, &indev->addr_list, if_list) {
  338. if (ifa->flags & (IFA_F_TENTATIVE | IFA_F_DEPRECATED))
  339. continue;
  340. laddr = &ifa->addr;
  341. break;
  342. }
  343. rcu_read_unlock();
  344. return laddr ? laddr : daddr;
  345. }
  346. /**
  347. * tproxy_handle_time_wait6 - handle IPv6 TCP TIME_WAIT reopen redirections
  348. * @skb: The skb being processed.
  349. * @tproto: Transport protocol.
  350. * @thoff: Transport protocol header offset.
  351. * @par: Iptables target parameters.
  352. * @sk: The TIME_WAIT TCP socket found by the lookup.
  353. *
  354. * We have to handle SYN packets arriving to TIME_WAIT sockets
  355. * differently: instead of reopening the connection we should rather
  356. * redirect the new connection to the proxy if there's a listener
  357. * socket present.
  358. *
  359. * tproxy_handle_time_wait6() consumes the socket reference passed in.
  360. *
  361. * Returns the listener socket if there's one, the TIME_WAIT socket if
  362. * no such listener is found, or NULL if the TCP header is incomplete.
  363. */
  364. static struct sock *
  365. tproxy_handle_time_wait6(struct sk_buff *skb, int tproto, int thoff,
  366. const struct xt_action_param *par,
  367. struct sock *sk)
  368. {
  369. const struct ipv6hdr *iph = ipv6_hdr(skb);
  370. struct tcphdr _hdr, *hp;
  371. const struct xt_tproxy_target_info_v1 *tgi = par->targinfo;
  372. hp = skb_header_pointer(skb, thoff, sizeof(_hdr), &_hdr);
  373. if (hp == NULL) {
  374. inet_twsk_put(inet_twsk(sk));
  375. return NULL;
  376. }
  377. if (hp->syn && !hp->rst && !hp->ack && !hp->fin) {
  378. /* SYN to a TIME_WAIT socket, we'd rather redirect it
  379. * to a listener socket if there's one */
  380. struct sock *sk2;
  381. sk2 = nf_tproxy_get_sock_v6(par->net, tproto,
  382. &iph->saddr,
  383. tproxy_laddr6(skb, &tgi->laddr.in6, &iph->daddr),
  384. hp->source,
  385. tgi->lport ? tgi->lport : hp->dest,
  386. skb->dev, NFT_LOOKUP_LISTENER);
  387. if (sk2) {
  388. inet_twsk_deschedule_put(inet_twsk(sk));
  389. sk = sk2;
  390. }
  391. }
  392. return sk;
  393. }
  394. static unsigned int
  395. tproxy_tg6_v1(struct sk_buff *skb, const struct xt_action_param *par)
  396. {
  397. const struct ipv6hdr *iph = ipv6_hdr(skb);
  398. const struct xt_tproxy_target_info_v1 *tgi = par->targinfo;
  399. struct udphdr _hdr, *hp;
  400. struct sock *sk;
  401. const struct in6_addr *laddr;
  402. __be16 lport;
  403. int thoff = 0;
  404. int tproto;
  405. tproto = ipv6_find_hdr(skb, &thoff, -1, NULL, NULL);
  406. if (tproto < 0) {
  407. pr_debug("unable to find transport header in IPv6 packet, dropping\n");
  408. return NF_DROP;
  409. }
  410. hp = skb_header_pointer(skb, thoff, sizeof(_hdr), &_hdr);
  411. if (hp == NULL) {
  412. pr_debug("unable to grab transport header contents in IPv6 packet, dropping\n");
  413. return NF_DROP;
  414. }
  415. /* check if there's an ongoing connection on the packet
  416. * addresses, this happens if the redirect already happened
  417. * and the current packet belongs to an already established
  418. * connection */
  419. sk = nf_tproxy_get_sock_v6(par->net, tproto,
  420. &iph->saddr, &iph->daddr,
  421. hp->source, hp->dest,
  422. par->in, NFT_LOOKUP_ESTABLISHED);
  423. laddr = tproxy_laddr6(skb, &tgi->laddr.in6, &iph->daddr);
  424. lport = tgi->lport ? tgi->lport : hp->dest;
  425. /* UDP has no TCP_TIME_WAIT state, so we never enter here */
  426. if (sk && sk->sk_state == TCP_TIME_WAIT)
  427. /* reopening a TIME_WAIT connection needs special handling */
  428. sk = tproxy_handle_time_wait6(skb, tproto, thoff, par, sk);
  429. else if (!sk)
  430. /* no there's no established connection, check if
  431. * there's a listener on the redirected addr/port */
  432. sk = nf_tproxy_get_sock_v6(par->net, tproto,
  433. &iph->saddr, laddr,
  434. hp->source, lport,
  435. par->in, NFT_LOOKUP_LISTENER);
  436. /* NOTE: assign_sock consumes our sk reference */
  437. if (sk && tproxy_sk_is_transparent(sk)) {
  438. /* This should be in a separate target, but we don't do multiple
  439. targets on the same rule yet */
  440. skb->mark = (skb->mark & ~tgi->mark_mask) ^ tgi->mark_value;
  441. pr_debug("redirecting: proto %hhu %pI6:%hu -> %pI6:%hu, mark: %x\n",
  442. tproto, &iph->saddr, ntohs(hp->source),
  443. laddr, ntohs(lport), skb->mark);
  444. nf_tproxy_assign_sock(skb, sk);
  445. return NF_ACCEPT;
  446. }
  447. pr_debug("no socket, dropping: proto %hhu %pI6:%hu -> %pI6:%hu, mark: %x\n",
  448. tproto, &iph->saddr, ntohs(hp->source),
  449. &iph->daddr, ntohs(hp->dest), skb->mark);
  450. return NF_DROP;
  451. }
  452. static int tproxy_tg6_check(const struct xt_tgchk_param *par)
  453. {
  454. const struct ip6t_ip6 *i = par->entryinfo;
  455. if ((i->proto == IPPROTO_TCP || i->proto == IPPROTO_UDP) &&
  456. !(i->invflags & IP6T_INV_PROTO))
  457. return 0;
  458. pr_info("Can be used only in combination with "
  459. "either -p tcp or -p udp\n");
  460. return -EINVAL;
  461. }
  462. #endif
  463. static int tproxy_tg4_check(const struct xt_tgchk_param *par)
  464. {
  465. const struct ipt_ip *i = par->entryinfo;
  466. if ((i->proto == IPPROTO_TCP || i->proto == IPPROTO_UDP)
  467. && !(i->invflags & IPT_INV_PROTO))
  468. return 0;
  469. pr_info("Can be used only in combination with "
  470. "either -p tcp or -p udp\n");
  471. return -EINVAL;
  472. }
  473. static struct xt_target tproxy_tg_reg[] __read_mostly = {
  474. {
  475. .name = "TPROXY",
  476. .family = NFPROTO_IPV4,
  477. .table = "mangle",
  478. .target = tproxy_tg4_v0,
  479. .revision = 0,
  480. .targetsize = sizeof(struct xt_tproxy_target_info),
  481. .checkentry = tproxy_tg4_check,
  482. .hooks = 1 << NF_INET_PRE_ROUTING,
  483. .me = THIS_MODULE,
  484. },
  485. {
  486. .name = "TPROXY",
  487. .family = NFPROTO_IPV4,
  488. .table = "mangle",
  489. .target = tproxy_tg4_v1,
  490. .revision = 1,
  491. .targetsize = sizeof(struct xt_tproxy_target_info_v1),
  492. .checkentry = tproxy_tg4_check,
  493. .hooks = 1 << NF_INET_PRE_ROUTING,
  494. .me = THIS_MODULE,
  495. },
  496. #ifdef XT_TPROXY_HAVE_IPV6
  497. {
  498. .name = "TPROXY",
  499. .family = NFPROTO_IPV6,
  500. .table = "mangle",
  501. .target = tproxy_tg6_v1,
  502. .revision = 1,
  503. .targetsize = sizeof(struct xt_tproxy_target_info_v1),
  504. .checkentry = tproxy_tg6_check,
  505. .hooks = 1 << NF_INET_PRE_ROUTING,
  506. .me = THIS_MODULE,
  507. },
  508. #endif
  509. };
  510. static int __init tproxy_tg_init(void)
  511. {
  512. nf_defrag_ipv4_enable();
  513. #ifdef XT_TPROXY_HAVE_IPV6
  514. nf_defrag_ipv6_enable();
  515. #endif
  516. return xt_register_targets(tproxy_tg_reg, ARRAY_SIZE(tproxy_tg_reg));
  517. }
  518. static void __exit tproxy_tg_exit(void)
  519. {
  520. xt_unregister_targets(tproxy_tg_reg, ARRAY_SIZE(tproxy_tg_reg));
  521. }
  522. module_init(tproxy_tg_init);
  523. module_exit(tproxy_tg_exit);
  524. MODULE_LICENSE("GPL");
  525. MODULE_AUTHOR("Balazs Scheidler, Krisztian Kovacs");
  526. MODULE_DESCRIPTION("Netfilter transparent proxy (TPROXY) target module.");
  527. MODULE_ALIAS("ipt_TPROXY");
  528. MODULE_ALIAS("ip6t_TPROXY");