Author: valleegr
Date: 2012-07-07 00:52:11 EDT (Sat, 07 Jul 2012)
New Revision: 9445
URL: https://svn.oscar.openclustergroup.org/trac/oscar/changeset/9445
Log:
Patch from Olivier Lahaye: fix various issues with newer versions of DHCP.
Text files modified:
pkgsrc/systeminstaller-oscar/trunk/CHANGELOG | 2 ++
pkgsrc/systeminstaller-oscar/trunk/bin/mkdhcpconf | 24 ++++++++++++++++--------
2 files changed, 18 insertions(+), 8 deletions(-)
Modified: pkgsrc/systeminstaller-oscar/trunk/CHANGELOG
==============================================================================
--- pkgsrc/systeminstaller-oscar/trunk/CHANGELOG Sat Jul 7 00:43:13 2012 (r9444)
+++ pkgsrc/systeminstaller-oscar/trunk/CHANGELOG 2012-07-07 00:52:11 EDT (Sat, 07 Jul 2012) (r9445)
@@ -2,6 +2,8 @@
System Installer v2.4.12 (not yet released)
------------------------------------------------------------
- Make some error messages more explicit.
+ - Fix issues with newer version of DHCP (patch from Olivier
+ Lahaye for the RHEL6 support).
------------------------------------------------------------
System Installer v2.4.11
Modified: pkgsrc/systeminstaller-oscar/trunk/bin/mkdhcpconf
==============================================================================
--- pkgsrc/systeminstaller-oscar/trunk/bin/mkdhcpconf Sat Jul 7 00:43:13 2012 (r9444)
+++ pkgsrc/systeminstaller-oscar/trunk/bin/mkdhcpconf 2012-07-07 00:52:11 EDT (Sat, 07 Jul 2012) (r9445)
@@ -163,11 +163,17 @@
foreach my $int (@INTS) {
unless (($int eq "lo") || ($int =~ /:\d+$/) || ($int eq $config->interface)) {
my ($ip,$bcast,$mask) = find_internal_ip($int);
- $mask ||= "255.255.255.0"; # ensure non-null mask
- my $block = new Net::Netmask ($ip,$mask);
- my $net = $block->base();
- print OUTFILE "\n# This entry ignores requests on $int...\n";
- print OUTFILE "subnet $net netmask $mask {\n\tnot authoritative;\n}\n";
+ if ( $ip =~ /^(?:\s|\t)*$/ ) {
+ # interface not configured ($ip is empty string)
+ print OUTFILE "\n# Interface $int is not configured\n";
+ } else {
+ $mask ||= "255.255.255.0"; # ensure non-null mask
+ my $block = new Net::Netmask ($ip,$mask);
+ my $net = $block->base();
+ print OUTFILE "\n# This entry ignores requests on $int...\n";
+ print OUTFILE "subnet $net netmask $mask ".
+ "{\n\tnot authoritative;\n}\n";
+ }
}
}
close(OUTFILE);
@@ -204,7 +210,8 @@
print OUTFILE "option option-143 \"9000\"; # Also for flamethrower\n";
}
if ($dhcpdver >= 3) {
- print OUTFILE "ddns-update-style none; # For dhpcd version 3\n";
+ print OUTFILE "ddns-update-style none; ".
+ "# For dhpcd version 3 and higher\n";
}
print OUTFILE "\n";
@@ -230,7 +237,8 @@
sub dhcpd_version {
# Gets the version number of dhcpd.
my $vstring=`/usr/sbin/dhcpd --version 2>&1`;
- my ($stuff,$version)=split(/-V/,$vstring);
+ # handles dhcp-V3.x and dhcp-4.x formats (no V).
+ my ($version) = ($vstring =~ /\d+(?:\.\d+)+/g);
my ($major,$minor)=split(/\./,$version);
return $major;
} # dhcpd_version
@@ -238,7 +246,7 @@
sub find_internal_ip {
my $interface = shift;
# normally I hate sub processes, but for this I make an exception
- my $string = qx/\/sbin\/ifconfig $interface | grep inet/;
+ my $string = qx/LC_ALL=C \/sbin\/ifconfig $interface | grep inet/;
if($string =~ /addr:([\d\.]+).*cast:([\d\.]+).*ask:([\d\.]+)/) {
return $1,$2,$3;
|