Esempio n. 1
0
    def send_accept(self, req, nas, **args):
        service.incr_stat(service.STAT_AUTH_ACCEPT)
        reply = req.CreateReply()
        reply.source = req.source
        reply.code = packet.AccessAccept

        if args:
            reply.set_framed_ip_addr(args.get("ipaddr"))
            reply.set_filter_id(nas.vendor_id, args.get("bandcode"))
            reply.set_special_str(nas.vendor_id, "context",
                                  args.get("domain_code"))
            reply.set_special_int(nas.vendor_id, "input_max_limit",
                                  args.get("input_max_limit"))
            reply.set_special_int(nas.vendor_id, "output_max_limit",
                                  args.get("output_max_limit"))
            reply.set_special_str(nas.vendor_id, "input_rate_code",
                                  args.get("input_rate_code"))
            reply.set_special_str(nas.vendor_id, "output_rate_code",
                                  args.get("output_rate_code"))

        req.sock.sendto(reply.ReplyPacket(), reply.source)

        if is_debug():
            radiuslog.debug("[Auth] send an authentication accept,user[%s],nas[%s]"\
                %(req.get_username(),nas.ip_addr))
Esempio n. 2
0
    def send_accept(self,req,nas,**args):
        service.incr_stat(service.STAT_AUTH_ACCEPT)
        reply = req.CreateReply()
        reply.source = req.source
        reply.code=packet.AccessAccept

        if args:
            reply.set_framed_ip_addr(args.get("ipaddr"))
            reply.set_filter_id(nas.vendor_id,args.get("bandcode"))
            reply.set_special_str(nas.vendor_id,"context",args.get("domain_code"))
            reply.set_special_int(nas.vendor_id,"input_max_limit",args.get("input_max_limit"))
            reply.set_special_int(nas.vendor_id,"output_max_limit",args.get("output_max_limit"))
            reply.set_special_str(nas.vendor_id,"input_rate_code",args.get("input_rate_code"))
            reply.set_special_str(nas.vendor_id,"output_rate_code",args.get("output_rate_code"))

        req.sock.sendto(reply.ReplyPacket(), reply.source)     

        if is_debug():
            radiuslog.debug("[Auth] send an authentication accept,user[%s],nas[%s]"\
                %(req.get_username(),nas.ip_addr))
Esempio n. 3
0
    def process(self,req):
        if radiuslog.isEnabledFor(DEBUG):
            radiuslog.debug("Received an accounting request")
            radiuslog.debug( "Attributes: ")
            for attr in req.keys():
                radiuslog.debug( "%s: %s" % (attr, req[attr]))

        reply = req.CreateReply()
        reply.source = req.source
        req.sock.sendto(reply.ReplyPacket(), reply.source)

        nasaddr = req.get_nasaddr()
        nas = service.get_nas(nasaddr)         
        
        acct_status_type  = req.get_acctstatustype()

        if acct_status_type == STATUS_TYPE_START:
            return self.start_accounting(req,nas)
        elif acct_status_type == STATUS_TYPE_STOP:
            return self.stop_accounting(req,nas)
        elif acct_status_type == STATUS_TYPE_UPDATE:
            return self.update_accounting(req,nas)
        elif acct_status_type == STATUS_TYPE_NAS_ON or \
             acct_status_type == STATUS_TYPE_NAS_OFF  :
            return self.nasonoff_accounting(nasaddr,acct_status_type)     
        else:
            return