Browse code

Make block-outside-dns work with persist-tun

- Remove and recreate WFP filters during restart even when
tun/tap is not re-opened. This is needed for resolving the remote.
Patch same as for v2.3 except for passing 'msg_channel'.

See also: http://article.gmane.org/gmane.network.openvpn.user/36990

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1465055833-13681-1-git-send-email-selva.nair@gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11788
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Selva Nair authored on 2016/06/05 00:57:13
Showing 1 changed files
... ...
@@ -1556,6 +1556,15 @@ do_open_tun (struct context *c)
1556 1556
 		     NULL,
1557 1557
 		     "up",
1558 1558
 		     c->c2.es);
1559
+#if defined(WIN32)
1560
+      if (c->options.block_outside_dns)
1561
+        {
1562
+          dmsg (D_LOW, "Blocking outside DNS");
1563
+          if (!win_wfp_block_dns(c->c1.tuntap->adapter_index, c->options.msg_channel))
1564
+            msg (M_FATAL, "Blocking DNS failed!");
1565
+        }
1566
+#endif
1567
+
1559 1568
     }
1560 1569
 #endif
1561 1570
   gc_free (&gc);
... ...
@@ -1686,6 +1695,15 @@ do_close_tun (struct context *c, bool force)
1686 1686
 					     c->sig->signal_text),
1687 1687
 			 "down",
1688 1688
 			 c->c2.es);
1689
+
1690
+#if defined(WIN32)
1691
+          if (c->options.block_outside_dns)
1692
+            {
1693
+              if (!win_wfp_uninit(c->options.msg_channel))
1694
+                  msg (M_FATAL, "Uninitialising WFP failed!");
1695
+            }
1696
+#endif
1697
+
1689 1698
 	}
1690 1699
     }
1691 1700
   gc_free (&gc);