wireless-net/trunk/sysconfig/interfaces/up.d/ppp/wlan-up.py

arekm cvs at pld-linux.org
Thu May 25 11:06:47 CEST 2006


Author: arekm
Date: Thu May 25 11:06:40 2006
New Revision: 7441

Modified:
   wireless-net/trunk/sysconfig/interfaces/up.d/ppp/wlan-up.py
Log:
Remove own interface from list of staled (and to be killed) interfaces.

Modified: wireless-net/trunk/sysconfig/interfaces/up.d/ppp/wlan-up.py
==============================================================================
--- wireless-net/trunk/sysconfig/interfaces/up.d/ppp/wlan-up.py	(original)
+++ wireless-net/trunk/sysconfig/interfaces/up.d/ppp/wlan-up.py	Thu May 25 11:06:40 2006
@@ -48,26 +48,29 @@
     # check if MAC is ok
     if reth_mac != None and mac != None and mac != "any" and mac != reth_mac:
         fl.write("%s: \"%s\" tried to use \"%s\" account [iface=%s, ip=%s]\n"
-                 % (time.asctime(time.gmtime()), reth_mac, user, ppp_iface, ip))
+                % (time.asctime(time.gmtime()), reth_mac, user, ppp_iface, ip))
         fl.close()
         os.system("/bin/kill -TERM `/bin/cat /var/run/%s.pid` > /dev/null 2>&1" % ppp_iface)
 
     if reth_mac == None:
         reth_mac = "(unknown)"
-    
+
     # check if user is already logged in
     pd = os.popen("/sbin/ip addr show 2>&1 | /bin/grep -E \'peer %s/[[:digit:]]+.*ppp[[:digit:]]+\' | /bin/sed -e \'s#.* global ##g\'" % ppp_remip, "r")
     used_ifaces = pd.readlines()
     pd.close()
+    for iface in used_ifaces:
+        if iface == ppp_iface:
+            used_ifaces.remove(iface)
     # already logged - kill old sessions
     if len(used_ifaces) > 1:
         fl.write("%s: \"%s\" already logged in - killing stale sessions [iface=%s, ip=%s, mac=%s]\n" % (time.asctime(time.gmtime()), user, ppp_iface, ip, reth_mac))
-	for iface in used_ifaces:
-	    iface = string.strip(iface)
-	    os.system("/bin/kill -TERM `/bin/cat /var/run/%s.pid` > /dev/null 2>&1" % iface)
+    for iface in used_ifaces:
+        iface = string.strip(iface)
+        os.system("/bin/kill -TERM `/bin/cat /var/run/%s.pid` > /dev/null 2>&1" % iface)
     fl.write("%s: \"%s\" logged in [iface=%s, ip=%s, mac=%s]\n"
-	    % (time.asctime(time.gmtime()), user, ppp_iface, ip, reth_mac))
-    
+            % (time.asctime(time.gmtime()), user, ppp_iface, ip, reth_mac))
+
     # filtering
     os.system("iptables --flush wlanfilter_%s 2> /dev/null" % ppp_iface)
     os.system("iptables -N wlanfilter_%s 2> /dev/null" % ppp_iface)
@@ -76,7 +79,7 @@
 
     os.system("iptables -A wlanfilter_%s -j RETURN" % ppp_iface)
     os.system("iptables -I wlanfilter -j wlanfilter_%s" % ppp_iface)
-    
+
     # only first matching line from config
     break
 


More information about the pld-cvs-commit mailing list