I'm working on a tuneable RIP regenerator. The idea is to define a start
network and how many networks need to be generated. The start-up looks like
this:

Usage: RIPgen.pl -n <IPnet/mask> [options]

Parameter:
  -n <IPnet/mask>       initial network with mask

Option:
  -a <count>    amount of generate routes       (default 1)
  -m <metric>   metric of all RIP routes        (default 15)
  -h <ip>       next hop of all RIP routes      (default 0.0.0.0)
  -t <tag>      tag of all RIP routes           (default 0)
  -d <seconds>  delay between RIP updates       (default 30)
  -r <count>    routes per RIP PDU              (default 25)
  -u <count>    amount of RIP updates           (default endless)

Examples:
  RIPgen.pl -n 10.1.1.0/255.255.255.0 -a 120

The first step is to validate the input of the initial network.
In example 10.1.1.0/24 is okay. And 10.1.1.0/22 is not okay.

If the input okay, then in a second step is to calculate additional networks
(-a 120 => 120 networks).

I'm looking after a better way to do the job like I currently have done.
To have an impression here a snip set:
        
        for(my $count = $cfg{'routeCount'}; $count; $count--){
                $netDigits[$digitCount] = $netDigits[$digitCount] +
$stepLength;
                if($netDigits[$digitCount] > 255){
                        $netDigits[$digitCount] = 0;
                        if($digitCount - 1 >= 0){
                                $netDigits[$digitCount - 1]++;
                                if($netDigits[$digitCount - 1] > 255){
                                        $netDigits[$digitCount - 1] = 0;
                                        if($digitCount - 2 >= 0){
                                                $netDigits[$digitCount -
2]++;
                                                if($netDigits[$digitCount -
2] > 255){
        
$netDigits[$digitCount - 2] = 0;
                                                        if($digitCount - 3
>= 0){
        
$netDigits[$digitCount - 3]++;
        
if($netDigits[$digitCount - 3] > 255){
                                                                        die
"no more IP networks available, max ".$cfg{'routeCount'}." possible\n";
                                                                }
                                                        }else{
                                                                die "no more
IP networks available, max ".$cfg{'routeCount'}." possible\n";
                                                        }
......

If you like I can give you the script directly.

Thanks for your interest.

Markus

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Im Auftrag von
Chris Wagner
Gesendet: Dienstag, 25. Oktober 2005 15:26
An: [email protected]
Betreff: Re: IP address calculation

Hi, can u state what u need in another way or go into some more detail?  I
can't figure out what ur even trying to do from what u wrote.

At 10:36 AM 10/25/2005 +0200, Markus wrote:
>I get IP network definition in format like this one 10.10.16.0/23 and need
>to calculate after counter additional networks.
>In the first step I need to validate the correctness of delivered IP
network
>definition.
>In the second step increment in valid steps additional networks.





--
REMEMBER THE WORLD TRADE CENTER         ---=< WTC 911 >=--
"...ne cede malis"

00000100

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs




_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to