- Timestamp:
- 10/20/17 19:31:15 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Task/Buildnet.pm
r2112 r2117 702 702 ? '# ' . $desc . "\n" 703 703 : ''; 704 my ($fixedparam, $label ) = $retainip =~ /^\d+(\.\d+){3}$/705 ? ('fixed-address', '' )706 : ('fixed-address6', '-6' );704 my ($fixedparam, $label, $netLockIp) = $retainip =~ /^\d+(\.\d+){3}$/ 705 ? ('fixed-address', '', '127.0.0.1') 706 : ('fixed-address6', '-6', '::1'); 707 707 # If two ip are given for same protocol keep only first 708 708 $done{$fixedparam} and next; … … 712 712 $output .= sprintf("host %s-%s%s {\n", $nethost, lc($fmac), $label); 713 713 $output .= sprintf(" hardware ethernet %s;\n", $mac); 714 $output .= sprintf(" $fixedparam %s;\n", $retainip) 715 if ($retainip); 714 if ($obj->get_attributes('netLocked')) { 715 $output .= sprintf(" $fixedparam %s;\n", $netLockIp); 716 } else { 717 $output .= sprintf(" $fixedparam %s;\n", $retainip) 718 if ($retainip); 719 } 716 720 $output .= "}\n\n"; 717 721 } … … 780 784 my $fmac = $mac; 781 785 $fmac =~ s/://g; 782 $output .= sprintf("host %s-%s {\n", $nethost, lc($fmac)); 783 $output .= sprintf(" hardware ethernet %s;\n", $mac); 784 $output .= "}\n\n"; 786 if ($obj->get_attributes('netLocked')) { 787 my ($ipv4, $ipv6); 788 foreach ($ozone->get_attributes('net')) { 789 if ($_ =~ /^\d+(\.\d+){3}\/(\d+)$/) { 790 $ipv4 = 1; 791 } else { 792 $ipv6 = 1; 793 } 794 } 795 796 if ($ipv4) { 797 $output .= sprintf("host %s-%s {\n", $nethost, lc($fmac)); 798 $output .= sprintf(" hardware ethernet %s;\n", $mac); 799 $output .= sprintf(" fixed-address 127.0.0.1;\n"); 800 $output .= "}\n\n"; 801 } 802 if ($ipv6) { 803 $output .= sprintf("host %s-%s {\n", $nethost, lc($fmac)); 804 $output .= sprintf(" hardware ethernet %s;\n", $mac); 805 $output .= sprintf(" fixed-address6 ::1\n"); 806 $output .= "}\n\n"; 807 } 808 } else { 809 $output .= sprintf("host %s-%s {\n", $nethost, lc($fmac)); 810 $output .= sprintf(" hardware ethernet %s;\n", $mac); 811 $output .= "}\n\n"; 812 } 785 813 } 786 814 }
Note: See TracChangeset
for help on using the changeset viewer.