Skip to content

Commit

Permalink
adding bandwidth restrictions to the radius-appengine protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
progrium committed Dec 27, 2010
1 parent 267767e commit c7d8c8c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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():
Expand Down
7 changes: 5 additions & 2 deletions pfsense/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit c7d8c8c

Please sign in to comment.