xt_TPROXY.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  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 sk_buff *skb, __be32 laddr, __be16 lport,
  231. 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(dev_net(skb->dev), 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(inet_twsk(sk));
  250. inet_twsk_put(inet_twsk(sk));
  251. sk = sk2;
  252. }
  253. }
  254. return sk;
  255. }
  256. /* assign a socket to the skb -- consumes sk */
  257. static void
  258. nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk)
  259. {
  260. skb_orphan(skb);
  261. skb->sk = sk;
  262. skb->destructor = sock_edemux;
  263. }
  264. static unsigned int
  265. tproxy_tg4(struct sk_buff *skb, __be32 laddr, __be16 lport,
  266. u_int32_t mark_mask, u_int32_t mark_value)
  267. {
  268. const struct iphdr *iph = ip_hdr(skb);
  269. struct udphdr _hdr, *hp;
  270. struct sock *sk;
  271. hp = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_hdr), &_hdr);
  272. if (hp == NULL)
  273. return NF_DROP;
  274. /* check if there's an ongoing connection on the packet
  275. * addresses, this happens if the redirect already happened
  276. * and the current packet belongs to an already established
  277. * connection */
  278. sk = nf_tproxy_get_sock_v4(dev_net(skb->dev), iph->protocol,
  279. iph->saddr, iph->daddr,
  280. hp->source, hp->dest,
  281. skb->dev, NFT_LOOKUP_ESTABLISHED);
  282. laddr = tproxy_laddr4(skb, laddr, iph->daddr);
  283. if (!lport)
  284. lport = hp->dest;
  285. /* UDP has no TCP_TIME_WAIT state, so we never enter here */
  286. if (sk && sk->sk_state == TCP_TIME_WAIT)
  287. /* reopening a TIME_WAIT connection needs special handling */
  288. sk = tproxy_handle_time_wait4(skb, laddr, lport, sk);
  289. else if (!sk)
  290. /* no, there's no established connection, check if
  291. * there's a listener on the redirected addr/port */
  292. sk = nf_tproxy_get_sock_v4(dev_net(skb->dev), iph->protocol,
  293. iph->saddr, laddr,
  294. hp->source, lport,
  295. skb->dev, NFT_LOOKUP_LISTENER);
  296. /* NOTE: assign_sock consumes our sk reference */
  297. if (sk && tproxy_sk_is_transparent(sk)) {
  298. /* This should be in a separate target, but we don't do multiple
  299. targets on the same rule yet */
  300. skb->mark = (skb->mark & ~mark_mask) ^ mark_value;
  301. pr_debug("redirecting: proto %hhu %pI4:%hu -> %pI4:%hu, mark: %x\n",
  302. iph->protocol, &iph->daddr, ntohs(hp->dest),
  303. &laddr, ntohs(lport), skb->mark);
  304. nf_tproxy_assign_sock(skb, sk);
  305. return NF_ACCEPT;
  306. }
  307. pr_debug("no socket, dropping: proto %hhu %pI4:%hu -> %pI4:%hu, mark: %x\n",
  308. iph->protocol, &iph->saddr, ntohs(hp->source),
  309. &iph->daddr, ntohs(hp->dest), skb->mark);
  310. return NF_DROP;
  311. }
  312. static unsigned int
  313. tproxy_tg4_v0(struct sk_buff *skb, const struct xt_action_param *par)
  314. {
  315. const struct xt_tproxy_target_info *tgi = par->targinfo;
  316. return tproxy_tg4(skb, tgi->laddr, tgi->lport, tgi->mark_mask, tgi->mark_value);
  317. }
  318. static unsigned int
  319. tproxy_tg4_v1(struct sk_buff *skb, const struct xt_action_param *par)
  320. {
  321. const struct xt_tproxy_target_info_v1 *tgi = par->targinfo;
  322. return tproxy_tg4(skb, tgi->laddr.ip, tgi->lport, tgi->mark_mask, tgi->mark_value);
  323. }
  324. #ifdef XT_TPROXY_HAVE_IPV6
  325. static inline const struct in6_addr *
  326. tproxy_laddr6(struct sk_buff *skb, const struct in6_addr *user_laddr,
  327. const struct in6_addr *daddr)
  328. {
  329. struct inet6_dev *indev;
  330. struct inet6_ifaddr *ifa;
  331. struct in6_addr *laddr;
  332. if (!ipv6_addr_any(user_laddr))
  333. return user_laddr;
  334. laddr = NULL;
  335. rcu_read_lock();
  336. indev = __in6_dev_get(skb->dev);
  337. if (indev)
  338. list_for_each_entry(ifa, &indev->addr_list, if_list) {
  339. if (ifa->flags & (IFA_F_TENTATIVE | IFA_F_DEPRECATED))
  340. continue;
  341. laddr = &ifa->addr;
  342. break;
  343. }
  344. rcu_read_unlock();
  345. return laddr ? laddr : daddr;
  346. }
  347. /**
  348. * tproxy_handle_time_wait6 - handle IPv6 TCP TIME_WAIT reopen redirections
  349. * @skb: The skb being processed.
  350. * @tproto: Transport protocol.
  351. * @thoff: Transport protocol header offset.
  352. * @par: Iptables target parameters.
  353. * @sk: The TIME_WAIT TCP socket found by the lookup.
  354. *
  355. * We have to handle SYN packets arriving to TIME_WAIT sockets
  356. * differently: instead of reopening the connection we should rather
  357. * redirect the new connection to the proxy if there's a listener
  358. * socket present.
  359. *
  360. * tproxy_handle_time_wait6() consumes the socket reference passed in.
  361. *
  362. * Returns the listener socket if there's one, the TIME_WAIT socket if
  363. * no such listener is found, or NULL if the TCP header is incomplete.
  364. */
  365. static struct sock *
  366. tproxy_handle_time_wait6(struct sk_buff *skb, int tproto, int thoff,
  367. const struct xt_action_param *par,
  368. struct sock *sk)
  369. {
  370. const struct ipv6hdr *iph = ipv6_hdr(skb);
  371. struct tcphdr _hdr, *hp;
  372. const struct xt_tproxy_target_info_v1 *tgi = par->targinfo;
  373. hp = skb_header_pointer(skb, thoff, sizeof(_hdr), &_hdr);
  374. if (hp == NULL) {
  375. inet_twsk_put(inet_twsk(sk));
  376. return NULL;
  377. }
  378. if (hp->syn && !hp->rst && !hp->ack && !hp->fin) {
  379. /* SYN to a TIME_WAIT socket, we'd rather redirect it
  380. * to a listener socket if there's one */
  381. struct sock *sk2;
  382. sk2 = nf_tproxy_get_sock_v6(dev_net(skb->dev), tproto,
  383. &iph->saddr,
  384. tproxy_laddr6(skb, &tgi->laddr.in6, &iph->daddr),
  385. hp->source,
  386. tgi->lport ? tgi->lport : hp->dest,
  387. skb->dev, NFT_LOOKUP_LISTENER);
  388. if (sk2) {
  389. inet_twsk_deschedule(inet_twsk(sk));
  390. inet_twsk_put(inet_twsk(sk));
  391. sk = sk2;
  392. }
  393. }
  394. return sk;
  395. }
  396. static unsigned int
  397. tproxy_tg6_v1(struct sk_buff *skb, const struct xt_action_param *par)
  398. {
  399. const struct ipv6hdr *iph = ipv6_hdr(skb);
  400. const struct xt_tproxy_target_info_v1 *tgi = par->targinfo;
  401. struct udphdr _hdr, *hp;
  402. struct sock *sk;
  403. const struct in6_addr *laddr;
  404. __be16 lport;
  405. int thoff = 0;
  406. int tproto;
  407. tproto = ipv6_find_hdr(skb, &thoff, -1, NULL, NULL);
  408. if (tproto < 0) {
  409. pr_debug("unable to find transport header in IPv6 packet, dropping\n");
  410. return NF_DROP;
  411. }
  412. hp = skb_header_pointer(skb, thoff, sizeof(_hdr), &_hdr);
  413. if (hp == NULL) {
  414. pr_debug("unable to grab transport header contents in IPv6 packet, dropping\n");
  415. return NF_DROP;
  416. }
  417. /* check if there's an ongoing connection on the packet
  418. * addresses, this happens if the redirect already happened
  419. * and the current packet belongs to an already established
  420. * connection */
  421. sk = nf_tproxy_get_sock_v6(dev_net(skb->dev), tproto,
  422. &iph->saddr, &iph->daddr,
  423. hp->source, hp->dest,
  424. par->in, NFT_LOOKUP_ESTABLISHED);
  425. laddr = tproxy_laddr6(skb, &tgi->laddr.in6, &iph->daddr);
  426. lport = tgi->lport ? tgi->lport : hp->dest;
  427. /* UDP has no TCP_TIME_WAIT state, so we never enter here */
  428. if (sk && sk->sk_state == TCP_TIME_WAIT)
  429. /* reopening a TIME_WAIT connection needs special handling */
  430. sk = tproxy_handle_time_wait6(skb, tproto, thoff, par, sk);
  431. else if (!sk)
  432. /* no there's no established connection, check if
  433. * there's a listener on the redirected addr/port */
  434. sk = nf_tproxy_get_sock_v6(dev_net(skb->dev), tproto,
  435. &iph->saddr, laddr,
  436. hp->source, lport,
  437. par->in, NFT_LOOKUP_LISTENER);
  438. /* NOTE: assign_sock consumes our sk reference */
  439. if (sk && tproxy_sk_is_transparent(sk)) {
  440. /* This should be in a separate target, but we don't do multiple
  441. targets on the same rule yet */
  442. skb->mark = (skb->mark & ~tgi->mark_mask) ^ tgi->mark_value;
  443. pr_debug("redirecting: proto %hhu %pI6:%hu -> %pI6:%hu, mark: %x\n",
  444. tproto, &iph->saddr, ntohs(hp->source),
  445. laddr, ntohs(lport), skb->mark);
  446. nf_tproxy_assign_sock(skb, sk);
  447. return NF_ACCEPT;
  448. }
  449. pr_debug("no socket, dropping: proto %hhu %pI6:%hu -> %pI6:%hu, mark: %x\n",
  450. tproto, &iph->saddr, ntohs(hp->source),
  451. &iph->daddr, ntohs(hp->dest), skb->mark);
  452. return NF_DROP;
  453. }
  454. static int tproxy_tg6_check(const struct xt_tgchk_param *par)
  455. {
  456. const struct ip6t_ip6 *i = par->entryinfo;
  457. if ((i->proto == IPPROTO_TCP || i->proto == IPPROTO_UDP) &&
  458. !(i->invflags & IP6T_INV_PROTO))
  459. return 0;
  460. pr_info("Can be used only in combination with "
  461. "either -p tcp or -p udp\n");
  462. return -EINVAL;
  463. }
  464. #endif
  465. static int tproxy_tg4_check(const struct xt_tgchk_param *par)
  466. {
  467. const struct ipt_ip *i = par->entryinfo;
  468. if ((i->proto == IPPROTO_TCP || i->proto == IPPROTO_UDP)
  469. && !(i->invflags & IPT_INV_PROTO))
  470. return 0;
  471. pr_info("Can be used only in combination with "
  472. "either -p tcp or -p udp\n");
  473. return -EINVAL;
  474. }
  475. static struct xt_target tproxy_tg_reg[] __read_mostly = {
  476. {
  477. .name = "TPROXY",
  478. .family = NFPROTO_IPV4,
  479. .table = "mangle",
  480. .target = tproxy_tg4_v0,
  481. .revision = 0,
  482. .targetsize = sizeof(struct xt_tproxy_target_info),
  483. .checkentry = tproxy_tg4_check,
  484. .hooks = 1 << NF_INET_PRE_ROUTING,
  485. .me = THIS_MODULE,
  486. },
  487. {
  488. .name = "TPROXY",
  489. .family = NFPROTO_IPV4,
  490. .table = "mangle",
  491. .target = tproxy_tg4_v1,
  492. .revision = 1,
  493. .targetsize = sizeof(struct xt_tproxy_target_info_v1),
  494. .checkentry = tproxy_tg4_check,
  495. .hooks = 1 << NF_INET_PRE_ROUTING,
  496. .me = THIS_MODULE,
  497. },
  498. #ifdef XT_TPROXY_HAVE_IPV6
  499. {
  500. .name = "TPROXY",
  501. .family = NFPROTO_IPV6,
  502. .table = "mangle",
  503. .target = tproxy_tg6_v1,
  504. .revision = 1,
  505. .targetsize = sizeof(struct xt_tproxy_target_info_v1),
  506. .checkentry = tproxy_tg6_check,
  507. .hooks = 1 << NF_INET_PRE_ROUTING,
  508. .me = THIS_MODULE,
  509. },
  510. #endif
  511. };
  512. static int __init tproxy_tg_init(void)
  513. {
  514. nf_defrag_ipv4_enable();
  515. #ifdef XT_TPROXY_HAVE_IPV6
  516. nf_defrag_ipv6_enable();
  517. #endif
  518. return xt_register_targets(tproxy_tg_reg, ARRAY_SIZE(tproxy_tg_reg));
  519. }
  520. static void __exit tproxy_tg_exit(void)
  521. {
  522. xt_unregister_targets(tproxy_tg_reg, ARRAY_SIZE(tproxy_tg_reg));
  523. }
  524. module_init(tproxy_tg_init);
  525. module_exit(tproxy_tg_exit);
  526. MODULE_LICENSE("GPL");
  527. MODULE_AUTHOR("Balazs Scheidler, Krisztian Kovacs");
  528. MODULE_DESCRIPTION("Netfilter transparent proxy (TPROXY) target module.");
  529. MODULE_ALIAS("ipt_TPROXY");
  530. MODULE_ALIAS("ip6t_TPROXY");