xt_TPROXY.c 17 KB

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