Permalink
Browse files

adding bandwidth restrictions to the radius-appengine protocol

  • Loading branch information...
1 parent 267767e commit c7d8c8cf291ffd023fe3c79dd6b97254e68c19af @progrium committed Dec 27, 2010
Showing with 10 additions and 3 deletions.
  1. +5 −1 main.py
  2. +5 −2 pfsense/bridge.py
View
@@ -10,6 +10,10 @@
import urllib
DOMAIN = 'hackerdojo.com'
+MEMBER_DOWNLOAD = 0
+MEMBER_UPLOAD = 0
+GUEST_DOWNLOAD = 1024
+GUEST_UPLOAD = 384
# Hacker Dojo Domain API helper with caching
def dojo(path, force=False):
@@ -71,7 +75,7 @@ def get(self, mac):
self.error(404)
self.response.out.write("not found")
else:
- self.response.out.write(mapping.username)
+ self.response.out.write("%s,%s,%s" % (mapping.username, MEMBER_DOWNLOAD, MEMBER_UPLOAD))
def main():
View
@@ -13,11 +13,14 @@ def HandleAuthPacket(self, pkt):
reply=self.CreateReplyPacket(pkt)
try:
resp = urllib2.urlopen('http://hd-wifi.appspot.com/api/mac/%s' % mac_address)
- print "success"
+ user, download, upload = resp.read().split(',')
+ reply.AddAttribute((14122,8), download) # WISPr-Bandwidth-Max-Down
+ reply.AddAttribute((14122,7), upload) # WISPr-Bandwidth-Max-Up
reply.code=packet.AccessAccept
+ print "success"
except:
- print "fail"
reply.code=packet.AccessReject
+ print "fail"
self.SendReplyPacket(pkt.fd, reply)

0 comments on commit c7d8c8c

Please sign in to comment.