John,

>I'm still looking into IP address allocation via the "+" option.
[...]
>(b) we just keep incrementing based on nas-port-id.  There's no way
>to define a range of IPs.

here is my small contribution:
it will work for you if you have contiguous IP's in one or more C class
the patches, badly written, manages to skip the xxx.xxx.xxx.255 and
xxx.xxx.(xx+1).0
when arriving at the boundary of the C classes IP's....

the loop is not very eleguant, but you'll be in the loop only 1/2 x number
of classes in average...
Voila ...


# diff -u src/main/auth.c.ORG src/main/auth.c
--- src/main/auth.c.ORG Tue Oct 23 18:56:13 2001
+++ src/main/auth.c     Tue Nov 13 15:38:25 2001
@@ -402,6 +402,7 @@
        int             exec_wait;
        int             seen_callback_id;
        char            buf[1024], logstr[1024];
+       int             fabip,fabport,fabtobroadcast;

        password = "";

@@ -692,9 +693,19 @@
                /*
                 *  Find the NAS port ID.
                 */
+
                if ((vpPortId = pairfind(request->packet->vps,
                                         PW_NAS_PORT_ID)) != NULL) {
-                 tmp->lvalue = htonl(ntohl(tmp->lvalue) +
vpPortId->lvalue);
+                       fabport=vpPortId->lvalue;
+                       fabip=ntohl(tmp->lvalue);
+                       while (fabport >= (fabtobroadcast=(255-(fabip
&255)))) { /* easy case : ex 212.46.36.205 + 10 < 255)
+                               # ex 212.46.35.205 + 100 < 255 #
212.46.36.205+100-> tobroadcast = 50;*/
+                               fabip+=(fabtobroadcast+2);              /* #
now is 212.46.37.1;*/
+                               fabport-=fabtobroadcast;                /*
$port=50;*/
+                       }
+
+
+                 tmp->lvalue = htonl(fabip + fabport);
                  tmp->addport = 0;
                }
        }


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to