Skip to content

Commit

Permalink
calculate broadcast address
Browse files Browse the repository at this point in the history
  • Loading branch information
donald authored and mariux committed May 30, 2012
1 parent e40b2d1 commit 4bb74e3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mxstartup2mxconfig
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,13 @@ sub print_ips_cfg {

foreach my $ip (keys %$H) {
if("$ip" ne "$hostip") {

my $broadcast=join('.',unpack('C*',pack('N',unpack('N',pack('C*',split '\.',$ip)) | (1<<(32-$H->{$ip}->{addressprefix}))-1 )));

print SCRIPT qq(# ip $i\n);
print SCRIPT qq(MX_IP_ADDRESS[$i]="$ip"\n);
print SCRIPT qq(MX_IP_ADDRESSPREFIX[$i]="$H->{$ip}->{addressprefix}"\n);
print SCRIPT qq(MX_IP_BROADCAST[$i]="141.14.31.255"\n);
print SCRIPT qq(MX_IP_BROADCAST[$i]="$broadcast"\n);
print SCRIPT qq(MX_IP_DEVICE[$i]="$H->{$ip}->{device}"\n);
$i++;

Expand Down

0 comments on commit 4bb74e3

Please sign in to comment.