]> git.llucax.com Git - software/pymin.git/commitdiff
Merge commit 'nico-baryon/master'
authorLeandro Lucarella <llucax@gmail.com>
Mon, 22 Oct 2007 16:11:43 +0000 (13:11 -0300)
committerLeandro Lucarella <llucax@gmail.com>
Mon, 22 Oct 2007 16:11:43 +0000 (13:11 -0300)
Conflicts:

pymin/services/ppp/__init__.py
pymin/services/vrrp/__init__.py

pymin/services/firewall/templates/iptables.sh
pymin/services/ppp/__init__.py
pymin/services/ppp/templates/nameX
pymin/services/ppp/templates/options.X
pymin/services/vrrp/__init__.py

index bb67d9a58b0b8993a12761f6e2815f0a1113ae56..80f4a323995ffe7eb9331a0e35bfed4b5e1656ce 100644 (file)
@@ -15,6 +15,10 @@ def optional(switch, value):
 
 /usr/sbin/iptables -t filter -F
 
+/usr/sbin/iptables -t filter -P INPUT ACCEPT
+/usr/sbin/iptables -t filter -P OUTPUT ACCEPT
+/usr/sbin/iptables -t filter -P FORWARD ACCEPT
+
 % for (index, rule) in enumerate(rules):
 /usr/sbin/iptables -t filter \
     -I ${rule.chain|s} ${index+1|s} \
index 91070e79cc652441b6909e36cda6a06a31939aab..c251e5025a25f00c12f4106d7d970f52296bfa10 100644 (file)
@@ -1,6 +1,8 @@
 # vim: set encoding=utf-8 et sw=4 sts=4 :
 
+import os
 from os import path
+from signal import SIGTERM
 
 from pymin.seqtools import Sequence
 from pymin.dispatcher import Handler, handler, HandlerError
@@ -104,7 +106,7 @@ class PppHandler(Restorable, ConfigWriter, ReloadHandler, TransactionalHandler):
         for name in names:
             if name in self.conns:
                 if not self.conns[name]._running:
-                    call(('pon', name))
+                    call(('pppd', 'call', name))
                     self.conns[name]._running = True
                     self._dump_attr('conns')
             else:
@@ -119,6 +121,12 @@ class PppHandler(Restorable, ConfigWriter, ReloadHandler, TransactionalHandler):
             if name in self.conns:
                 if self.conns[name]._running:
                     call(('poff', name))
+                    if path.exists('/var/run/ppp-' + name + '.pid'):
+                        pid = file('/var/run/ppp-' + name + '.pid').readline()
+                        try:
+                            os.kill(int(pid.strip()), SIGTERM)
+                        except OSError:
+                            pass # XXX report error?
                     self.conns[name]._running = False
                     self._dump_attr('conns')
             else:
@@ -185,3 +193,4 @@ if __name__ == '__main__':
     p.commit()
     print p.conn.list()
     print p.conn.show()
+
index 10524ff0ca90e6994d1172ae678456e503a6bff2..ee70cf118dcd6a845df8455b9e88769436b3f3ab 100644 (file)
@@ -1,7 +1,16 @@
+updetach
 % if conn.type != 'TUNNEL':
 name ${conn.username}
 file /etc/ppp/options.${conn.name}
 ipparam ${conn.name}
+# pppoe has a lower mtu/mru
+mtu 1492
+mru 1492
+# switch off all compressions (this is a must)
+nopcomp
+# this is recommended
+novjccomp
+noccp
 % else:
 pty "pptp ${conn.server} --nolaunchpppd"
 name ${conn.username}
index ffaf43f17d6e869e032ef33606387a3e8c66333c..6ac57141ced0abd631d14284a93ee5170fa56ff0 100644 (file)
@@ -1,3 +1,4 @@
+linkname ${conn.name}
 % if conn.type == 'PPP':
 lock ${conn.device}
 % elif conn.type == 'OE':
index c8563a699b6923f091ea50be67532ddf94121d26..403cd364fdac153229282e8fb6230cc921680eb3 100644 (file)
@@ -13,8 +13,6 @@ from pymin.services.util import Restorable, TransactionalHandler, \
 
 __ALL__ = ('VrrpHandler',)
 
-pid_filename = 'vrrp.pid'
-
 class VrrpHandler(Restorable, ParametersHandler, ReloadHandler, RestartHandler,
                         ServiceHandler, TransactionalHandler):
 
@@ -40,6 +38,7 @@ class VrrpHandler(Restorable, ParametersHandler, ReloadHandler, RestartHandler,
 
     def _service_stop(self):
         try:
+            pid_filename = 'vrrpd_%(dev)s_%(id)s.pid' % self.params
             pid = file(path.join(self._pid_dir, pid_filename )).read().strip()
             os.kill(int(pid), SIGTERM)
         except (IOError, OSError):
@@ -55,4 +54,5 @@ class VrrpHandler(Restorable, ParametersHandler, ReloadHandler, RestartHandler,
 if __name__ == '__main__':
     v = VrrpHandler()
     v.set('prio','10')
-    v.commit()
\ No newline at end of file
+    v.commit()
+