Changeset 6244
- Timestamp:
- Sep 4, 2008, 10:37:42 AM (16 years ago)
- Location:
- exodus
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
exodus/templates/dhcpd.conf
r6242 r6244 1 {% load network %} 1 2 # The file is WirelessLeiden specific. Please make all changes in exodus 2 3 # … … 16 17 option domain-name-servers {{ object.masterip }}; 17 18 18 {% for nic in object.nic %} 19 # {{ nic.iface }} {{ nic.desc }} 20 19 {% for nic in object.nic.all %} 20 # {{ nic.iface }} {{ nic.desc }} 21 {% for omni in nic.omni.all %} 22 subnet {% network omni.ip omni.netmask %} netmask {{ omni.netmask|subnet }} { 23 range {{ omni.dhcpstart }} {{ omni.dhcpstop }}; 24 option routers {{ omni.ip }}; 25 option broadcast-address {% broadcast omni.ip omni.netmask %}; 26 option subnet-mask {{ omni.netmask|subnet }}; 27 } 28 {% endfor %} 29 21 30 {% endfor %} -
exodus/wllogic.py
r6231 r6244 1 1 # (c) Roland van Laar 2 2 3 from exodus.models import Node, Network, Interlink3 #from exodus.models import Node, Network, Interlink 4 4 5 5 def newSSIDName(node, nic, desc): … … 23 23 def showaddr(a): 24 24 return "%d.%d.%d.%d" % ((a >> 24) & 0xff, (a >> 16) & 0xff, (a >> 8) & 0xff, a & 0xff) 25 26 def netmask2subnet(s): 27 """IPv4 netmask to subnet""" 28 return (0xffffffff << (32 - s)) 29 30 def getSubnet(netmask): 31 return(showaddr(netmask2subnet(netmask))) 32 33 def network(address, netmask): 34 """IPv4 network address when address and netmask are given""" 35 return(parseaddr(address) & netmask2subnet(netmask)) 36 37 def broadcast(address, netmask): 38 """IPv4 network address when address and netmask are given""" 39 return((parseaddr(address) & netmask2subnet(netmask)) | 0xffffffff >> netmask) 40 41 def getNetwork(address, netmask): 42 return(showaddr(network(address,netmask))) 43 44 def getBroadcast(address, netmask): 45 return(showaddr(broadcast(address,netmask))) 46 25 47 26 48 def freemasterip():
Note:
See TracChangeset
for help on using the changeset viewer.