1 |
vip-ire |
1.1 |
--- smeserver-openvpn-bridge-2.0/root/etc/e-smith/templates/etc/openvpn/bridge/openvpn.conf/60options.enhance_routes_push 2010-10-26 11:22:59.000000000 +0200 |
2 |
|
|
+++ smeserver-openvpn-bridge-2.0/root/etc/e-smith/templates/etc/openvpn/bridge/openvpn.conf/60options 2010-10-26 11:29:18.000000000 +0200 |
3 |
|
|
@@ -9,14 +9,7 @@ |
4 |
|
|
my $proto = ${'openvpn-bridge'}{protocol} || 'udp'; |
5 |
|
|
my $duplicate = ${'openvpn-bridge'}{duplicateCN} || 'disabled'; |
6 |
|
|
my $passtos = ${'openvpn-bridge'}{PassTOS} || 'enabled'; |
7 |
|
|
-my $pushRoutes = ${'openvpn-bridge'}{PushLocalNetworks} || 'enabled'; |
8 |
|
|
|
9 |
|
|
-use esmith::NetworksDB; |
10 |
|
|
-my $ndb = esmith::NetworksDB->open_ro() || |
11 |
|
|
- die('Can not open Networks DB'); |
12 |
|
|
- |
13 |
|
|
-my @networks = $ndb->networks(); |
14 |
|
|
- |
15 |
|
|
if ($proto eq 'tcp'){ |
16 |
|
|
$mtuTest = 'disabled'; |
17 |
|
|
$fragment = ''; |
18 |
|
|
@@ -30,22 +23,6 @@ |
19 |
|
|
|
20 |
|
|
HERE |
21 |
|
|
|
22 |
|
|
-if ($pushRoutes eq 'enabled'){ |
23 |
|
|
- foreach my $network (@networks) { |
24 |
|
|
- if ($network->prop('Router')) { |
25 |
|
|
- $OUT .= sprintf("push \"route %s %s %s\"\n", |
26 |
|
|
- $network->key(), |
27 |
|
|
- $network->prop('Mask'), |
28 |
|
|
- $network->prop('Router') |
29 |
|
|
- ); |
30 |
|
|
- } |
31 |
|
|
- } |
32 |
|
|
-} |
33 |
|
|
- |
34 |
|
|
-if ($redirectGW eq 'always'){ |
35 |
|
|
- $OUT .= "push \"redirect-gateway def1\"\n"; |
36 |
|
|
-} |
37 |
|
|
- |
38 |
|
|
if ($mtuTest eq 'enabled'){ |
39 |
|
|
$OUT .= "mtu-test\n"; |
40 |
|
|
} |
41 |
|
|
--- smeserver-openvpn-bridge-2.0/root/etc/e-smith/templates/etc/openvpn/bridge/openvpn.conf/65routes.enhance_routes_push 2010-10-26 11:23:31.000000000 +0200 |
42 |
|
|
+++ smeserver-openvpn-bridge-2.0/root/etc/e-smith/templates/etc/openvpn/bridge/openvpn.conf/65routes 2010-10-26 12:00:30.000000000 +0200 |
43 |
|
|
@@ -0,0 +1,32 @@ |
44 |
|
|
+# Routes |
45 |
|
|
+ |
46 |
|
|
+{ |
47 |
|
|
+ |
48 |
|
|
+my $pushRoutes = ${'openvpn-bridge'}{PushLocalNetworks} || 'enabled'; |
49 |
|
|
+my $redirectGW = ${'openvpn-bridge'}{redirectGW} || 'PerClient'; |
50 |
|
|
+ |
51 |
|
|
+use esmith::NetworksDB; |
52 |
|
|
+my $ndb = esmith::NetworksDB->open_ro() || |
53 |
|
|
+ die('Can not open Networks DB'); |
54 |
|
|
+ |
55 |
|
|
+my @networks = $ndb->networks(); |
56 |
|
|
+ |
57 |
|
|
+if ($redirectGW eq 'always'){ |
58 |
|
|
+ $OUT .= "push \"redirect-gateway def1\"\n"; |
59 |
|
|
+} |
60 |
|
|
+elsif ($pushRoutes eq 'enabled'){ |
61 |
|
|
+ foreach my $network (@networks) { |
62 |
|
|
+ my $route = ''; |
63 |
|
|
+ my $addr = $network->key; |
64 |
|
|
+ my $mask = $network->prop('Mask'); |
65 |
|
|
+ my $gw = $network->prop('Router') || ''; |
66 |
|
|
+ my $vpn = $network->prop('VPN') || ''; |
67 |
|
|
+ if ($gw ne '') { |
68 |
|
|
+ $route .= "push \"route $addr $mask"; |
69 |
|
|
+ $route .= " $gw" if ($vpn eq ''); |
70 |
|
|
+ $OUT .= "$route\"\n"; |
71 |
|
|
+ } |
72 |
|
|
+ } |
73 |
|
|
+} |
74 |
|
|
+ |
75 |
|
|
+} |