rpms/dhcp/devel dhcpd-conf-to-ldap, 1.7, 1.8 dhcpd.conf, 1.2, 1.3 dhcp-3.1.0-xen-checksum.patch, 1.2, 1.3 dhcp-3.1.0-warnings.patch, 1.3, 1.4 dhcp-3.1.0-options.patch, 1.2, 1.3 dhcp-3.1.0-ldap-configuration.patch, 1.3, 1.4 dhcp-3.1.0-dhclient-usage.patch, 1.2, 1.3 dhcp-3.1.0-dhclient-anycast.patch, 1.2, 1.3 dhcp-3.0.6-memory.patch, 1.2, 1.3 dhcp-3.0.6-ignore-hyphen-x.patch, 1.2, 1.3 dhcp-3.0.5-unicast-bootp.patch, 1.2, 1.3 dhcp-3.0.5-selinux.patch, 1.2, 1.3 dhcp-3.0.5-release-by-ifup.patch, 1.2, 1.3 dhcp-3.0.5-prototypes.patch, 1.2, 1.3 dhcp-3.0.5-inherit-leases.patch, 1.2, 1.3 dhcp-3.0.5-fast-timeout.patch, 1.2, 1.3
David Cantrell (dcantrel)
fedora-extras-commits at redhat.com
Fri Jan 11 00:17:30 UTC 2008
- Previous message (by thread): rpms/dhcp/devel linux, 1.9, 1.10 libdhcp_control.h, 1.5, 1.6 libdhcp4client.pc, 1.5, 1.6 get-ldap-patch.sh, 1.2, 1.3 draft-ietf-dhc-ldap-schema-01.txt, 1.4, 1.5 dhcrelay.init, 1.8, 1.9 dhcpd.init, 1.24, 1.25 dhcpd.conf.sample, 1.5, 1.6 dhclient-script.8, 1.3, 1.4 dhclient.8, 1.3, 1.4 dhclient.conf.5, 1.3, 1.4 dhcp-options.5, 1.3, 1.4 dhcpd.conf.5, 1.3, 1.4 dhcpctl.3, 1.2, 1.3 dhcp4client.h, 1.4, 1.5 dhcp.schema, 1.3, 1.4 sources, 1.21, 1.22
- Next message (by thread): rpms/soundconverter/devel .cvsignore, 1.10, 1.11 soundconverter.spec, 1.15, 1.16 sources, 1.10, 1.11
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: dcantrel
Update of /cvs/pkgs/rpms/dhcp/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv23809
Added Files:
dhcpd-conf-to-ldap dhcpd.conf dhcp-3.1.0-xen-checksum.patch
dhcp-3.1.0-warnings.patch dhcp-3.1.0-options.patch
dhcp-3.1.0-ldap-configuration.patch
dhcp-3.1.0-dhclient-usage.patch
dhcp-3.1.0-dhclient-anycast.patch dhcp-3.0.6-memory.patch
dhcp-3.0.6-ignore-hyphen-x.patch
dhcp-3.0.5-unicast-bootp.patch dhcp-3.0.5-selinux.patch
dhcp-3.0.5-release-by-ifup.patch dhcp-3.0.5-prototypes.patch
dhcp-3.0.5-inherit-leases.patch dhcp-3.0.5-fast-timeout.patch
Log Message:
Revert to dhcp-3.1.0
Index: dhcpd-conf-to-ldap
===================================================================
RCS file: dhcpd-conf-to-ldap
diff -N dhcpd-conf-to-ldap
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dhcpd-conf-to-ldap 11 Jan 2008 00:16:44 -0000 1.8
@@ -0,0 +1,760 @@
+#!/usr/bin/perl -w
+
+# Brian Masney <masneyb at ntelos.net>
+# To use this script, set your base DN below. Then run
+# ./dhcpd-conf-to-ldap.pl < /path-to-dhcpd-conf/dhcpd.conf > output-file
+# The output of this script will generate entries in LDIF format. You can use
+# the slapadd command to add these entries into your LDAP server. You will
+# definately want to double check that your LDAP entries are correct before
+# you load them into LDAP.
+
+# This script does not do much error checking. Make sure before you run this
+# that the DHCP server doesn't give any errors about your config file
+
+# FailOver notes:
+# Failover is disabled by default, since it may need manually intervention.
+# You can try the '--use=failover' option to see what happens :-)
+#
+# If enabled, the failover pool references will be written to LDIF output.
+# The failover configs itself will be added to the dhcpServer statements
+# and not to the dhcpService object (since this script uses only one and
+# it may be usefull to have multiple service containers in failover mode).
+# Further, this script does not check if primary or secondary makes sense,
+# it simply converts what it gets...
+
+use Net::Domain qw(hostname hostfqdn hostdomain);
+use Getopt::Long;
+
+my $domain = hostdomain(); # your.domain
+my $basedn = "dc=".$domain;
+ $basedn =~ s/\./,dc=/g; # dc=your,dc=domain
+my $server = hostname(); # hostname (nodename)
+my $dhcpcn = 'DHCP Config'; # CN of DHCP config tree
+my $dhcpdn = "cn=$dhcpcn, $basedn"; # DHCP config tree DN
+my $second = ''; # secondary server DN / hostname
+my $i_conf = ''; # dhcp.conf file to read or stdin
+my $o_ldif = ''; # output ldif file name or stdout
+my @use = (); # extended flags (failover)
+
+sub usage($;$)
+{
+ my $rc = shift;
+ my $err= shift;
+
+ print STDERR "Error: $err\n\n" if(defined $err);
+ print STDERR <<__EOF_USAGE__;
+usage:
+ $0 [options] < dhcpd.conf > dhcpd.ldif
+
+options:
+
+ --basedn "dc=your,dc=domain" ("$basedn")
+
+ --dhcpdn "dhcp config DN" ("$dhcpdn")
+
+ --server "dhcp server name" ("$server")
+
+ --second "secondary server or DN" ("$second")
+
+ --conf "/path/to/dhcpd.conf" (default is stdin)
+ --ldif "/path/to/output.ldif" (default is stdout)
+
+ --use "extended features" (see source comments)
+__EOF_USAGE__
+ exit($rc);
+}
+
+
+sub next_token
+{
+ local ($lowercase) = @_;
+ local ($token, $newline);
+
+ do
+ {
+ if (!defined ($line) || length ($line) == 0)
+ {
+ $line = <>;
+ return undef if !defined ($line);
+ chop $line;
+ $line_number++;
+ $token_number = 0;
+ }
+
+ $line =~ s/#.*//;
+ $line =~ s/^\s+//;
+ $line =~ s/\s+$//;
+ }
+ while (length ($line) == 0);
+
+ if (($token, $newline) = $line =~ /^(.*?)\s+(.*)/)
+ {
+ if ($token =~ /^"/) {
+ #handle quoted token
+ if ($token !~ /"\s*$/)
+ {
+ ($tok, $newline) = $newline =~ /([^"]+")(.*)/;
+ $token .= " $tok";
+ }
+ }
+ $line = $newline;
+ }
+ else
+ {
+ $token = $line;
+ $line = '';
+ }
+ $token_number++;
+
+ $token =~ y/[A-Z]/[a-z]/ if $lowercase;
+
+ return ($token);
+}
+
+
+sub remaining_line
+{
+ local ($block) = shift || 0;
+ local ($tmp, $str);
+
+ $str = "";
+ while (defined($tmp = next_token (0)))
+ {
+ $str .= ' ' if !($str eq "");
+ $str .= $tmp;
+ last if $tmp =~ /;\s*$/;
+ last if($block and $tmp =~ /\s*[}{]\s*$/);
+ }
+
+ $str =~ s/;$//;
+ return ($str);
+}
+
+
+sub
+add_dn_to_stack
+{
+ local ($dn) = @_;
+
+ $current_dn = "$dn, $current_dn";
+}
+
+
+sub
+remove_dn_from_stack
+{
+ $current_dn =~ s/^.*?,\s*//;
+}
+
+
+sub
+parse_error
+{
+ print "Parse error on line number $line_number at token number $token_number\n";
+ exit (1);
+}
+
+
+sub
+print_entry
+{
+ return if (scalar keys %curentry == 0);
+
+ if (!defined ($curentry{'type'}))
+ {
+ $hostdn = "cn=$server, $basedn";
+ print "dn: $hostdn\n";
+ print "cn: $server\n";
+ print "objectClass: top\n";
+ print "objectClass: dhcpServer\n";
+ print "dhcpServiceDN: $current_dn\n";
+ if(grep(/FaIlOvEr/i, @use))
+ {
+ foreach my $fo_peer (keys %failover)
+ {
+ next if(scalar(@{$failover{$fo_peer}}) <= 1);
+ print "dhcpStatements: failover peer $fo_peer { ",
+ join('; ', @{$failover{$fo_peer}}), "; }\n";
+ }
+ }
+ print "\n";
+
+ print "dn: $current_dn\n";
+ print "cn: $dhcpcn\n";
+ print "objectClass: top\n";
+ print "objectClass: dhcpService\n";
+ if (defined ($curentry{'options'}))
+ {
+ print "objectClass: dhcpOptions\n";
+ }
+ print "dhcpPrimaryDN: $hostdn\n";
+ if(grep(/FaIlOvEr/i, @use) and ($second ne ''))
+ {
+ print "dhcpSecondaryDN: $second\n";
+ }
+ }
+ elsif ($curentry{'type'} eq 'subnet')
+ {
+ print "dn: $current_dn\n";
+ print "cn: " . $curentry{'ip'} . "\n";
+ print "objectClass: top\n";
+ print "objectClass: dhcpSubnet\n";
+ if (defined ($curentry{'options'}))
+ {
+ print "objectClass: dhcpOptions\n";
+ }
+
+ print "dhcpNetMask: " . $curentry{'netmask'} . "\n";
+ if (defined ($curentry{'ranges'}))
+ {
+ foreach $statement (@{$curentry{'ranges'}})
+ {
+ print "dhcpRange: $statement\n";
+ }
+ }
+ }
+ elsif ($curentry{'type'} eq 'shared-network')
+ {
+ print "dn: $current_dn\n";
+ print "cn: " . $curentry{'descr'} . "\n";
+ print "objectClass: top\n";
+ print "objectClass: dhcpSharedNetwork\n";
+ if (defined ($curentry{'options'}))
+ {
+ print "objectClass: dhcpOptions\n";
+ }
+ }
+ elsif ($curentry{'type'} eq 'group')
+ {
+ print "dn: $current_dn\n";
+ print "cn: group", $curentry{'idx'}, "\n";
+ print "objectClass: top\n";
+ print "objectClass: dhcpGroup\n";
+ if (defined ($curentry{'options'}))
+ {
+ print "objectClass: dhcpOptions\n";
+ }
+ }
+ elsif ($curentry{'type'} eq 'host')
+ {
+ print "dn: $current_dn\n";
+ print "cn: " . $curentry{'host'} . "\n";
+ print "objectClass: top\n";
+ print "objectClass: dhcpHost\n";
+ if (defined ($curentry{'options'}))
+ {
+ print "objectClass: dhcpOptions\n";
+ }
+
+ if (defined ($curentry{'hwaddress'}))
+ {
+ $curentry{'hwaddress'} =~ y/[A-Z]/[a-z]/;
+ print "dhcpHWAddress: " . $curentry{'hwaddress'} . "\n";
+ }
+ }
+ elsif ($curentry{'type'} eq 'pool')
+ {
+ print "dn: $current_dn\n";
+ print "cn: pool", $curentry{'idx'}, "\n";
+ print "objectClass: top\n";
+ print "objectClass: dhcpPool\n";
+ if (defined ($curentry{'options'}))
+ {
+ print "objectClass: dhcpOptions\n";
+ }
+
+ if (defined ($curentry{'ranges'}))
+ {
+ foreach $statement (@{$curentry{'ranges'}})
+ {
+ print "dhcpRange: $statement\n";
+ }
+ }
+ }
+ elsif ($curentry{'type'} eq 'class')
+ {
+ print "dn: $current_dn\n";
+ print "cn: " . $curentry{'class'} . "\n";
+ print "objectClass: top\n";
+ print "objectClass: dhcpClass\n";
+ if (defined ($curentry{'options'}))
+ {
+ print "objectClass: dhcpOptions\n";
+ }
+ }
+ elsif ($curentry{'type'} eq 'subclass')
+ {
+ print "dn: $current_dn\n";
+ print "cn: " . $curentry{'subclass'} . "\n";
+ print "objectClass: top\n";
+ print "objectClass: dhcpSubClass\n";
+ if (defined ($curentry{'options'}))
+ {
+ print "objectClass: dhcpOptions\n";
+ }
+ print "dhcpClassData: " . $curentry{'class'} . "\n";
+ }
+
+ if (defined ($curentry{'statements'}))
+ {
+ foreach $statement (@{$curentry{'statements'}})
+ {
+ print "dhcpStatements: $statement\n";
+ }
+ }
+
+ if (defined ($curentry{'options'}))
+ {
+ foreach $statement (@{$curentry{'options'}})
+ {
+ print "dhcpOption: $statement\n";
+ }
+ }
+
+ print "\n";
+ undef (%curentry);
+}
+
+
+sub parse_netmask
+{
+ local ($netmask) = @_;
+ local ($i);
+
+ if ((($a, $b, $c, $d) = $netmask =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) != 4)
+ {
+ parse_error ();
+ }
+
+ $num = (($a & 0xff) << 24) |
+ (($b & 0xff) << 16) |
+ (($c & 0xff) << 8) |
+ ($d & 0xff);
+
+ for ($i=1; $i<=32 && $num & (1 << (32 - $i)); $i++)
+ {
+ }
+ $i--;
+
+ return ($i);
+}
+
+
+sub parse_subnet
+{
+ local ($ip, $tmp, $netmask);
+
+ print_entry () if %curentry;
+
+ $ip = next_token (0);
+ parse_error () if !defined ($ip);
+
+ $tmp = next_token (1);
+ parse_error () if !defined ($tmp);
+ parse_error () if !($tmp eq 'netmask');
+
+ $tmp = next_token (0);
+ parse_error () if !defined ($tmp);
+ $netmask = parse_netmask ($tmp);
+
+ $tmp = next_token (0);
+ parse_error () if !defined ($tmp);
+ parse_error () if !($tmp eq '{');
+
+ add_dn_to_stack ("cn=$ip");
+ $curentry{'type'} = 'subnet';
+ $curentry{'ip'} = $ip;
+ $curentry{'netmask'} = $netmask;
+ $cursubnet = $ip;
+ $curcounter{$ip} = { pool => 0, group => 0 };
+}
+
+
+sub parse_shared_network
+{
+ local ($descr, $tmp);
+
+ print_entry () if %curentry;
+
+ $descr = next_token (0);
+ parse_error () if !defined ($descr);
+
+ $tmp = next_token (0);
+ parse_error () if !defined ($tmp);
+ parse_error () if !($tmp eq '{');
+
+ add_dn_to_stack ("cn=$descr");
+ $curentry{'type'} = 'shared-network';
+ $curentry{'descr'} = $descr;
+}
+
+
+sub parse_host
+{
+ local ($descr, $tmp);
+
+ print_entry () if %curentry;
+
+ $host = next_token (0);
+ parse_error () if !defined ($host);
+
+ $tmp = next_token (0);
+ parse_error () if !defined ($tmp);
+ parse_error () if !($tmp eq '{');
+
+ add_dn_to_stack ("cn=$host");
+ $curentry{'type'} = 'host';
+ $curentry{'host'} = $host;
+}
+
+
+sub parse_group
+{
+ local ($descr, $tmp);
+
+ print_entry () if %curentry;
+
+ $tmp = next_token (0);
+ parse_error () if !defined ($tmp);
+ parse_error () if !($tmp eq '{');
+
+ my $idx;
+ if(exists($curcounter{$cursubnet})) {
+ $idx = ++$curcounter{$cursubnet}->{'group'};
+ } else {
+ $idx = ++$curcounter{''}->{'group'};
+ }
+
+ add_dn_to_stack ("cn=group".$idx);
+ $curentry{'type'} = 'group';
+ $curentry{'idx'} = $idx;
+}
+
+
+sub parse_pool
+{
+ local ($descr, $tmp);
+
+ print_entry () if %curentry;
+
+ $tmp = next_token (0);
+ parse_error () if !defined ($tmp);
+ parse_error () if !($tmp eq '{');
+
+ my $idx;
+ if(exists($curcounter{$cursubnet})) {
+ $idx = ++$curcounter{$cursubnet}->{'pool'};
+ } else {
+ $idx = ++$curcounter{''}->{'pool'};
+ }
+
+ add_dn_to_stack ("cn=pool".$idx);
+ $curentry{'type'} = 'pool';
+ $curentry{'idx'} = $idx;
+}
+
+
+sub parse_class
+{
+ local ($descr, $tmp);
+
+ print_entry () if %curentry;
+
+ $class = next_token (0);
+ parse_error () if !defined ($class);
+
+ $tmp = next_token (0);
+ parse_error () if !defined ($tmp);
+ parse_error () if !($tmp eq '{');
+
+ $class =~ s/\"//g;
+ add_dn_to_stack ("cn=$class");
+ $curentry{'type'} = 'class';
+ $curentry{'class'} = $class;
+}
+
+
+sub parse_subclass
+{
+ local ($descr, $tmp);
+
+ print_entry () if %curentry;
+
+ $class = next_token (0);
+ parse_error () if !defined ($class);
+
+ $subclass = next_token (0);
+ parse_error () if !defined ($subclass);
+
+ $tmp = next_token (0);
+ parse_error () if !defined ($tmp);
+ parse_error () if !($tmp eq '{');
+
+ add_dn_to_stack ("cn=$subclass");
+ $curentry{'type'} = 'subclass';
+ $curentry{'class'} = $class;
+ $curentry{'subclass'} = $subclass;
+}
+
+
+sub parse_hwaddress
+{
+ local ($type, $hw, $tmp);
+
+ $type = next_token (1);
+ parse_error () if !defined ($type);
+
+ $hw = next_token (1);
+ parse_error () if !defined ($hw);
+ $hw =~ s/;$//;
+
+ $curentry{'hwaddress'} = "$type $hw";
+}
+
+
+sub parse_range
+{
+ local ($tmp, $str);
+
+ $str = remaining_line ();
+
+ if (!($str eq ''))
+ {
+ $str =~ s/;$//;
+ push (@{$curentry{'ranges'}}, $str);
+ }
+}
+
+
+sub parse_statement
+{
+ local ($token) = shift;
+ local ($str);
+
+ if ($token eq 'option')
+ {
+ $str = remaining_line ();
+ push (@{$curentry{'options'}}, $str);
+ }
+ elsif($token eq 'failover')
+ {
+ $str = remaining_line (1); # take care on block
+ if($str =~ /[{]/)
+ {
+ my ($peername, @statements);
+
+ parse_error() if($str !~ /^\s*peer\s+(.+?)\s+[{]\s*$/);
+ parse_error() if(($peername = $1) !~ /^\"?[^\"]+\"?$/);
+
+ #
+ # failover config block found:
+ # e.g. 'failover peer "some-name" {'
+ #
+ if(not grep(/FaIlOvEr/i, @use))
+ {
+ print STDERR "Warning: Failover config 'peer $peername' found!\n";
+ print STDERR " Skipping it, since failover disabled!\n";
+ print STDERR " You may try out --use=failover option.\n";
+ }
+
+ until($str =~ /[}]/ or $str eq "")
+ {
+ $str = remaining_line (1);
+ # collect all statements, except ending '}'
+ push(@statements, $str) if($str !~ /[}]/);
+ }
+ $failover{$peername} = [@statements];
+ }
+ else
+ {
+ #
+ # pool reference to failover config is fine
+ # e.g. 'failover peer "some-name";'
+ #
+ if(not grep(/FaIlOvEr/i, @use))
+ {
+ print STDERR "Warning: Failover reference '$str' found!\n";
+ print STDERR " Skipping it, since failover disabled!\n";
+ print STDERR " You may try out --use=failover option.\n";
+ }
+ else
+ {
+ push (@{$curentry{'statements'}}, $token. " " . $str);
+ }
+ }
+ }
+ elsif($token eq 'zone')
+ {
+ $str = $token;
+ while($str !~ /}$/) {
+ $str .= ' ' . next_token (0);
+ }
+ push (@{$curentry{'statements'}}, $str);
+ }
+ elsif($token =~ /^(authoritative)[;]*$/)
+ {
+ push (@{$curentry{'statements'}}, $1);
+ }
+ else
+ {
+ $str = $token . " " . remaining_line ();
+ push (@{$curentry{'statements'}}, $str);
+ }
+}
+
+
+my $ok = GetOptions(
+ 'basedn=s' => \$basedn,
+ 'dhcpdn=s' => \$dhcpdn,
+ 'server=s' => \$server,
+ 'second=s' => \$second,
+ 'conf=s' => \$i_conf,
+ 'ldif=s' => \$o_ldif,
+ 'use=s' => \@use,
+ 'h|help|usage' => sub { usage(0); },
+);
+
+unless($server =~ /^\w+/)
+ {
+ usage(1, "invalid server name '$server'");
+ }
+unless($basedn =~ /^\w+=[^,]+/)
+ {
+ usage(1, "invalid base dn '$basedn'");
+ }
+
+if($dhcpdn =~ /^cn=([^,]+)/i)
+ {
+ $dhcpcn = "$1";
+ }
+$second = '' if not defined $second;
+unless($second eq '' or $second =~ /^cn=[^,]+\s*,\s*\w+=[^,]+/i)
+ {
+ if($second =~ /^cn=[^,]+$/i)
+ {
+ # relative DN 'cn=name'
+ $second = "$second, $basedn";
+ }
+ elsif($second =~ /^\w+/)
+ {
+ # assume hostname only
+ $second = "cn=$second, $basedn";
+ }
+ else
+ {
+ usage(1, "invalid secondary '$second'")
+ }
+ }
+
+usage(1) unless($ok);
+
+if($i_conf ne "" and -f $i_conf)
+ {
+ if(not open(STDIN, '<', $i_conf))
+ {
+ print STDERR "Error: can't open conf file '$i_conf': $!\n";
+ exit(1);
+ }
+ }
+if($o_ldif ne "")
+ {
+ if(-e $o_ldif)
+ {
+ print STDERR "Error: output ldif name '$o_ldif' already exists!\n";
+ exit(1);
+ }
+ if(not open(STDOUT, '>', $o_ldif))
+ {
+ print STDERR "Error: can't open ldif file '$o_ldif': $!\n";
+ exit(1);
+ }
+ }
+
+
+print STDERR "Creating LDAP Configuration with the following options:\n";
+print STDERR "\tBase DN: $basedn\n";
+print STDERR "\tDHCP DN: $dhcpdn\n";
+print STDERR "\tServer DN: cn=$server, $basedn\n";
+print STDERR "\tSecondary DN: $second\n"
+ if(grep(/FaIlOvEr/i, @use) and $second ne '');
+print STDERR "\n";
+
+my $token;
+my $token_number = 0;
+my $line_number = 0;
+my %curentry;
+my $cursubnet = '';
+my %curcounter = ( '' => { pool => 0, group => 0 } );
+
+$current_dn = "$dhcpdn";
+$curentry{'descr'} = $dhcpcn;
+$line = '';
+%failover = ();
+
+while (($token = next_token (1)))
+ {
+ if ($token eq '}')
+ {
+ print_entry () if %curentry;
+ if($current_dn =~ /.+?,\s*${dhcpdn}$/) {
+ # don't go below dhcpdn ...
+ remove_dn_from_stack ();
+ }
+ }
+ elsif ($token eq 'subnet')
+ {
+ parse_subnet ();
+ next;
+ }
+ elsif ($token eq 'shared-network')
+ {
+ parse_shared_network ();
+ next;
+ }
+ elsif ($token eq 'class')
+ {
+ parse_class ();
+ next;
+ }
+ elsif ($token eq 'subclass')
+ {
+ parse_subclass ();
+ next;
+ }
+ elsif ($token eq 'pool')
+ {
+ parse_pool ();
+ next;
+ }
+ elsif ($token eq 'group')
+ {
+ parse_group ();
+ next;
+ }
+ elsif ($token eq 'host')
+ {
+ parse_host ();
+ next;
+ }
+ elsif ($token eq 'hardware')
+ {
+ parse_hwaddress ();
+ next;
+ }
+ elsif ($token eq 'range')
+ {
+ parse_range ();
+ next;
+ }
+ else
+ {
+ parse_statement ($token);
+ next;
+ }
+ }
+
+close(STDIN) if($i_conf);
+close(STDOUT) if($o_ldif);
+
+print STDERR "Done.\n";
+
Index: dhcpd.conf
===================================================================
RCS file: dhcpd.conf
diff -N dhcpd.conf
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dhcpd.conf 11 Jan 2008 00:16:44 -0000 1.3
@@ -0,0 +1,4 @@
+#
+# DHCP Server Configuration file.
+# see /usr/share/doc/dhcp*/dhcpd.conf.sample
+#
\ No newline at end of file
dhcp-3.1.0-xen-checksum.patch:
Index: dhcp-3.1.0-xen-checksum.patch
===================================================================
RCS file: dhcp-3.1.0-xen-checksum.patch
diff -N dhcp-3.1.0-xen-checksum.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dhcp-3.1.0-xen-checksum.patch 11 Jan 2008 00:16:44 -0000 1.3
@@ -0,0 +1,243 @@
+diff -up dhcp-3.1.0/common/nit.c.xen dhcp-3.1.0/common/nit.c
+--- dhcp-3.1.0/common/nit.c.xen 2007-05-23 19:30:32.000000000 -0400
++++ dhcp-3.1.0/common/nit.c 2007-10-22 16:12:27.000000000 -0400
+@@ -371,7 +371,7 @@ ssize_t receive_packet (interface, buf,
+
+ /* Decode the IP and UDP headers... */
+ offset = decode_udp_ip_header (interface, ibuf, bufix,
+- from, length, &paylen);
++ from, length, &paylen, 0);
+
+ /* If the IP or UDP checksum was bad, skip the packet... */
+ if (offset < 0)
+diff -up dhcp-3.1.0/common/dlpi.c.xen dhcp-3.1.0/common/dlpi.c
+--- dhcp-3.1.0/common/dlpi.c.xen 2007-05-23 19:30:32.000000000 -0400
++++ dhcp-3.1.0/common/dlpi.c 2007-10-22 16:12:11.000000000 -0400
+@@ -680,7 +680,7 @@ ssize_t receive_packet (interface, buf,
+ length -= offset;
+ #endif
+ offset = decode_udp_ip_header (interface, dbuf, bufix,
+- from, length, &paylen);
++ from, length, &paylen, 0);
+
+ /* If the IP or UDP checksum was bad, skip the packet... */
+ if (offset < 0) {
+diff -up dhcp-3.1.0/common/upf.c.xen dhcp-3.1.0/common/upf.c
+--- dhcp-3.1.0/common/upf.c.xen 2007-05-23 19:30:32.000000000 -0400
++++ dhcp-3.1.0/common/upf.c 2007-10-22 16:12:52.000000000 -0400
+@@ -322,7 +322,7 @@ ssize_t receive_packet (interface, buf,
+
+ /* Decode the IP and UDP headers... */
+ offset = decode_udp_ip_header (interface, ibuf, bufix,
+- from, length, &paylen);
++ from, length, &paylen, 0);
+
+ /* If the IP or UDP checksum was bad, skip the packet... */
+ if (offset < 0)
+diff -up dhcp-3.1.0/common/lpf.c.xen dhcp-3.1.0/common/lpf.c
+--- dhcp-3.1.0/common/lpf.c.xen 2007-10-22 16:11:12.000000000 -0400
++++ dhcp-3.1.0/common/lpf.c 2007-10-22 16:15:24.000000000 -0400
+@@ -34,16 +34,31 @@ static char copyright[] =
+ #include "dhcpd.h"
+ #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
+ #include <sys/ioctl.h>
++#include <sys/socket.h>
+ #include <sys/uio.h>
+
+ #include <asm/types.h>
+ #include <linux/filter.h>
+ #include <linux/if_ether.h>
++#include <linux/if_packet.h>
+ #include <netinet/in_systm.h>
+ #include "includes/netinet/ip.h"
+ #include "includes/netinet/udp.h"
+ #include "includes/netinet/if_ether.h"
+
++#ifndef PACKET_AUXDATA
++#define PACKET_AUXDATA 8
++
++struct tpacket_auxdata
++{
++ __u32 tp_status;
++ __u32 tp_len;
++ __u32 tp_snaplen;
++ __u16 tp_mac;
++ __u16 tp_net;
++};
++#endif
++
+ /* Reinitializes the specified interface after an address change. This
+ is not required for packet-filter APIs. */
+
+@@ -71,10 +86,14 @@ int if_register_lpf (info)
+ int sock;
+ char filename[50];
+ int b;
+- struct sockaddr sa;
++ union {
++ struct sockaddr_ll ll;
++ struct sockaddr common;
++ } sa;
++ struct ifreq ifr;
+
+ /* Make an LPF socket. */
+- if ((sock = socket(PF_PACKET, SOCK_PACKET,
++ if ((sock = socket(PF_PACKET, SOCK_RAW,
+ htons((short)ETH_P_ALL))) < 0) {
+ if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
+ errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
+@@ -89,11 +108,16 @@ int if_register_lpf (info)
+ log_fatal ("Open a socket for LPF: %m");
+ }
+
++ memset (&ifr, 0, sizeof ifr);
++ strncpy (ifr.ifr_name, (const char *)info -> ifp, sizeof ifr.ifr_name);
++ if (ioctl (sock, SIOCGIFINDEX, &ifr))
++ log_fatal ("Failed to get interface index: %m");
++
+ /* Bind to the interface name */
+ memset (&sa, 0, sizeof sa);
+- sa.sa_family = AF_PACKET;
+- strncpy (sa.sa_data, (const char *)info -> ifp, sizeof sa.sa_data);
+- if (bind (sock, &sa, sizeof sa)) {
++ sa.ll.sll_family = AF_PACKET;
++ sa.ll.sll_ifindex = ifr.ifr_ifindex;
++ if (bind (sock, &sa.common, sizeof sa)) {
+ if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
+ errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
+ errno == EAFNOSUPPORT || errno == EINVAL) {
+@@ -173,9 +197,18 @@ static void lpf_gen_filter_setup (struct
+ void if_register_receive (info)
+ struct interface_info *info;
+ {
++ int val;
++
+ /* Open a LPF device and hang it on this interface... */
+ info -> rfdesc = if_register_lpf (info);
+
++ val = 1;
++ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val,
++ sizeof val) < 0) {
++ if (errno != ENOPROTOOPT)
++ log_fatal ("Failed to set auxiliary packet data: %m");
++ }
++
+ #if defined (HAVE_TR_SUPPORT)
+ if (info -> hw_address.hbuf [0] == HTYPE_IEEE802)
+ lpf_tr_filter_setup (info);
+@@ -294,7 +327,6 @@ ssize_t send_packet (interface, packet,
+ double hh [16];
+ double ih [1536 / sizeof (double)];
+ unsigned char *buf = (unsigned char *)ih;
+- struct sockaddr sa;
+ int result;
+ int fudge;
+
+@@ -312,15 +344,7 @@ ssize_t send_packet (interface, packet,
+ (unsigned char *)raw, len);
+ memcpy (buf + ibufp, raw, len);
+
+- /* For some reason, SOCK_PACKET sockets can't be connected,
+- so we have to do a sentdo every time. */
+- memset (&sa, 0, sizeof sa);
+- sa.sa_family = AF_PACKET;
+- strncpy (sa.sa_data,
+- (const char *)interface -> ifp, sizeof sa.sa_data);
+-
+- result = sendto (interface -> wfdesc,
+- buf + fudge, ibufp + len - fudge, 0, &sa, sizeof sa);
++ result = write (interface -> wfdesc, buf + fudge, ibufp + len - fudge);
+ if (result < 0)
+ log_error ("send_packet: %m");
+ return result;
+@@ -338,14 +362,35 @@ ssize_t receive_packet (interface, buf,
+ int nread;
+ int length = 0;
+ int offset = 0;
++ int nocsum = 0;
+ unsigned char ibuf [1536];
+ unsigned bufix = 0;
+ unsigned paylen;
++ unsigned char cmsgbuf[CMSG_LEN(sizeof(struct tpacket_auxdata))];
++ struct iovec iov = {
++ .iov_base = ibuf,
++ .iov_len = sizeof ibuf,
++ };
++ struct msghdr msg = {
++ .msg_iov = &iov,
++ .msg_iovlen = 1,
++ .msg_control = cmsgbuf,
++ .msg_controllen = sizeof(cmsgbuf),
++ };
++ struct cmsghdr *cmsg;
+
+- length = read (interface -> rfdesc, ibuf, sizeof ibuf);
++ length = recvmsg (interface -> rfdesc, &msg, 0);
+ if (length <= 0)
+ return length;
+
++ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
++ if (cmsg->cmsg_level == SOL_PACKET &&
++ cmsg->cmsg_type == PACKET_AUXDATA) {
++ struct tpacket_auxdata *aux = (void *)CMSG_DATA(cmsg);
++ nocsum = aux->tp_status & TP_STATUS_CSUMNOTREADY;
++ }
++ }
++
+ bufix = 0;
+ /* Decode the physical header... */
+ offset = decode_hw_header (interface, ibuf, bufix, hfrom);
+@@ -362,7 +407,7 @@ ssize_t receive_packet (interface, buf,
+
+ /* Decode the IP and UDP headers... */
+ offset = decode_udp_ip_header (interface, ibuf, bufix, from,
+- (unsigned)length, &paylen);
++ (unsigned)length, &paylen, nocsum);
+
+ /* If the IP or UDP checksum was bad, skip the packet... */
+ if (offset < 0)
+diff -up dhcp-3.1.0/common/bpf.c.xen dhcp-3.1.0/common/bpf.c
+--- dhcp-3.1.0/common/bpf.c.xen 2007-05-23 19:30:32.000000000 -0400
++++ dhcp-3.1.0/common/bpf.c 2007-10-22 16:13:14.000000000 -0400
+@@ -478,7 +478,7 @@ ssize_t receive_packet (interface, buf,
+ offset = decode_udp_ip_header (interface,
+ interface -> rbuf,
+ interface -> rbuf_offset,
+- from, hdr.bh_caplen, &paylen);
++ from, hdr.bh_caplen, &paylen, 0);
+
+ /* If the IP or UDP checksum was bad, skip the packet... */
+ if (offset < 0) {
+diff -up dhcp-3.1.0/common/packet.c.xen dhcp-3.1.0/common/packet.c
+--- dhcp-3.1.0/common/packet.c.xen 2007-10-22 16:11:12.000000000 -0400
++++ dhcp-3.1.0/common/packet.c 2007-10-22 16:12:41.000000000 -0400
+@@ -215,7 +215,7 @@ ssize_t
+ decode_udp_ip_header(struct interface_info *interface,
+ unsigned char *buf, unsigned bufix,
+ struct sockaddr_in *from, unsigned buflen,
+- unsigned *rbuflen)
++ unsigned *rbuflen, int nocsum)
+ {
+ unsigned char *data;
+ struct ip ip;
+@@ -326,7 +326,7 @@ decode_udp_ip_header(struct interface_in
+ 8, IPPROTO_UDP + ulen))));
+
+ udp_packets_seen++;
+- if (usum && usum != sum) {
++ if (!nocsum && usum && usum != sum) {
+ udp_packets_bad_checksum++;
+ if (udp_packets_seen > 4 &&
+ (udp_packets_seen / udp_packets_bad_checksum) < 2) {
+diff -up dhcp-3.1.0/includes/dhcpd.h.xen dhcp-3.1.0/includes/dhcpd.h
+--- dhcp-3.1.0/includes/dhcpd.h.xen 2007-10-22 16:11:12.000000000 -0400
++++ dhcp-3.1.0/includes/dhcpd.h 2007-10-22 16:13:01.000000000 -0400
+@@ -2140,7 +2140,7 @@ ssize_t decode_hw_header PROTO ((struct
+ unsigned, struct hardware *));
+ ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
+ unsigned, struct sockaddr_in *,
+- unsigned, unsigned *));
++ unsigned, unsigned *, int));
+
+ /* ethernet.c */
+ void assemble_ethernet_header PROTO ((struct interface_info *, unsigned char *,
dhcp-3.1.0-warnings.patch:
View full diff with command:
/usr/bin/cvs -f diff -kk -u -N -r 1.3 -r 1.4 dhcp-3.1.0-warnings.patch
Index: dhcp-3.1.0-warnings.patch
===================================================================
RCS file: dhcp-3.1.0-warnings.patch
diff -N dhcp-3.1.0-warnings.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dhcp-3.1.0-warnings.patch 11 Jan 2008 00:16:44 -0000 1.4
@@ -0,0 +1,2631 @@
+diff -up dhcp-3.1.0/relay/dhcrelay.c.warnings dhcp-3.1.0/relay/dhcrelay.c
+--- dhcp-3.1.0/relay/dhcrelay.c.warnings 2007-02-14 17:41:23.000000000 -0500
++++ dhcp-3.1.0/relay/dhcrelay.c 2007-10-23 14:33:17.000000000 -0400
+@@ -739,7 +739,7 @@ int add_relay_agent_options (ip, packet,
+ unsigned length;
+ struct in_addr giaddr;
+ {
+- int is_dhcp = 0, agent_options_present = 0;
++ int is_dhcp = 0;
+ unsigned optlen;
+ u_int8_t *op, *nextop, *sp, *max, *end_pad = NULL;
+
+diff -up dhcp-3.1.0/dhcpctl/dhcpctl.c.warnings dhcp-3.1.0/dhcpctl/dhcpctl.c
+--- dhcp-3.1.0/dhcpctl/dhcpctl.c.warnings 2005-03-17 15:15:03.000000000 -0500
++++ dhcp-3.1.0/dhcpctl/dhcpctl.c 2007-10-23 14:33:17.000000000 -0400
+@@ -101,7 +101,6 @@ dhcpctl_status dhcpctl_connect (dhcpctl_
+ dhcpctl_handle authinfo)
+ {
+ isc_result_t status;
+- dhcpctl_status waitstatus;
+
+ status = omapi_generic_new (connection, MDL);
+ if (status != ISC_R_SUCCESS) {
+@@ -171,7 +170,6 @@ dhcpctl_status dhcpctl_get_value (dhcpct
+ {
+ isc_result_t status;
+ omapi_value_t *tv = (omapi_value_t *)0;
+- omapi_data_string_t *value = (omapi_data_string_t *)0;
+ unsigned len;
+ int ip;
+
+@@ -263,7 +261,6 @@ dhcpctl_status dhcpctl_set_value (dhcpct
+ isc_result_t status;
+ omapi_typed_data_t *tv = (omapi_typed_data_t *)0;
+ omapi_data_string_t *name = (omapi_data_string_t *)0;
+- int len;
+
+ status = omapi_data_string_new (&name, strlen (value_name), MDL);
+ if (status != ISC_R_SUCCESS)
+@@ -297,7 +294,6 @@ dhcpctl_status dhcpctl_set_string_value
+ isc_result_t status;
+ omapi_typed_data_t *tv = (omapi_typed_data_t *)0;
+ omapi_data_string_t *name = (omapi_data_string_t *)0;
+- int len;
+
+ status = omapi_data_string_new (&name, strlen (value_name), MDL);
+ if (status != ISC_R_SUCCESS)
+@@ -386,7 +382,6 @@ dhcpctl_status dhcpctl_set_boolean_value
+ isc_result_t status;
+ omapi_typed_data_t *tv = (omapi_typed_data_t *)0;
+ omapi_data_string_t *name = (omapi_data_string_t *)0;
+- int len;
+
+ status = omapi_data_string_new (&name, strlen (value_name), MDL);
+ if (status != ISC_R_SUCCESS)
+@@ -416,7 +411,6 @@ dhcpctl_status dhcpctl_set_int_value (dh
+ isc_result_t status;
+ omapi_typed_data_t *tv = (omapi_typed_data_t *)0;
+ omapi_data_string_t *name = (omapi_data_string_t *)0;
+- int len;
+
+ status = omapi_data_string_new (&name, strlen (value_name), MDL);
+ if (status != ISC_R_SUCCESS)
+diff -up dhcp-3.1.0/dhcpctl/cltest.c.warnings dhcp-3.1.0/dhcpctl/cltest.c
+--- dhcp-3.1.0/dhcpctl/cltest.c.warnings 2005-03-17 15:15:03.000000000 -0500
++++ dhcp-3.1.0/dhcpctl/cltest.c 2007-10-23 14:33:17.000000000 -0400
+@@ -60,9 +60,8 @@ int main (argc, argv)
+ isc_result_t status, waitstatus;
+ dhcpctl_handle authenticator;
+ dhcpctl_handle connection;
+- dhcpctl_handle host_handle, group_handle, interface_handle;
+- dhcpctl_data_string cid;
+- dhcpctl_data_string result, groupname, identifier;
++ dhcpctl_handle interface_handle;
++ dhcpctl_data_string result;
+ int i;
+ int mode = undefined;
+ const char *interface = 0;
+diff -up dhcp-3.1.0/dhcpctl/remote.c.warnings dhcp-3.1.0/dhcpctl/remote.c
+--- dhcp-3.1.0/dhcpctl/remote.c.warnings 2005-03-17 15:15:04.000000000 -0500
++++ dhcp-3.1.0/dhcpctl/remote.c 2007-10-23 14:33:17.000000000 -0400
+@@ -354,8 +354,6 @@ isc_result_t dhcpctl_remote_stuff_values
+ omapi_object_t *id,
+ omapi_object_t *p)
+ {
+- int i;
+-
+ if (p -> type != dhcpctl_remote_type)
+ return ISC_R_INVALIDARG;
+
+diff -up dhcp-3.1.0/dhcpctl/callback.c.warnings dhcp-3.1.0/dhcpctl/callback.c
+--- dhcp-3.1.0/dhcpctl/callback.c.warnings 2005-03-17 15:15:02.000000000 -0500
++++ dhcp-3.1.0/dhcpctl/callback.c 2007-10-23 14:33:17.000000000 -0400
+@@ -59,7 +59,6 @@ dhcpctl_status dhcpctl_set_callback (dhc
+ {
+ dhcpctl_callback_object_t *callback;
+ omapi_object_t *inner;
+- isc_result_t status;
+
+ callback = dmalloc (sizeof *callback, MDL);
+ if (!callback)
+@@ -162,8 +161,6 @@ isc_result_t dhcpctl_callback_stuff_valu
+ omapi_object_t *id,
+ omapi_object_t *p)
+ {
+- int i;
+-
+ if (p -> type != dhcpctl_callback_type)
+ return ISC_R_INVALIDARG;
+
+diff -up dhcp-3.1.0/dhcpctl/omshell.c.warnings dhcp-3.1.0/dhcpctl/omshell.c
+--- dhcp-3.1.0/dhcpctl/omshell.c.warnings 2007-02-14 17:41:22.000000000 -0500
++++ dhcp-3.1.0/dhcpctl/omshell.c 2007-10-23 14:33:17.000000000 -0400
+@@ -82,11 +82,9 @@ int main (int argc, char **argv, char **
+ dhcpctl_handle connection;
+ dhcpctl_handle authenticator;
+ dhcpctl_handle oh;
+- dhcpctl_data_string cid, ip_addr;
+- dhcpctl_data_string result, groupname, identifier;
+ struct data_string secret;
+ const char *name = 0, *algorithm = "hmac-md5";
+- int i, j;
++ int i;
+ int port = 7911;
+ const char *server = "127.0.0.1";
+ struct parse *cfile;
+@@ -481,7 +479,6 @@ int main (int argc, char **argv, char **
+ val = buf;
+ do {
+ int intval = atoi (val);
+- dotiszero:
+ if (intval > 255) {
+ parse_warn (cfile,
+ "dotted octet > 255: %s",
+diff -up dhcp-3.1.0/omapip/message.c.warnings dhcp-3.1.0/omapip/message.c
+--- dhcp-3.1.0/omapip/message.c.warnings 2005-03-17 15:15:22.000000000 -0500
++++ dhcp-3.1.0/omapip/message.c 2007-10-23 14:33:17.000000000 -0400
+@@ -209,8 +209,6 @@ isc_result_t omapi_message_get_value (om
+ isc_result_t omapi_message_destroy (omapi_object_t *h,
+ const char *file, int line)
+ {
+- int i;
+-
+ omapi_message_object_t *m;
+ if (h -> type != omapi_type_message)
+ return ISC_R_INVALIDARG;
+@@ -261,8 +259,6 @@ isc_result_t omapi_message_stuff_values
+ omapi_object_t *id,
+ omapi_object_t *m)
+ {
+- int i;
+-
+ if (m -> type != omapi_type_message)
+ return ISC_R_INVALIDARG;
+
+diff -up dhcp-3.1.0/omapip/alloc.c.warnings dhcp-3.1.0/omapip/alloc.c
+--- dhcp-3.1.0/omapip/alloc.c.warnings 2007-10-23 14:33:17.000000000 -0400
++++ dhcp-3.1.0/omapip/alloc.c 2007-10-23 14:33:17.000000000 -0400
+@@ -93,7 +93,6 @@ VOIDPTR dmalloc (size, file, line)
+ {
+ unsigned char *foo;
+ unsigned len;
+- int i;
+ VOIDPTR *bar;
+ #if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
+ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
+diff -up dhcp-3.1.0/omapip/connection.c.warnings dhcp-3.1.0/omapip/connection.c
+--- dhcp-3.1.0/omapip/connection.c.warnings 2005-03-17 15:15:21.000000000 -0500
++++ dhcp-3.1.0/omapip/connection.c 2007-10-23 14:33:17.000000000 -0400
+@@ -111,10 +111,6 @@ isc_result_t omapi_connect_list (omapi_o
+ omapi_connection_object_t *obj;
+ int flag;
+ struct sockaddr_in local_sin;
+-#if defined (TRACING)
+- trace_addr_t *addrs;
+- u_int16_t naddrs;
+-#endif
+
+ obj = (omapi_connection_object_t *)0;
+ status = omapi_connection_allocate (&obj, MDL);
+@@ -1005,8 +1001,6 @@ isc_result_t omapi_connection_stuff_valu
+ omapi_object_t *id,
+ omapi_object_t *m)
+ {
+- int i;
+-
+ if (m -> type != omapi_type_connection)
+ return ISC_R_INVALIDARG;
+
+diff -up dhcp-3.1.0/omapip/protocol.c.warnings dhcp-3.1.0/omapip/protocol.c
+--- dhcp-3.1.0/omapip/protocol.c.warnings 2007-05-23 19:30:33.000000000 -0400
++++ dhcp-3.1.0/omapip/protocol.c 2007-10-23 14:33:17.000000000 -0400
+@@ -165,7 +165,6 @@ isc_result_t omapi_protocol_send_message
[...2238 lines suppressed...]
+@@ -992,11 +987,9 @@ void parse_client_lease_declaration (cfi
+ {
+ int token;
+ const char *val;
+- char *t, *n;
+ struct interface_info *ip;
+ struct option_cache *oc;
+ struct client_state *client = (struct client_state *)0;
+- struct data_string key_id;
+
+ switch (next_token (&val, (unsigned *)0, cfile)) {
+ case KEY:
+@@ -1212,12 +1205,6 @@ int parse_allow_deny (oc, cfile, flag)
+ struct parse *cfile;
+ int flag;
+ {
+- enum dhcp_token token;
+- const char *val;
+- unsigned char rf = flag;
+- struct expression *data = (struct expression *)0;
+- int status;
+-
+ parse_warn (cfile, "allow/deny/ignore not permitted here.");
+ skip_to_semi (cfile);
+ return 0;
+diff -up dhcp-3.1.0/client/dhclient.c.warnings dhcp-3.1.0/client/dhclient.c
+--- dhcp-3.1.0/client/dhclient.c.warnings 2007-10-23 14:33:17.000000000 -0400
++++ dhcp-3.1.0/client/dhclient.c 2007-10-23 14:33:17.000000000 -0400
+@@ -126,7 +126,9 @@ int main (argc, argv, envp)
+ #ifdef LIBDHCP
+ libdhcp_control = libdhcp_ctl;
+ #endif
++#ifndef LIBDHCP
+ int fd;
++#endif
+ int i;
+ struct servent *ent;
+ struct interface_info *ip;
+@@ -140,7 +142,6 @@ int main (argc, argv, envp)
+ omapi_object_t *listener;
+ isc_result_t result;
+ int persist = 0;
+- int omapi_port;
+ int no_dhclient_conf = 0;
+ int no_dhclient_db = 0;
+ int no_dhclient_pid = 0;
+@@ -1171,7 +1172,6 @@ void state_selecting (cpp)
+ picked = lp;
+ picked -> next = (struct client_lease *)0;
+ } else {
+- freeit:
+ destroy_client_lease (lp);
+ }
+ }
+@@ -1230,7 +1230,6 @@ void dhcpack (packet)
+ struct client_lease *lease;
+ struct option_cache *oc;
+ struct data_string ds;
+- int i;
+
+ /* If we're not receptive to an offer right now, or if the offer
+ has an unrecognizable transaction id, then just drop it. */
+@@ -1395,8 +1394,6 @@ void dhcpack (packet)
+ void bind_lease (client)
+ struct client_state *client;
+ {
+- struct interface_info *ip = client -> interface;
+-
+ /* Remember the medium. */
+ client -> new -> medium = client -> medium;
+
+@@ -1465,7 +1462,6 @@ void state_bound (cpp)
+ void *cpp;
+ {
+ struct client_state *client = cpp;
+- int i;
+ struct option_cache *oc;
+ struct data_string ds;
+
+@@ -1508,7 +1504,6 @@ void state_stop (cpp)
+ void *cpp;
+ {
+ struct client_state *client = cpp;
+- int i;
+
+ /* Cancel all timeouts. */
+ cancel_timeout (state_selecting, client);
+@@ -1643,8 +1638,6 @@ void dhcpoffer (packet)
+ int i;
+ int stop_selecting;
+ const char *name = packet -> packet_type ? "DHCPOFFER" : "BOOTREPLY";
+- struct iaddrlist *ap;
+- struct option_cache *oc;
+ char obuf [1024];
+
+ #ifdef DEBUG_PACKET
+@@ -2493,7 +2486,6 @@ void make_discover (client, lease)
+ struct client_lease *lease;
+ {
+ unsigned char discover = DHCPDISCOVER;
+- int i;
+ struct option_state *options = (struct option_state *)0;
+
+ memset (&client -> packet, 0, sizeof (client -> packet));
+@@ -2558,9 +2550,6 @@ void make_request (client, lease)
+ struct client_lease *lease;
+ {
+ unsigned char request = DHCPREQUEST;
+- int i, j;
+- unsigned char *tmp, *digest;
+- unsigned char *old_digest_loc;
+ struct option_cache *oc;
+
+ memset (&client -> packet, 0, sizeof (client -> packet));
+@@ -2650,7 +2639,6 @@ void make_decline (client, lease)
+ struct client_lease *lease;
+ {
+ unsigned char decline = DHCPDECLINE;
+- int i;
+ struct option_cache *oc;
+
+ struct option_state *options = (struct option_state *)0;
+@@ -2707,7 +2695,6 @@ void make_release (client, lease)
+ struct client_lease *lease;
+ {
+ unsigned char request = DHCPRELEASE;
+- int i;
+ struct option_cache *oc;
+
+ struct option_state *options = (struct option_state *)0;
+@@ -2764,8 +2751,6 @@ void make_release (client, lease)
+ void destroy_client_lease (lease)
+ struct client_lease *lease;
+ {
+- int i;
+-
+ if (lease -> server_name)
+ dfree (lease -> server_name, MDL);
+ if (lease -> filename)
+@@ -2830,8 +2815,6 @@ void write_lease_option (struct option_c
+ {
+ const char *name, *dot;
+ struct data_string ds;
+- int status;
+- struct client_state *client;
+
+ memset (&ds, 0, sizeof ds);
+
+@@ -2860,11 +2843,8 @@ int write_client_lease (client, lease, r
+ int makesure;
+ {
+ int i;
+- struct tm *t;
+ static int leases_written;
+- struct option_cache *oc;
+ struct data_string ds;
+- pair *hash;
+ int errors = 0;
+ char *s;
+ const char *tval;
+@@ -3079,8 +3059,6 @@ void script_write_params (client, prefix
+ int i;
+ struct data_string data;
+ struct option_cache *oc;
+- pair *hash;
+- char *s, *t;
+ struct envadd_state es;
+
+ es.client = client;
+@@ -3205,11 +3183,9 @@ int script_go (client)
+
+ return 0;
+ #else
+- int rval;
+ char *scriptName;
+ char *argv [2];
+ char **envp;
+- char *epp [3];
+ char reason [] = "REASON=NBI";
+ static char client_path [] = CLIENT_PATH;
+ int i;
+@@ -3291,7 +3267,7 @@ void client_envadd (struct client_state
+ {
+ char spbuf [1024];
+ char *s;
+- unsigned len, i;
++ unsigned len;
+ struct string_list *val;
+ va_list list;
+
+@@ -3720,8 +3696,7 @@ void client_dns_update_timeout (void *cp
+
+ isc_result_t client_dns_update (struct client_state *client, int addp, int ttl)
+ {
+- struct data_string ddns_fqdn, ddns_fwd_name,
+- ddns_dhcid, client_identifier;
++ struct data_string ddns_fwd_name, ddns_dhcid, client_identifier;
+ struct option_cache *oc;
+ int ignorep;
+ int result;
dhcp-3.1.0-options.patch:
Index: dhcp-3.1.0-options.patch
===================================================================
RCS file: dhcp-3.1.0-options.patch
diff -N dhcp-3.1.0-options.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dhcp-3.1.0-options.patch 11 Jan 2008 00:16:44 -0000 1.3
@@ -0,0 +1,402 @@
+diff -up dhcp-3.1.0/common/conflex.c.options dhcp-3.1.0/common/conflex.c
+--- dhcp-3.1.0/common/conflex.c.options 2007-10-22 15:46:24.000000000 -0400
++++ dhcp-3.1.0/common/conflex.c 2007-10-22 15:48:07.000000000 -0400
+@@ -599,6 +599,8 @@ static enum dhcp_token intern (atom, dfv
+ return BALANCE;
+ if (!strcasecmp (atom + 1, "ound"))
+ return BOUND;
++ if (!strcasecmp (atom + 1, "ootp-broadcast-always"))
++ return BOOTP_BROADCAST_ALWAYS;
+ break;
+ case 'c':
+ if (!strcasecmp (atom + 1, "ase"))
+diff -up dhcp-3.1.0/includes/dhcpd.h.options dhcp-3.1.0/includes/dhcpd.h
+--- dhcp-3.1.0/includes/dhcpd.h.options 2007-10-22 15:46:24.000000000 -0400
++++ dhcp-3.1.0/includes/dhcpd.h 2007-10-22 15:48:21.000000000 -0400
+@@ -912,6 +912,9 @@ struct client_config {
+ int do_forward_update; /* If nonzero, and if we have the
+ information we need, update the
+ A record for the address we get. */
++
++ int bootp_broadcast_always; /* If nonzero, always set the BOOTP_BROADCAST
++ flag in requests */
+ };
+
+ /* Per-interface state used in the dhcp client... */
+diff -up dhcp-3.1.0/includes/dhctoken.h.options dhcp-3.1.0/includes/dhctoken.h
+--- dhcp-3.1.0/includes/dhctoken.h.options 2006-07-31 18:19:51.000000000 -0400
++++ dhcp-3.1.0/includes/dhctoken.h 2007-10-22 15:49:24.000000000 -0400
+@@ -325,7 +325,8 @@ enum dhcp_token {
+ MIN_BALANCE = 629,
+ DOMAIN_LIST = 630,
+ LEASEQUERY = 631,
+- EXECUTE = 632
++ EXECUTE = 632,
++ BOOTP_BROADCAST_ALWAYS = 633
+ };
+
+ #define is_identifier(x) ((x) >= FIRST_TOKEN && \
+diff -up dhcp-3.1.0/client/dhclient.c.options dhcp-3.1.0/client/dhclient.c
+--- dhcp-3.1.0/client/dhclient.c.options 2007-05-22 16:37:04.000000000 -0400
++++ dhcp-3.1.0/client/dhclient.c 2007-10-22 15:47:51.000000000 -0400
+@@ -38,6 +38,12 @@ static char ocopyright[] =
+ #include "dhcpd.h"
+ #include "version.h"
+
++/*
++ * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define
++ * that when building ISC code.
++ */
++extern int asprintf(char **strp, const char *fmt, ...);
++
+ TIME default_lease_time = 43200; /* 12 hours... */
+ TIME max_lease_time = 86400; /* 24 hours... */
+
+@@ -74,6 +80,9 @@ int client_env_count=0;
+ int onetry=0;
+ int quiet=0;
+ int nowait=0;
++int bootp_broadcast_always = 0;
++
++extern u_int32_t default_requested_options[];
+
+ static void usage PROTO ((void));
+
+@@ -101,6 +110,15 @@ int main (argc, argv, envp)
+ int no_dhclient_pid = 0;
+ int no_dhclient_script = 0;
+ char *s;
++ char *dhcp_client_identifier_arg = NULL;
++ char *dhcp_host_name_arg = NULL;
++ char *dhcp_fqdn_arg = NULL;
++ char *dhcp_vendor_class_identifier_arg = NULL;
++ char *dhclient_request_options = NULL;
++
++ int timeout_arg = 0;
++ char *arg_conf = NULL;
++ int arg_conf_len = 0;
+
+ /* Make sure that file descriptors 0 (stdin), 1, (stdout), and
+ 2 (stderr) are open. To do this, we assume that when we
+@@ -211,6 +229,88 @@ int main (argc, argv, envp)
+ } else if (!strcmp (argv [i], "--version")) {
+ log_info ("isc-dhclient-%s", DHCP_VERSION);
+ exit (0);
++ } else if (!strcmp (argv [i], "-I")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage ();
++ return EXIT_FAILURE;
++ }
++
++ if (strlen(argv[i]) >= DHCP_OPTION_LEN) {
++ log_error("-I option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_OPTION_LEN-1);
++ exit(1);
++ }
++
++ dhcp_client_identifier_arg = argv[i];
++ } else if (!strcmp (argv [i], "-B")) {
++ bootp_broadcast_always = 1;
++ } else if (!strcmp (argv [i], "-H")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage ();
++ return EXIT_FAILURE;
++ }
++
++ if (strlen(argv[i]) >= DHCP_OPTION_LEN) {
++ log_error("-H option host-name string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_OPTION_LEN-1);
++ exit(1);
++ }
++
++ if (dhcp_host_name_arg != NULL) {
++ log_error("The -H <host-name> and -F <fqdn> arguments are mutually exclusive");
++ exit(1);
++ }
++
++ dhcp_host_name_arg = argv[i];
++ } else if (!strcmp (argv [i], "-F")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage ();
++ return EXIT_FAILURE;
++ }
++
++ if (strlen(argv[i]) >= DHCP_OPTION_LEN) {
++ log_error("-F option fqdn.fqdn string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_OPTION_LEN-1);
++ exit(1);
++ }
++
++ if (dhcp_fqdn_arg != NULL) {
++ log_error("Only one -F <fqdn> argument can be specified");
++ exit(1);
++ }
++
++ if (dhcp_host_name_arg != NULL) {
++ log_error("The -F <fqdn> and -H <host-name> arguments are mutually exclusive");
++ exit(1);
++ }
++
++ dhcp_fqdn_arg = argv[i];
++ } else if (!strcmp (argv [i], "-T")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage ();
++ return EXIT_FAILURE;
++ }
++
++ if ((timeout_arg = atoi(argv[i])) <= 0) {
++ log_error("-T timeout option must be > 0 - bad value: %s",argv[i]);
++ exit(1);
++ }
++ } else if (!strcmp (argv [i], "-V")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage ();
++ return EXIT_FAILURE;
++ }
++
++ if (strlen(argv[i]) >= DHCP_OPTION_LEN) {
++ log_error("-V option vendor-class-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_OPTION_LEN-1);
++ exit(1);
++ }
++
++ dhcp_vendor_class_identifier_arg = argv[i];
++ } else if (!strcmp (argv [i], "-R")) {
++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++ usage ();
++ return EXIT_FAILURE;
++ }
++
++ dhclient_request_options=argv[i];
+ } else if (argv [i][0] == '-') {
+ usage ();
+ } else {
+@@ -347,6 +447,167 @@ int main (argc, argv, envp)
+ /* Parse the dhclient.conf file. */
+ read_client_conf ();
+
++ /* Parse any extra command line configuration arguments: */
++ if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) {
++ arg_conf_len = asprintf(&arg_conf, "send dhcp-client-identifier \"%s\";", dhcp_client_identifier_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -I option dhcp-client-identifier");
++ }
++
++ if ((dhcp_host_name_arg != NULL) && (*dhcp_host_name_arg != '\0')) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "send host-name \"%s\";", dhcp_host_name_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -H option host-name");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf( &arg_conf, "%s\nsend host-name \"%s\";", last_arg_conf, dhcp_host_name_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -H option host-name");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if ((dhcp_fqdn_arg != NULL) && (*dhcp_fqdn_arg != '\0')) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "send fqdn.fqdn \"%s\";", dhcp_fqdn_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -F option fqdn.fqdn");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf( &arg_conf, "%s\nsend fqdn.fqdn \"%s\";", last_arg_conf, dhcp_fqdn_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -F option fqdn.fqdn");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if (timeout_arg) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "timeout %d;", timeout_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to process -T timeout argument");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf( &arg_conf, "%s\ntimeout %d;", last_arg_conf, timeout_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len == 0))
++ log_fatal("Unable to process -T timeout argument");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if ((dhcp_vendor_class_identifier_arg != NULL) && (*dhcp_vendor_class_identifier_arg != '\0')) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "send vendor-class-identifier \"%s\";", dhcp_vendor_class_identifier_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -V option vendor-class-identifier");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf(&arg_conf, "%s\nsend vendor-class-identifier \"%s\";", last_arg_conf, dhcp_vendor_class_identifier_arg);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to send -V option vendor-class-identifier");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if (dhclient_request_options != NULL) {
++ if (arg_conf == 0) {
++ arg_conf_len = asprintf(&arg_conf, "request %s;", dhclient_request_options);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to parse -R <request options list> argument");
++ } else {
++ char *last_arg_conf = arg_conf;
++ arg_conf = NULL;
++ arg_conf_len = asprintf(&arg_conf, "%s\nrequest %s;", last_arg_conf, dhclient_request_options);
++
++ if ((arg_conf == 0) || (arg_conf_len <= 0))
++ log_fatal("Unable to parse -R <request options list> argument");
++
++ free(last_arg_conf);
++ }
++ }
++
++ if (arg_conf) {
++ if (arg_conf_len == 0)
++ if ((arg_conf_len = strlen(arg_conf)) == 0)
++ /* huh ? cannot happen ! */
++ log_fatal("Unable to process -I/-H/-F/-T/-V/-R configuration arguments");
++
++ /* parse the extra dhclient.conf configuration arguments
++ * into top level config: */
++ struct parse *cfile = (struct parse *)0;
++ const char *val = NULL;
++ int token;
++
++ status = new_parse (&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -I/-H/-F/-T/-V/-R configuration arguments", 0);
++
++ if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred))
++ log_fatal("Cannot parse -I/-H/-F/-T/-V/-R configuration arguments !");
++ /* more detailed parse failures will be logged */
++
++ do {
++ token = peek_token (&val, (unsigned *)0, cfile);
++ if (token == END_OF_FILE)
++ break;
++
++ parse_client_statement (cfile, (struct interface_info *)0, &top_level_config);
++ } while (1);
++
++ if (cfile -> warnings_occurred)
++ log_fatal ("Cannot parse -I/-H/-F/-T/-V/-R configuration arguments !");
++ end_parse (&cfile);
++
++ if (timeout_arg) {
++ /* we just set the toplevel timeout, but per-client
++ * timeouts may still be at defaults. Also, it makes no
++ * sense having the reboot_timeout or backoff_cutoff
++ * greater than the timeout:
++ */
++ if ((top_level_config.backoff_cutoff == 15) && (top_level_config.backoff_cutoff > (timeout_arg / 2)))
++ top_level_config.backoff_cutoff = (((unsigned long)(timeout_arg / 2)) == 0) ? timeout_arg : (unsigned long)(timeout_arg / 2);
++
++ for (ip = interfaces; ip; ip = ip -> next) {
++ if (ip->client->config->timeout == 60)
++ ip->client->config->timeout = timeout_arg;
++
++ if ((ip->client->config->reboot_timeout == 10) && (ip->client->config->reboot_timeout > ip->client->config->timeout))
++ ip->client->config->reboot_timeout = ip->client->config->timeout;
++
++ if ((ip->client->config->backoff_cutoff == 15) && (ip->client->config->backoff_cutoff > top_level_config.backoff_cutoff))
++ ip->client->config->backoff_cutoff = top_level_config.backoff_cutoff;
++ }
++ }
++
++ if ((dhclient_request_options != 0) && (top_level_config.requested_options != default_requested_options)) {
++ for (ip = interfaces; ip; ip = ip -> next) {
++ if (ip->client->config->requested_options == default_requested_options)
++ ip->client->config->requested_options = top_level_config.requested_options;
++ }
++ }
++
++ free(arg_conf);
++ arg_conf = NULL;
++ arg_conf_len = 0;
++ }
++
+ /* Parse the lease database. */
+ read_client_leases ();
+
+@@ -1978,7 +2239,8 @@ void make_discover (client, lease)
+ client -> packet.xid = random ();
+ client -> packet.secs = 0; /* filled in by send_discover. */
+
+- if (can_receive_unicast_unconfigured (client -> interface))
++ if ((!(bootp_broadcast_always || client->config->bootp_broadcast_always))
++ && can_receive_unicast_unconfigured(client->interface))
+ client -> packet.flags = 0;
+ else
+ client -> packet.flags = htons (BOOTP_BROADCAST);
+@@ -2065,7 +2327,9 @@ void make_request (client, lease)
+ } else {
+ memset (&client -> packet.ciaddr, 0,
+ sizeof client -> packet.ciaddr);
+- if (can_receive_unicast_unconfigured (client -> interface))
++ if ((!(bootp_broadcast_always ||
++ client ->config->bootp_broadcast_always)) &&
++ can_receive_unicast_unconfigured (client -> interface))
+ client -> packet.flags = 0;
+ else
+ client -> packet.flags = htons (BOOTP_BROADCAST);
+@@ -2125,7 +2389,8 @@ void make_decline (client, lease)
+ client -> packet.hops = 0;
+ client -> packet.xid = client -> xid;
+ client -> packet.secs = 0; /* Filled in by send_request. */
+- if (can_receive_unicast_unconfigured (client -> interface))
++ if ((!(bootp_broadcast_always || client->config-> bootp_broadcast_always))
++ && can_receive_unicast_unconfigured (client->interface))
+ client -> packet.flags = 0;
+ else
+ client -> packet.flags = htons (BOOTP_BROADCAST);
+diff -up dhcp-3.1.0/client/clparse.c.options dhcp-3.1.0/client/clparse.c
+--- dhcp-3.1.0/client/clparse.c.options 2007-02-14 17:41:22.000000000 -0500
++++ dhcp-3.1.0/client/clparse.c 2007-10-22 15:47:12.000000000 -0400
+@@ -84,6 +84,7 @@ isc_result_t read_client_conf ()
+ top_level_config.requested_options = default_requested_options;
+ top_level_config.omapi_port = -1;
+ top_level_config.do_forward_update = 1;
++ top_level_config.bootp_broadcast_always = 0;
+
+ group_allocate (&top_level_config.on_receipt, MDL);
+ if (!top_level_config.on_receipt)
+@@ -230,7 +231,8 @@ void read_client_leases ()
+ interface-declaration |
+ LEASE client-lease-statement |
+ ALIAS client-lease-statement |
+- KEY key-definition */
++ KEY key-definition |
++ BOOTP_BROADCAST_ALWAYS */
+
+ void parse_client_statement (cfile, ip, config)
+ struct parse *cfile;
+@@ -554,6 +556,12 @@ void parse_client_statement (cfile, ip,
+ parse_reject_statement (cfile, config);
+ return;
+
++ case BOOTP_BROADCAST_ALWAYS:
++ token = next_token(&val, (unsigned*)0, cfile);
++ config -> bootp_broadcast_always = 1;
++ parse_semi (cfile);
++ return;
++
+ default:
+ lose = 0;
+ stmt = (struct executable_statement *)0;
dhcp-3.1.0-ldap-configuration.patch:
View full diff with command:
/usr/bin/cvs -f diff -kk -u -N -r 1.3 -r 1.4 dhcp-3.1.0-ldap-configuration.patch
Index: dhcp-3.1.0-ldap-configuration.patch
===================================================================
RCS file: dhcp-3.1.0-ldap-configuration.patch
diff -N dhcp-3.1.0-ldap-configuration.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dhcp-3.1.0-ldap-configuration.patch 11 Jan 2008 00:16:44 -0000 1.4
@@ -0,0 +1,2724 @@
+diff -up dhcp-3.1.0/server/mdb.c.ldap dhcp-3.1.0/server/mdb.c
+--- dhcp-3.1.0/server/mdb.c.ldap 2007-06-08 14:57:02.000000000 -0400
++++ dhcp-3.1.0/server/mdb.c 2007-11-12 15:41:15.000000000 -0500
+@@ -454,6 +454,12 @@ int find_hosts_by_haddr (struct host_dec
+ {
+ struct host_decl *foo;
+ struct hardware h;
++ int ret;
++
++#if defined(LDAP_CONFIGURATION)
++ if ((ret = find_haddr_in_ldap (hp, htype, hlen, haddr, file, line)))
++ return ret;
++#endif
+
+ h.hlen = hlen + 1;
+ h.hbuf [0] = htype;
+diff -up /dev/null dhcp-3.1.0/server/ldap_casa.c
+--- /dev/null 2007-11-12 10:55:50.854093917 -0500
++++ dhcp-3.1.0/server/ldap_casa.c 2007-11-12 15:41:15.000000000 -0500
+@@ -0,0 +1,138 @@
++/* ldap_casa.c
++
++ CASA routines for DHCPD... */
++
++/* Copyright (c) 2004 Internet Systems Consorium, Inc. ("ISC")
++ * Copyright (c) 1995-2003 Internet Software Consortium.
++ * Copyright (c) 2006 Novell, Inc.
++
++ * All rights reserved.
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions are met:
++ * 1.Redistributions of source code must retain the above copyright notice,
++ * this list of conditions and the following disclaimer.
++ * 2.Redistributions in binary form must reproduce the above copyright notice,
++ * this list of conditions and the following disclaimer in the documentation
++ * and/or other materials provided with the distribution.
++ * 3.Neither the name of ISC, ISC DHCP, nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++
++ * THIS SOFTWARE IS PROVIDED BY INTERNET SYSTEMS CONSORTIUM AND CONTRIBUTORS
++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ISC OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
++ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++
++ * This file was written by S Kalyanasundaram <skalyanasundaram at novell.com>
++ */
++
++#if defined(LDAP_CASA_AUTH)
++#include "ldap_casa.h"
++#include "dhcpd.h"
++
++int
++load_casa (void)
++{
++ if( !(casaIDK = dlopen(MICASA_LIB,RTLD_LAZY)))
++ return 0;
++ p_miCASAGetCredential = (CASA_GetCredential_T) dlsym(casaIDK, "miCASAGetCredential");
++ p_miCASASetCredential = (CASA_SetCredential_T) dlsym(casaIDK, "miCASASetCredential");
++ p_miCASARemoveCredential = (CASA_RemoveCredential_T) dlsym(casaIDK, "miCASARemoveCredential");
++
++ if((p_miCASAGetCredential == NULL) ||
++ (p_miCASASetCredential == NULL) ||
++ (p_miCASARemoveCredential == NULL))
++ {
++ if(casaIDK)
++ dlclose(casaIDK);
++ casaIDK = NULL;
++ p_miCASAGetCredential = NULL;
++ p_miCASASetCredential = NULL;
++ p_miCASARemoveCredential = NULL;
++ return 0;
++ }
++ else
++ return 1;
++}
++
++static void
++release_casa(void)
++{
++ if(casaIDK)
++ {
++ dlclose(casaIDK);
++ casaIDK = NULL;
++ }
++
++ p_miCASAGetCredential = NULL;
++ p_miCASASetCredential = NULL;
++ p_miCASARemoveCredential = NULL;
++
++}
++
++int
++load_uname_pwd_from_miCASA (char **ldap_username, char **ldap_password)
++ {
++ int result = 0;
++ uint32_t credentialtype = SSCS_CRED_TYPE_SERVER_F;
++ SSCS_BASIC_CREDENTIAL credential;
++ SSCS_SECRET_ID_T applicationSecretId;
++ char *tempVar = NULL;
++
++ const char applicationName[10] = "dhcp-ldap";
++
++ if ( load_casa() )
++ {
++ memset(&credential, 0, sizeof(SSCS_BASIC_CREDENTIAL));
++ memset(&applicationSecretId, 0, sizeof(SSCS_SECRET_ID_T));
++
++ applicationSecretId.len = strlen(applicationName) + 1;
++ memcpy (applicationSecretId.id, applicationName, applicationSecretId.len);
++
++ credential.unFlags = USERNAME_TYPE_CN_F;
++
++ result = p_miCASAGetCredential (0,
++ &applicationSecretId,NULL,&credentialtype,
++ &credential,NULL);
++
++ if(credential.unLen)
++ {
++ tempVar = dmalloc (credential.unLen + 1, MDL);
++ if (!tempVar)
++ log_fatal ("no memory for ldap_username");
++ memcpy(tempVar , credential.username, credential.unLen);
++ *ldap_username = tempVar;
++
++ tempVar = dmalloc (credential.pwordLen + 1, MDL);
++ if (!tempVar)
++ log_fatal ("no memory for ldap_password");
++ memcpy(tempVar, credential.password, credential.pwordLen);
++ *ldap_password = tempVar;
++
++#if defined (DEBUG_LDAP)
++ log_info ("Authentication credential taken from CASA");
++#endif
++
++ release_casa();
++ return 1;
++
++ }
++ else
++ {
++ release_casa();
++ return 0;
++ }
++ }
++ else
++ return 0; //casa libraries not loaded
++ }
++
++#endif /* LDAP_CASA_AUTH */
++
+diff -up dhcp-3.1.0/server/Makefile.dist.ldap dhcp-3.1.0/server/Makefile.dist
+--- dhcp-3.1.0/server/Makefile.dist.ldap 2006-07-25 09:26:00.000000000 -0400
++++ dhcp-3.1.0/server/Makefile.dist 2007-11-12 15:41:15.000000000 -0500
+@@ -25,14 +25,14 @@
+ CATMANPAGES = dhcpd.cat8 dhcpd.conf.cat5 dhcpd.leases.cat5
+ SEDMANPAGES = dhcpd.man8 dhcpd.conf.man5 dhcpd.leases.man5
+ SRCS = dhcpd.c dhcp.c bootp.c confpars.c db.c class.c failover.c \
+- omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.c
++ omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.c ldap.c ldap_casa.c
+ OBJS = dhcpd.o dhcp.o bootp.o confpars.o db.o class.o failover.o \
+- omapi.o mdb.o stables.o salloc.o ddns.o dhcpleasequery.o
++ omapi.o mdb.o stables.o salloc.o ddns.o dhcpleasequery.o ldap.o ldap_casa.o
+ PROG = dhcpd
+ MAN = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5
+
+ INCLUDES = -I$(TOP) $(BINDINC) -I$(TOP)/includes
+-DHCPLIB = ../common/libdhcp.a $(BINDLIB) ../omapip/libomapi.a ../dst/libdst.a
++DHCPLIB = ../common/libdhcp.a $(BINDLIB) ../omapip/libomapi.a ../dst/libdst-nomd5.a
+ CFLAGS = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS)
+
+ all: $(PROG) $(CATMANPAGES)
+@@ -106,6 +106,6 @@ dhcpd.leases.man5: dhcpd.leases.5
+ -e "s#RUNDIR#$(VARRUN)#g" < dhcpd.leases.5 >dhcpd.leases.man5
+
+ dhcpd: $(OBJS) $(COBJ) $(DHCPLIB)
+- $(CC) $(LFLAGS) -o dhcpd $(OBJS) $(DHCPLIB) $(LIBS)
++ $(CC) $(LFLAGS) -o dhcpd $(OBJS) $(DHCPLIB) $(LIBS) -lldap
+
+ # Dependencies (semi-automatically-generated)
+diff -up dhcp-3.1.0/server/dhcpd.c.ldap dhcp-3.1.0/server/dhcpd.c
+--- dhcp-3.1.0/server/dhcpd.c.ldap 2007-05-29 13:49:44.000000000 -0400
++++ dhcp-3.1.0/server/dhcpd.c 2007-11-12 15:41:15.000000000 -0500
+@@ -440,6 +440,14 @@ int main (argc, argv, envp)
+ /* Add the ddns update style enumeration prior to parsing. */
+ add_enumeration (&ddns_styles);
[...2331 lines suppressed...]
+@@ -362,6 +369,32 @@ struct hardware {
+ u_int8_t hbuf [17];
+ };
+
++#if defined(LDAP_CONFIGURATION)
++# define LDAP_BUFFER_SIZE 8192
++# define LDAP_METHOD_STATIC 0
++# define LDAP_METHOD_DYNAMIC 1
++#if defined (USE_SSL)
++# define LDAP_SSL_OFF 0
++# define LDAP_SSL_ON 1
++# define LDAP_SSL_TLS 2
++# define LDAP_SSL_LDAPS 3
++#endif
++
++/* This is a tree of the current configuration we are building from LDAP */
++struct ldap_config_stack {
++ LDAPMessage * res; /* Pointer returned from ldap_search */
++ LDAPMessage * ldent; /* Current item in LDAP that we're processing.
++ in res */
++ int close_brace; /* Put a closing } after we're through with
++ this item */
++ int processed; /* We set this flag if this base item has been
++ processed. After this base item is processed,
++ we can start processing the children */
++ struct ldap_config_stack *children;
++ struct ldap_config_stack *next;
++};
++#endif
++
+ typedef enum {
+ server_startup = 0,
+ server_running = 1,
+@@ -558,6 +591,29 @@ struct lease_state {
+ # define DEFAULT_PING_TIMEOUT 1
+ #endif
+
++#if defined(LDAP_CONFIGURATION)
++# define SV_LDAP_SERVER 47
++# define SV_LDAP_PORT 48
++# define SV_LDAP_USERNAME 49
++# define SV_LDAP_PASSWORD 50
++# define SV_LDAP_BASE_DN 51
++# define SV_LDAP_METHOD 52
++# define SV_LDAP_DEBUG_FILE 53
++# define SV_LDAP_DHCP_SERVER_CN 54
++# define SV_LDAP_REFERRALS 55
++#if defined (USE_SSL)
++# define SV_LDAP_SSL 56
++# define SV_LDAP_TLS_REQCERT 57
++# define SV_LDAP_TLS_CA_FILE 58
++# define SV_LDAP_TLS_CA_DIR 59
++# define SV_LDAP_TLS_CERT 60
++# define SV_LDAP_TLS_KEY 61
++# define SV_LDAP_TLS_CRLCHECK 62
++# define SV_LDAP_TLS_CIPHERS 63
++# define SV_LDAP_TLS_RANDFILE 64
++#endif
++#endif
++
+ #if !defined (DEFAULT_DEFAULT_LEASE_TIME)
+ # define DEFAULT_DEFAULT_LEASE_TIME 43200
+ #endif
+@@ -1702,7 +1758,7 @@ extern int db_time_format;
+ char *quotify_string (const char *, const char *, int);
+ char *quotify_buf (const unsigned char *, unsigned, const char *, int);
+ char *print_base64 (const unsigned char *, unsigned, const char *, int);
+-char *print_hw_addr PROTO ((int, int, unsigned char *));
++char *print_hw_addr PROTO ((const int, const int, const unsigned char *));
+ void print_lease PROTO ((struct lease *));
+ void dump_raw PROTO ((const unsigned char *, unsigned));
+ void dump_packet_option (struct option_cache *, struct packet *,
+@@ -2812,3 +2868,18 @@ OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_l
+ #endif /* FAILOVER_PROTOCOL */
+
+ const char *binding_state_print (enum failover_state);
++
++/* ldap.c */
++#if defined(LDAP_CONFIGURATION)
++extern struct enumeration ldap_methods;
++#if defined (USE_SSL)
++extern struct enumeration ldap_ssl_usage_enum;
++extern struct enumeration ldap_tls_reqcert_enum;
++extern struct enumeration ldap_tls_crlcheck_enum;
++#endif
++isc_result_t ldap_read_config (void);
++int find_haddr_in_ldap (struct host_decl **, int, unsigned,
++ const unsigned char *, const char *, int);
++int find_subclass_in_ldap (struct class *, struct class **,
++ struct data_string *);
++#endif
+diff -up dhcp-3.1.0/includes/site.h.ldap dhcp-3.1.0/includes/site.h
+--- dhcp-3.1.0/includes/site.h.ldap 2006-07-31 18:19:51.000000000 -0400
++++ dhcp-3.1.0/includes/site.h 2007-11-12 15:41:15.000000000 -0500
+@@ -183,3 +183,18 @@
+ traces. */
+
+ #define TRACING
++
++/* Define this if you want to read your config from LDAP. Read README.ldap
++ about how to set this up */
++
++#define LDAP_CONFIGURATION
++
++/* Define this if you want to enable LDAP over a SSL connection. You will need
++ to add -lcrypto -lssl to the LIBS= line of server/Makefile */
++
++#define USE_SSL
++
++#define _PATH_DHCPD_DB "/var/lib/dhcpd/dhcpd.leases"
++#define _PATH_DHCLIENT_DB "/var/lib/dhclient/dhclient.leases"
++#define _PATH_DHCPD_DB "/var/lib/dhcpd/dhcpd.leases"
++#define _PATH_DHCLIENT_DB "/var/lib/dhclient/dhclient.leases"
+diff -up /dev/null dhcp-3.1.0/includes/ldap_casa.h
+--- /dev/null 2007-11-12 10:55:50.854093917 -0500
++++ dhcp-3.1.0/includes/ldap_casa.h 2007-11-12 15:41:15.000000000 -0500
+@@ -0,0 +1,83 @@
++/* ldap_casa.h
++
++ Definition for CASA modules... */
++
++/* Copyright (c) 2004 Internet Systems Consorium, Inc. ("ISC")
++ * Copyright (c) 1995-2003 Internet Software Consortium.
++ * Copyright (c) 2006 Novell, Inc.
++
++ * All rights reserved.
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions are met:
++ * 1.Redistributions of source code must retain the above copyright notice,
++ * this list of conditions and the following disclaimer.
++ * 2.Redistributions in binary form must reproduce the above copyright notice,
++ * this list of conditions and the following disclaimer in the documentation
++ * and/or other materials provided with the distribution.
++ * 3.Neither the name of ISC, ISC DHCP, nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++
++ * THIS SOFTWARE IS PROVIDED BY INTERNET SYSTEMS CONSORTIUM AND CONTRIBUTORS
++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ISC OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
++ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++
++ * This file was written by S Kalyanasundaram <skalyanasundaram at novell.com>
++ */
++
++#if defined(LDAP_CASA_AUTH)
++#ifndef __LDAP_CASA_H__
++#define __LDAP_CASA_H__
++
++#include <micasa_mgmd.h>
++#include <dlfcn.h>
++#include <string.h>
++
++#define MICASA_LIB "libmicasa.so.1"
++
++SSCS_TYPEDEF_LIBCALL(int, CASA_GetCredential_T)
++(
++ uint32_t ssFlags,
++ SSCS_SECRET_ID_T *appSecretID,
++ SSCS_SECRET_ID_T *sharedSecretID,
++ uint32_t *credentialType,
++ void *credential,
++ SSCS_EXT_T *ext
++);
++SSCS_TYPEDEF_LIBCALL(int, CASA_SetCredential_T)
++(
++ uint32_t ssFlags,
++ SSCS_SECRET_ID_T *appSecretID,
++ SSCS_SECRET_ID_T *sharedSecretID,
++ uint32_t credentialType,
++ void *credential,
++ SSCS_EXT_T *ext
++);
++
++SSCS_TYPEDEF_LIBCALL(int, CASA_RemoveCredential_T)
++(
++ uint32_t ssFlags,
++ SSCS_SECRET_ID_T *appSecretID,
++ SSCS_SECRET_ID_T *sharedSecretID,
++ SSCS_EXT_T *ext
++);
++static CASA_GetCredential_T p_miCASAGetCredential = NULL;
++static CASA_SetCredential_T p_miCASASetCredential = NULL;
++static CASA_RemoveCredential_T p_miCASARemoveCredential = NULL;
++static void *casaIDK = NULL;
++
++int load_casa(void);
++static void release_casa(void);
++int load_uname_pwd_from_miCASA(char **, char **);
++
++#endif /* __LDAP_CASA_H__ */
++#endif /* LDAP_CASA_AUTH */
++
dhcp-3.1.0-dhclient-usage.patch:
Index: dhcp-3.1.0-dhclient-usage.patch
===================================================================
RCS file: dhcp-3.1.0-dhclient-usage.patch
diff -N dhcp-3.1.0-dhclient-usage.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dhcp-3.1.0-dhclient-usage.patch 11 Jan 2008 00:16:44 -0000 1.3
@@ -0,0 +1,39 @@
+diff -up dhcp-3.1.0/client/dhclient.c.usage dhcp-3.1.0/client/dhclient.c
+--- dhcp-3.1.0/client/dhclient.c.usage 2007-10-22 15:52:06.000000000 -0400
++++ dhcp-3.1.0/client/dhclient.c 2007-10-22 15:54:21.000000000 -0400
+@@ -818,16 +818,25 @@ int main (argc, argv, envp)
+
+ static void usage ()
+ {
+- log_info ("%s %s", message, DHCP_VERSION);
+- log_info (copyright);
+- log_info (arr);
+- log_info (url);
+-
+- log_error ("Usage: dhclient [-1dqrx] [-nw] [-p <port>] %s",
+- "[-s server]");
+- log_error (" [-cf config-file] [-lf lease-file]%s",
+- "[-pf pid-file] [-e VAR=val]");
+- log_fatal (" [-sf script-file] [interface]");
++ printf ("%s %s\n", message, DHCP_VERSION);
++ printf (copyright);
++ printf ("\n");
++ printf (arr);
++ printf ("\n");
++ printf (url);
++ printf ("\n");
++
++ printf ("Usage: dhclient [-1dqr] [-nw] [-p <port>] %s",
++ "[-s server]");
++ printf (" [-cf config-file] [-lf lease-file]%s",
++ "[-pf pid-file] [-e VAR=val]");
++ printf (" [ -I <dhcp-client-identifier> ] [-B]\n");
++ printf (" [ -H <host-name> | -F <fqdn.fqdn> ] [ -T <timeout> ]\n");
++ printf (" [ -V <vendor-class-identifier> ]\n");
++ printf (" [ -R <request option list> ]\n");
++ printf (" [-sf script-file] [interface]\n");
++
++ exit (EXIT_FAILURE);
+ }
+
+ isc_result_t find_class (struct class **c,
dhcp-3.1.0-dhclient-anycast.patch:
Index: dhcp-3.1.0-dhclient-anycast.patch
===================================================================
RCS file: dhcp-3.1.0-dhclient-anycast.patch
diff -N dhcp-3.1.0-dhclient-anycast.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dhcp-3.1.0-dhclient-anycast.patch 11 Jan 2008 00:16:44 -0000 1.3
@@ -0,0 +1,82 @@
+diff -up dhcp-3.1.0/common/lpf.c.anycast dhcp-3.1.0/common/lpf.c
+--- dhcp-3.1.0/common/lpf.c.anycast 2007-10-22 16:16:48.000000000 -0400
++++ dhcp-3.1.0/common/lpf.c 2007-10-22 16:19:01.000000000 -0400
+@@ -334,6 +334,9 @@ ssize_t send_packet (interface, packet,
+ return send_fallback (interface, packet, raw,
+ len, from, to, hto);
+
++ if (hto == NULL && interface->anycast_mac_addr.hlen)
++ hto = &interface->anycast_mac_addr;
++
+ /* Assemble the headers... */
+ assemble_hw_header (interface, (unsigned char *)hh, &hbufp, hto);
+ fudge = hbufp % 4; /* IP header must be word-aligned. */
+diff -up dhcp-3.1.0/common/conflex.c.anycast dhcp-3.1.0/common/conflex.c
+--- dhcp-3.1.0/common/conflex.c.anycast 2007-10-22 16:16:47.000000000 -0400
++++ dhcp-3.1.0/common/conflex.c 2007-10-22 16:18:52.000000000 -0400
+@@ -549,6 +549,8 @@ static enum dhcp_token intern (atom, dfv
+ }
+ if (!strcasecmp (atom + 1, "nd"))
+ return AND;
++ if (!strcasecmp (atom + 1, "nycast-mac"))
++ return ANYCAST_MAC;
+ if (!strcasecmp (atom + 1, "ppend"))
+ return APPEND;
+ if (!strcasecmp (atom + 1, "llow"))
+diff -up dhcp-3.1.0/includes/site.h.anycast dhcp-3.1.0/includes/site.h
+--- dhcp-3.1.0/includes/site.h.anycast 2007-10-22 16:16:47.000000000 -0400
++++ dhcp-3.1.0/includes/site.h 2007-10-22 16:19:43.000000000 -0400
+@@ -184,6 +184,8 @@
+
+ #define TRACING
+
++#define USE_LPF
++
+ /* Define this if you want to read your config from LDAP. Read README.ldap
+ about how to set this up */
+
+diff -up dhcp-3.1.0/includes/dhcpd.h.anycast dhcp-3.1.0/includes/dhcpd.h
+--- dhcp-3.1.0/includes/dhcpd.h.anycast 2007-10-22 16:16:48.000000000 -0400
++++ dhcp-3.1.0/includes/dhcpd.h 2007-10-22 16:19:17.000000000 -0400
+@@ -990,6 +990,7 @@ struct interface_info {
+ int dlpi_sap_length;
+ struct hardware dlpi_broadcast_addr;
+ # endif /* DLPI_SEND || DLPI_RECEIVE */
++ struct hardware anycast_mac_addr;
+ };
+
+ struct hardware_link {
+diff -up dhcp-3.1.0/includes/dhctoken.h.anycast dhcp-3.1.0/includes/dhctoken.h
+--- dhcp-3.1.0/includes/dhctoken.h.anycast 2007-10-22 16:16:48.000000000 -0400
++++ dhcp-3.1.0/includes/dhctoken.h 2007-10-22 16:20:33.000000000 -0400
+@@ -326,7 +326,8 @@ enum dhcp_token {
+ DOMAIN_LIST = 630,
+ LEASEQUERY = 631,
+ EXECUTE = 632,
+- BOOTP_BROADCAST_ALWAYS = 633
++ BOOTP_BROADCAST_ALWAYS = 633,
++ ANYCAST_MAC = 634
+ };
+
+ #define is_identifier(x) ((x) >= FIRST_TOKEN && \
+diff -up dhcp-3.1.0/client/clparse.c.anycast dhcp-3.1.0/client/clparse.c
+--- dhcp-3.1.0/client/clparse.c.anycast 2007-10-22 16:16:48.000000000 -0400
++++ dhcp-3.1.0/client/clparse.c 2007-10-22 16:18:40.000000000 -0400
+@@ -407,6 +407,17 @@ void parse_client_statement (cfile, ip,
+ }
+ return;
+
++ case ANYCAST_MAC:
++ token = next_token (&val, (unsigned *)0, cfile);
++ if (ip) {
++ parse_hardware_param (cfile, &ip -> anycast_mac_addr);
++ } else {
++ parse_warn (cfile, "anycast mac address parameter %s",
++ "not allowed here.");
++ skip_to_semi (cfile);
++ }
++ return;
++
+ case REQUEST:
+ token = next_token (&val, (unsigned *)0, cfile);
+ if (config -> requested_options == default_requested_options)
dhcp-3.0.6-memory.patch:
Index: dhcp-3.0.6-memory.patch
===================================================================
RCS file: dhcp-3.0.6-memory.patch
diff -N dhcp-3.0.6-memory.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dhcp-3.0.6-memory.patch 11 Jan 2008 00:16:44 -0000 1.3
@@ -0,0 +1,37 @@
+diff -up dhcp-3.0.6/minires/ns_name.c.memory dhcp-3.0.6/minires/ns_name.c
+--- dhcp-3.0.6/minires/ns_name.c.memory 2004-06-10 13:59:40.000000000 -0400
++++ dhcp-3.0.6/minires/ns_name.c 2007-07-10 11:43:29.000000000 -0400
+@@ -71,6 +71,11 @@ ns_name_ntop(const u_char *src, char *ds
+ dn = dst;
+ eom = dst + dstsiz;
+
++ if (dn >= eom) {
++ errno = EMSGSIZE;
++ return (-1);
++ }
++
+ while ((n = *cp++) != 0) {
+ if ((n & NS_CMPRSFLGS) != 0) {
+ /* Some kind of compression pointer. */
+diff -up dhcp-3.0.6/common/packet.c.memory dhcp-3.0.6/common/packet.c
+--- dhcp-3.0.6/common/packet.c.memory 2007-05-01 16:42:55.000000000 -0400
++++ dhcp-3.0.6/common/packet.c 2007-07-10 11:43:29.000000000 -0400
+@@ -140,6 +140,7 @@ void assemble_udp_ip_header (interface,
+ struct ip ip;
+ struct udphdr udp;
+
++ memset( &ip, '\0', sizeof ip);
+ /* Fill out the IP header */
+ IP_V_SET (&ip, 4);
+ IP_HL_SET (&ip, 20);
+diff -up dhcp-3.0.6/common/lpf.c.memory dhcp-3.0.6/common/lpf.c
+--- dhcp-3.0.6/common/lpf.c.memory 2007-07-10 11:43:29.000000000 -0400
++++ dhcp-3.0.6/common/lpf.c 2007-07-10 11:43:29.000000000 -0400
+@@ -246,6 +246,7 @@ static void lpf_tr_filter_setup (info)
+ struct interface_info *info;
+ {
+ struct sock_fprog p;
++ memset(&p,'\0', sizeof(struct sock_fprog));
+
+ /* Set up the bpf filter program structure. This is defined in
+ bpf.c */
dhcp-3.0.6-ignore-hyphen-x.patch:
Index: dhcp-3.0.6-ignore-hyphen-x.patch
===================================================================
RCS file: dhcp-3.0.6-ignore-hyphen-x.patch
diff -N dhcp-3.0.6-ignore-hyphen-x.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dhcp-3.0.6-ignore-hyphen-x.patch 11 Jan 2008 00:16:44 -0000 1.3
@@ -0,0 +1,13 @@
+diff -up dhcp-3.0.6/client/dhclient.c.enoi dhcp-3.0.6/client/dhclient.c
+--- dhcp-3.0.6/client/dhclient.c.enoi 2007-08-15 16:14:32.000000000 -0400
++++ dhcp-3.0.6/client/dhclient.c 2007-08-15 16:17:17.000000000 -0400
+@@ -259,6 +259,9 @@ int main (argc, argv, envp)
+ } else if (!strcmp (argv [i], "--version")) {
+ log_info ("isc-dhclient-%s", DHCP_VERSION);
+ exit (0);
++ } else if (!strcmp (argv [i], "-x")) {
++ /* ignored for compatibility */
++ continue;
+ } else if (!strcmp (argv [i], "-I")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
+ usage ();
dhcp-3.0.5-unicast-bootp.patch:
Index: dhcp-3.0.5-unicast-bootp.patch
===================================================================
RCS file: dhcp-3.0.5-unicast-bootp.patch
diff -N dhcp-3.0.5-unicast-bootp.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dhcp-3.0.5-unicast-bootp.patch 11 Jan 2008 00:16:44 -0000 1.3
@@ -0,0 +1,97 @@
+--- dhcp-3.0.5/server/bootp.c.unicast 2005-05-18 15:54:17.000000000 -0400
++++ dhcp-3.0.5/server/bootp.c 2007-03-30 16:16:00.000000000 -0400
+@@ -62,6 +62,7 @@
+ char msgbuf [1024];
+ int ignorep;
+ int peer_has_leases = 0;
++ int norelay = 0;
+
+ if (packet -> raw -> op != BOOTREQUEST)
+ return;
+@@ -77,7 +78,7 @@
+ ? inet_ntoa (packet -> raw -> giaddr)
+ : packet -> interface -> name);
+
+- if (!locate_network (packet)) {
++ if ((norelay = locate_network (packet)) == 0) {
+ log_info ("%s: network unknown", msgbuf);
+ return;
+ }
+@@ -357,6 +358,13 @@
+ from, &to, &hto);
+ goto out;
+ }
++ } else if (norelay == 2) {
++ to.sin_addr = raw.ciaddr;
++ to.sin_port = remote_port;
++ if (fallback_interface) {
++ result = send_packet (fallback_interface, (struct packet *)0, &raw, outgoing.packet_length, from, &to, &hto);
++ goto out;
++ }
+
+ /* If it comes from a client that already knows its address
+ and is not requesting a broadcast response, and we can
+--- dhcp-3.0.5/server/dhcp.c.unicast 2007-03-30 16:13:36.000000000 -0400
++++ dhcp-3.0.5/server/dhcp.c 2007-03-30 16:19:35.000000000 -0400
+@@ -3817,6 +3817,7 @@
+ struct data_string data;
+ struct subnet *subnet = (struct subnet *)0;
+ struct option_cache *oc;
++ int norelay = 0;
+
+ /* See if there's a subnet selection option. */
+ oc = lookup_option (&dhcp_universe, packet -> options,
+@@ -3826,12 +3827,24 @@
+ from the interface, if there is one. If not, fail. */
+ if (!oc && !packet -> raw -> giaddr.s_addr) {
+ if (packet -> interface -> shared_network) {
+- shared_network_reference
+- (&packet -> shared_network,
+- packet -> interface -> shared_network, MDL);
+- return 1;
++ struct in_addr any_addr;
++ any_addr.s_addr = INADDR_ANY;
++
++ if (!packet -> packet_type && memcmp(&packet -> raw -> ciaddr, &any_addr, 4)) {
++ struct iaddr cip;
++ memcpy(cip.iabuf, &packet -> raw -> ciaddr, 4);
++ cip.len = 4;
++ if (!find_grouped_subnet(&subnet, packet->interface->shared_network, cip, MDL))
++ norelay = 2;
++ }
++
++ if (!norelay) {
++ shared_network_reference(&packet -> shared_network, packet -> interface -> shared_network, MDL);
++ return 1;
++ }
++ } else {
++ return 0;
+ }
+- return 0;
+ }
+
+ /* If there's an SSO, and it's valid, use it to figure out the
+@@ -3853,7 +3866,10 @@
+ data_string_forget (&data, MDL);
+ } else {
+ ia.len = 4;
+- memcpy (ia.iabuf, &packet -> raw -> giaddr, 4);
++ if (norelay)
++ memcpy (ia.iabuf, &packet->raw->ciaddr, 4);
++ else
++ memcpy (ia.iabuf, &packet->raw->giaddr, 4);
+ }
+
+ /* If we know the subnet on which the IP address lives, use it. */
+@@ -3861,7 +3877,10 @@
+ shared_network_reference (&packet -> shared_network,
+ subnet -> shared_network, MDL);
+ subnet_dereference (&subnet, MDL);
+- return 1;
++ if (norelay)
++ return norelay;
++ else
++ return 1;
+ }
+
+ /* Otherwise, fail. */
dhcp-3.0.5-selinux.patch:
Index: dhcp-3.0.5-selinux.patch
===================================================================
RCS file: dhcp-3.0.5-selinux.patch
diff -N dhcp-3.0.5-selinux.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dhcp-3.0.5-selinux.patch 11 Jan 2008 00:16:44 -0000 1.3
@@ -0,0 +1,11 @@
+--- dhcp-3.0.5/client/dhclient.c.selinux 2007-03-30 16:11:54.000000000 -0400
++++ dhcp-3.0.5/client/dhclient.c 2007-03-30 16:12:27.000000000 -0400
+@@ -3009,6 +3009,8 @@
+ wstatus = 0;
+ }
+ } else {
++ if (leaseFile)
++ fclose(leaseFile);
+ execve (scriptName, argv, envp);
+ log_error ("execve (%s, ...): %m", scriptName);
+ exit (0);
dhcp-3.0.5-release-by-ifup.patch:
Index: dhcp-3.0.5-release-by-ifup.patch
===================================================================
RCS file: dhcp-3.0.5-release-by-ifup.patch
diff -N dhcp-3.0.5-release-by-ifup.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dhcp-3.0.5-release-by-ifup.patch 11 Jan 2008 00:16:44 -0000 1.3
@@ -0,0 +1,84 @@
+--- dhcp-3.0.5/client/dhclient.c.release 2007-03-30 15:30:14.000000000 -0400
++++ dhcp-3.0.5/client/dhclient.c 2007-03-30 15:29:58.000000000 -0400
+@@ -366,9 +366,81 @@
+ }
+ }
+ fclose(pidfd);
++ } else {
++ /* handle release for interfaces requested with Red Hat
++ * /sbin/ifup - pidfile will be /var/run/dhclient-$interface.pid
++ */
++
++ if ((path_dhclient_pid == NULL) || (*path_dhclient_pid == '\0'))
++ path_dhclient_pid = "/var/run/dhclient.pid";
++
++ char *new_path_dhclient_pid;
++ struct interface_info *ip;
++ int pdp_len = strlen(path_dhclient_pid), pfx, dpfx;
++
++ /* find append point: beginning of any trailing '.pid'
++ * or '-$IF.pid' */
++ for (pfx=pdp_len; (pfx >= 0) && (path_dhclient_pid[pfx] != '.') && (path_dhclient_pid[pfx] != '/'); pfx--);
++ if (pfx == -1)
++ pfx = pdp_len;
++
++ if (path_dhclient_pid[pfx] == '/')
++ pfx += 1;
++
++ for (dpfx=pfx; (dpfx >= 0) && (path_dhclient_pid[dpfx] != '-') && (path_dhclient_pid[dpfx] != '/'); dpfx--);
++ if ((dpfx > -1) && (path_dhclient_pid[dpfx] != '/'))
++ pfx = dpfx;
++
++ for (ip = interfaces; ip; ip = ip->next) {
++ if (interfaces_requested && (ip->flags & (INTERFACE_REQUESTED)) && (ip->name != NULL)) {
++ int n_len = strlen(ip->name);
++
++ new_path_dhclient_pid = (char*) malloc(pfx + n_len + 6);
++ strncpy(new_path_dhclient_pid, path_dhclient_pid, pfx);
++ sprintf(new_path_dhclient_pid + pfx, "-%s.pid", ip->name);
++
++ if ((pidfd = fopen(new_path_dhclient_pid, "r")) != NULL) {
++ e = fscanf(pidfd, "%ld\n", &temp);
++ oldpid = (pid_t)temp;
++
++ if (e != 0 && e != EOF) {
++ if (oldpid) {
++ if (kill(oldpid, SIGTERM) == 0)
++ unlink(path_dhclient_pid);
++ }
++ }
++
++ fclose(pidfd);
++ }
++
++ free(new_path_dhclient_pid);
++ }
++ }
++ }
++ } else {
++ FILE *pidfp = NULL;
++ long temp = 0;
++ pid_t dhcpid = 0;
++ int dhc_running = 0;
++ char procfn[256] = "";
++
++ if ((pidfp = fopen(path_dhclient_pid, "r")) != NULL) {
++ if ((fscanf(pidfp, "%ld", &temp)==1) && ((dhcpid=(pid_t)temp) > 0)) {
++ snprintf(procfn,256,"/proc/%u",dhcpid);
++ dhc_running = (access(procfn, F_OK) == 0);
++ }
++
++ fclose(pidfp);
++ }
++
++ if (dhc_running) {
++ log_fatal("dhclient(%u) is already running - exiting. ", dhcpid);
++ return(1);
+ }
+ }
+
++ write_client_pid_file();
++
+ if (!quiet) {
+ log_info ("%s %s", message, DHCP_VERSION);
+ log_info (copyright);
dhcp-3.0.5-prototypes.patch:
Index: dhcp-3.0.5-prototypes.patch
===================================================================
RCS file: dhcp-3.0.5-prototypes.patch
diff -N dhcp-3.0.5-prototypes.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dhcp-3.0.5-prototypes.patch 11 Jan 2008 00:16:44 -0000 1.3
@@ -0,0 +1,73 @@
+--- dhcp-3.0.5/dst/dst_api.c.prototypes 2007-04-01 16:29:10.000000000 -0400
++++ dhcp-3.0.5/dst/dst_api.c 2007-04-01 16:29:10.000000000 -0400
+@@ -58,6 +58,10 @@
+
+ #include "dst_internal.h"
+
++/* prototypes */
++extern int b64_pton(char const *src, u_char *target, size_t targsize);
++extern int b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize);
++
+ /* static variables */
+ static int done_init = 0;
+ dst_func *dst_t_func[DST_MAX_ALGS];
+--- dhcp-3.0.5/dst/dst_support.c.prototypes 2001-02-22 02:22:08.000000000 -0500
++++ dhcp-3.0.5/dst/dst_support.c 2007-04-01 16:29:10.000000000 -0400
+@@ -32,6 +32,10 @@
+
+ #include "dst_internal.h"
+
++/* prototypes */
++extern int b64_pton(char const *src, u_char *target, size_t targsize);
++extern int b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize);
++
+ /*
+ * dst_s_conv_bignum_u8_to_b64
+ * This function converts binary data stored as a u_char[] to a
+--- dhcp-3.0.5/includes/minires/minires.h.prototypes 2004-06-10 13:59:37.000000000 -0400
++++ dhcp-3.0.5/includes/minires/minires.h 2007-04-01 16:29:10.000000000 -0400
+@@ -65,7 +65,6 @@
+ #define res_protocolname MRres_protocolname
+ #define res_servicename MRres_servicename
+ #define ns_datetosecs MRns_datetosecs
+-#define b64_pton MRb64_pton
+ #define res_ninit minires_ninit
+ #define res_randomid MRres_randomid
+ #define res_findzonecut MRres_findzonecut
+--- dhcp-3.0.5/minires/res_mkupdate.c.prototypes 2007-04-01 16:29:10.000000000 -0400
++++ dhcp-3.0.5/minires/res_mkupdate.c 2007-04-01 16:30:12.000000000 -0400
+@@ -49,6 +49,10 @@
+ #include "minires/minires.h"
+ #include "arpa/nameser.h"
+
++/* prototypes */
++extern int b64_pton(char const *src, u_char *target, size_t targsize);
++int dn_comp(const char *src, u_char *dst, unsigned dstsiz, u_char **dnptrs, u_char **lastdnptr);
++
+ /* Options. Leave them on. */
+ #define DEBUG
+ #define MAXPORT 1024
+--- dhcp-3.0.5/minires/res_comp.c.prototypes 2004-06-10 13:59:42.000000000 -0400
++++ dhcp-3.0.5/minires/res_comp.c 2007-04-01 16:31:02.000000000 -0400
+@@ -91,6 +91,11 @@
+ #include "minires/minires.h"
+ #include "arpa/nameser.h"
+
++/* prototypes */
++int ns_name_uncompress(const u_char *msg, const u_char *eom, const u_char *src, char *dst, size_t dstsiz);
++int ns_name_compress(const char *src, u_char *dst, size_t dstsiz, const u_char **dnptrs, const u_char **lastdnptr);
++int ns_name_skip(const u_char **ptrptr, const u_char *eom);
++
+ /*
+ * Expand compressed domain name 'comp_dn' to full domain name.
+ * 'msg' is a pointer to the begining of the message,
+--- dhcp-3.0.5/minires/res_init.c.prototypes 2004-06-10 13:59:43.000000000 -0400
++++ dhcp-3.0.5/minires/res_init.c 2007-04-01 16:31:38.000000000 -0400
+@@ -102,6 +102,7 @@
+ #define DEBUG
+
+ static void res_setoptions (res_state, const char *, const char *);
++u_int res_randomid(void);
+
+ #ifdef RESOLVSORT
+ static const char sort_mask[] = "/&";
dhcp-3.0.5-inherit-leases.patch:
Index: dhcp-3.0.5-inherit-leases.patch
===================================================================
RCS file: dhcp-3.0.5-inherit-leases.patch
diff -N dhcp-3.0.5-inherit-leases.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dhcp-3.0.5-inherit-leases.patch 11 Jan 2008 00:16:44 -0000 1.3
@@ -0,0 +1,17 @@
+--- dhcp-3.0.5/client/dhclient.c.inherit 2007-03-30 16:06:30.000000000 -0400
++++ dhcp-3.0.5/client/dhclient.c 2007-03-30 16:09:06.000000000 -0400
+@@ -720,6 +720,14 @@
+ continue;
+ script_init (ip -> client,
+ "PREINIT", (struct string_list *)0);
++ /* Has an active lease */
++ if (ip->client->active &&
++ !ip->client->active->is_bootp &&
++ ip->client->active->expiry > cur_time &&
++ ip->primary_address.s_addr != 0 &&
++ ip->client->active->address.len == 4 &&
++ memcmp(ip->client->active->address.iabuf, &ip->primary_address, 4) == 0)
++ client_envadd(ip->client, "", "keep_old_ip", "%s", "yes");
+ if (ip -> client -> alias)
+ script_write_params (ip -> client, "alias_",
+ ip -> client -> alias);
dhcp-3.0.5-fast-timeout.patch:
Index: dhcp-3.0.5-fast-timeout.patch
===================================================================
RCS file: dhcp-3.0.5-fast-timeout.patch
diff -N dhcp-3.0.5-fast-timeout.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dhcp-3.0.5-fast-timeout.patch 11 Jan 2008 00:16:44 -0000 1.3
@@ -0,0 +1,14 @@
+--- dhcp-3.0.5/client/dhclient.c.fast 2007-03-30 16:22:54.000000000 -0400
++++ dhcp-3.0.5/client/dhclient.c 2007-03-30 16:26:11.000000000 -0400
+@@ -766,10 +766,7 @@
+ do_release (client);
+ else {
+ client -> state = S_INIT;
+- /* Set up a timeout to start the initialization
+- process. */
+- add_timeout (cur_time + random () % 5,
+- state_reboot, client, 0, 0);
++ add_timeout (cur_time, state_reboot, client, 0, 0);
+ }
+ }
+ }
- Previous message (by thread): rpms/dhcp/devel linux, 1.9, 1.10 libdhcp_control.h, 1.5, 1.6 libdhcp4client.pc, 1.5, 1.6 get-ldap-patch.sh, 1.2, 1.3 draft-ietf-dhc-ldap-schema-01.txt, 1.4, 1.5 dhcrelay.init, 1.8, 1.9 dhcpd.init, 1.24, 1.25 dhcpd.conf.sample, 1.5, 1.6 dhclient-script.8, 1.3, 1.4 dhclient.8, 1.3, 1.4 dhclient.conf.5, 1.3, 1.4 dhcp-options.5, 1.3, 1.4 dhcpd.conf.5, 1.3, 1.4 dhcpctl.3, 1.2, 1.3 dhcp4client.h, 1.4, 1.5 dhcp.schema, 1.3, 1.4 sources, 1.21, 1.22
- Next message (by thread): rpms/soundconverter/devel .cvsignore, 1.10, 1.11 soundconverter.spec, 1.15, 1.16 sources, 1.10, 1.11
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list