]> git.llucax.com Git - software/pymin.git/commitdiff
Use ip command to configure VPN networks in vpn service (closes #34)
authorLeandro Lucarella <llucax@gmail.com>
Sat, 28 Jun 2008 04:50:39 +0000 (01:50 -0300)
committerLeandro Lucarella <llucax@gmail.com>
Sat, 28 Jun 2008 04:54:00 +0000 (01:54 -0300)
services/vpn/handler.py
services/vpn/templates/tinc-up

index a628f79811146f22132068b7ec46538aad65a07e..89dfac7845f6f71af22422401a49aa7aeb0a59af 100644 (file)
@@ -18,28 +18,25 @@ __all__ = ('VpnHandler',)
 
 
 class Vpn(Sequence):
-    def __init__(self, name, connect_to, local_ip, mask,
+    def __init__(self, name, connect_to, local_addr,
                  public_key=None, private_key=None):
         self.name = name
         self.connect_to = connect_to
-        self.local_ip = local_ip
-        self.mask = mask
+        self.local_addr = local_addr
         self.public_key = public_key
         self.private_key = private_key
         self.hosts = dict()
         self._delete = False
 
     def as_tuple(self):
-        return (self.name, self.connect_to, self.local_ip, self.mask,
+        return (self.name, self.connect_to, self.local_addr,
                 self.public_key, self.private_key)
 
-    def update(self, connect_to=None, local_ip=None, mask=None):
+    def update(self, connect_to=None, local_addr=None):
         if connect_to is not None:
             self.connect_to = connect_to
-        if local_ip is not None:
-            self.local_ip = local_ip
-        if mask is not None:
-            self.mask = mask
+        if local_addr is not None:
+            self.local_addr = local_addr
 
 
 class VpnHandler(Restorable, ConfigWriter,
index 282a7a14d7df1471a55e31e7e2e60c8ea047af2b..52765703d6efc5fea1c79258be19a0930ed0bb31 100644 (file)
@@ -1,2 +1,2 @@
 #!/bin/sh
-ifconfig $INTERFACE ${vpn.local_ip} netmask ${vpn.mask}
+ip addr add ${vpn.local_addr} dev $INTERFACE