This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "IPFire 3.x development tree".
The branch, master has been updated via cf8d9c33032cbf9269cb4101229a4171defc77d1 (commit) via e8744052f2b8bee4d7581ad3b501a977187dc22f (commit) via 7748d56fa7bf229f351ff63210d97e9e900f1237 (commit) via 6205da65c5aad2269a62ce3b81f55dd0b6c4dfcc (commit) via e1b23d7a13d9a516e75079a3c17ca626965491bc (commit) via 444c11848eb724d4aa47edf0e39af1c16320243a (commit) via b781eae54d011280936fea367d0be6f6e2bd8c2a (commit) from c08a5fb64f9b6359f63dbc35168e89e31e0aa7d0 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit cf8d9c33032cbf9269cb4101229a4171defc77d1 Merge: e874405 c08a5fb Author: Michael Tremer michael.tremer@ipfire.org Date: Wed Oct 3 17:53:29 2012 +0000
Merge branch 'master' of ssh://git.ipfire.org/pub/git/ipfire-3.x
commit e8744052f2b8bee4d7581ad3b501a977187dc22f Author: Michael Tremer michael.tremer@ipfire.org Date: Wed Oct 3 17:48:12 2012 +0000
network: Update to 005.
commit 7748d56fa7bf229f351ff63210d97e9e900f1237 Merge: 6205da6 444c118 Author: Michael Tremer michael.tremer@ipfire.org Date: Wed Oct 3 17:40:43 2012 +0000
Merge branch 'dhcp'
commit 6205da65c5aad2269a62ce3b81f55dd0b6c4dfcc Author: Michael Tremer michael.tremer@ipfire.org Date: Wed Oct 3 17:40:04 2012 +0000
wpa_supplicant: Add systemd unit file.
commit e1b23d7a13d9a516e75079a3c17ca626965491bc Author: Michael Tremer michael.tremer@ipfire.org Date: Wed Oct 3 17:26:39 2012 +0000
initscripts: Enhance ipcalc with IPv6 implode/explode.
commit 444c11848eb724d4aa47edf0e39af1c16320243a Author: Michael Tremer michael.tremer@ipfire.org Date: Sat Sep 15 09:12:10 2012 +0000
dhcp: Update to 4.2.4.
Fixes configuration files, defined in the systemd unit files.
commit b781eae54d011280936fea367d0be6f6e2bd8c2a Author: Michael Tremer michael.tremer@ipfire.org Date: Sun Sep 9 16:09:55 2012 +0000
dhcp: Fix some configuration paths.
Enable automatic generation of configuration files for the server daemons.
-----------------------------------------------------------------------
Summary of changes: dhcp/dhcp.nm | 71 ++-- dhcp/patches/dhcp-4.2.0-CLOEXEC.patch | 422 ------------------- dhcp/patches/dhcp-4.2.0-inherit-leases.patch | 34 -- dhcp/patches/dhcp-4.2.0-noprefixavail.patch | 140 ------- dhcp/patches/dhcp-4.2.0-paths.patch | 45 -- dhcp/patches/dhcp-4.2.1-P1-CVE-2011-0997.patch | 16 - .../patches/dhcp-4.2.1-invalid-dhclient-conf.patch | 12 - dhcp/patches/dhcp-4.2.2-CLOEXEC.patch | 60 --- dhcp/patches/dhcp-4.2.2-capability.patch | 73 ---- dhcp/patches/dhcp-4.2.2-gpxe-cid.patch | 53 +--- dhcp/patches/dhcp-4.2.2-sharedlib.patch | 57 +-- dhcp/patches/dhcp-4.2.3-P2-log_perror.patch | 11 + ...2-rfc5970-dhcpv6-options-for-network-boot.patch | 89 ++++ .../dhcp-4.2.3-dhclient-decline-onetry.patch | 27 ++ dhcp/patches/dhcp-4.2.3-paranoia.patch | 49 +++ ...e.patch => dhcp-4.2.4-64_bit_lease_parse.patch} | 36 +- ....4-P1-dhclient6-leases_semicolon_expected.patch | 41 ++ dhcp/patches/dhcp-4.2.4-P1-interval.patch | 25 ++ dhcp/patches/dhcp-4.2.4-P1-remove-dst.patch | 46 ++ .../{dhcp-4.2.0-PPP.patch => dhcp-4.2.4-PPP.patch} | 64 ++-- ...lticast.patch => dhcp-4.2.4-UseMulticast.patch} | 38 ++- dhcp/patches/dhcp-4.2.4-failOverPeer.patch | 12 + dhcp/patches/dhcp-4.2.4-getifaddrs.patch | 431 ++++++++++++++++++++ ...ved-xid.patch => dhcp-4.2.4-improved-xid.patch} | 40 +- ...-4.2.2-lpf-ib.patch => dhcp-4.2.4-lpf-ib.patch} | 175 +++++---- ....2.2-options.patch => dhcp-4.2.4-options.patch} | 76 ++-- dhcp/patches/dhcp-4.2.4-paths.patch | 26 ++ ...cp-4.2.4-rfc3442-classless-static-routes.patch} | 92 ++-- dhcp/patches/dhcp-4.2.4-send_release.patch | 23 + ...-systemtap.patch => dhcp-4.2.4-systemtap.patch} | 182 ++++----- ...-bootp.patch => dhcp-4.2.4-unicast-bootp.patch} | 32 +- dhcp/systemd/dhcpd.service | 5 +- dhcp/systemd/dhcpd6.service | 5 +- initscripts/initscripts.nm | 2 +- ...Enhance-to-implode-explode-IPv6-addresses.patch | 93 +++++ .../0001-ipcalc-Implement-prefix-for-IPv6.patch | 84 ++++ network/network.nm | 10 +- wpa_supplicant/systemd/wpa_supplicant@.service | 11 + wpa_supplicant/wpa_supplicant.nm | 4 +- 39 files changed, 1412 insertions(+), 1300 deletions(-) delete mode 100644 dhcp/patches/dhcp-4.2.0-CLOEXEC.patch delete mode 100644 dhcp/patches/dhcp-4.2.0-inherit-leases.patch delete mode 100644 dhcp/patches/dhcp-4.2.0-noprefixavail.patch delete mode 100644 dhcp/patches/dhcp-4.2.0-paths.patch delete mode 100644 dhcp/patches/dhcp-4.2.1-P1-CVE-2011-0997.patch delete mode 100644 dhcp/patches/dhcp-4.2.1-invalid-dhclient-conf.patch create mode 100644 dhcp/patches/dhcp-4.2.3-P2-log_perror.patch create mode 100644 dhcp/patches/dhcp-4.2.3-P2-rfc5970-dhcpv6-options-for-network-boot.patch create mode 100644 dhcp/patches/dhcp-4.2.3-dhclient-decline-onetry.patch create mode 100644 dhcp/patches/dhcp-4.2.3-paranoia.patch rename dhcp/patches/{dhcp-4.2.1-64_bit_lease_parse.patch => dhcp-4.2.4-64_bit_lease_parse.patch} (64%) create mode 100644 dhcp/patches/dhcp-4.2.4-P1-dhclient6-leases_semicolon_expected.patch create mode 100644 dhcp/patches/dhcp-4.2.4-P1-interval.patch create mode 100644 dhcp/patches/dhcp-4.2.4-P1-remove-dst.patch rename dhcp/patches/{dhcp-4.2.0-PPP.patch => dhcp-4.2.4-PPP.patch} (65%) rename dhcp/patches/{dhcp-4.2.0-UseMulticast.patch => dhcp-4.2.4-UseMulticast.patch} (85%) create mode 100644 dhcp/patches/dhcp-4.2.4-failOverPeer.patch create mode 100644 dhcp/patches/dhcp-4.2.4-getifaddrs.patch rename dhcp/patches/{dhcp-4.2.2-improved-xid.patch => dhcp-4.2.4-improved-xid.patch} (78%) rename dhcp/patches/{dhcp-4.2.2-lpf-ib.patch => dhcp-4.2.4-lpf-ib.patch} (79%) rename dhcp/patches/{dhcp-4.2.2-options.patch => dhcp-4.2.4-options.patch} (82%) create mode 100644 dhcp/patches/dhcp-4.2.4-paths.patch rename dhcp/patches/{dhcp-4.2.2-rfc3442-classless-static-routes.patch => dhcp-4.2.4-rfc3442-classless-static-routes.patch} (81%) create mode 100644 dhcp/patches/dhcp-4.2.4-send_release.patch rename dhcp/patches/{dhcp-4.2.2-systemtap.patch => dhcp-4.2.4-systemtap.patch} (76%) rename dhcp/patches/{dhcp-4.2.0-unicast-bootp.patch => dhcp-4.2.4-unicast-bootp.patch} (72%) create mode 100644 initscripts/patches/0001-ipcalc-Enhance-to-implode-explode-IPv6-addresses.patch create mode 100644 initscripts/patches/0001-ipcalc-Implement-prefix-for-IPv6.patch create mode 100644 wpa_supplicant/systemd/wpa_supplicant@.service
Difference in files: diff --git a/dhcp/dhcp.nm b/dhcp/dhcp.nm index c2db7d2..f97734b 100644 --- a/dhcp/dhcp.nm +++ b/dhcp/dhcp.nm @@ -4,8 +4,8 @@ ###############################################################################
name = dhcp -version = 4.2.2 -release = 4 +version = 4.2.4 +release = 1
groups = Networking/Daemons url = http://isc.org/products/DHCP/ @@ -20,41 +20,49 @@ description easier to administer a large network. end
-source_dl = ftp://ftp.isc.org/isc/dhcp/ +source_dl = ftp://ftp.isc.org/isc/dhcp/%{version}/
# Apply patches in a special order. patches = \ dhcp-4.2.2-remove-bind.patch \ + dhcp-4.2.4-P1-remove-dst.patch \ dhcp-4.2.0-errwarn-message.patch \ - dhcp-4.2.2-options.patch \ + dhcp-4.2.4-options.patch \ dhcp-4.2.0-release-by-ifup.patch \ dhcp-4.2.0-dhclient-decline-backoff.patch \ - dhcp-4.2.0-unicast-bootp.patch \ + dhcp-4.2.4-unicast-bootp.patch \ dhcp-4.2.2-dhclient-usage.patch \ dhcp-4.2.0-default-requested-options.patch \ dhcp-4.2.2-xen-checksum.patch \ dhcp-4.2.1-manpages.patch \ - dhcp-4.2.0-paths.patch \ + dhcp-4.2.4-paths.patch \ dhcp-4.2.2-CLOEXEC.patch \ - dhcp-4.2.0-inherit-leases.patch \ dhcp-4.2.0-garbage-chars.patch \ dhcp-4.2.0-missing-ipv6-not-fatal.patch \ dhcp-4.2.0-add_timeout_when_NULL.patch \ - dhcp-4.2.1-64_bit_lease_parse.patch \ + dhcp-4.2.4-64_bit_lease_parse.patch \ dhcp-4.2.2-capability.patch \ dhcp-4.2.0-logpid.patch \ - dhcp-4.2.0-UseMulticast.patch \ + dhcp-4.2.4-UseMulticast.patch \ dhcp-4.2.1-sendDecline.patch \ dhcp-4.2.1-retransmission.patch \ - dhcp-4.2.2-rfc3442-classless-static-routes.patch \ + dhcp-4.2.4-rfc3442-classless-static-routes.patch \ dhcp-4.2.0-honor-expired.patch \ - dhcp-4.2.0-noprefixavail.patch \ dhcp-4.2.2-sharedlib.patch \ - dhcp-4.2.0-PPP.patch \ - dhcp-4.2.2-lpf-ib.patch \ - dhcp-4.2.2-improved-xid.patch \ + dhcp-4.2.4-PPP.patch \ + dhcp-4.2.3-paranoia.patch \ + dhcp-4.2.4-lpf-ib.patch \ + dhcp-4.2.4-improved-xid.patch \ dhcp-4.2.2-gpxe-cid.patch \ - dhcp-4.2.2-systemtap.patch + dhcp-4.2.4-systemtap.patch \ + dhcp-4.2.3-dhclient-decline-onetry.patch \ + dhcp-4.2.3-P2-log_perror.patch \ + dhcp-4.2.4-getifaddrs.patch \ + dhcp-4.2.4-send_release.patch \ + dhcp-4.2.3-P2-rfc5970-dhcpv6-options-for-network-boot.patch \ + dhcp-4.2.4-failOverPeer.patch \ + dhcp-4.2.4-P1-dhclient6-leases_semicolon_expected.patch \ + dhcp-4.2.4-P1-interval.patch
build requires @@ -69,15 +77,12 @@ build systemd-units end
- CFLAGS += \ - -fno-strict-aliasing \ - -D_GNU_SOURCE \ - -Wl,--as-needed + CFLAGS += -fno-strict-aliasing
configure_options += \ - --sysconfdir=/etc \ + --sysconfdir=%{sysconfdir}/dhcp \ --with-srv-lease-file=/var/lib/dhcpd/dhcpd.leases \ - --with-srv6-lease-file=/var/lib/dhcpd/dhcp6.leases \ + --with-srv6-lease-file=/var/lib/dhcpd/dhcpd6.leases \ --with-cli-lease-file=/var/lib/dhclient/dhclient.leases \ --with-cli6-lease-file=/var/lib/dhclient/dhclient6.leases \ --with-srv-pid-file=/run/dhcpd.pid \ @@ -97,13 +102,16 @@ build # Remove bundled BIND source rm -rvf %{DIR_APP}/bind/bind.tar.gz
+ # Remove dst. + rm -rvf dst includes/isc-dhcp + # Regenerate build environment - libtoolize --copy --force + #libtoolize --copy --force autoreconf --verbose --force --install end
install_cmds - rm -vf %{BUILDROOT}/etc/dhclient.conf + rm -vf %{BUILDROOT}%{sysconfdir}/dhcp/dhclient.conf
# Move the client to /sbin, create dirs # and remove the default config. @@ -127,19 +135,23 @@ end
packages package %{name} - requires - dhcp-common + dhcp-common = %{thisver} + dhcp-libs = %{thisver} + /usr/lib/network/helpers/dhcpd-config-helper end
prerequires += shadow-utils
+ configfiles + %{sysconfdir}/dhcp + end + script prein getent group dhcpd >/dev/null || groupadd -r dhcpd getent passwd dhcpd >/dev/null || \ useradd -r -g dhcpd -d /var/lib/dhcpd -s /sbin/nologin \ -c "User for the DHCP server" dhcpd - exit 0 end
# Just search for new unit files that were just installed. @@ -176,7 +188,8 @@ packages description = %{summary}
requires - dhcp-common + dhcp-common = %{thisver} + dhcp-libs = %{thisver} end
files @@ -205,6 +218,10 @@ packages summary = Common files used by the dhcp client and server. description = %{summary}
+ requires + dhcp-libs = %{thisver} + end + files /usr/bin/ /usr/share/man/man1/omshell.1* diff --git a/dhcp/patches/dhcp-4.2.0-CLOEXEC.patch b/dhcp/patches/dhcp-4.2.0-CLOEXEC.patch deleted file mode 100644 index 2483f55..0000000 --- a/dhcp/patches/dhcp-4.2.0-CLOEXEC.patch +++ /dev/null @@ -1,422 +0,0 @@ -diff -up dhcp-4.2.0/client/clparse.c.cloexec dhcp-4.2.0/client/clparse.c ---- dhcp-4.2.0/client/clparse.c.cloexec 2010-07-21 13:55:42.000000000 +0200 -+++ dhcp-4.2.0/client/clparse.c 2010-07-21 14:31:13.000000000 +0200 -@@ -211,7 +211,7 @@ int read_client_conf_file (const char *n - int token; - isc_result_t status; - -- if ((file = open (name, O_RDONLY)) < 0) -+ if ((file = open (name, O_RDONLY | O_CLOEXEC)) < 0) - return uerr2isc (errno); - - cfile = NULL; -@@ -248,7 +248,7 @@ void read_client_leases () - - /* Open the lease file. If we can't open it, just return - - we can safely trust the server to remember our state. */ -- if ((file = open (path_dhclient_db, O_RDONLY)) < 0) -+ if ((file = open (path_dhclient_db, O_RDONLY | O_CLOEXEC)) < 0) - return; - - cfile = NULL; -diff -up dhcp-4.2.0/client/dhclient.c.cloexec dhcp-4.2.0/client/dhclient.c ---- dhcp-4.2.0/client/dhclient.c.cloexec 2010-07-21 13:55:42.000000000 +0200 -+++ dhcp-4.2.0/client/dhclient.c 2010-07-21 14:33:44.000000000 +0200 -@@ -137,11 +137,11 @@ main(int argc, char **argv) { - /* Make sure that file descriptors 0 (stdin), 1, (stdout), and - 2 (stderr) are open. To do this, we assume that when we - open a file the lowest available file descriptor is used. */ -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 0) -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 1) -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 2) - log_perror = 0; /* No sense logging to /dev/null. */ - else if (fd != -1) -@@ -488,7 +488,7 @@ main(int argc, char **argv) { - int e; - - oldpid = 0; -- if ((pidfd = fopen(path_dhclient_pid, "r")) != NULL) { -+ if ((pidfd = fopen(path_dhclient_pid, "re")) != NULL) { - e = fscanf(pidfd, "%ld\n", &temp); - oldpid = (pid_t)temp; - -@@ -530,7 +530,7 @@ main(int argc, char **argv) { - 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) { -+ if ((pidfd = fopen(new_path_dhclient_pid, "re")) != NULL) { - e = fscanf(pidfd, "%ld\n", &temp); - oldpid = (pid_t)temp; - -@@ -555,7 +555,7 @@ main(int argc, char **argv) { - int dhc_running = 0; - char procfn[256] = ""; - -- if ((pidfp = fopen(path_dhclient_pid, "r")) != NULL) { -+ if ((pidfp = fopen(path_dhclient_pid, "re")) != 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); -@@ -2931,7 +2931,7 @@ void rewrite_client_leases () - - if (leaseFile != NULL) - fclose (leaseFile); -- leaseFile = fopen (path_dhclient_db, "w"); -+ leaseFile = fopen (path_dhclient_db, "we"); - if (leaseFile == NULL) { - log_error ("can't create %s: %m", path_dhclient_db); - return; -@@ -3035,7 +3035,7 @@ write_duid(struct data_string *duid) - return DHCP_R_INVALIDARG; - - if (leaseFile == NULL) { /* XXX? */ -- leaseFile = fopen(path_dhclient_db, "w"); -+ leaseFile = fopen(path_dhclient_db, "we"); - if (leaseFile == NULL) { - log_error("can't create %s: %m", path_dhclient_db); - return ISC_R_IOERROR; -@@ -3215,7 +3215,7 @@ int write_client_lease (client, lease, r - return 1; - - if (leaseFile == NULL) { /* XXX */ -- leaseFile = fopen (path_dhclient_db, "w"); -+ leaseFile = fopen (path_dhclient_db, "we"); - if (leaseFile == NULL) { - log_error ("can't create %s: %m", path_dhclient_db); - return 0; -@@ -3668,9 +3668,9 @@ void go_daemon () - close(2); - - /* Reopen them on /dev/null. */ -- open("/dev/null", O_RDWR); -- open("/dev/null", O_RDWR); -- open("/dev/null", O_RDWR); -+ open("/dev/null", O_RDWR | O_CLOEXEC); -+ open("/dev/null", O_RDWR | O_CLOEXEC); -+ open("/dev/null", O_RDWR | O_CLOEXEC); - - write_client_pid_file (); - -@@ -3682,14 +3682,14 @@ void write_client_pid_file () - FILE *pf; - int pfdesc; - -- pfdesc = open (path_dhclient_pid, O_CREAT | O_TRUNC | O_WRONLY, 0644); -+ pfdesc = open (path_dhclient_pid, O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC, 0644); - - if (pfdesc < 0) { - log_error ("Can't create %s: %m", path_dhclient_pid); - return; - } - -- pf = fdopen (pfdesc, "w"); -+ pf = fdopen (pfdesc, "we"); - if (!pf) - log_error ("Can't fdopen %s: %m", path_dhclient_pid); - else { -diff -up dhcp-4.2.0/common/bpf.c.cloexec dhcp-4.2.0/common/bpf.c ---- dhcp-4.2.0/common/bpf.c.cloexec 2009-11-20 02:48:59.000000000 +0100 -+++ dhcp-4.2.0/common/bpf.c 2010-07-21 14:31:13.000000000 +0200 -@@ -94,7 +94,7 @@ int if_register_bpf (info) - for (b = 0; 1; b++) { - /* %Audit% 31 bytes max. %2004.06.17,Safe% */ - sprintf(filename, BPF_FORMAT, b); -- sock = open (filename, O_RDWR, 0); -+ sock = open (filename, O_RDWR | O_CLOEXEC, 0); - if (sock < 0) { - if (errno == EBUSY) { - continue; -diff -up dhcp-4.2.0/common/discover.c.cloexec dhcp-4.2.0/common/discover.c ---- dhcp-4.2.0/common/discover.c.cloexec 2009-10-28 05:12:29.000000000 +0100 -+++ dhcp-4.2.0/common/discover.c 2010-07-21 14:31:13.000000000 +0200 -@@ -409,7 +409,7 @@ begin_iface_scan(struct iface_conf_list - int len; - int i; - -- ifaces->fp = fopen("/proc/net/dev", "r"); -+ ifaces->fp = fopen("/proc/net/dev", "re"); - if (ifaces->fp == NULL) { - log_error("Error opening '/proc/net/dev' to list interfaces"); - return 0; -@@ -444,7 +444,7 @@ begin_iface_scan(struct iface_conf_list - - #ifdef DHCPv6 - if (local_family == AF_INET6) { -- ifaces->fp6 = fopen("/proc/net/if_inet6", "r"); -+ ifaces->fp6 = fopen("/proc/net/if_inet6", "re"); - if (ifaces->fp6 == NULL) { - log_error("Error opening '/proc/net/if_inet6' to " - "list IPv6 interfaces; %m"); -diff -up dhcp-4.2.0/common/dlpi.c.cloexec dhcp-4.2.0/common/dlpi.c ---- dhcp-4.2.0/common/dlpi.c.cloexec 2009-11-20 02:49:00.000000000 +0100 -+++ dhcp-4.2.0/common/dlpi.c 2010-07-21 14:31:13.000000000 +0200 -@@ -807,7 +807,7 @@ dlpiopen(const char *ifname) { - } - *dp = '\0'; - -- return open (devname, O_RDWR, 0); -+ return open (devname, O_RDWR | O_CLOEXEC, 0); - } - - /* -diff -up dhcp-4.2.0/common/nit.c.cloexec dhcp-4.2.0/common/nit.c ---- dhcp-4.2.0/common/nit.c.cloexec 2009-11-20 02:49:01.000000000 +0100 -+++ dhcp-4.2.0/common/nit.c 2010-07-21 14:31:13.000000000 +0200 -@@ -81,7 +81,7 @@ int if_register_nit (info) - struct strioctl sio; - - /* Open a NIT device */ -- sock = open ("/dev/nit", O_RDWR); -+ sock = open ("/dev/nit", O_RDWR | O_CLOEXEC); - if (sock < 0) - log_fatal ("Can't open NIT device for %s: %m", info -> name); - -diff -up dhcp-4.2.0/common/resolv.c.cloexec dhcp-4.2.0/common/resolv.c ---- dhcp-4.2.0/common/resolv.c.cloexec 2009-11-20 02:49:01.000000000 +0100 -+++ dhcp-4.2.0/common/resolv.c 2010-07-21 14:31:13.000000000 +0200 -@@ -49,7 +49,7 @@ void read_resolv_conf (parse_time) - struct domain_search_list *dp, *dl, *nd; - isc_result_t status; - -- if ((file = open (path_resolv_conf, O_RDONLY)) < 0) { -+ if ((file = open (path_resolv_conf, O_RDONLY | O_CLOEXEC)) < 0) { - log_error ("Can't open %s: %m", path_resolv_conf); - return; - } -diff -up dhcp-4.2.0/common/upf.c.cloexec dhcp-4.2.0/common/upf.c ---- dhcp-4.2.0/common/upf.c.cloexec 2009-11-20 02:49:01.000000000 +0100 -+++ dhcp-4.2.0/common/upf.c 2010-07-21 14:31:13.000000000 +0200 -@@ -77,7 +77,7 @@ int if_register_upf (info) - /* %Audit% Cannot exceed 36 bytes. %2004.06.17,Safe% */ - sprintf(filename, "/dev/pf/pfilt%d", b); - -- sock = open (filename, O_RDWR, 0); -+ sock = open (filename, O_RDWR | O_CLOEXEC, 0); - if (sock < 0) { - if (errno == EBUSY) { - continue; -diff -up dhcp-4.2.0/dst/dst_api.c.cloexec dhcp-4.2.0/dst/dst_api.c ---- dhcp-4.2.0/dst/dst_api.c.cloexec 2009-10-29 01:46:48.000000000 +0100 -+++ dhcp-4.2.0/dst/dst_api.c 2010-07-21 14:31:13.000000000 +0200 -@@ -437,7 +437,7 @@ dst_s_write_private_key(const DST_KEY *k - PRIVATE_KEY, PATH_MAX); - - /* Do not overwrite an existing file */ -- if ((fp = dst_s_fopen(file, "w", 0600)) != NULL) { -+ if ((fp = dst_s_fopen(file, "we", 0600)) != NULL) { - int nn; - if ((nn = fwrite(encoded_block, 1, len, fp)) != len) { - EREPORT(("dst_write_private_key(): Write failure on %s %d != %d errno=%d\n", -@@ -494,7 +494,7 @@ dst_s_read_public_key(const char *in_nam - * flags, proto, alg stored as decimal (or hex numbers FIXME). - * (FIXME: handle parentheses for line continuation.) - */ -- if ((fp = dst_s_fopen(name, "r", 0)) == NULL) { -+ if ((fp = dst_s_fopen(name, "re", 0)) == NULL) { - EREPORT(("dst_read_public_key(): Public Key not found %s\n", - name)); - return (NULL); -@@ -620,7 +620,7 @@ dst_s_write_public_key(const DST_KEY *ke - return (0); - } - /* create public key file */ -- if ((fp = dst_s_fopen(filename, "w+", 0644)) == NULL) { -+ if ((fp = dst_s_fopen(filename, "w+e", 0644)) == NULL) { - EREPORT(("DST_write_public_key: open of file:%s failed (errno=%d)\n", - filename, errno)); - return (0); -@@ -854,7 +854,7 @@ dst_s_read_private_key_file(char *name, - return (0); - } - /* first check if we can find the key file */ -- if ((fp = dst_s_fopen(filename, "r", 0)) == NULL) { -+ if ((fp = dst_s_fopen(filename, "re", 0)) == NULL) { - EREPORT(("dst_s_read_private_key_file: Could not open file %s in directory %s\n", - filename, dst_path[0] ? dst_path : - (char *) getcwd(NULL, PATH_MAX - 1))); -diff -up dhcp-4.2.0/dst/prandom.c.cloexec dhcp-4.2.0/dst/prandom.c ---- dhcp-4.2.0/dst/prandom.c.cloexec 2009-11-20 02:49:01.000000000 +0100 -+++ dhcp-4.2.0/dst/prandom.c 2010-07-21 14:31:13.000000000 +0200 -@@ -269,7 +269,7 @@ get_dev_random(u_char *output, unsigned - - s = stat("/dev/random", &st); - if (s == 0 && S_ISCHR(st.st_mode)) { -- if ((fd = open("/dev/random", O_RDONLY | O_NONBLOCK)) != -1) { -+ if ((fd = open("/dev/random", O_RDONLY | O_NONBLOCK | O_CLOEXEC)) != -1) { - if ((n = read(fd, output, size)) < 0) - n = 0; - close(fd); -@@ -480,7 +480,7 @@ digest_file(dst_work *work) - work->file_digest = dst_free_key(work->file_digest); - return (0); - } -- if ((fp = fopen(name, "r")) == NULL) -+ if ((fp = fopen(name, "re")) == NULL) - return (0); - for (no = 0; (i = fread(buf, sizeof(*buf), sizeof(buf), fp)) > 0; - no += i) -diff -up dhcp-4.2.0/omapip/trace.c.cloexec dhcp-4.2.0/omapip/trace.c ---- dhcp-4.2.0/omapip/trace.c.cloexec 2010-06-01 19:29:59.000000000 +0200 -+++ dhcp-4.2.0/omapip/trace.c 2010-07-21 14:36:48.000000000 +0200 -@@ -141,10 +141,10 @@ isc_result_t trace_begin (const char *fi - return DHCP_R_INVALIDARG; - } - -- traceoutfile = open (filename, O_CREAT | O_WRONLY | O_EXCL, 0600); -+ traceoutfile = open (filename, O_CREAT | O_WRONLY | O_EXCL | O_CLOEXEC, 0600); - if (traceoutfile < 0 && errno == EEXIST) { - log_error ("WARNING: Overwriting trace file "%s"", filename); -- traceoutfile = open (filename, O_WRONLY | O_EXCL | O_TRUNC, -+ traceoutfile = open (filename, O_WRONLY | O_EXCL | O_TRUNC | O_CLOEXEC, - 0600); - } - -@@ -431,7 +431,7 @@ void trace_file_replay (const char *file - isc_result_t result; - int len; - -- traceinfile = fopen (filename, "r"); -+ traceinfile = fopen (filename, "re"); - if (!traceinfile) { - log_error("Can't open tracefile %s: %m", filename); - return; -diff -up dhcp-4.2.0/relay/dhcrelay.c.cloexec dhcp-4.2.0/relay/dhcrelay.c ---- dhcp-4.2.0/relay/dhcrelay.c.cloexec 2010-02-17 21:33:55.000000000 +0100 -+++ dhcp-4.2.0/relay/dhcrelay.c 2010-07-21 14:31:39.000000000 +0200 -@@ -177,11 +177,11 @@ main(int argc, char **argv) { - /* Make sure that file descriptors 0(stdin), 1,(stdout), and - 2(stderr) are open. To do this, we assume that when we - open a file the lowest available file descriptor is used. */ -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 0) -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 1) -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 2) - log_perror = 0; /* No sense logging to /dev/null. */ - else if (fd != -1) -@@ -520,12 +520,12 @@ main(int argc, char **argv) { - exit(0); - - pfdesc = open(path_dhcrelay_pid, -- O_CREAT | O_TRUNC | O_WRONLY, 0644); -+ O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC, 0644); - - if (pfdesc < 0) { - log_error("Can't create %s: %m", path_dhcrelay_pid); - } else { -- pf = fdopen(pfdesc, "w"); -+ pf = fdopen(pfdesc, "we"); - if (!pf) - log_error("Can't fdopen %s: %m", - path_dhcrelay_pid); -diff -up dhcp-4.2.0/server/confpars.c.cloexec dhcp-4.2.0/server/confpars.c ---- dhcp-4.2.0/server/confpars.c.cloexec 2010-03-24 22:49:47.000000000 +0100 -+++ dhcp-4.2.0/server/confpars.c 2010-07-21 14:31:39.000000000 +0200 -@@ -116,7 +116,7 @@ isc_result_t read_conf_file (const char - } - #endif - -- if ((file = open (filename, O_RDONLY)) < 0) { -+ if ((file = open (filename, O_RDONLY | O_CLOEXEC)) < 0) { - if (leasep) { - log_error ("Can't open lease database %s: %m --", - path_dhcpd_db); -diff -up dhcp-4.2.0/server/db.c.cloexec dhcp-4.2.0/server/db.c ---- dhcp-4.2.0/server/db.c.cloexec 2010-02-17 21:33:55.000000000 +0100 -+++ dhcp-4.2.0/server/db.c 2010-07-21 14:31:39.000000000 +0200 -@@ -1035,7 +1035,7 @@ void db_startup (testp) - } - #endif - if (!testp) { -- db_file = fopen (path_dhcpd_db, "a"); -+ db_file = fopen (path_dhcpd_db, "ae"); - if (!db_file) - log_fatal ("Can't open %s for append.", path_dhcpd_db); - expire_all_pools (); -@@ -1083,12 +1083,12 @@ int new_lease_file () - path_dhcpd_db, (int)t) >= sizeof newfname) - log_fatal("new_lease_file: lease file path too long"); - -- db_fd = open (newfname, O_WRONLY | O_TRUNC | O_CREAT, 0664); -+ db_fd = open (newfname, O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, 0664); - if (db_fd < 0) { - log_error ("Can't create new lease file: %m"); - return 0; - } -- if ((new_db_file = fdopen(db_fd, "w")) == NULL) { -+ if ((new_db_file = fdopen(db_fd, "we")) == NULL) { - log_error("Can't fdopen new lease file: %m"); - close(db_fd); - goto fdfail; -diff -up dhcp-4.2.0/server/dhcpd.c.cloexec dhcp-4.2.0/server/dhcpd.c ---- dhcp-4.2.0/server/dhcpd.c.cloexec 2010-06-01 19:29:59.000000000 +0200 -+++ dhcp-4.2.0/server/dhcpd.c 2010-07-21 14:31:39.000000000 +0200 -@@ -268,11 +268,11 @@ main(int argc, char **argv) { - /* Make sure that file descriptors 0 (stdin), 1, (stdout), and - 2 (stderr) are open. To do this, we assume that when we - open a file the lowest available file descriptor is used. */ -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 0) -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 1) -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 2) - log_perror = 0; /* No sense logging to /dev/null. */ - else if (fd != -1) -@@ -780,7 +780,7 @@ main(int argc, char **argv) { - #endif /* PARANOIA */ - - /* Read previous pid file. */ -- if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) { -+ if ((i = open (path_dhcpd_pid, O_RDONLY | O_CLOEXEC)) >= 0) { - status = read(i, pbuf, (sizeof pbuf) - 1); - close (i); - if (status > 0) { -@@ -798,7 +798,7 @@ main(int argc, char **argv) { - } - - /* Write new pid file. */ -- if ((i = open(path_dhcpd_pid, O_WRONLY|O_CREAT|O_TRUNC, 0644)) >= 0) { -+ if ((i = open(path_dhcpd_pid, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0644)) >= 0) { - sprintf(pbuf, "%d\n", (int) getpid()); - IGNORE_RET (write(i, pbuf, strlen(pbuf))); - close(i); -@@ -824,9 +824,9 @@ main(int argc, char **argv) { - close(2); - - /* Reopen them on /dev/null. */ -- open("/dev/null", O_RDWR); -- open("/dev/null", O_RDWR); -- open("/dev/null", O_RDWR); -+ open("/dev/null", O_RDWR | O_CLOEXEC); -+ open("/dev/null", O_RDWR | O_CLOEXEC); -+ open("/dev/null", O_RDWR | O_CLOEXEC); - log_perror = 0; /* No sense logging to /dev/null. */ - - IGNORE_RET (chdir("/")); -diff -up dhcp-4.2.0/server/ldap.c.cloexec dhcp-4.2.0/server/ldap.c ---- dhcp-4.2.0/server/ldap.c.cloexec 2010-03-25 16:26:58.000000000 +0100 -+++ dhcp-4.2.0/server/ldap.c 2010-07-21 14:31:39.000000000 +0200 -@@ -685,7 +685,7 @@ ldap_start (void) - - if (ldap_debug_file != NULL && ldap_debug_fd == -1) - { -- if ((ldap_debug_fd = open (ldap_debug_file, O_CREAT | O_TRUNC | O_WRONLY, -+ if ((ldap_debug_fd = open (ldap_debug_file, O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC, - S_IRUSR | S_IWUSR)) < 0) - log_error ("Error opening debug LDAP log file %s: %s", ldap_debug_file, - strerror (errno)); diff --git a/dhcp/patches/dhcp-4.2.0-PPP.patch b/dhcp/patches/dhcp-4.2.0-PPP.patch deleted file mode 100644 index bef2be7..0000000 --- a/dhcp/patches/dhcp-4.2.0-PPP.patch +++ /dev/null @@ -1,150 +0,0 @@ -diff -up dhcp-4.2.0-P1/client/dhc6.c.PPP dhcp-4.2.0-P1/client/dhc6.c ---- dhcp-4.2.0-P1/client/dhc6.c.PPP 2010-11-05 10:47:37.000000000 +0100 -+++ dhcp-4.2.0-P1/client/dhc6.c 2010-11-09 15:54:12.000000000 +0100 -@@ -129,7 +129,7 @@ extern int stateless; - * is not how it is intended. Upcoming rearchitecting the client should - * address this "one daemon model." - */ --void -+isc_result_t - form_duid(struct data_string *duid, const char *file, int line) - { - struct interface_info *ip; -@@ -141,6 +141,15 @@ form_duid(struct data_string *duid, cons - if (ip == NULL) - log_fatal("Impossible condition at %s:%d.", MDL); - -+ while (ip && ip->hw_address.hbuf[0] == HTYPE_RESERVED) { -+ /* Try the other interfaces */ -+ log_debug("Cannot form default DUID from interface %s.", ip->name); -+ ip = ip->next; -+ } -+ if (ip == NULL) { -+ return ISC_R_UNEXPECTED; -+ } -+ - if ((ip->hw_address.hlen == 0) || - (ip->hw_address.hlen > sizeof(ip->hw_address.hbuf))) - log_fatal("Impossible hardware address length at %s:%d.", MDL); -@@ -176,6 +185,8 @@ form_duid(struct data_string *duid, cons - memcpy(duid->buffer->data + 4, ip->hw_address.hbuf + 1, - ip->hw_address.hlen - 1); - } -+ -+ return ISC_R_SUCCESS; - } - - /* -@@ -5289,7 +5300,8 @@ make_client6_options(struct client_state - */ - if ((oc = lookup_option(&dhcpv6_universe, *op, - D6O_CLIENTID)) == NULL) { -- if (!option_cache(&oc, &default_duid, NULL, clientid_option, -+ if (default_duid.len == 0 || -+ !option_cache(&oc, &default_duid, NULL, clientid_option, - MDL)) - log_fatal("Failure assembling a DUID."); - -diff -up dhcp-4.2.0-P1/client/dhclient.c.PPP dhcp-4.2.0-P1/client/dhclient.c ---- dhcp-4.2.0-P1/client/dhclient.c.PPP 2010-11-05 10:47:37.000000000 +0100 -+++ dhcp-4.2.0-P1/client/dhclient.c 2010-11-09 15:37:26.000000000 +0100 -@@ -911,8 +911,8 @@ main(int argc, char **argv) { - if (default_duid.buffer != NULL) - data_string_forget(&default_duid, MDL); - -- form_duid(&default_duid, MDL); -- write_duid(&default_duid); -+ if (form_duid(&default_duid, MDL) == ISC_R_SUCCESS) -+ write_duid(&default_duid); - } - - for (ip = interfaces ; ip != NULL ; ip = ip->next) { -diff -up dhcp-4.2.0-P1/common/bpf.c.PPP dhcp-4.2.0-P1/common/bpf.c ---- dhcp-4.2.0-P1/common/bpf.c.PPP 2010-11-05 10:47:37.000000000 +0100 -+++ dhcp-4.2.0-P1/common/bpf.c 2010-11-09 15:42:42.000000000 +0100 -@@ -599,6 +599,22 @@ get_hw_addr(const char *name, struct har - memcpy(&hw->hbuf[1], LLADDR(sa), sa->sdl_alen); - break; - #endif /* IFT_FDDI */ -+#if defined(IFT_PPP) -+ case IFT_PPP: -+ if (local_family != AF_INET6) -+ log_fatal("Unsupported device type %d for "%s"", -+ sa->sdl_type, name); -+ hw->hlen = 0; -+ hw->hbuf[0] = HTYPE_RESERVED; -+ /* 0xdeadbeef should never occur on the wire, -+ * and is a signature that something went wrong. -+ */ -+ hw->hbuf[1] = 0xde; -+ hw->hbuf[2] = 0xad; -+ hw->hbuf[3] = 0xbe; -+ hw->hbuf[4] = 0xef; -+ break; -+#endif - default: - log_fatal("Unsupported device type %d for "%s"", - sa->sdl_type, name); -diff -up dhcp-4.2.0-P1/common/lpf.c.PPP dhcp-4.2.0-P1/common/lpf.c ---- dhcp-4.2.0-P1/common/lpf.c.PPP 2010-11-05 10:47:37.000000000 +0100 -+++ dhcp-4.2.0-P1/common/lpf.c 2010-11-09 15:45:40.000000000 +0100 -@@ -502,6 +502,22 @@ get_hw_addr(const char *name, struct har - hw->hbuf[0] = HTYPE_FDDI; - memcpy(&hw->hbuf[1], sa->sa_data, 16); - break; -+#if defined(ARPHRD_PPP) -+ case ARPHRD_PPP: -+ if (local_family != AF_INET6) -+ log_fatal("Unsupported device type %d for "%s"", -+ sa->sa_family, name); -+ hw->hlen = 0; -+ hw->hbuf[0] = HTYPE_RESERVED; -+ /* 0xdeadbeef should never occur on the wire, -+ * and is a signature that something went wrong. -+ */ -+ hw->hbuf[1] = 0xde; -+ hw->hbuf[2] = 0xad; -+ hw->hbuf[3] = 0xbe; -+ hw->hbuf[4] = 0xef; -+ break; -+#endif - default: - log_fatal("Unsupported device type %ld for "%s"", - (long int)sa->sa_family, name); -diff -up dhcp-4.2.0-P1/includes/dhcpd.h.PPP dhcp-4.2.0-P1/includes/dhcpd.h ---- dhcp-4.2.0-P1/includes/dhcpd.h.PPP 2010-11-05 10:47:37.000000000 +0100 -+++ dhcp-4.2.0-P1/includes/dhcpd.h 2010-11-09 15:46:58.000000000 +0100 -@@ -2733,7 +2733,7 @@ void dhcpv4_client_assignments(void); - void dhcpv6_client_assignments(void); - - /* dhc6.c */ --void form_duid(struct data_string *duid, const char *file, int line); -+isc_result_t form_duid(struct data_string *duid, const char *file, int line); - void dhc6_lease_destroy(struct dhc6_lease **src, const char *file, int line); - void start_init6(struct client_state *client); - void start_info_request6(struct client_state *client); -diff -up dhcp-4.2.0-P1/includes/dhcp.h.PPP dhcp-4.2.0-P1/includes/dhcp.h ---- dhcp-4.2.0-P1/includes/dhcp.h.PPP 2010-11-05 10:47:37.000000000 +0100 -+++ dhcp-4.2.0-P1/includes/dhcp.h 2010-11-09 15:48:53.000000000 +0100 -@@ -80,6 +80,8 @@ struct dhcp_packet { - #define HTYPE_IEEE802 6 /* IEEE 802.2 Token Ring... */ - #define HTYPE_FDDI 8 /* FDDI... */ - -+#define HTYPE_RESERVED 0 /* RFC 5494 */ -+ - /* Magic cookie validating dhcp options field (and bootp vendor - extensions field). */ - #define DHCP_OPTIONS_COOKIE "\143\202\123\143" -diff -up dhcp-4.2.0-P1/server/dhcpv6.c.PPP dhcp-4.2.0-P1/server/dhcpv6.c ---- dhcp-4.2.0-P1/server/dhcpv6.c.PPP 2010-11-05 10:47:37.000000000 +0100 -+++ dhcp-4.2.0-P1/server/dhcpv6.c 2010-11-09 15:50:17.000000000 +0100 -@@ -300,6 +300,9 @@ generate_new_server_duid(void) { - if (p->hw_address.hlen > 0) { - break; - } -+ if (p->next == NULL && p->hw_address.hbuf[0] == HTYPE_RESERVED) { -+ log_error("Can not generate DUID from interfaces which do not have hardware addresses, please configure server-duid!"); -+ } - } - if (p == NULL) { - return ISC_R_UNEXPECTED; diff --git a/dhcp/patches/dhcp-4.2.0-UseMulticast.patch b/dhcp/patches/dhcp-4.2.0-UseMulticast.patch deleted file mode 100644 index 319344a..0000000 --- a/dhcp/patches/dhcp-4.2.0-UseMulticast.patch +++ /dev/null @@ -1,229 +0,0 @@ -diff -up dhcp-4.2.0/server/dhcpv6.c.UseMulticast dhcp-4.2.0/server/dhcpv6.c ---- dhcp-4.2.0/server/dhcpv6.c.UseMulticast 2010-06-01 19:30:00.000000000 +0200 -+++ dhcp-4.2.0/server/dhcpv6.c 2010-07-21 16:17:30.000000000 +0200 -@@ -346,6 +346,48 @@ generate_new_server_duid(void) { - } - - /* -+ * Is the D6O_UNICAST option defined in dhcpd.conf ? -+ */ -+static isc_boolean_t unicast_option_defined; -+ -+/* -+ * Did we already search dhcpd.conf for D6O_UNICAST option ? -+ * We need to store it here to not parse dhcpd.conf repeatedly. -+ */ -+static isc_boolean_t unicast_option_parsed = ISC_FALSE; -+ -+ -+/* -+ * Is the D6O_UNICAST option defined in dhcpd.conf ? -+ */ -+isc_boolean_t -+is_unicast_option_defined(void) { -+ struct option_state *opt_state; -+ struct option_cache *oc; -+ -+ /* -+ * If we are looking for the unicast option for the first time -+ */ -+ if (unicast_option_parsed == ISC_FALSE) { -+ unicast_option_parsed = ISC_TRUE; -+ opt_state = NULL; -+ if (!option_state_allocate(&opt_state, MDL)) { -+ log_fatal("No memory for option state."); -+ } -+ -+ execute_statements_in_scope(NULL, NULL, NULL, NULL, NULL, -+ opt_state, &global_scope, root_group, NULL); -+ -+ oc = lookup_option(&dhcpv6_universe, opt_state, D6O_UNICAST); -+ unicast_option_defined = (oc != NULL); -+ -+ option_state_dereference(&opt_state, MDL); -+ } -+ -+ return (unicast_option_defined); -+} -+ -+/* - * Get the client identifier from the packet. - */ - isc_result_t -@@ -1405,6 +1447,56 @@ lease_to_client(struct data_string *repl - reply.shared->group); - } - -+ /* reject unicast message, unless we set unicast option */ -+ if ((packet->unicast == ISC_TRUE) && !is_unicast_option_defined()) -+ /* -+ * RFC3315 section 18.2.1 (Request): -+ * -+ * When the server receives a Request message via unicast from a client -+ * to which the server has not sent a unicast option, the server -+ * discards the Request message and responds with a Reply message -+ * containing a Status Code option with the value UseMulticast, a Server -+ * Identifier option containing the server's DUID, the Client Identifier -+ * option from the client message, and no other options. -+ * -+ * Section 18.2.3 (Renew): -+ * -+ * When the server receives a Renew message via unicast from a client to -+ * which the server has not sent a unicast option, the server discards -+ * the Renew message and responds with a Reply message containing a -+ * Status Code option with the value UseMulticast, a Server Identifier -+ * option containing the server's DUID, the Client Identifier option -+ * from the client message, and no other options. -+ */ -+ { -+ /* Set the UseMulticast status code. */ -+ if (!set_status_code(STATUS_UseMulticast, -+ "Unicast not allowed by server.", -+ reply.opt_state)) { -+ log_error("lease_to_client: Unable to set " -+ "UseMulticast status code."); -+ goto exit; -+ } -+ -+ /* Rewind the cursor to the start. */ -+ reply.cursor = REPLY_OPTIONS_INDEX; -+ -+ /* -+ * Produce an reply that includes only: -+ * -+ * Status code. -+ * Server DUID. -+ * Client DUID. -+ */ -+ reply.cursor += store_options6((char *)reply.buf.data + -+ reply.cursor, -+ sizeof(reply.buf) - -+ reply.cursor, -+ reply.opt_state, reply.packet, -+ required_opts_NAA, -+ NULL); -+ } else if (no_resources_avail && (reply.ia_count != 0) && -+ (reply.packet->dhcpv6_msg_type == DHCPV6_SOLICIT)) - /* - * RFC3315 section 17.2.2 (Solicit): - * -@@ -1429,8 +1521,6 @@ lease_to_client(struct data_string *repl - * the server. - * Sends a Renew/Rebind if the IA is not in the Reply message. - */ -- if (no_resources_avail && (reply.ia_count != 0) && -- (reply.packet->dhcpv6_msg_type == DHCPV6_SOLICIT)) - { - /* Set the NoAddrsAvail status code. */ - if (!set_status_code(STATUS_NoAddrsAvail, -@@ -4128,7 +4218,6 @@ dhcpv6_solicit(struct data_string *reply - * Very similar to Solicit handling, except the server DUID is required. - */ - --/* TODO: reject unicast messages, unless we set unicast option */ - static void - dhcpv6_request(struct data_string *reply_ret, struct packet *packet) { - struct data_string client_id; -@@ -4443,7 +4532,6 @@ exit: - * except for the error code of when addresses don't match. - */ - --/* TODO: reject unicast messages, unless we set unicast option */ - static void - dhcpv6_renew(struct data_string *reply, struct packet *packet) { - struct data_string client_id; -@@ -4688,18 +4776,60 @@ iterate_over_ia_na(struct data_string *r - goto exit; - } - -- snprintf(status_msg, sizeof(status_msg), "%s received.", packet_type); -- if (!set_status_code(STATUS_Success, status_msg, opt_state)) { -- goto exit; -- } -+ /* reject unicast message, unless we set unicast option */ -+ if ((packet->unicast == ISC_TRUE) && !is_unicast_option_defined()) { -+ /* -+ * RFC3315 section 18.2.6 (Release): -+ * -+ * When the server receives a Release message via unicast from a client -+ * to which the server has not sent a unicast option, the server -+ * discards the Release message and responds with a Reply message -+ * containing a Status Code option with value UseMulticast, a Server -+ * Identifier option containing the server's DUID, the Client Identifier -+ * option from the client message, and no other options. -+ * -+ * Section 18.2.7 (Decline): -+ * -+ * When the server receives a Decline message via unicast from a client -+ * to which the server has not sent a unicast option, the server -+ * discards the Decline message and responds with a Reply message -+ * containing a Status Code option with the value UseMulticast, a Server -+ * Identifier option containing the server's DUID, the Client Identifier -+ * option from the client message, and no other options. -+ */ -+ snprintf(status_msg, sizeof(status_msg), -+ "%s received unicast.", packet_type); -+ if (!set_status_code(STATUS_UseMulticast, status_msg, opt_state)) { -+ goto exit; -+ } - -- /* -- * Add our options that are not associated with any IA_NA or IA_TA. -- */ -- reply_ofs += store_options6(reply_data+reply_ofs, -- sizeof(reply_data)-reply_ofs, -+ /* -+ * Produce an reply that includes only: -+ * -+ * Status code. -+ * Server DUID. -+ * Client DUID. -+ */ -+ reply_ofs += store_options6(reply_data+reply_ofs, -+ sizeof(reply_data)-reply_ofs, - opt_state, packet, -- required_opts, NULL); -+ required_opts_NAA, NULL); -+ -+ goto return_reply; -+ } else { -+ snprintf(status_msg, sizeof(status_msg), "%s received.", packet_type); -+ if (!set_status_code(STATUS_Success, status_msg, opt_state)) { -+ goto exit; -+ } -+ -+ /* -+ * Add our options that are not associated with any IA_NA or IA_TA. -+ */ -+ reply_ofs += store_options6(reply_data+reply_ofs, -+ sizeof(reply_data)-reply_ofs, -+ opt_state, packet, -+ required_opts, NULL); -+ } - - /* - * Loop through the IA_NA reported by the client, and deal with -@@ -4838,6 +4968,7 @@ iterate_over_ia_na(struct data_string *r - /* - * Return our reply to the caller. - */ -+return_reply: - reply_ret->len = reply_ofs; - reply_ret->buffer = NULL; - if (!buffer_allocate(&reply_ret->buffer, reply_ofs, MDL)) { -@@ -4883,7 +5014,6 @@ exit: - * we still need to be aware of this possibility. - */ - --/* TODO: reject unicast messages, unless we set unicast option */ - /* TODO: IA_TA */ - static void - dhcpv6_decline(struct data_string *reply, struct packet *packet) { -@@ -5355,7 +5485,6 @@ exit: - * Release means a client is done with the leases. - */ - --/* TODO: reject unicast messages, unless we set unicast option */ - static void - dhcpv6_release(struct data_string *reply, struct packet *packet) { - struct data_string client_id; diff --git a/dhcp/patches/dhcp-4.2.0-inherit-leases.patch b/dhcp/patches/dhcp-4.2.0-inherit-leases.patch deleted file mode 100644 index 052f642..0000000 --- a/dhcp/patches/dhcp-4.2.0-inherit-leases.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff -up dhcp-4.2.0/client/dhclient.c.inherit dhcp-4.2.0/client/dhclient.c ---- dhcp-4.2.0/client/dhclient.c.inherit 2010-07-21 14:33:44.000000000 +0200 -+++ dhcp-4.2.0/client/dhclient.c 2010-07-21 14:40:05.000000000 +0200 -@@ -2322,6 +2322,7 @@ void send_request (cpp) - { - struct client_state *client = cpp; - -+ int i; - int result; - int interval; - struct sockaddr_in destination; -@@ -2381,6 +2382,22 @@ void send_request (cpp) - /* Now do a preinit on the interface so that we can - discover a new address. */ - script_init (client, "PREINIT", (struct string_list *)0); -+ -+ /* Has an active lease */ -+ if (client -> interface -> addresses != NULL) { -+ for (i = 0; i < client -> interface -> address_count; i++) { -+ if (client -> active && -+ client -> active -> is_bootp && -+ client -> active -> expiry > cur_time && -+ client -> interface -> addresses[i].s_addr != 0 && -+ client -> active -> address.len == 4 && -+ memcpy (client -> active -> address.iabuf, &(client -> interface -> addresses[i]), 4) == 0) { -+ client_envadd (client, "", "keep_old_ip", "%s", "yes"); -+ break; -+ } -+ } -+ } -+ - if (client -> alias) - script_write_params (client, "alias_", - client -> alias); diff --git a/dhcp/patches/dhcp-4.2.0-noprefixavail.patch b/dhcp/patches/dhcp-4.2.0-noprefixavail.patch deleted file mode 100644 index 729a172..0000000 --- a/dhcp/patches/dhcp-4.2.0-noprefixavail.patch +++ /dev/null @@ -1,140 +0,0 @@ -diff -up dhcp-4.2.0/server/dhcpv6.c.noprefixavail dhcp-4.2.0/server/dhcpv6.c ---- dhcp-4.2.0/server/dhcpv6.c.noprefixavail 2010-10-07 13:48:45.000000000 +0200 -+++ dhcp-4.2.0/server/dhcpv6.c 2010-10-13 11:00:25.000000000 +0200 -@@ -1134,7 +1134,7 @@ try_client_v6_prefix(struct iasubopt **p - return DHCP_R_INVALIDARG; - } - tmp_plen = (int) requested_pref->data[0]; -- if ((tmp_plen < 3) || (tmp_plen > 128)) { -+ if ((tmp_plen < 3) || (tmp_plen > 128) ||((int)tmp_plen != pool->units)) { - return ISC_R_FAILURE; - } - memcpy(&tmp_pref, requested_pref->data + 1, sizeof(tmp_pref)); -@@ -1147,9 +1147,8 @@ try_client_v6_prefix(struct iasubopt **p - return ISC_R_FAILURE; - } - -- if (((int)tmp_plen != pool->units) || -- !ipv6_in_pool(&tmp_pref, pool)) { -- return ISC_R_FAILURE; -+ if (!ipv6_in_pool(&tmp_pref, pool)) { -+ return ISC_R_ADDRNOTAVAIL; - } - - if (prefix6_exists(pool, &tmp_pref, tmp_plen)) { -@@ -1409,13 +1408,6 @@ lease_to_client(struct data_string *repl - if ((status != ISC_R_SUCCESS) && - (status != ISC_R_NORESOURCES)) - goto exit; -- -- /* -- * If any prefix cannot be given to any IA_PD, then -- * set the NoPrefixAvail status code. -- */ -- if (reply.client_resources == 0) -- no_resources_avail = ISC_TRUE; - } - - /* -@@ -1549,36 +1541,6 @@ lease_to_client(struct data_string *repl - reply.opt_state, reply.packet, - required_opts_NAA, - NULL); -- } else if (no_resources_avail && (reply.ia_count == 0) && -- (reply.packet->dhcpv6_msg_type == DHCPV6_SOLICIT)) -- { -- /* Set the NoPrefixAvail status code. */ -- if (!set_status_code(STATUS_NoPrefixAvail, -- "No prefixes available for this " -- "interface.", reply.opt_state)) { -- log_error("lease_to_client: Unable to set " -- "NoPrefixAvail status code."); -- goto exit; -- } -- -- /* Rewind the cursor to the start. */ -- reply.cursor = REPLY_OPTIONS_INDEX; -- -- /* -- * Produce an advertise that includes only: -- * -- * Status code. -- * Server DUID. -- * Client DUID. -- */ -- reply.buf.reply.msg_type = DHCPV6_ADVERTISE; -- reply.cursor += store_options6((char *)reply.buf.data + -- reply.cursor, -- sizeof(reply.buf) - -- reply.cursor, -- reply.opt_state, reply.packet, -- required_opts_NAA, -- NULL); - } else { - /* - * Having stored the client's IA's, store any options that -@@ -2793,16 +2755,18 @@ find_client_temporaries(struct reply_sta - */ - static isc_result_t - reply_process_try_addr(struct reply_state *reply, struct iaddr *addr) { -- isc_result_t status = ISC_R_NORESOURCES; -+ isc_result_t status = ISC_R_ADDRNOTAVAIL; - struct ipv6_pool *pool; - int i; - struct data_string data_addr; - - if ((reply == NULL) || (reply->shared == NULL) || -- (reply->shared->ipv6_pools == NULL) || (addr == NULL) || -- (reply->lease != NULL)) -+ (addr == NULL) || (reply->lease != NULL)) - return DHCP_R_INVALIDARG; - -+ if (reply->shared->ipv6_pools == NULL) -+ return ISC_R_ADDRNOTAVAIL; -+ - memset(&data_addr, 0, sizeof(data_addr)); - data_addr.len = addr->len; - data_addr.data = addr->iabuf; -@@ -3314,7 +3278,9 @@ reply_process_ia_pd(struct reply_state * - if (status == ISC_R_CANCELED) - break; - -- if ((status != ISC_R_SUCCESS) && (status != ISC_R_ADDRINUSE)) -+ if ((status != ISC_R_SUCCESS) && -+ (status != ISC_R_ADDRINUSE) && -+ (status != ISC_R_ADDRNOTAVAIL)) - goto cleanup; - } - -@@ -3594,7 +3560,8 @@ reply_process_prefix(struct reply_state - - /* Either error out or skip this prefix. */ - if ((status != ISC_R_SUCCESS) && -- (status != ISC_R_ADDRINUSE)) -+ (status != ISC_R_ADDRINUSE) && -+ (status != ISC_R_ADDRNOTAVAIL)) - goto cleanup; - - if (reply->lease == NULL) { -@@ -3773,16 +3740,18 @@ prefix_is_owned(struct reply_state *repl - static isc_result_t - reply_process_try_prefix(struct reply_state *reply, - struct iaddrcidrnet *pref) { -- isc_result_t status = ISC_R_NORESOURCES; -+ isc_result_t status = ISC_R_ADDRNOTAVAIL; - struct ipv6_pool *pool; - int i; - struct data_string data_pref; - - if ((reply == NULL) || (reply->shared == NULL) || -- (reply->shared->ipv6_pools == NULL) || (pref == NULL) || -- (reply->lease != NULL)) -+ (pref == NULL) || (reply->lease != NULL)) - return DHCP_R_INVALIDARG; - -+ if (reply->shared->ipv6_pools == NULL) -+ return ISC_R_ADDRNOTAVAIL; -+ - memset(&data_pref, 0, sizeof(data_pref)); - data_pref.len = 17; - if (!buffer_allocate(&data_pref.buffer, data_pref.len, MDL)) { diff --git a/dhcp/patches/dhcp-4.2.0-paths.patch b/dhcp/patches/dhcp-4.2.0-paths.patch deleted file mode 100644 index 54c7aba..0000000 --- a/dhcp/patches/dhcp-4.2.0-paths.patch +++ /dev/null @@ -1,45 +0,0 @@ -diff -up dhcp-4.2.0/includes/dhcpd.h.paths dhcp-4.2.0/includes/dhcpd.h ---- dhcp-4.2.0/includes/dhcpd.h.paths 2010-07-21 13:55:42.000000000 +0200 -+++ dhcp-4.2.0/includes/dhcpd.h 2010-07-21 14:29:57.000000000 +0200 -@@ -1390,15 +1390,15 @@ typedef unsigned char option_mask [16]; - #else /* !DEBUG */ - - #ifndef _PATH_DHCPD_CONF --#define _PATH_DHCPD_CONF "/etc/dhcpd.conf" -+#define _PATH_DHCPD_CONF "/etc/dhcp/dhcpd.conf" - #endif /* DEBUG */ - - #ifndef _PATH_DHCPD_DB --#define _PATH_DHCPD_DB LOCALSTATEDIR"/db/dhcpd.leases" -+#define _PATH_DHCPD_DB LOCALSTATEDIR"/dhcpd/dhcpd.leases" - #endif - - #ifndef _PATH_DHCPD6_DB --#define _PATH_DHCPD6_DB LOCALSTATEDIR"/db/dhcpd6.leases" -+#define _PATH_DHCPD6_DB LOCALSTATEDIR"/dhcpd/dhcpd6.leases" - #endif - - #ifndef _PATH_DHCPD_PID -@@ -1412,7 +1412,7 @@ typedef unsigned char option_mask [16]; - #endif /* DEBUG */ - - #ifndef _PATH_DHCLIENT_CONF --#define _PATH_DHCLIENT_CONF "/etc/dhclient.conf" -+#define _PATH_DHCLIENT_CONF "/etc/dhcp/dhclient.conf" - #endif - - #ifndef _PATH_DHCLIENT_SCRIPT -@@ -1428,11 +1428,11 @@ typedef unsigned char option_mask [16]; - #endif - - #ifndef _PATH_DHCLIENT_DB --#define _PATH_DHCLIENT_DB LOCALSTATEDIR"/db/dhclient.leases" -+#define _PATH_DHCLIENT_DB LOCALSTATEDIR"/dhclient/dhclient.leases" - #endif - - #ifndef _PATH_DHCLIENT6_DB --#define _PATH_DHCLIENT6_DB LOCALSTATEDIR"/db/dhclient6.leases" -+#define _PATH_DHCLIENT6_DB LOCALSTATEDIR"/dhclient/dhclient6.leases" - #endif - - #ifndef _PATH_RESOLV_CONF diff --git a/dhcp/patches/dhcp-4.2.0-unicast-bootp.patch b/dhcp/patches/dhcp-4.2.0-unicast-bootp.patch deleted file mode 100644 index 78bc078..0000000 --- a/dhcp/patches/dhcp-4.2.0-unicast-bootp.patch +++ /dev/null @@ -1,99 +0,0 @@ -diff -up dhcp-4.2.0/server/bootp.c.unicast dhcp-4.2.0/server/bootp.c ---- dhcp-4.2.0/server/bootp.c.unicast 2009-11-20 02:49:03.000000000 +0100 -+++ dhcp-4.2.0/server/bootp.c 2010-07-21 13:40:25.000000000 +0200 -@@ -58,6 +58,7 @@ void bootp (packet) - char msgbuf [1024]; - int ignorep; - int peer_has_leases = 0; -+ int norelay = 0; - - if (packet -> raw -> op != BOOTREQUEST) - return; -@@ -73,7 +74,7 @@ void bootp (packet) - ? 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; - } -@@ -390,6 +391,13 @@ void bootp (packet) - 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 -diff -up dhcp-4.2.0/server/dhcp.c.unicast dhcp-4.2.0/server/dhcp.c ---- dhcp-4.2.0/server/dhcp.c.unicast 2010-06-01 19:29:59.000000000 +0200 -+++ dhcp-4.2.0/server/dhcp.c 2010-07-21 13:40:25.000000000 +0200 -@@ -4185,6 +4185,7 @@ int locate_network (packet) - struct data_string data; - struct subnet *subnet = (struct subnet *)0; - struct option_cache *oc; -+ int norelay = 0; - - /* See if there's a Relay Agent Link Selection Option, or a - * Subnet Selection Option. The Link-Select and Subnet-Select -@@ -4200,12 +4201,24 @@ int locate_network (packet) - 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 option indicating link connection, and it's valid, -@@ -4228,7 +4241,10 @@ int locate_network (packet) - 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. */ -@@ -4236,7 +4252,10 @@ int locate_network (packet) - 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. */ diff --git a/dhcp/patches/dhcp-4.2.1-64_bit_lease_parse.patch b/dhcp/patches/dhcp-4.2.1-64_bit_lease_parse.patch deleted file mode 100644 index a540bc1..0000000 --- a/dhcp/patches/dhcp-4.2.1-64_bit_lease_parse.patch +++ /dev/null @@ -1,94 +0,0 @@ -diff -up dhcp-4.2.1b1/common/dispatch.c.64-bit_lease_parse dhcp-4.2.1b1/common/dispatch.c -diff -up dhcp-4.2.1b1/common/parse.c.64-bit_lease_parse dhcp-4.2.1b1/common/parse.c ---- dhcp-4.2.1b1/common/parse.c.64-bit_lease_parse 2010-12-30 00:01:42.000000000 +0100 -+++ dhcp-4.2.1b1/common/parse.c 2011-01-28 08:01:10.000000000 +0100 -@@ -909,8 +909,8 @@ TIME - parse_date_core(cfile) - struct parse *cfile; - { -- int guess; -- int tzoff, wday, year, mon, mday, hour, min, sec; -+ TIME guess; -+ long int tzoff, wday, year, mon, mday, hour, min, sec; - const char *val; - enum dhcp_token token; - static int months[11] = { 31, 59, 90, 120, 151, 181, -@@ -936,7 +936,7 @@ parse_date_core(cfile) - } - - token = next_token(&val, NULL, cfile); /* consume number */ -- guess = atoi(val); -+ guess = atol(val); - - return((TIME)guess); - } -@@ -948,7 +948,7 @@ parse_date_core(cfile) - return((TIME)0); - } - token = next_token(&val, NULL, cfile); /* consume day of week */ -- wday = atoi(val); -+ wday = atol(val); - - /* Year... */ - token = peek_token(&val, NULL, cfile); -@@ -964,7 +964,7 @@ parse_date_core(cfile) - somebody invents a time machine, I think we can safely disregard - it. This actually works around a stupid Y2K bug that was present - in a very early beta release of dhcpd. */ -- year = atoi(val); -+ year = atol(val); - if (year > 1900) - year -= 1900; - -@@ -988,7 +988,7 @@ parse_date_core(cfile) - return((TIME)0); - } - token = next_token(&val, NULL, cfile); /* consume month */ -- mon = atoi(val) - 1; -+ mon = atol(val) - 1; - - /* Slash separating month from day... */ - token = peek_token(&val, NULL, cfile); -@@ -1010,7 +1010,7 @@ parse_date_core(cfile) - return((TIME)0); - } - token = next_token(&val, NULL, cfile); /* consume day of month */ -- mday = atoi(val); -+ mday = atol(val); - - /* Hour... */ - token = peek_token(&val, NULL, cfile); -@@ -1021,7 +1021,7 @@ parse_date_core(cfile) - return((TIME)0); - } - token = next_token(&val, NULL, cfile); /* consume hour */ -- hour = atoi(val); -+ hour = atol(val); - - /* Colon separating hour from minute... */ - token = peek_token(&val, NULL, cfile); -@@ -1043,7 +1043,7 @@ parse_date_core(cfile) - return((TIME)0); - } - token = next_token(&val, NULL, cfile); /* consume minute */ -- min = atoi(val); -+ min = atol(val); - - /* Colon separating minute from second... */ - token = peek_token(&val, NULL, cfile); -@@ -1065,13 +1065,13 @@ parse_date_core(cfile) - return((TIME)0); - } - token = next_token(&val, NULL, cfile); /* consume second */ -- sec = atoi(val); -+ sec = atol(val); - - tzoff = 0; - token = peek_token(&val, NULL, cfile); - if (token == NUMBER) { - token = next_token(&val, NULL, cfile); /* consume tzoff */ -- tzoff = atoi(val); -+ tzoff = atol(val); - } else if (token != SEMI) { - token = next_token(&val, NULL, cfile); - parse_warn(cfile, diff --git a/dhcp/patches/dhcp-4.2.1-P1-CVE-2011-0997.patch b/dhcp/patches/dhcp-4.2.1-P1-CVE-2011-0997.patch deleted file mode 100644 index 1a0243c..0000000 --- a/dhcp/patches/dhcp-4.2.1-P1-CVE-2011-0997.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -up dhcp-4.2.1-P1/client/dhclient.c.CVE-2011-0997 dhcp-4.2.1-P1/client/dhclient.c ---- dhcp-4.2.1-P1/client/dhclient.c.CVE-2011-0997 2011-04-06 20:21:43.000000000 +0200 -+++ dhcp-4.2.1-P1/client/dhclient.c 2011-04-06 20:22:31.000000000 +0200 -@@ -4545,11 +4545,11 @@ static int check_option_values(struct un - if ((universe == NULL) || (universe == &dhcp_universe)) { - switch(opt) { - case DHO_HOST_NAME: -- case DHO_DOMAIN_NAME: - case DHO_NIS_DOMAIN: - case DHO_NETBIOS_SCOPE: - return check_domain_name(ptr, len, 0); - break; -+ case DHO_DOMAIN_NAME: /* accept a list for compatibiliy */ - case DHO_DOMAIN_SEARCH: - return check_domain_name_list(ptr, len, 0); - break; diff --git a/dhcp/patches/dhcp-4.2.1-invalid-dhclient-conf.patch b/dhcp/patches/dhcp-4.2.1-invalid-dhclient-conf.patch deleted file mode 100644 index eeeea84..0000000 --- a/dhcp/patches/dhcp-4.2.1-invalid-dhclient-conf.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up dhcp-4.2.1b1/client/dhclient.conf.supersede dhcp-4.2.1b1/client/dhclient.conf ---- dhcp-4.2.1b1/client/dhclient.conf.supersede 2010-09-15 01:03:56.000000000 +0200 -+++ dhcp-4.2.1b1/client/dhclient.conf 2011-01-27 18:38:28.000000000 +0100 -@@ -4,7 +4,7 @@ send dhcp-lease-time 3600; - supersede domain-search "fugue.com", "home.vix.com"; - prepend domain-name-servers 127.0.0.1; - request subnet-mask, broadcast-address, time-offset, routers, -- domain-name, domain-name-servers, host-name; -+ domain-search, domain-name-servers, host-name; - require subnet-mask, domain-name-servers; - timeout 60; - retry 60; diff --git a/dhcp/patches/dhcp-4.2.2-CLOEXEC.patch b/dhcp/patches/dhcp-4.2.2-CLOEXEC.patch index b07e2ff..1198f77 100644 --- a/dhcp/patches/dhcp-4.2.2-CLOEXEC.patch +++ b/dhcp/patches/dhcp-4.2.2-CLOEXEC.patch @@ -202,66 +202,6 @@ diff -up dhcp-4.2.2b1/common/upf.c.cloexec dhcp-4.2.2b1/common/upf.c if (sock < 0) { if (errno == EBUSY) { continue; -diff -up dhcp-4.2.2b1/dst/dst_api.c.cloexec dhcp-4.2.2b1/dst/dst_api.c ---- dhcp-4.2.2b1/dst/dst_api.c.cloexec 2009-10-29 01:46:48.000000000 +0100 -+++ dhcp-4.2.2b1/dst/dst_api.c 2011-07-01 14:13:31.035887670 +0200 -@@ -437,7 +437,7 @@ dst_s_write_private_key(const DST_KEY *k - PRIVATE_KEY, PATH_MAX); - - /* Do not overwrite an existing file */ -- if ((fp = dst_s_fopen(file, "w", 0600)) != NULL) { -+ if ((fp = dst_s_fopen(file, "we", 0600)) != NULL) { - int nn; - if ((nn = fwrite(encoded_block, 1, len, fp)) != len) { - EREPORT(("dst_write_private_key(): Write failure on %s %d != %d errno=%d\n", -@@ -494,7 +494,7 @@ dst_s_read_public_key(const char *in_nam - * flags, proto, alg stored as decimal (or hex numbers FIXME). - * (FIXME: handle parentheses for line continuation.) - */ -- if ((fp = dst_s_fopen(name, "r", 0)) == NULL) { -+ if ((fp = dst_s_fopen(name, "re", 0)) == NULL) { - EREPORT(("dst_read_public_key(): Public Key not found %s\n", - name)); - return (NULL); -@@ -620,7 +620,7 @@ dst_s_write_public_key(const DST_KEY *ke - return (0); - } - /* create public key file */ -- if ((fp = dst_s_fopen(filename, "w+", 0644)) == NULL) { -+ if ((fp = dst_s_fopen(filename, "w+e", 0644)) == NULL) { - EREPORT(("DST_write_public_key: open of file:%s failed (errno=%d)\n", - filename, errno)); - return (0); -@@ -854,7 +854,7 @@ dst_s_read_private_key_file(char *name, - return (0); - } - /* first check if we can find the key file */ -- if ((fp = dst_s_fopen(filename, "r", 0)) == NULL) { -+ if ((fp = dst_s_fopen(filename, "re", 0)) == NULL) { - EREPORT(("dst_s_read_private_key_file: Could not open file %s in directory %s\n", - filename, dst_path[0] ? dst_path : - (char *) getcwd(NULL, PATH_MAX - 1))); -diff -up dhcp-4.2.2b1/dst/prandom.c.cloexec dhcp-4.2.2b1/dst/prandom.c ---- dhcp-4.2.2b1/dst/prandom.c.cloexec 2009-11-20 02:49:01.000000000 +0100 -+++ dhcp-4.2.2b1/dst/prandom.c 2011-07-01 14:13:31.035887670 +0200 -@@ -269,7 +269,7 @@ get_dev_random(u_char *output, unsigned - - s = stat("/dev/random", &st); - if (s == 0 && S_ISCHR(st.st_mode)) { -- if ((fd = open("/dev/random", O_RDONLY | O_NONBLOCK)) != -1) { -+ if ((fd = open("/dev/random", O_RDONLY | O_NONBLOCK | O_CLOEXEC)) != -1) { - if ((n = read(fd, output, size)) < 0) - n = 0; - close(fd); -@@ -480,7 +480,7 @@ digest_file(dst_work *work) - work->file_digest = dst_free_key(work->file_digest); - return (0); - } -- if ((fp = fopen(name, "r")) == NULL) -+ if ((fp = fopen(name, "re")) == NULL) - return (0); - for (no = 0; (i = fread(buf, sizeof(*buf), sizeof(buf), fp)) > 0; - no += i) diff -up dhcp-4.2.2b1/omapip/trace.c.cloexec dhcp-4.2.2b1/omapip/trace.c --- dhcp-4.2.2b1/omapip/trace.c.cloexec 2010-05-27 02:34:57.000000000 +0200 +++ dhcp-4.2.2b1/omapip/trace.c 2011-07-01 14:13:31.036887669 +0200 diff --git a/dhcp/patches/dhcp-4.2.2-capability.patch b/dhcp/patches/dhcp-4.2.2-capability.patch index 79af036..db2fb38 100644 --- a/dhcp/patches/dhcp-4.2.2-capability.patch +++ b/dhcp/patches/dhcp-4.2.2-capability.patch @@ -248,76 +248,3 @@ diff -up dhcp-4.2.2b1/relay/Makefile.am.capability dhcp-4.2.2b1/relay/Makefile.a man_MANS = dhcrelay.8 EXTRA_DIST = $(man_MANS)
-diff -up dhcp-4.2.2b1/server/dhcpd.c.capability dhcp-4.2.2b1/server/dhcpd.c ---- dhcp-4.2.2b1/server/dhcpd.c.capability 2011-07-01 15:09:06.636784192 +0200 -+++ dhcp-4.2.2b1/server/dhcpd.c 2011-07-01 15:09:06.670783841 +0200 -@@ -58,6 +58,11 @@ static const char url [] = - # undef group - #endif /* PARANOIA */ - -+#ifdef HAVE_LIBCAP_NG -+# include <cap-ng.h> -+ int keep_capabilities = 0; -+#endif -+ - static void usage(void); - - struct iaddr server_identifier; -@@ -403,6 +408,10 @@ main(int argc, char **argv) { - traceinfile = argv [i]; - trace_replay_init (); - #endif /* TRACING */ -+ } else if (!strcmp(argv[i], "-nc")) { -+#ifdef HAVE_LIBCAP_NG -+ keep_capabilities = 1; -+#endif - } else if (argv [i][0] == '-') { - usage (); - } else { -@@ -459,6 +468,17 @@ main(int argc, char **argv) { - } - #endif /* DHCPv6 */ - -+#ifdef HAVE_LIBCAP_NG -+ /* Drop capabilities */ -+ if (!keep_capabilities) { -+ capng_clear(CAPNG_SELECT_BOTH); -+ capng_updatev(CAPNG_ADD, CAPNG_EFFECTIVE|CAPNG_PERMITTED, -+ CAP_NET_RAW, CAP_NET_BIND_SERVICE, CAP_SYS_CHROOT, CAP_SETUID, CAP_SETGID, -1); -+ capng_apply(CAPNG_SELECT_BOTH); -+ log_info ("Dropped all unnecessary capabilities."); -+ } -+#endif -+ - /* - * convert relative path names to absolute, for files that need - * to be reopened after chdir() has been called -@@ -859,6 +879,15 @@ main(int argc, char **argv) { - omapi_set_int_value ((omapi_object_t *)dhcp_control_object, - (omapi_object_t *)0, "state", server_running); - -+#ifdef HAVE_LIBCAP_NG -+ /* Drop all capabilities */ -+ if (!keep_capabilities) { -+ capng_clear(CAPNG_SELECT_BOTH); -+ capng_apply(CAPNG_SELECT_BOTH); -+ log_info ("Dropped all capabilities."); -+ } -+#endif -+ - /* Receive packets and dispatch them... */ - dispatch (); - -diff -up dhcp-4.2.2b1/server/Makefile.am.capability dhcp-4.2.2b1/server/Makefile.am ---- dhcp-4.2.2b1/server/Makefile.am.capability 2011-07-01 15:09:06.546785121 +0200 -+++ dhcp-4.2.2b1/server/Makefile.am 2011-07-01 15:09:06.671783830 +0200 -@@ -8,7 +8,8 @@ dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c c - - dhcpd_CFLAGS = $(LDAP_CFLAGS) - dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ -- ../dhcpctl/libdhcpctl.a $(BIND9_LIBDIR) -ldns-export -lisc-export -+ ../dhcpctl/libdhcpctl.a $(BIND9_LIBDIR) -ldns-export -lisc-export \ -+ $(CAPNG_LDADD) - - man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5 - EXTRA_DIST = $(man_MANS) diff --git a/dhcp/patches/dhcp-4.2.2-gpxe-cid.patch b/dhcp/patches/dhcp-4.2.2-gpxe-cid.patch index c0be4c2..fd73b2c 100644 --- a/dhcp/patches/dhcp-4.2.2-gpxe-cid.patch +++ b/dhcp/patches/dhcp-4.2.2-gpxe-cid.patch @@ -73,60 +73,11 @@ diff -up dhcp-4.2.2/client/dhclient.c.gpxe-cid dhcp-4.2.2/client/dhclient.c diff -up dhcp-4.2.2/common/lpf.c.gpxe-cid dhcp-4.2.2/common/lpf.c --- dhcp-4.2.2/common/lpf.c.gpxe-cid 2011-09-16 18:23:20.183453996 +0200 +++ dhcp-4.2.2/common/lpf.c 2011-09-16 18:25:28.235804421 +0200 -@@ -591,6 +591,37 @@ void maybe_setup_fallback () - } - } - -+static unsigned char * get_ib_hw_addr(char * name) -+{ -+ struct ifaddrs *ifaddrs; -+ struct ifaddrs *ifa; -+ struct sockaddr_ll *sll = NULL; -+ static unsigned char hw_addr[8]; -+ -+ if (getifaddrs(&ifaddrs) == -1) -+ return NULL; -+ -+ for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) { -+ if (ifa->ifa_addr == NULL) -+ continue; -+ if (ifa->ifa_addr->sa_family != AF_PACKET) -+ continue; -+ if (ifa->ifa_flags & IFF_LOOPBACK) -+ continue; -+ if (strcmp(ifa->ifa_name, name) == 0) { -+ sll = (struct sockaddr_ll *)(void *)ifa->ifa_addr; -+ break; -+ } -+ } -+ if (sll == NULL) { -+ freeifaddrs(ifaddrs); -+ return NULL; -+ } -+ memcpy(hw_addr, &sll->sll_addr[sll->sll_halen - 8], 8); -+ freeifaddrs(ifaddrs); -+ return (unsigned char *)&hw_addr; -+} -+ - void - get_hw_addr(struct interface_info *info) - { -@@ -599,6 +630,7 @@ get_hw_addr(struct interface_info *info) - struct ifaddrs *ifaddrs; - struct ifaddrs *ifa; - struct sockaddr_ll *sll = NULL; -+ unsigned char *hw_addr; - - if (getifaddrs(&ifaddrs) == -1) - log_fatal("Failed to get interfaces"); -@@ -660,6 +692,10 @@ get_hw_addr(struct interface_info *info) +@@ -698,6 +698,7 @@ get_hw_addr(struct interface_info *info)
hw->hlen = 1; hw->hbuf[0] = HTYPE_INFINIBAND; -+ hw_addr = get_ib_hw_addr(name); -+ if (!hw_addr) -+ log_fatal("Failed getting %s hw addr", name); -+ memcpy (&hw->hbuf [1], hw_addr, 8); ++ memcpy(&hw->hbuf[1], &sll->sll_addr[sll->sll_halen - 8], 8); break; #if defined(ARPHRD_PPP) case ARPHRD_PPP: diff --git a/dhcp/patches/dhcp-4.2.2-improved-xid.patch b/dhcp/patches/dhcp-4.2.2-improved-xid.patch deleted file mode 100644 index f49fc78..0000000 --- a/dhcp/patches/dhcp-4.2.2-improved-xid.patch +++ /dev/null @@ -1,138 +0,0 @@ -diff -up dhcp-4.2.2/client/dhclient.c.improved-xid dhcp-4.2.2/client/dhclient.c ---- dhcp-4.2.2/client/dhclient.c.improved-xid 2011-09-16 18:18:00.649730661 +0200 -+++ dhcp-4.2.2/client/dhclient.c 2011-09-16 18:22:36.815035513 +0200 -@@ -898,6 +898,26 @@ main(int argc, char **argv) { - } - } - -+ /* We create a backup seed before rediscovering interfaces in order to -+ have a seed built using all of the available interfaces -+ It's interesting if required interfaces doesn't let us defined -+ a really unique seed due to a lack of valid HW addr later -+ (this is the case with DHCP over IB) -+ We only use the last device as using a sum could broke the -+ uniqueness of the seed among multiple nodes -+ */ -+ unsigned backup_seed = 0; -+ for (ip = interfaces; ip; ip = ip -> next) { -+ int junk; -+ if ( ip -> hw_address.hlen <= sizeof seed ) -+ continue; -+ memcpy (&junk, -+ &ip -> hw_address.hbuf [ip -> hw_address.hlen - -+ sizeof seed], sizeof seed); -+ backup_seed = junk; -+ } -+ -+ - /* At this point, all the interfaces that the script thinks - are relevant should be running, so now we once again call - discover_interfaces(), and this time ask it to actually set -@@ -912,14 +932,36 @@ main(int argc, char **argv) { - Not much entropy, but we're booting, so we're not likely to - find anything better. */ - seed = 0; -+ int seed_flag = 0; - for (ip = interfaces; ip; ip = ip->next) { - int junk; -+ if ( ip -> hw_address.hlen <= sizeof seed ) -+ continue; - memcpy(&junk, - &ip->hw_address.hbuf[ip->hw_address.hlen - - sizeof seed], sizeof seed); - seed += junk; -+ seed_flag = 1; - } -- srandom(seed + cur_time + (unsigned)getpid()); -+ if ( seed_flag == 0 ) { -+ if ( backup_seed != 0 ) { -+ seed = backup_seed; -+ log_info ("xid: rand init seed (0x%x) built using all" -+ " available interfaces",seed); -+ } -+ else { -+ seed = cur_time^((unsigned) gethostid()) ; -+ log_info ("xid: warning: no netdev with useable HWADDR found" -+ " for seed's uniqueness enforcement"); -+ log_info ("xid: rand init seed (0x%x) built using gethostid", -+ seed); -+ } -+ /* we only use seed and no current time as a broadcast reply */ -+ /* will certainly be used by the hwaddrless interface */ -+ srandom(seed); -+ } -+ else -+ srandom(seed + cur_time + (unsigned)getpid()); - - /* Setup specific Infiniband options */ - for (ip = interfaces; ip; ip = ip->next) { -@@ -1457,7 +1499,7 @@ void dhcpack (packet) - return; - } - -- log_info ("DHCPACK from %s", piaddr (packet -> client_addr)); -+ log_info ("DHCPACK from %s (xid=0x%x)", piaddr (packet -> client_addr), client -> xid); - - lease = packet_to_lease (packet, client); - if (!lease) { -@@ -2174,7 +2216,7 @@ void dhcpnak (packet) - return; - } - -- log_info ("DHCPNAK from %s", piaddr (packet -> client_addr)); -+ log_info ("DHCPNAK from %s (xid=0x%x)", piaddr (packet -> client_addr), client -> xid); - - if (!client -> active) { - #if defined (DEBUG) -@@ -2300,10 +2342,10 @@ void send_discover (cpp) - client -> packet.secs = htons (65535); - client -> secs = client -> packet.secs; - -- log_info ("DHCPDISCOVER on %s to %s port %d interval %ld", -+ log_info ("DHCPDISCOVER on %s to %s port %d interval %ld (xid=0x%x)", - client -> name ? client -> name : client -> interface -> name, - inet_ntoa (sockaddr_broadcast.sin_addr), -- ntohs (sockaddr_broadcast.sin_port), (long)(client -> interval)); -+ ntohs (sockaddr_broadcast.sin_port), (long)(client -> interval), client -> xid); - - /* Send out a packet. */ - result = send_packet (client -> interface, (struct packet *)0, -@@ -2584,10 +2626,10 @@ void send_request (cpp) - client -> packet.secs = htons (65535); - } - -- log_info ("DHCPREQUEST on %s to %s port %d", -+ log_info ("DHCPREQUEST on %s to %s port %d (xid=0x%x)", - client -> name ? client -> name : client -> interface -> name, - inet_ntoa (destination.sin_addr), -- ntohs (destination.sin_port)); -+ ntohs (destination.sin_port), client -> xid); - - if (destination.sin_addr.s_addr != INADDR_BROADCAST && - fallback_interface) -@@ -2618,10 +2660,10 @@ void send_decline (cpp) - - int result; - -- log_info ("DHCPDECLINE on %s to %s port %d", -+ log_info ("DHCPDECLINE on %s to %s port %d (xid=0x%x)", - client -> name ? client -> name : client -> interface -> name, - inet_ntoa (sockaddr_broadcast.sin_addr), -- ntohs (sockaddr_broadcast.sin_port)); -+ ntohs (sockaddr_broadcast.sin_port), client -> xid); - - /* Send out a packet. */ - result = send_packet (client -> interface, (struct packet *)0, -@@ -2661,10 +2703,10 @@ void send_release (cpp) - return; - } - -- log_info ("DHCPRELEASE on %s to %s port %d", -+ log_info ("DHCPRELEASE on %s to %s port %d (xid=0x%x)", - client -> name ? client -> name : client -> interface -> name, - inet_ntoa (destination.sin_addr), -- ntohs (destination.sin_port)); -+ ntohs (destination.sin_port), client -> xid); - - if (fallback_interface) - result = send_packet (fallback_interface, diff --git a/dhcp/patches/dhcp-4.2.2-lpf-ib.patch b/dhcp/patches/dhcp-4.2.2-lpf-ib.patch deleted file mode 100644 index 4034028..0000000 --- a/dhcp/patches/dhcp-4.2.2-lpf-ib.patch +++ /dev/null @@ -1,538 +0,0 @@ -diff -up dhcp-4.2.2/client/dhclient.c.lpf-ib dhcp-4.2.2/client/dhclient.c ---- dhcp-4.2.2/client/dhclient.c.lpf-ib 2011-09-19 11:24:08.693775799 +0200 -+++ dhcp-4.2.2/client/dhclient.c 2011-09-19 11:24:08.703775541 +0200 -@@ -113,6 +113,8 @@ static int check_domain_name_list(const - static int check_option_values(struct universe *universe, unsigned int opt, - const char *ptr, size_t len); - -+static void setup_ib_interface(struct interface_info *ip); -+ - int - main(int argc, char **argv) { - int fd; -@@ -919,6 +921,14 @@ main(int argc, char **argv) { - } - srandom(seed + cur_time + (unsigned)getpid()); - -+ /* Setup specific Infiniband options */ -+ for (ip = interfaces; ip; ip = ip->next) { -+ if (ip->client && -+ (ip->hw_address.hbuf[0] == HTYPE_INFINIBAND)) { -+ setup_ib_interface(ip); -+ } -+ } -+ - /* Start a configuration state machine for each interface. */ - #ifdef DHCPv6 - if (local_family == AF_INET6) { -@@ -1195,6 +1205,29 @@ int find_subnet (struct subnet **sp, - return 0; - } - -+static void setup_ib_interface(struct interface_info *ip) -+{ -+ struct group *g; -+ -+ /* Set the broadcast flag */ -+ ip->client->config->bootp_broadcast_always = 1; -+ -+ /* -+ * Find out if a dhcp-client-identifier option was specified either -+ * in the config file or on the command line -+ */ -+ for (g = ip->client->config->on_transmission; g != NULL; g = g->next) { -+ if ((g->statements != NULL) && -+ (strcmp(g->statements->data.option->option->name, -+ "dhcp-client-identifier") == 0)) { -+ return; -+ } -+ } -+ -+ /* No client ID specified */ -+ log_fatal("dhcp-client-identifier must be specified for InfiniBand"); -+} -+ - /* Individual States: - * - * Each routine is called from the dhclient_state_machine() in one of -diff -up dhcp-4.2.2/common/bpf.c.lpf-ib dhcp-4.2.2/common/bpf.c ---- dhcp-4.2.2/common/bpf.c.lpf-ib 2011-09-19 11:24:08.694775773 +0200 -+++ dhcp-4.2.2/common/bpf.c 2011-09-19 11:24:08.704775516 +0200 -@@ -198,11 +198,44 @@ struct bpf_insn dhcp_bpf_filter [] = { - BPF_STMT(BPF_RET+BPF_K, 0), - }; - -+/* Packet filter program for DHCP over Infiniband. -+ * -+ * XXX -+ * Changes to the filter program may require changes to the constant offsets -+ * used in lpf_gen_filter_setup to patch the port in the BPF program! -+ * XXX -+ */ -+struct bpf_insn dhcp_ib_bpf_filter [] = { -+ /* Packet filter for Infiniband */ -+ /* Make sure it's a UDP packet... */ -+ BPF_STMT(BPF_LD + BPF_B + BPF_ABS, 9), -+ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 6), -+ -+ /* Make sure this isn't a fragment... */ -+ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 6), -+ BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 4, 0), -+ -+ /* Get the IP header length... */ -+ BPF_STMT(BPF_LDX + BPF_B + BPF_MSH, 0), -+ -+ /* Make sure it's to the right port... */ -+ BPF_STMT(BPF_LD + BPF_H + BPF_IND, 2), -+ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 67, 0, 1), -+ -+ /* If we passed all the tests, ask for the whole packet. */ -+ BPF_STMT(BPF_RET + BPF_K, (u_int)-1), -+ -+ /* Otherwise, drop it. */ -+ BPF_STMT(BPF_RET + BPF_K, 0), -+}; -+ - #if defined (DEC_FDDI) - struct bpf_insn *bpf_fddi_filter; - #endif - - int dhcp_bpf_filter_len = sizeof dhcp_bpf_filter / sizeof (struct bpf_insn); -+int dhcp_ib_bpf_filter_len = sizeof dhcp_ib_bpf_filter / sizeof (struct bpf_insn); -+ - #if defined (HAVE_TR_SUPPORT) - struct bpf_insn dhcp_bpf_tr_filter [] = { - /* accept all token ring packets due to variable length header */ -diff -up dhcp-4.2.2/common/lpf.c.lpf-ib dhcp-4.2.2/common/lpf.c ---- dhcp-4.2.2/common/lpf.c.lpf-ib 2011-09-19 11:24:08.694775773 +0200 -+++ dhcp-4.2.2/common/lpf.c 2011-09-19 11:26:15.107109935 +0200 -@@ -42,6 +42,7 @@ - #include "includes/netinet/udp.h" - #include "includes/netinet/if_ether.h" - #include <net/if.h> -+#include <ifaddrs.h> - - #ifndef PACKET_AUXDATA - #define PACKET_AUXDATA 8 -@@ -59,6 +60,15 @@ struct tpacket_auxdata - /* Reinitializes the specified interface after an address change. This - is not required for packet-filter APIs. */ - -+/* Default broadcast address for IPoIB */ -+static unsigned char default_ib_bcast_addr[20] = { -+ 0x00, 0xff, 0xff, 0xff, -+ 0xff, 0x12, 0x40, 0x1b, -+ 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, -+ 0xff, 0xff, 0xff, 0xff -+}; -+ - #ifdef USE_LPF_SEND - void if_reinitialize_send (info) - struct interface_info *info; -@@ -86,10 +96,21 @@ int if_register_lpf (info) - struct sockaddr common; - } sa; - struct ifreq ifr; -+ int type; -+ int protocol; - - /* Make an LPF socket. */ -- if ((sock = socket(PF_PACKET, SOCK_RAW, -- htons((short)ETH_P_ALL))) < 0) { -+ get_hw_addr(info); -+ -+ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) { -+ type = SOCK_DGRAM; -+ protocol = ETHERTYPE_IP; -+ } else { -+ type = SOCK_RAW; -+ protocol = ETH_P_ALL; -+ } -+ -+ if ((sock = socket(PF_PACKET, type, htons((short)protocol))) < 0) { - if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || - errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || - errno == EAFNOSUPPORT || errno == EINVAL) { -@@ -112,6 +133,7 @@ int if_register_lpf (info) - /* Bind to the interface name */ - memset (&sa, 0, sizeof sa); - sa.ll.sll_family = AF_PACKET; -+ sa.ll.sll_protocol = htons(protocol); - sa.ll.sll_ifindex = ifr.ifr_ifindex; - if (bind (sock, &sa.common, sizeof sa)) { - if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || -@@ -127,8 +149,6 @@ int if_register_lpf (info) - log_fatal ("Bind socket to interface: %m"); - } - -- get_hw_addr(info->name, &info->hw_address); -- - return sock; - } - #endif /* USE_LPF_SEND || USE_LPF_RECEIVE */ -@@ -183,6 +203,8 @@ void if_deregister_send (info) - in bpf includes... */ - extern struct sock_filter dhcp_bpf_filter []; - extern int dhcp_bpf_filter_len; -+extern struct sock_filter dhcp_ib_bpf_filter []; -+extern int dhcp_ib_bpf_filter_len; - - #if defined (HAVE_TR_SUPPORT) - extern struct sock_filter dhcp_bpf_tr_filter []; -@@ -200,11 +222,13 @@ void if_register_receive (info) - /* 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 (info->hw_address.hbuf[0] != HTYPE_INFINIBAND) { -+ 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) -@@ -250,15 +274,28 @@ static void lpf_gen_filter_setup (info) - - memset(&p, 0, sizeof(p)); - -- /* Set up the bpf filter program structure. This is defined in -- bpf.c */ -- p.len = dhcp_bpf_filter_len; -- p.filter = dhcp_bpf_filter; -- -- /* Patch the server port into the LPF program... -- XXX changes to filter program may require changes -- to the insn number(s) used below! XXX */ -- dhcp_bpf_filter [8].k = ntohs ((short)local_port); -+ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) { -+ /* Set up the bpf filter program structure. */ -+ p.len = dhcp_ib_bpf_filter_len; -+ p.filter = dhcp_ib_bpf_filter; -+ -+ /* Patch the server port into the LPF program... -+ XXX -+ changes to filter program may require changes -+ to the insn number(s) used below! -+ XXX */ -+ dhcp_ib_bpf_filter[6].k = ntohs ((short)local_port); -+ } else { -+ /* Set up the bpf filter program structure. -+ This is defined in bpf.c */ -+ p.len = dhcp_bpf_filter_len; -+ p.filter = dhcp_bpf_filter; -+ -+ /* Patch the server port into the LPF program... -+ XXX changes to filter program may require changes -+ to the insn number(s) used below! XXX */ -+ dhcp_bpf_filter [8].k = ntohs ((short)local_port); -+ } - - if (setsockopt (info -> rfdesc, SOL_SOCKET, SO_ATTACH_FILTER, &p, - sizeof p) < 0) { -@@ -315,6 +352,54 @@ static void lpf_tr_filter_setup (info) - #endif /* USE_LPF_RECEIVE */ - - #ifdef USE_LPF_SEND -+ssize_t send_packet_ib(interface, packet, raw, len, from, to, hto) -+ struct interface_info *interface; -+ struct packet *packet; -+ struct dhcp_packet *raw; -+ size_t len; -+ struct in_addr from; -+ struct sockaddr_in *to; -+ struct hardware *hto; -+{ -+ unsigned ibufp = 0; -+ double ih [1536 / sizeof (double)]; -+ unsigned char *buf = (unsigned char *)ih; -+ ssize_t result; -+ -+ union sockunion { -+ struct sockaddr sa; -+ struct sockaddr_ll sll; -+ struct sockaddr_storage ss; -+ } su; -+ -+ assemble_udp_ip_header (interface, buf, &ibufp, from.s_addr, -+ to->sin_addr.s_addr, to->sin_port, -+ (unsigned char *)raw, len); -+ memcpy (buf + ibufp, raw, len); -+ -+ memset(&su, 0, sizeof(su)); -+ su.sll.sll_family = AF_PACKET; -+ su.sll.sll_protocol = htons(ETHERTYPE_IP); -+ -+ if (!(su.sll.sll_ifindex = if_nametoindex(interface->name))) { -+ errno = ENOENT; -+ log_error ("send_packet_ib: %m - failed to get if index"); -+ return -1; -+ } -+ -+ su.sll.sll_hatype = htons(HTYPE_INFINIBAND); -+ su.sll.sll_halen = sizeof(interface->bcast_addr); -+ memcpy(&su.sll.sll_addr, interface->bcast_addr, 20); -+ -+ result = sendto(interface->wfdesc, buf, ibufp + len, 0, -+ &su.sa, sizeof(su)); -+ -+ if (result < 0) -+ log_error ("send_packet_ib: %m"); -+ -+ return result; -+} -+ - ssize_t send_packet (interface, packet, raw, len, from, to, hto) - struct interface_info *interface; - struct packet *packet; -@@ -335,6 +420,11 @@ ssize_t send_packet (interface, packet, - return send_fallback (interface, packet, raw, - len, from, to, hto); - -+ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) { -+ return send_packet_ib(interface, packet, raw, len, from, -+ to, hto); -+ } -+ - if (hto == NULL && interface->anycast_mac_addr.hlen) - hto = &interface->anycast_mac_addr; - -@@ -356,6 +446,42 @@ ssize_t send_packet (interface, packet, - #endif /* USE_LPF_SEND */ - - #ifdef USE_LPF_RECEIVE -+ssize_t receive_packet_ib (interface, buf, len, from, hfrom) -+ struct interface_info *interface; -+ unsigned char *buf; -+ size_t len; -+ struct sockaddr_in *from; -+ struct hardware *hfrom; -+{ -+ int length = 0; -+ int offset = 0; -+ unsigned char ibuf [1536]; -+ unsigned bufix = 0; -+ unsigned paylen; -+ -+ length = read(interface->rfdesc, ibuf, sizeof(ibuf)); -+ -+ if (length <= 0) -+ return length; -+ -+ offset = decode_udp_ip_header(interface, ibuf, bufix, from, -+ (unsigned)length, &paylen, 0); -+ -+ if (offset < 0) -+ return 0; -+ -+ bufix += offset; -+ length -= offset; -+ -+ if (length < paylen) -+ log_fatal("Internal inconsistency at %s:%d.", MDL); -+ -+ /* Copy out the data in the packet... */ -+ memcpy(buf, &ibuf[bufix], paylen); -+ -+ return (ssize_t)paylen; -+} -+ - ssize_t receive_packet (interface, buf, len, from, hfrom) - struct interface_info *interface; - unsigned char *buf; -@@ -382,6 +508,10 @@ ssize_t receive_packet (interface, buf, - }; - struct cmsghdr *cmsg; - -+ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) { -+ return receive_packet_ib(interface, buf, len, from, hfrom); -+ } -+ - length = recvmsg (interface -> rfdesc, &msg, 0); - if (length <= 0) - return length; -@@ -462,33 +592,44 @@ void maybe_setup_fallback () - } - - void --get_hw_addr(const char *name, struct hardware *hw) { -- int sock; -- struct ifreq tmp; -- struct sockaddr *sa; -+get_hw_addr(struct interface_info *info) -+{ -+ struct hardware *hw = &info->hw_address; -+ char *name = info->name; -+ struct ifaddrs *ifaddrs; -+ struct ifaddrs *ifa; -+ struct sockaddr_ll *sll = NULL; - -- if (strlen(name) >= sizeof(tmp.ifr_name)) { -- log_fatal("Device name too long: "%s"", name); -- } -+ if (getifaddrs(&ifaddrs) == -1) -+ log_fatal("Failed to get interfaces"); - -- sock = socket(AF_INET, SOCK_DGRAM, 0); -- if (sock < 0) { -- log_fatal("Can't create socket for "%s": %m", name); -+ for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) { -+ -+ if (ifa->ifa_addr == NULL) -+ continue; -+ -+ if (ifa->ifa_addr->sa_family != AF_PACKET) -+ continue; -+ -+ if (ifa->ifa_flags & IFF_LOOPBACK) -+ continue; -+ -+ if (strcmp(ifa->ifa_name, name) == 0) { -+ sll = (struct sockaddr_ll *)(void *)ifa->ifa_addr; -+ break; -+ } - } - -- memset(&tmp, 0, sizeof(tmp)); -- strcpy(tmp.ifr_name, name); -- if (ioctl(sock, SIOCGIFHWADDR, &tmp) < 0) { -- log_fatal("Error getting hardware address for "%s": %m", -- name); -+ if (sll == NULL) { -+ freeifaddrs(ifaddrs); -+ log_fatal("Failed to get HW address for %s\n", name); - } - -- sa = &tmp.ifr_hwaddr; -- switch (sa->sa_family) { -+ switch (sll->sll_hatype) { - case ARPHRD_ETHER: - hw->hlen = 7; - hw->hbuf[0] = HTYPE_ETHER; -- memcpy(&hw->hbuf[1], sa->sa_data, 6); -+ memcpy(&hw->hbuf[1], sll->sll_addr, 6); - break; - case ARPHRD_IEEE802: - #ifdef ARPHRD_IEEE802_TR -@@ -496,18 +637,35 @@ get_hw_addr(const char *name, struct har - #endif /* ARPHRD_IEEE802_TR */ - hw->hlen = 7; - hw->hbuf[0] = HTYPE_IEEE802; -- memcpy(&hw->hbuf[1], sa->sa_data, 6); -+ memcpy(&hw->hbuf[1], sll->sll_addr, 6); - break; - case ARPHRD_FDDI: - hw->hlen = 17; - hw->hbuf[0] = HTYPE_FDDI; -- memcpy(&hw->hbuf[1], sa->sa_data, 16); -+ memcpy(&hw->hbuf[1], sll->sll_addr, 16); -+ break; -+ case ARPHRD_INFINIBAND: -+ /* For Infiniband, save the broadcast address and store -+ * the port GUID into the hardware address. -+ */ -+ if (ifa->ifa_flags & IFF_BROADCAST) { -+ struct sockaddr_ll *bll; -+ -+ bll = (struct sockaddr_ll *)ifa->ifa_broadaddr; -+ memcpy(&info->bcast_addr, bll->sll_addr, 20); -+ } else { -+ memcpy(&info->bcast_addr, default_ib_bcast_addr, -+ 20); -+ } -+ -+ hw->hlen = 1; -+ hw->hbuf[0] = HTYPE_INFINIBAND; - break; - #if defined(ARPHRD_PPP) - case ARPHRD_PPP: - if (local_family != AF_INET6) -- log_fatal("Unsupported device type %d for "%s"", -- sa->sa_family, name); -+ log_fatal("Unsupported device type %ld for "%s"", -+ (long int)sll->sll_family, name); - hw->hlen = 0; - hw->hbuf[0] = HTYPE_RESERVED; - /* 0xdeadbeef should never occur on the wire, -@@ -520,10 +678,11 @@ get_hw_addr(const char *name, struct har - break; - #endif - default: -+ freeifaddrs(ifaddrs); - log_fatal("Unsupported device type %ld for "%s"", -- (long int)sa->sa_family, name); -+ (long int)sll->sll_family, name); - } - -- close(sock); -+ freeifaddrs(ifaddrs); - } - #endif -diff -up dhcp-4.2.2/common/socket.c.lpf-ib dhcp-4.2.2/common/socket.c ---- dhcp-4.2.2/common/socket.c.lpf-ib 2011-06-27 18:18:20.000000000 +0200 -+++ dhcp-4.2.2/common/socket.c 2011-09-19 11:24:08.705775490 +0200 -@@ -324,7 +324,7 @@ void if_register_send (info) - info->wfdesc = if_register_socket(info, AF_INET, 0); - /* If this is a normal IPv4 address, get the hardware address. */ - if (strcmp(info->name, "fallback") != 0) -- get_hw_addr(info->name, &info->hw_address); -+ get_hw_addr(info); - #if defined (USE_SOCKET_FALLBACK) - /* Fallback only registers for send, but may need to receive as - well. */ -@@ -387,7 +387,7 @@ void if_register_receive (info) - #endif /* IP_PKTINFO... */ - /* If this is a normal IPv4 address, get the hardware address. */ - if (strcmp(info->name, "fallback") != 0) -- get_hw_addr(info->name, &info->hw_address); -+ get_hw_addr(info); - - if (!quiet_interface_discovery) - log_info ("Listening on Socket/%s%s%s", -@@ -497,7 +497,7 @@ if_register6(struct interface_info *info - if (req_multi) - if_register_multicast(info); - -- get_hw_addr(info->name, &info->hw_address); -+ get_hw_addr(info); - - if (!quiet_interface_discovery) { - if (info->shared_network != NULL) { -diff -up dhcp-4.2.2/includes/dhcpd.h.lpf-ib dhcp-4.2.2/includes/dhcpd.h ---- dhcp-4.2.2/includes/dhcpd.h.lpf-ib 2011-09-19 11:24:08.696775721 +0200 -+++ dhcp-4.2.2/includes/dhcpd.h 2011-09-19 11:24:08.707775438 +0200 -@@ -1243,6 +1243,7 @@ struct interface_info { - struct shared_network *shared_network; - /* Networks connected to this interface. */ - struct hardware hw_address; /* Its physical address. */ -+ u_int8_t bcast_addr[20]; /* Infiniband broadcast address */ - struct in_addr *addresses; /* Addresses associated with this - * interface. - */ -@@ -2356,7 +2357,7 @@ void print_dns_status (int, struct dhcp_ - #endif - const char *print_time(TIME); - --void get_hw_addr(const char *name, struct hardware *hw); -+void get_hw_addr(struct interface_info *info); - - /* socket.c */ - #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \ -diff -up dhcp-4.2.2/includes/dhcp.h.lpf-ib dhcp-4.2.2/includes/dhcp.h ---- dhcp-4.2.2/includes/dhcp.h.lpf-ib 2011-09-19 11:24:08.696775721 +0200 -+++ dhcp-4.2.2/includes/dhcp.h 2011-09-19 11:24:08.707775438 +0200 -@@ -79,6 +79,7 @@ struct dhcp_packet { - #define HTYPE_ETHER 1 /* Ethernet 10Mbps */ - #define HTYPE_IEEE802 6 /* IEEE 802.2 Token Ring... */ - #define HTYPE_FDDI 8 /* FDDI... */ -+#define HTYPE_INFINIBAND 32 /* Infiniband IPoIB */ - - #define HTYPE_RESERVED 0 /* RFC 5494 */ - diff --git a/dhcp/patches/dhcp-4.2.2-options.patch b/dhcp/patches/dhcp-4.2.2-options.patch deleted file mode 100644 index 32e2add..0000000 --- a/dhcp/patches/dhcp-4.2.2-options.patch +++ /dev/null @@ -1,401 +0,0 @@ -diff -up dhcp-4.2.2b1/client/clparse.c.options dhcp-4.2.2b1/client/clparse.c ---- dhcp-4.2.2b1/client/clparse.c.options 2011-04-21 16:08:14.000000000 +0200 -+++ dhcp-4.2.2b1/client/clparse.c 2011-07-01 13:51:52.935755570 +0200 -@@ -146,6 +146,7 @@ isc_result_t read_client_conf () - /* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache) - */ - top_level_config.requested_lease = 7200; -+ top_level_config.bootp_broadcast_always = 0; - - group_allocate (&top_level_config.on_receipt, MDL); - if (!top_level_config.on_receipt) -@@ -313,7 +314,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; -@@ -732,6 +734,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; -diff -up dhcp-4.2.2b1/client/dhclient.c.options dhcp-4.2.2b1/client/dhclient.c ---- dhcp-4.2.2b1/client/dhclient.c.options 2011-05-11 16:20:59.000000000 +0200 -+++ dhcp-4.2.2b1/client/dhclient.c 2011-07-01 13:51:52.936755545 +0200 -@@ -39,6 +39,12 @@ - #include <limits.h> - #include <dns/result.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... */ - -@@ -87,6 +93,9 @@ int wanted_ia_na = -1; /* the absolute - int wanted_ia_ta = 0; - int wanted_ia_pd = 0; - char *mockup_relay = NULL; -+int bootp_broadcast_always = 0; -+ -+extern u_int32_t default_requested_options[]; - - void run_stateless(int exit_mode); - -@@ -123,6 +132,15 @@ main(int argc, char **argv) { - int local_family_set = 0; - #endif /* DHCPv6 */ - 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; - - /* Initialize client globals. */ - memset(&default_duid, 0, sizeof(default_duid)); -@@ -310,6 +328,88 @@ main(int argc, char **argv) { - } else if (!strcmp(argv[i], "--version")) { - log_info("isc-dhclient-%s", PACKAGE_VERSION); - exit(0); -+ } else if (!strcmp(argv[i], "-I")) { -+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) { -+ usage(); -+ exit(1); -+ } -+ -+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) { -+ log_error("-I option dhcp-client-identifier string "%s" is too long - maximum length is: %d", argv[i], DHCP_MAX_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(); -+ exit(1); -+ } -+ -+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) { -+ log_error("-H option host-name string "%s" is too long - maximum length is: %d", argv[i], DHCP_MAX_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(); -+ exit(1); -+ } -+ -+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) { -+ log_error("-F option fqdn.fqdn string "%s" is too long - maximum length is: %d", argv[i], DHCP_MAX_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], "-timeout")) { -+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) { -+ usage(); -+ exit(1); -+ } -+ -+ 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(); -+ exit(1); -+ } -+ -+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) { -+ log_error("-V option vendor-class-identifier string "%s" is too long - maximum length is: %d", argv[i], DHCP_MAX_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(); -+ exit(1); -+ } -+ -+ dhclient_request_options = argv[i]; - } else if (argv[i][0] == '-') { - usage(); - } else if (interfaces_requested < 0) { -@@ -484,6 +584,166 @@ main(int argc, char **argv) { - /* 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 -timeout 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 -timeout 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/-timeout/-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/-timeout/-V/-R configuration arguments", 0); -+ -+ if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred)) -+ log_fatal("Cannot parse -I/-H/-F/-timeout/-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/-timeout/-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(); - -@@ -2397,7 +2657,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); -@@ -2481,7 +2742,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); -@@ -2543,7 +2806,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-4.2.2b1/common/conflex.c.options dhcp-4.2.2b1/common/conflex.c ---- dhcp-4.2.2b1/common/conflex.c.options 2011-05-11 16:20:59.000000000 +0200 -+++ dhcp-4.2.2b1/common/conflex.c 2011-07-01 13:51:52.938755494 +0200 -@@ -808,6 +808,8 @@ intern(char *atom, enum dhcp_token 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-4.2.2b1/includes/dhcpd.h.options dhcp-4.2.2b1/includes/dhcpd.h ---- dhcp-4.2.2b1/includes/dhcpd.h.options 2011-05-20 16:21:11.000000000 +0200 -+++ dhcp-4.2.2b1/includes/dhcpd.h 2011-07-01 13:51:52.940755442 +0200 -@@ -1147,6 +1147,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-4.2.2b1/includes/dhctoken.h.options dhcp-4.2.2b1/includes/dhctoken.h ---- dhcp-4.2.2b1/includes/dhctoken.h.options 2011-05-12 14:02:47.000000000 +0200 -+++ dhcp-4.2.2b1/includes/dhctoken.h 2011-07-01 13:53:43.316861637 +0200 -@@ -361,7 +361,8 @@ enum dhcp_token { - GETHOSTNAME = 662, - REWIND = 663, - INITIAL_DELAY = 664, -- GETHOSTBYNAME = 665 -+ GETHOSTBYNAME = 665, -+ BOOTP_BROADCAST_ALWAYS = 666 - }; - - #define is_identifier(x) ((x) >= FIRST_TOKEN && \ diff --git a/dhcp/patches/dhcp-4.2.2-rfc3442-classless-static-routes.patch b/dhcp/patches/dhcp-4.2.2-rfc3442-classless-static-routes.patch deleted file mode 100644 index 0a0bfcb..0000000 --- a/dhcp/patches/dhcp-4.2.2-rfc3442-classless-static-routes.patch +++ /dev/null @@ -1,405 +0,0 @@ -diff -up dhcp-4.2.2b1/client/clparse.c.rfc3442 dhcp-4.2.2b1/client/clparse.c ---- dhcp-4.2.2b1/client/clparse.c.rfc3442 2011-07-01 14:22:38.031534508 +0200 -+++ dhcp-4.2.2b1/client/clparse.c 2011-07-01 14:22:38.128532940 +0200 -@@ -37,7 +37,7 @@ - - struct client_config top_level_config; - --#define NUM_DEFAULT_REQUESTED_OPTS 14 -+#define NUM_DEFAULT_REQUESTED_OPTS 15 - struct option *default_requested_options[NUM_DEFAULT_REQUESTED_OPTS + 1]; - - static void parse_client_default_duid(struct parse *cfile); -@@ -82,7 +82,11 @@ isc_result_t read_client_conf () - dhcp_universe.code_hash, &code, 0, MDL); - - /* 4 */ -- code = DHO_ROUTERS; -+ /* The Classless Static Routes option code MUST appear in the parameter -+ * request list prior to both the Router option code and the Static -+ * Routes option code, if present. (RFC3442) -+ */ -+ code = DHO_CLASSLESS_STATIC_ROUTES; - option_code_hash_lookup(&default_requested_options[3], - dhcp_universe.code_hash, &code, 0, MDL); - -@@ -136,6 +140,11 @@ isc_result_t read_client_conf () - option_code_hash_lookup(&default_requested_options[13], - dhcp_universe.code_hash, &code, 0, MDL); - -+ /* 15 */ -+ code = DHO_ROUTERS; -+ option_code_hash_lookup(&default_requested_options[14], -+ dhcp_universe.code_hash, &code, 0, MDL); -+ - for (code = 0 ; code < NUM_DEFAULT_REQUESTED_OPTS ; code++) { - if (default_requested_options[code] == NULL) - log_fatal("Unable to find option definition for " -diff -up dhcp-4.2.2b1/common/dhcp-options.5.rfc3442 dhcp-4.2.2b1/common/dhcp-options.5 ---- dhcp-4.2.2b1/common/dhcp-options.5.rfc3442 2011-07-01 14:22:38.020534686 +0200 -+++ dhcp-4.2.2b1/common/dhcp-options.5 2011-07-01 14:22:38.129532924 +0200 -@@ -115,6 +115,26 @@ hexadecimal, separated by colons. For - or - option dhcp-client-identifier 43:4c:49:45:54:2d:46:4f:4f; - .fi -+.PP -+The -+.B destination-descriptor -+describe the IP subnet number and subnet mask -+of a particular destination using a compact encoding. This encoding -+consists of one octet describing the width of the subnet mask, -+followed by all the significant octets of the subnet number. -+The following table contains some examples of how various subnet -+number/mask combinations can be encoded: -+.nf -+.sp 1 -+Subnet number Subnet mask Destination descriptor -+0 0 0 -+10.0.0.0 255.0.0.0 8.10 -+10.0.0.0 255.255.255.0 24.10.0.0 -+10.17.0.0 255.255.0.0 16.10.17 -+10.27.129.0 255.255.255.0 24.10.27.129 -+10.229.0.128 255.255.255.128 25.10.229.0.128 -+10.198.122.47 255.255.255.255 32.10.198.122.47 -+.fi - .SH SETTING OPTION VALUES USING EXPRESSIONS - Sometimes it's helpful to be able to set the value of a DHCP option - based on some value that the client has sent. To do this, you can -@@ -931,6 +951,29 @@ dhclient-script will create routes: - .RE - .PP - .nf -+.B option \fBclassless-static-routes\fR \fIdestination-descriptor ip-address\fR -+ [\fB,\fR \fIdestination-descriptor ip-address\fR...]\fB;\fR -+.fi -+.RS 0.25i -+.PP -+This option (see RFC3442) specifies a list of classless static routes -+that the client should install in its routing cache. -+.PP -+This option can contain one or more static routes, each of which -+consists of a destination descriptor and the IP address of the router -+that should be used to reach that destination. -+.PP -+Many clients may not implement the Classless Static Routes option. -+DHCP server administrators should therefore configure their DHCP -+servers to send both a Router option and a Classless Static Routes -+option, and should specify the default router(s) both in the Router -+option and in the Classless Static Routes option. -+.PP -+If the DHCP server returns both a Classless Static Routes option and -+a Router option, the DHCP client ignores the Router option. -+.RE -+.PP -+.nf - .B option \fBstreettalk-directory-assistance-server\fR \fIip-address\fR - [\fB,\fR \fIip-address\fR...]\fB;\fR - .fi -diff -up dhcp-4.2.2b1/common/inet.c.rfc3442 dhcp-4.2.2b1/common/inet.c ---- dhcp-4.2.2b1/common/inet.c.rfc3442 2011-05-11 02:47:22.000000000 +0200 -+++ dhcp-4.2.2b1/common/inet.c 2011-07-01 14:22:38.130532908 +0200 -@@ -528,6 +528,60 @@ free_iaddrcidrnetlist(struct iaddrcidrne - return ISC_R_SUCCESS; - } - -+static const char * -+inet_ntopdd(const unsigned char *src, unsigned srclen, char *dst, size_t size) -+{ -+ char tmp[sizeof("32.255.255.255.255")]; -+ int len; -+ -+ switch (srclen) { -+ case 2: -+ len = sprintf (tmp, "%u.%u", src[0], src[1]); -+ break; -+ case 3: -+ len = sprintf (tmp, "%u.%u.%u", src[0], src[1], src[2]); -+ break; -+ case 4: -+ len = sprintf (tmp, "%u.%u.%u.%u", src[0], src[1], src[2], src[3]); -+ break; -+ case 5: -+ len = sprintf (tmp, "%u.%u.%u.%u.%u", src[0], src[1], src[2], src[3], src[4]); -+ break; -+ default: -+ return NULL; -+ } -+ if (len < 0) -+ return NULL; -+ -+ if (len > size) { -+ errno = ENOSPC; -+ return NULL; -+ } -+ -+ return strcpy (dst, tmp); -+} -+ -+/* pdestdesc() turns an iaddr structure into a printable dest. descriptor */ -+const char * -+pdestdesc(const struct iaddr addr) { -+ static char pbuf[sizeof("255.255.255.255.255")]; -+ -+ if (addr.len == 0) { -+ return "<null destination descriptor>"; -+ } -+ if (addr.len == 1) { -+ return "0"; -+ } -+ if ((addr.len >= 2) && (addr.len <= 5)) { -+ return inet_ntopdd(addr.iabuf, addr.len, pbuf, sizeof(pbuf)); -+ } -+ -+ log_fatal("pdestdesc():%s:%d: Invalid destination descriptor length %d.", -+ MDL, addr.len); -+ /* quell compiler warnings */ -+ return NULL; -+} -+ - /* piaddr() turns an iaddr structure into a printable address. */ - /* XXX: should use a const pointer rather than passing the structure */ - const char * -diff -up dhcp-4.2.2b1/common/options.c.rfc3442 dhcp-4.2.2b1/common/options.c ---- dhcp-4.2.2b1/common/options.c.rfc3442 2011-03-24 22:57:13.000000000 +0100 -+++ dhcp-4.2.2b1/common/options.c 2011-07-01 14:22:38.132532876 +0200 -@@ -706,7 +706,11 @@ cons_options(struct packet *inpacket, st - * packet. - */ - priority_list[priority_len++] = DHO_SUBNET_MASK; -- priority_list[priority_len++] = DHO_ROUTERS; -+ if (lookup_option(&dhcp_universe, cfg_options, -+ DHO_CLASSLESS_STATIC_ROUTES)) -+ priority_list[priority_len++] = DHO_CLASSLESS_STATIC_ROUTES; -+ else -+ priority_list[priority_len++] = DHO_ROUTERS; - priority_list[priority_len++] = DHO_DOMAIN_NAME_SERVERS; - priority_list[priority_len++] = DHO_HOST_NAME; - priority_list[priority_len++] = DHO_FQDN; -@@ -1683,6 +1687,7 @@ const char *pretty_print_option (option, - const unsigned char *dp = data; - char comma; - unsigned long tval; -+ unsigned int octets = 0; - - if (emit_commas) - comma = ','; -@@ -1691,6 +1696,7 @@ const char *pretty_print_option (option, - - memset (enumbuf, 0, sizeof enumbuf); - -+ if (option->format[0] != 'R') { /* see explanation lower */ - /* Figure out the size of the data. */ - for (l = i = 0; option -> format [i]; i++, l++) { - if (l >= sizeof(fmtbuf) - 1) -@@ -1840,6 +1846,33 @@ const char *pretty_print_option (option, - if (numhunk < 0) - numhunk = 1; - -+ } else { /* option->format[i] == 'R') */ -+ /* R (destination descriptor) has variable length. -+ * We can find it only in classless static route option, -+ * so we are for sure parsing classless static route option now. -+ * We go through whole the option to check whether there are no -+ * missing/extra bytes. -+ * I didn't find out how to improve the existing code and that's the -+ * reason for this separate 'else' where I do my own checkings. -+ * I know it's little bit unsystematic, but it works. -+ */ -+ numhunk = 0; -+ numelem = 2; /* RI */ -+ fmtbuf[0]='R'; fmtbuf[1]='I'; fmtbuf[2]=0; -+ for (i =0; i < len; i = i + octets + 5) { -+ if (data[i] > 32) { /* subnet mask width */ -+ log_error ("wrong subnet mask width in destination descriptor"); -+ break; -+ } -+ numhunk++; -+ octets = ((data[i]+7) / 8); -+ } -+ if (i != len) { -+ log_error ("classless static routes option has wrong size or " -+ "there's some garbage in format"); -+ } -+ } -+ - /* Cycle through the array (or hunk) printing the data. */ - for (i = 0; i < numhunk; i++) { - for (j = 0; j < numelem; j++) { -@@ -1978,6 +2011,20 @@ const char *pretty_print_option (option, - strcpy(op, piaddr(iaddr)); - dp += 4; - break; -+ -+ case 'R': -+ if (dp[0] <= 32) -+ iaddr.len = (((dp[0]+7)/8)+1); -+ else { -+ log_error ("wrong subnet mask width in destination descriptor"); -+ return "<error>"; -+ } -+ -+ memcpy(iaddr.iabuf, dp, iaddr.len); -+ strcpy(op, pdestdesc(iaddr)); -+ dp += iaddr.len; -+ break; -+ - case '6': - iaddr.len = 16; - memcpy(iaddr.iabuf, dp, 16); -diff -up dhcp-4.2.2b1/common/parse.c.rfc3442 dhcp-4.2.2b1/common/parse.c ---- dhcp-4.2.2b1/common/parse.c.rfc3442 2011-07-01 14:22:38.097533441 +0200 -+++ dhcp-4.2.2b1/common/parse.c 2011-07-01 14:22:38.135532828 +0200 -@@ -341,6 +341,39 @@ int parse_ip_addr (cfile, addr) - } - - /* -+ * destination-descriptor :== NUMBER DOT NUMBER | -+ * NUMBER DOT NUMBER DOT NUMBER | -+ * NUMBER DOT NUMBER DOT NUMBER DOT NUMBER | -+ * NUMBER DOT NUMBER DOT NUMBER DOT NUMBER DOT NUMBER -+ */ -+ -+int parse_destination_descriptor (cfile, addr) -+ struct parse *cfile; -+ struct iaddr *addr; -+{ -+ unsigned int mask_width, dest_dest_len; -+ addr -> len = 0; -+ if (parse_numeric_aggregate (cfile, addr -> iabuf, -+ &addr -> len, DOT, 10, 8)) { -+ mask_width = (unsigned int)addr->iabuf[0]; -+ dest_dest_len = (((mask_width+7)/8)+1); -+ if (mask_width > 32) { -+ parse_warn (cfile, -+ "subnet mask width (%u) greater than 32.", mask_width); -+ } -+ else if (dest_dest_len != addr->len) { -+ parse_warn (cfile, -+ "destination descriptor with subnet mask width %u " -+ "should have %u octets, but has %u octets.", -+ mask_width, dest_dest_len, addr->len); -+ } -+ -+ return 1; -+ } -+ return 0; -+} -+ -+/* - * Return true if every character in the string is hexadecimal. - */ - static int -@@ -700,8 +733,10 @@ unsigned char *parse_numeric_aggregate ( - if (count) { - token = peek_token (&val, (unsigned *)0, cfile); - if (token != separator) { -- if (!*max) -+ if (!*max) { -+ *max = count; - break; -+ } - if (token != RBRACE && token != LBRACE) - token = next_token (&val, - (unsigned *)0, -@@ -1624,6 +1659,9 @@ int parse_option_code_definition (cfile, - case IP_ADDRESS: - type = 'I'; - break; -+ case DESTINATION_DESCRIPTOR: -+ type = 'R'; -+ break; - case IP6_ADDRESS: - type = '6'; - break; -@@ -5288,6 +5326,15 @@ int parse_option_token (rv, cfile, fmt, - } - break; - -+ case 'R': /* destination descriptor */ -+ if (!parse_destination_descriptor (cfile, &addr)) { -+ return 0; -+ } -+ if (!make_const_data (&t, addr.iabuf, addr.len, 0, 1, MDL)) { -+ return 0; -+ } -+ break; -+ - case '6': /* IPv6 address. */ - if (!parse_ip6_addr(cfile, &addr)) { - return 0; -@@ -5548,6 +5595,13 @@ int parse_option_decl (oc, cfile) - goto exit; - len = ip_addr.len; - dp = ip_addr.iabuf; -+ goto alloc; -+ -+ case 'R': /* destination descriptor */ -+ if (!parse_destination_descriptor (cfile, &ip_addr)) -+ goto exit; -+ len = ip_addr.len; -+ dp = ip_addr.iabuf; - - alloc: - if (hunkix + len > sizeof hunkbuf) { -diff -up dhcp-4.2.2b1/common/tables.c.rfc3442 dhcp-4.2.2b1/common/tables.c ---- dhcp-4.2.2b1/common/tables.c.rfc3442 2011-07-01 14:22:38.087533601 +0200 -+++ dhcp-4.2.2b1/common/tables.c 2011-07-01 14:22:38.137532796 +0200 -@@ -51,6 +51,7 @@ HASH_FUNCTIONS (option_code, const unsig - Format codes: - - I - IPv4 address -+ R - destination descriptor (RFC3442) - 6 - IPv6 address - l - 32-bit signed integer - L - 32-bit unsigned integer -@@ -208,6 +209,7 @@ static struct option dhcp_options[] = { - { "default-url", "t", &dhcp_universe, 114, 1 }, - { "subnet-selection", "I", &dhcp_universe, 118, 1 }, - { "domain-search", "D", &dhcp_universe, 119, 1 }, -+ { "classless-static-routes", "RIA", &dhcp_universe, 121, 1 }, - { "vivco", "Evendor-class.", &dhcp_universe, 124, 1 }, - { "vivso", "Evendor.", &dhcp_universe, 125, 1 }, - #if 0 -diff -up dhcp-4.2.2b1/includes/dhcpd.h.rfc3442 dhcp-4.2.2b1/includes/dhcpd.h ---- dhcp-4.2.2b1/includes/dhcpd.h.rfc3442 2011-07-01 14:22:38.000000000 +0200 -+++ dhcp-4.2.2b1/includes/dhcpd.h 2011-07-01 14:24:19.999810333 +0200 -@@ -2662,6 +2662,7 @@ isc_result_t range2cidr(struct iaddrcidr - const struct iaddr *lo, const struct iaddr *hi); - isc_result_t free_iaddrcidrnetlist(struct iaddrcidrnetlist **result); - const char *piaddr (struct iaddr); -+const char *pdestdesc (struct iaddr); - char *piaddrmask(struct iaddr *, struct iaddr *); - char *piaddrcidr(const struct iaddr *, unsigned int); - u_int16_t validate_port(char *); -@@ -2869,6 +2870,7 @@ void parse_client_lease_declaration (str - int parse_option_decl (struct option_cache **, struct parse *); - void parse_string_list (struct parse *, struct string_list **, int); - int parse_ip_addr (struct parse *, struct iaddr *); -+int parse_destination_descriptor (struct parse *, struct iaddr *); - int parse_ip_addr_with_subnet(struct parse *, struct iaddrmatch *); - void parse_reject_statement (struct parse *, struct client_config *); - -diff -up dhcp-4.2.2b1/includes/dhcp.h.rfc3442 dhcp-4.2.2b1/includes/dhcp.h ---- dhcp-4.2.2b1/includes/dhcp.h.rfc3442 2009-11-20 02:49:01.000000000 +0100 -+++ dhcp-4.2.2b1/includes/dhcp.h 2011-07-01 14:22:38.145532665 +0200 -@@ -158,6 +158,7 @@ struct dhcp_packet { - #define DHO_ASSOCIATED_IP 92 - #define DHO_SUBNET_SELECTION 118 /* RFC3011! */ - #define DHO_DOMAIN_SEARCH 119 /* RFC3397 */ -+#define DHO_CLASSLESS_STATIC_ROUTES 121 /* RFC3442 */ - #define DHO_VIVCO_SUBOPTIONS 124 - #define DHO_VIVSO_SUBOPTIONS 125 - -diff -up dhcp-4.2.2b1/includes/dhctoken.h.rfc3442 dhcp-4.2.2b1/includes/dhctoken.h ---- dhcp-4.2.2b1/includes/dhctoken.h.rfc3442 2011-07-01 14:22:37.000000000 +0200 -+++ dhcp-4.2.2b1/includes/dhctoken.h 2011-07-01 14:25:12.541867623 +0200 -@@ -362,7 +362,8 @@ enum dhcp_token { - REWIND = 663, - INITIAL_DELAY = 664, - GETHOSTBYNAME = 665, -- BOOTP_BROADCAST_ALWAYS = 666 -+ BOOTP_BROADCAST_ALWAYS = 666, -+ DESTINATION_DESCRIPTOR = 667 - }; - - #define is_identifier(x) ((x) >= FIRST_TOKEN && \ diff --git a/dhcp/patches/dhcp-4.2.2-sharedlib.patch b/dhcp/patches/dhcp-4.2.2-sharedlib.patch index 74fe9f1..b504de7 100644 --- a/dhcp/patches/dhcp-4.2.2-sharedlib.patch +++ b/dhcp/patches/dhcp-4.2.2-sharedlib.patch @@ -1,7 +1,7 @@ diff -up dhcp-4.2.2/client/Makefile.am.sharedlib dhcp-4.2.2/client/Makefile.am ---- dhcp-4.2.2/client/Makefile.am.sharedlib 2011-09-09 16:35:56.000000000 +0200 -+++ dhcp-4.2.2/client/Makefile.am 2011-09-09 16:36:29.849007951 +0200 -@@ -4,7 +4,7 @@ dhclient_SOURCES = clparse.c dhclient.c +--- dhcp-4.2.2/client/Makefile.am.sharedlib 2011-10-09 20:07:40.000000000 +0200 ++++ dhcp-4.2.2/client/Makefile.am 2011-10-09 20:07:40.000000000 +0200 +@@ -4,7 +4,7 @@ dhclient_SOURCES = clparse.c dhclient.c scripts/bsdos scripts/freebsd scripts/linux scripts/macos \ scripts/netbsd scripts/nextstep scripts/openbsd \ scripts/solaris scripts/openwrt @@ -11,8 +11,8 @@ diff -up dhcp-4.2.2/client/Makefile.am.sharedlib dhcp-4.2.2/client/Makefile.am man_MANS = dhclient.8 dhclient-script.8 dhclient.conf.5 dhclient.leases.5 EXTRA_DIST = $(man_MANS) diff -up dhcp-4.2.2/configure.ac.sharedlib dhcp-4.2.2/configure.ac ---- dhcp-4.2.2/configure.ac.sharedlib 2011-09-09 16:35:56.097000001 +0200 -+++ dhcp-4.2.2/configure.ac 2011-09-09 16:35:56.383000000 +0200 +--- dhcp-4.2.2/configure.ac.sharedlib 2011-10-09 20:07:40.000000000 +0200 ++++ dhcp-4.2.2/configure.ac 2011-10-09 20:07:40.000000000 +0200 @@ -30,7 +30,8 @@ fi # Use this to define _GNU_SOURCE to pull in the IPv6 Advanced Socket API. AC_USE_SYSTEM_EXTENSIONS @@ -24,8 +24,8 @@ diff -up dhcp-4.2.2/configure.ac.sharedlib dhcp-4.2.2/configure.ac
# we sometimes need to know byte order for building packets diff -up dhcp-4.2.2/dhcpctl/Makefile.am.sharedlib dhcp-4.2.2/dhcpctl/Makefile.am ---- dhcp-4.2.2/dhcpctl/Makefile.am.sharedlib 2011-09-09 16:35:55.459000001 +0200 -+++ dhcp-4.2.2/dhcpctl/Makefile.am 2011-09-09 16:35:56.384000000 +0200 +--- dhcp-4.2.2/dhcpctl/Makefile.am.sharedlib 2011-10-09 20:07:39.000000000 +0200 ++++ dhcp-4.2.2/dhcpctl/Makefile.am 2011-10-09 20:07:40.000000000 +0200 @@ -1,15 +1,15 @@ bin_PROGRAMS = omshell -lib_LIBRARIES = libdhcpctl.a @@ -46,34 +46,9 @@ diff -up dhcp-4.2.2/dhcpctl/Makefile.am.sharedlib dhcp-4.2.2/dhcpctl/Makefile.am -cltest_LDADD = libdhcpctl.a ../common/libdhcp.a ../omapip/libomapi.a \ +cltest_LDADD = libdhcpctl.la ../common/libdhcp.a ../omapip/libomapi.la \ $(BIND9_LIBDIR) -ldns-export -lisc-export -diff -up dhcp-4.2.2/dst/base64.c.sharedlib dhcp-4.2.2/dst/base64.c ---- dhcp-4.2.2/dst/base64.c.sharedlib 2009-11-20 02:49:01.000000000 +0100 -+++ dhcp-4.2.2/dst/base64.c 2011-09-09 16:35:56.385000000 +0200 -@@ -64,6 +64,7 @@ static const char rcsid[] = "$Id: base64 - - #include <sys/socket.h> - -+#include "dst_internal.h" - #include "cdefs.h" - #include "osdep.h" - #include "arpa/nameser.h" -diff -up dhcp-4.2.2/dst/Makefile.am.sharedlib dhcp-4.2.2/dst/Makefile.am ---- dhcp-4.2.2/dst/Makefile.am.sharedlib 2007-05-29 18:32:10.000000000 +0200 -+++ dhcp-4.2.2/dst/Makefile.am 2011-09-09 16:35:56.386000000 +0200 -@@ -1,8 +1,8 @@ - AM_CPPFLAGS = -DMINIRES_LIB -DHMAC_MD5 - --lib_LIBRARIES = libdst.a -+lib_LTLIBRARIES = libdst.la - --libdst_a_SOURCES = dst_support.c dst_api.c hmac_link.c md5_dgst.c \ -+libdst_la_SOURCES = dst_support.c dst_api.c hmac_link.c md5_dgst.c \ - base64.c prandom.c - - EXTRA_DIST = dst_internal.h md5.h md5_locl.h diff -up dhcp-4.2.2/omapip/Makefile.am.sharedlib dhcp-4.2.2/omapip/Makefile.am ---- dhcp-4.2.2/omapip/Makefile.am.sharedlib 2011-09-09 16:35:55.000000000 +0200 -+++ dhcp-4.2.2/omapip/Makefile.am 2011-09-09 16:37:36.734000324 +0200 +--- dhcp-4.2.2/omapip/Makefile.am.sharedlib 2011-10-09 20:07:39.000000000 +0200 ++++ dhcp-4.2.2/omapip/Makefile.am 2011-10-09 20:07:40.000000000 +0200 @@ -1,7 +1,7 @@ -lib_LIBRARIES = libomapi.a +lib_LTLIBRARIES = libomapi.la @@ -92,8 +67,8 @@ diff -up dhcp-4.2.2/omapip/Makefile.am.sharedlib dhcp-4.2.2/omapip/Makefile.am +svtest_LDADD = libomapi.la $(BIND9_LIBDIR) -ldns-export -lisc-export
diff -up dhcp-4.2.2/relay/Makefile.am.sharedlib dhcp-4.2.2/relay/Makefile.am ---- dhcp-4.2.2/relay/Makefile.am.sharedlib 2011-09-09 16:35:56.000000000 +0200 -+++ dhcp-4.2.2/relay/Makefile.am 2011-09-09 16:37:57.058019749 +0200 +--- dhcp-4.2.2/relay/Makefile.am.sharedlib 2011-10-09 20:07:40.000000000 +0200 ++++ dhcp-4.2.2/relay/Makefile.am 2011-10-09 20:07:40.000000000 +0200 @@ -2,7 +2,7 @@ AM_CPPFLAGS = -DLOCALSTATEDIR='"@localst
sbin_PROGRAMS = dhcrelay @@ -104,16 +79,16 @@ diff -up dhcp-4.2.2/relay/Makefile.am.sharedlib dhcp-4.2.2/relay/Makefile.am man_MANS = dhcrelay.8 EXTRA_DIST = $(man_MANS) diff -up dhcp-4.2.2/server/Makefile.am.sharedlib dhcp-4.2.2/server/Makefile.am ---- dhcp-4.2.2/server/Makefile.am.sharedlib 2011-09-09 16:35:56.000000000 +0200 -+++ dhcp-4.2.2/server/Makefile.am 2011-09-09 16:38:56.291004599 +0200 +--- dhcp-4.2.2/server/Makefile.am.sharedlib 2011-10-09 20:07:39.000000000 +0200 ++++ dhcp-4.2.2/server/Makefile.am 2011-10-09 20:08:26.000000000 +0200 @@ -7,8 +7,8 @@ dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c c dhcpv6.c mdb6.c ldap.c ldap_casa.c
dhcpd_CFLAGS = $(LDAP_CFLAGS) -dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ -- ../dhcpctl/libdhcpctl.a $(BIND9_LIBDIR) -ldns-export -lisc-export \ +- ../dhcpctl/libdhcpctl.a $(BIND9_LIBDIR) -ldns-export -lisc-export +dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \ -+ ../dhcpctl/libdhcpctl.la $(BIND9_LIBDIR) -ldns-export -lisc-export \ - $(CAPNG_LDADD) ++ ../dhcpctl/libdhcpctl.la $(BIND9_LIBDIR) -ldns-export -lisc-export
man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5 + EXTRA_DIST = $(man_MANS) diff --git a/dhcp/patches/dhcp-4.2.2-systemtap.patch b/dhcp/patches/dhcp-4.2.2-systemtap.patch deleted file mode 100644 index c067348..0000000 --- a/dhcp/patches/dhcp-4.2.2-systemtap.patch +++ /dev/null @@ -1,810 +0,0 @@ -diff -up dhcp-4.2.2/configure.ac.systemtap dhcp-4.2.2/configure.ac ---- dhcp-4.2.2/configure.ac.systemtap 2011-09-21 15:13:35.515434854 +0200 -+++ dhcp-4.2.2/configure.ac 2011-09-21 15:13:35.574434049 +0200 -@@ -485,6 +485,35 @@ else - AC_MSG_RESULT(no) - fi - -+AC_MSG_CHECKING([whether to include systemtap tracing support]) -+AC_ARG_ENABLE([systemtap], -+ [AS_HELP_STRING([--enable-systemtap], -+ [Enable inclusion of systemtap trace support])], -+ [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP='no']) -+AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test x$ENABLE_SYSTEMTAP = xyes]) -+AC_MSG_RESULT(${ENABLE_SYSTEMTAP}) -+ -+if test "x${ENABLE_SYSTEMTAP}" = xyes; then -+ # Additional configuration for --enable-systemtap is HERE -+ AC_CHECK_PROGS(DTRACE, dtrace) -+ if test -z "$DTRACE"; then -+ AC_MSG_ERROR([dtrace not found]) -+ fi -+ AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='yes'], -+ [SDT_H_FOUND='no'; -+ AC_MSG_ERROR([systemtap support needs sys/sdt.h header])]) -+ AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if using SystemTap probes.]) -+ AC_ARG_WITH([tapset-install-dir], -+ [AS_HELP_STRING([--with-tapset-install-dir], -+ [The absolute path where the tapset dir will be installed])], -+ [if test "x${withval}" = x; then -+ ABS_TAPSET_DIR="$(datadir)/systemtap/tapset" -+ else -+ ABS_TAPSET_DIR="${withval}" -+ fi], [ABS_TAPSET_DIR="$(datadir)/systemtap/tapset"]) -+ AC_SUBST(ABS_TAPSET_DIR) -+fi -+ - # Solaris needs some libraries for functions - AC_SEARCH_LIBS(socket, [socket]) - AC_SEARCH_LIBS(inet_ntoa, [nsl]) -@@ -631,6 +660,7 @@ AC_OUTPUT([ - relay/Makefile - server/Makefile - tests/Makefile -+ tapset/Makefile - ]) - - sh util/bindvar.sh -diff -up dhcp-4.2.2/Makefile.am.systemtap dhcp-4.2.2/Makefile.am ---- dhcp-4.2.2/Makefile.am.systemtap 2011-09-21 15:13:35.339437258 +0200 -+++ dhcp-4.2.2/Makefile.am 2011-09-21 15:13:35.574434049 +0200 -@@ -29,5 +29,8 @@ endif - - SUBDIRS += includes tests common dst omapip client dhcpctl relay server - -+SUBDIRS += tapset -+#DIST_SUBDIRS = $(SUBDIRS) -+ - nobase_include_HEADERS = dhcpctl/dhcpctl.h - -diff -up dhcp-4.2.2/server/dhcp.c.systemtap dhcp-4.2.2/server/dhcp.c ---- dhcp-4.2.2/server/dhcp.c.systemtap 2011-09-21 15:13:35.362436945 +0200 -+++ dhcp-4.2.2/server/dhcp.c 2011-09-21 15:13:35.576434021 +0200 -@@ -36,7 +36,7 @@ - #include <errno.h> - #include <limits.h> - #include <sys/time.h> -- -+#include "trace.h" - static void commit_leases_ackout(void *foo); - static void maybe_return_agent_options(struct packet *packet, - struct option_state *options); -@@ -275,6 +275,8 @@ void dhcpdiscover (packet, ms_nulltp) - dhcp_failover_state_t *peer; - #endif - -+ TRACE(DHCPD_DISCOVER_START()); -+ - find_lease (&lease, packet, packet -> shared_network, - 0, &peer_has_leases, (struct lease *)0, MDL); - -@@ -399,6 +401,8 @@ void dhcpdiscover (packet, ms_nulltp) - out: - if (lease) - lease_dereference (&lease, MDL); -+ -+ TRACE(DHCPD_DISCOVER_DONE()); - } - - void dhcprequest (packet, ms_nulltp, ip_lease) -@@ -422,6 +426,8 @@ void dhcprequest (packet, ms_nulltp, ip_ - int have_server_identifier = 0; - int have_requested_addr = 0; - -+ TRACE(DHCPD_REQUEST_START()); -+ - oc = lookup_option (&dhcp_universe, packet -> options, - DHO_DHCP_REQUESTED_ADDRESS); - memset (&data, 0, sizeof data); -@@ -679,6 +685,9 @@ void dhcprequest (packet, ms_nulltp, ip_ - log_info ("%s: unknown lease %s.", msgbuf, piaddr (cip)); - - out: -+ -+ TRACE(DHCPD_REQUEST_DONE()); -+ - if (subnet) - subnet_dereference (&subnet, MDL); - if (lease) -@@ -697,6 +706,7 @@ void dhcprelease (packet, ms_nulltp) - const char *s; - char msgbuf [1024], cstr[16]; /* XXX */ - -+ TRACE(DHCPD_RELEASE_START()); - - /* DHCPRELEASE must not specify address in requested-address - option, but old protocol specs weren't explicit about this, -@@ -821,6 +831,8 @@ void dhcprelease (packet, ms_nulltp) - #endif - if (lease) - lease_dereference (&lease, MDL); -+ -+ TRACE(DHCPD_RELEASE_DONE()); - } - - void dhcpdecline (packet, ms_nulltp) -@@ -838,6 +850,8 @@ void dhcpdecline (packet, ms_nulltp) - struct option_cache *oc; - struct data_string data; - -+ TRACE(DHCPD_DECLINE_START()); -+ - /* DHCPDECLINE must specify address. */ - if (!(oc = lookup_option (&dhcp_universe, packet -> options, - DHO_DHCP_REQUESTED_ADDRESS))) -@@ -949,6 +963,8 @@ void dhcpdecline (packet, ms_nulltp) - option_state_dereference (&options, MDL); - if (lease) - lease_dereference (&lease, MDL); -+ -+ TRACE(DHCPD_DECLINE_DONE()); - } - - void dhcpinform (packet, ms_nulltp) -@@ -970,6 +986,8 @@ void dhcpinform (packet, ms_nulltp) - struct in_addr from; - isc_boolean_t zeroed_ciaddr; - -+ TRACE(DHCPD_INFORM_START()); -+ - /* The client should set ciaddr to its IP address, but apparently - it's common for clients not to do this, so we'll use their IP - source address if they didn't set ciaddr. */ -@@ -1320,6 +1338,8 @@ void dhcpinform (packet, ms_nulltp) - from, &to, (struct hardware *)0); - if (subnet) - subnet_dereference (&subnet, MDL); -+ -+ TRACE(DHCPD_INFORM_DONE()); - } - - void nak_lease (packet, cip) -@@ -1336,6 +1356,8 @@ void nak_lease (packet, cip) - struct option_state *options = (struct option_state *)0; - struct option_cache *oc = (struct option_cache *)0; - -+ TRACE(DHCPD_NAK_LEASE_START()); -+ - option_state_allocate (&options, MDL); - memset (&outgoing, 0, sizeof outgoing); - memset (&raw, 0, sizeof raw); -@@ -1474,6 +1496,8 @@ void nak_lease (packet, cip) - errno = 0; - result = send_packet(packet->interface, packet, &raw, - outgoing.packet_length, from, &to, NULL); -+ -+ TRACE(DHCPD_NAK_LEASE_DONE()); - } - - void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) -@@ -1515,6 +1539,8 @@ void ack_lease (packet, lease, offer, wh - if (lease -> state) - return; - -+ TRACE(DHCPD_ACK_LEASE_START()); -+ - /* Save original cltt for comparison later. */ - lease_cltt = lease->cltt; - -@@ -2877,6 +2903,8 @@ void ack_lease (packet, lease, offer, wh - #endif - dhcp_reply(lease); - } -+ -+ TRACE(DHCPD_ACK_LEASE_DONE()); - } - - /* -@@ -3029,6 +3057,8 @@ void dhcp_reply (lease) - if (!state) - log_fatal ("dhcp_reply was supplied lease with no state!"); - -+ TRACE(DHCPD_REPLY_START()); -+ - /* Compose a response for the client... */ - memset (&raw, 0, sizeof raw); - memset (&d1, 0, sizeof d1); -@@ -3236,6 +3266,8 @@ void dhcp_reply (lease) - - free_lease_state (state, MDL); - lease -> state = (struct lease_state *)0; -+ -+ TRACE(DHCPD_REPLY_DONE()); - } - - int find_lease (struct lease **lp, -@@ -3258,6 +3290,8 @@ int find_lease (struct lease **lp, - struct data_string client_identifier; - struct hardware h; - -+ TRACE(DHCPD_FIND_LEASE_START()); -+ - #if defined(FAILOVER_PROTOCOL) - /* Quick check to see if the peer has leases. */ - if (peer_has_leases) { -@@ -3985,6 +4019,9 @@ int find_lease (struct lease **lp, - #if defined (DEBUG_FIND_LEASE) - log_info ("Not returning a lease."); - #endif -+ -+ TRACE(DHCPD_FIND_LEASE_DONE()); -+ - return 0; - } - -diff -up dhcp-4.2.2/server/dhcpd.c.systemtap dhcp-4.2.2/server/dhcpd.c ---- dhcp-4.2.2/server/dhcpd.c.systemtap 2011-09-21 15:13:35.471435455 +0200 -+++ dhcp-4.2.2/server/dhcpd.c 2011-09-21 15:14:47.686449112 +0200 -@@ -63,6 +63,8 @@ static const char url [] = - int keep_capabilities = 0; - #endif - -+#include "trace.h" -+ - static void usage(void); - - struct iaddr server_identifier; -@@ -887,7 +889,7 @@ main(int argc, char **argv) { - log_info ("Dropped all capabilities."); - } - #endif -- -+ TRACE(DHCPD_MAIN()); - /* Receive packets and dispatch them... */ - dispatch (); - -diff -up dhcp-4.2.2/server/dhcpv6.c.systemtap dhcp-4.2.2/server/dhcpv6.c ---- dhcp-4.2.2/server/dhcpv6.c.systemtap 2011-09-21 15:13:35.528434676 +0200 -+++ dhcp-4.2.2/server/dhcpv6.c 2011-09-21 15:13:35.579433979 +0200 -@@ -15,6 +15,7 @@ - */ - - #include "dhcpd.h" -+#include "trace.h" - - #ifdef DHCPv6 - -@@ -4171,6 +4172,8 @@ static void - dhcpv6_solicit(struct data_string *reply_ret, struct packet *packet) { - struct data_string client_id; - -+ TRACE(DHCPD_6_SOLICIT_START()); -+ - /* - * Validate our input. - */ -@@ -4184,6 +4187,8 @@ dhcpv6_solicit(struct data_string *reply - * Clean up. - */ - data_string_forget(&client_id, MDL); -+ -+ TRACE(DHCPD_6_SOLICIT_DONE()); - } - - /* -@@ -4197,6 +4202,8 @@ dhcpv6_request(struct data_string *reply - struct data_string client_id; - struct data_string server_id; - -+ TRACE(DHCPD_6_REQUEST_START()); -+ - /* - * Validate our input. - */ -@@ -4214,6 +4221,8 @@ dhcpv6_request(struct data_string *reply - */ - data_string_forget(&client_id, MDL); - data_string_forget(&server_id, MDL); -+ -+ TRACE(DHCPD_6_REQUEST_DONE()); - } - - /* Find a DHCPv6 packet's shared network from hints in the packet. -@@ -4326,6 +4335,8 @@ dhcpv6_confirm(struct data_string *reply - struct dhcpv6_packet *reply = (struct dhcpv6_packet *)reply_data; - int reply_ofs = (int)(offsetof(struct dhcpv6_packet, options)); - -+ TRACE(DHCPD_6_CONFIRM_START()); -+ - /* - * Basic client message validation. - */ -@@ -4512,6 +4523,8 @@ exit: - option_state_dereference(&cli_enc_opt_state, MDL); - if (opt_state != NULL) - option_state_dereference(&opt_state, MDL); -+ -+ TRACE(DHCPD_6_CONFIRM_DONE()); - } - - /* -@@ -4526,6 +4539,8 @@ dhcpv6_renew(struct data_string *reply, - struct data_string client_id; - struct data_string server_id; - -+ TRACE(DHCPD_6_RENEW_START()); -+ - /* - * Validate the request. - */ -@@ -4543,6 +4558,8 @@ dhcpv6_renew(struct data_string *reply, - */ - data_string_forget(&server_id, MDL); - data_string_forget(&client_id, MDL); -+ -+ TRACE(DHCPD_6_RENEW_DONE()); - } - - /* -@@ -4556,6 +4573,8 @@ static void - dhcpv6_rebind(struct data_string *reply, struct packet *packet) { - struct data_string client_id; - -+ TRACE(DHCPD_6_REBIND_START()); -+ - if (!valid_client_msg(packet, &client_id)) { - return; - } -@@ -4563,6 +4582,8 @@ dhcpv6_rebind(struct data_string *reply, - lease_to_client(reply, packet, &client_id, NULL); - - data_string_forget(&client_id, MDL); -+ -+ TRACE(DHCPD_6_REBIND_DONE()); - } - - static void -@@ -5009,6 +5030,8 @@ dhcpv6_decline(struct data_string *reply - struct data_string client_id; - struct data_string server_id; - -+ TRACE(DHCPD_6_DECLINE_START()); -+ - /* - * Validate our input. - */ -@@ -5029,6 +5052,8 @@ dhcpv6_decline(struct data_string *reply - - data_string_forget(&server_id, MDL); - data_string_forget(&client_id, MDL); -+ -+ TRACE(DHCPD_6_DECLINE_DONE()); - } - - static void -@@ -5479,6 +5504,8 @@ dhcpv6_release(struct data_string *reply - struct data_string client_id; - struct data_string server_id; - -+ TRACE(DHCPD_6_RELEASE_START()); -+ - /* - * Validate our input. - */ -@@ -5500,6 +5527,8 @@ dhcpv6_release(struct data_string *reply - - data_string_forget(&server_id, MDL); - data_string_forget(&client_id, MDL); -+ -+ TRACE(DHCPD_6_RELEASE_DONE()); - } - - /* -@@ -5512,6 +5541,8 @@ dhcpv6_information_request(struct data_s - struct data_string client_id; - struct data_string server_id; - -+ TRACE(DHCPD_6_INFORMATION_REQUEST_START()); -+ - /* - * Validate our input. - */ -@@ -5543,6 +5574,8 @@ dhcpv6_information_request(struct data_s - data_string_forget(&client_id, MDL); - } - data_string_forget(&server_id, MDL); -+ -+ TRACE(DHCPD_6_INFORMATION_REQUEST_DONE()); - } - - /* -@@ -5571,6 +5604,8 @@ dhcpv6_relay_forw(struct data_string *re - struct dhcpv6_relay_packet *reply; - int reply_ofs; - -+ TRACE(DHCPD_6_RELAY_FORW_START()); -+ - /* - * Initialize variables for early exit. - */ -@@ -5828,6 +5863,8 @@ exit: - if (enc_packet != NULL) { - packet_dereference(&enc_packet, MDL); - } -+ -+ TRACE(DHCPD_6_RELAY_FORW_DONE()); - } - - static void -diff -up dhcp-4.2.2/server/failover.c.systemtap dhcp-4.2.2/server/failover.c ---- dhcp-4.2.2/server/failover.c.systemtap 2011-05-11 16:21:00.000000000 +0200 -+++ dhcp-4.2.2/server/failover.c 2011-09-21 15:13:35.584433913 +0200 -@@ -35,6 +35,8 @@ - #include "dhcpd.h" - #include <omapip/omapip_p.h> - -+#include "trace.h" -+ - #if defined (FAILOVER_PROTOCOL) - dhcp_failover_state_t *failover_states; - static isc_result_t do_a_failover_option (omapi_object_t *, -@@ -1711,6 +1713,8 @@ isc_result_t dhcp_failover_set_state (dh - struct lease *l; - struct timeval tv; - -+ TRACE(DHCPD_FAILOVER_SET_STATE_START(state->me.state, new_state)); -+ - /* If we're in certain states where we're sending updates, and the peer - * state changes, we need to re-schedule any pending updates just to - * be on the safe side. This results in retransmission. -@@ -1938,6 +1942,8 @@ isc_result_t dhcp_failover_set_state (dh - break; - } - -+ TRACE(DHCPD_FAILOVER_SET_STATE_DONE()); -+ - return ISC_R_SUCCESS; - } - -@@ -2420,6 +2426,8 @@ dhcp_failover_pool_dobalance(dhcp_failov - if (state -> me.state != normal) - return 0; - -+ TRACE(DHCPD_FAILOVER_POOL_DOBALANCE_START()); -+ - state->last_balance = cur_time; - - for (s = shared_networks ; s ; s = s->next) { -@@ -2580,6 +2588,8 @@ dhcp_failover_pool_dobalance(dhcp_failov - if (leases_queued) - commit_leases(); - -+ TRACE(DHCPD_FAILOVER_POOL_DOBALANCE_DONE()); -+ - return leases_queued; - } - -diff -up dhcp-4.2.2/server/Makefile.am.systemtap dhcp-4.2.2/server/Makefile.am ---- dhcp-4.2.2/server/Makefile.am.systemtap 2011-09-21 15:13:35.517434828 +0200 -+++ dhcp-4.2.2/server/Makefile.am 2011-09-21 15:13:35.585433900 +0200 -@@ -4,7 +4,7 @@ dist_sysconf_DATA = dhcpd.conf - sbin_PROGRAMS = dhcpd - dhcpd_SOURCES = 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 \ -- dhcpv6.c mdb6.c ldap.c ldap_casa.c -+ dhcpv6.c mdb6.c ldap.c ldap_casa.c probes.d trace.h - - dhcpd_CFLAGS = $(LDAP_CFLAGS) - dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \ -@@ -14,3 +14,13 @@ dhcpd_LDADD = ../common/libdhcp.a ../oma - man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5 - EXTRA_DIST = $(man_MANS) - -+if ENABLE_SYSTEMTAP -+BUILT_SOURCES = probes.h -+probes.h: probes.d -+ $(DTRACE) -C -h -s $< -o $@ -+ -+probes.o: probes.d -+ $(DTRACE) -C -G -s $< -o $@ -+ -+dhcpd_LDADD += probes.o -+endif -diff -up dhcp-4.2.2/server/probes.d.systemtap dhcp-4.2.2/server/probes.d ---- dhcp-4.2.2/server/probes.d.systemtap 2011-09-21 15:13:35.585433900 +0200 -+++ dhcp-4.2.2/server/probes.d 2011-09-21 15:13:35.585433900 +0200 -@@ -0,0 +1,43 @@ -+provider dhcpd { -+ probe main(); -+ probe discover_start() -+ probe discover_done() -+ probe request_start() -+ probe request_done() -+ probe release_start() -+ probe release_done() -+ probe decline_start() -+ probe decline_done() -+ probe inform_start() -+ probe inform_done() -+ probe nak_lease_start() -+ probe nak_lease_done() -+ probe ack_lease_start() -+ probe ack_lease_done() -+ probe reply_start() -+ probe reply_done() -+ probe find_lease_start() -+ probe find_lease_done() -+ probe 6_solicit_start() -+ probe 6_solicit_done() -+ probe 6_request_start() -+ probe 6_request_done() -+ probe 6_confirm_start() -+ probe 6_confirm_done() -+ probe 6_renew_start() -+ probe 6_renew_done() -+ probe 6_rebind_start() -+ probe 6_rebind_done() -+ probe 6_decline_start() -+ probe 6_decline_done() -+ probe 6_release_start() -+ probe 6_release_done() -+ probe 6_information_request_start() -+ probe 6_information_request_done() -+ probe 6_relay_forw_start() -+ probe 6_relay_forw_done() -+ probe failover_pool_dobalance_start() -+ probe failover_pool_dobalance_done() -+ probe failover_set_state_start(int, int) /* state, new_state */ -+ probe failover_set_state_done() -+}; -diff -up dhcp-4.2.2/server/trace.h.systemtap dhcp-4.2.2/server/trace.h ---- dhcp-4.2.2/server/trace.h.systemtap 2011-09-21 15:13:35.585433900 +0200 -+++ dhcp-4.2.2/server/trace.h 2011-09-21 15:13:35.585433900 +0200 -@@ -0,0 +1,11 @@ -+// trace.h -+ -+#include "config.h" -+#ifdef HAVE_SYSTEMTAP -+// include the generated probes header and put markers in code -+#include "probes.h" -+#define TRACE(probe) probe -+#else -+// Wrap the probe to allow it to be removed when no systemtap available -+#define TRACE(probe) -+#endif -diff -up dhcp-4.2.2/tapset/dhcpd.stp.systemtap dhcp-4.2.2/tapset/dhcpd.stp ---- dhcp-4.2.2/tapset/dhcpd.stp.systemtap 2011-09-21 15:13:35.586433886 +0200 -+++ dhcp-4.2.2/tapset/dhcpd.stp 2011-09-21 15:13:35.586433886 +0200 -@@ -0,0 +1,212 @@ -+/* dhcpd tapset -+ Copyright (C) 2011, Red Hat Inc. -+ */ -+ -+probe dhcpd_main = process("dhcpd").mark("main") -+{ -+ probestr = sprintf("%s(locals: %s)", $$name, $$locals); -+ -+} -+ -+probe dhcpd_discover_start = process("dhcpd").mark("discover_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_discover_done = process("dhcpd").mark("discover_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_request_start = process("dhcpd").mark("request_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_request_done = process("dhcpd").mark("request_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_release_start = process("dhcpd").mark("release_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_release_done = process("dhcpd").mark("release_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_decline_start = process("dhcpd").mark("decline_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_decline_done = process("dhcpd").mark("decline_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_inform_start = process("dhcpd").mark("inform_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_inform_done = process("dhcpd").mark("inform_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_nak_lease_start = process("dhcpd").mark("nak_lease_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_nak_lease_done = process("dhcpd").mark("nak_lease_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_ack_lease_start = process("dhcpd").mark("ack_lease_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_ack_lease_done = process("dhcpd").mark("ack_lease_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_reply_start = process("dhcpd").mark("reply_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_reply_done = process("dhcpd").mark("reply_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_find_lease_start = process("dhcpd").mark("find_lease_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_find_lease_done = process("dhcpd").mark("find_lease_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_solicit_start = process("dhcpd").mark("6_solicit_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_solicit_done = process("dhcpd").mark("6_solicit_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_request_start = process("dhcpd").mark("6_request_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_request_done = process("dhcpd").mark("6_request_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_confirm_start = process("dhcpd").mark("6_confirm_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_confirm_done = process("dhcpd").mark("6_confirm_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_renew_start = process("dhcpd").mark("6_renew_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_renew_done = process("dhcpd").mark("6_renew_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_rebind_start = process("dhcpd").mark("6_rebind_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_rebind_done = process("dhcpd").mark("6_rebind_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_decline_start = process("dhcpd").mark("6_decline_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_decline_done = process("dhcpd").mark("6_decline_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_release_start = process("dhcpd").mark("6_release_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_release_done = process("dhcpd").mark("6_release_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_information_request_start = process("dhcpd").mark("6_information_request_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_information_request_done = process("dhcpd").mark("6_information_request_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_relay_forw_start = process("dhcpd").mark("6_relay_forw_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_relay_forw_done = process("dhcpd").mark("6_relay_forw_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_failover_pool_dobalance_start = process("dhcpd").mark("failover_pool_dobalance_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_failover_pool_dobalance_done = process("dhcpd").mark("failover_pool_dobalance_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+ -+probe dhcpd_failover_set_state_start = process("dhcpd").mark("failover_set_state_start") -+{ -+ state = $arg1; -+ new_state = $arg2; -+ probestr = sprintf("%s(state=%d, new_state=%d)", $$name, state, new_state); -+} -+ -+probe dhcpd_failover_set_state_done = process("dhcpd").mark("failover_set_state_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -diff -up dhcp-4.2.2/tapset/Makefile.am.systemtap dhcp-4.2.2/tapset/Makefile.am ---- dhcp-4.2.2/tapset/Makefile.am.systemtap 2011-09-21 15:13:35.586433886 +0200 -+++ dhcp-4.2.2/tapset/Makefile.am 2011-09-21 15:13:35.586433886 +0200 -@@ -0,0 +1,26 @@ -+# Makefile.am for dhcp/tapset -+# Jiri Popelka -+ -+.PHONY: clean-local install-data-hook uninstall-local -+ -+# -+EXTRA_DIST = dhcpd.stp -+TAPSET_FILES = $(EXTRA_DIST) -+TAPSET_INSTALL_DIR = $(DESTDIR)@ABS_TAPSET_DIR@ -+ -+if ENABLE_SYSTEMTAP -+all-local: $(TAPSET_FILES) -+ -+clean-local: -+ -+install-data-hook: -+ $(MKDIR_P) $(TAPSET_INSTALL_DIR) -+ $(INSTALL_DATA) $(TAPSET_FILES) $(TAPSET_INSTALL_DIR) -+ -+uninstall-local: -+ @list='$(TAPSET_FILES)'; for p in $$list; do \ -+ echo " rm -f '$(TAPSET_INSTALL_DIR)/$$p'"; \ -+ rm -f "$(TAPSET_INSTALL_DIR)/$$p"; \ -+ done -+endif -+ diff --git a/dhcp/patches/dhcp-4.2.3-P2-log_perror.patch b/dhcp/patches/dhcp-4.2.3-P2-log_perror.patch new file mode 100644 index 0000000..124c8c5 --- /dev/null +++ b/dhcp/patches/dhcp-4.2.3-P2-log_perror.patch @@ -0,0 +1,11 @@ +diff -up dhcp-4.2.3-P2/server/dhcpd.c.log_perror dhcp-4.2.3-P2/server/dhcpd.c +--- dhcp-4.2.3-P2/server/dhcpd.c.log_perror 2012-02-22 14:24:57.000000000 +0100 ++++ dhcp-4.2.3-P2/server/dhcpd.c 2012-02-22 14:29:09.964576687 +0100 +@@ -315,6 +315,7 @@ main(int argc, char **argv) { + #ifndef DEBUG + daemon = 0; + #endif ++ log_perror = 0; + } else if (!strcmp (argv [i], "-d")) { + #ifndef DEBUG + daemon = 0; diff --git a/dhcp/patches/dhcp-4.2.3-P2-rfc5970-dhcpv6-options-for-network-boot.patch b/dhcp/patches/dhcp-4.2.3-P2-rfc5970-dhcpv6-options-for-network-boot.patch new file mode 100644 index 0000000..3bcb5da --- /dev/null +++ b/dhcp/patches/dhcp-4.2.3-P2-rfc5970-dhcpv6-options-for-network-boot.patch @@ -0,0 +1,89 @@ +diff -up dhcp-4.2.3-P2/common/dhcp-options.5.rfc5970 dhcp-4.2.3-P2/common/dhcp-options.5 +--- dhcp-4.2.3-P2/common/dhcp-options.5.rfc5970 2012-03-21 19:39:47.572002389 +0100 ++++ dhcp-4.2.3-P2/common/dhcp-options.5 2012-03-21 19:39:47.670001164 +0100 +@@ -1770,7 +1770,48 @@ The \fBlq-relay-data\fR option is used i + The \fBlq-client-link\fR option is used internally by for lease query. + .RE + .PP ++ ++.B option ++.B dhcp6.bootfile-url ++.I string ++.B ; ++.RS 0.25i ++.PP ++The server sends this option to inform the client about a URL to a ++boot file. Used primarily for UEFI network booting, it contains an RFC3986 ++compliant URI which the client may use to boot an operating system. This option ++is defined in RFC5970 ++.RE ++.PP ++ ++.B option ++.B dhcp6.arch-type ++.I arch-id \fR[\fB,\fR arch-id\fR...] ++.B ; ++.RS 0.25i ++.PP ++A client will send this option to a server so that the server may make decisions ++on what options and addresses to offer the requesting client. The option ++consists of a list of 16 bit unsigned values that represent the architecture of ++the requesting client. These values corespond to the values available to the ++dhcpv4 option architecture-type, as defined in RFC4578, section 2.1. ++This option is defined in RFC5970 + .RE ++.PP ++ ++.B option ++.B dhcp6.net-id ++.I uint8 uint8 uint8 ++.B ; ++.RS 0.25i ++.PP ++A client will send this option to a server to inform it about the clients level ++of UNDI support. The option consists of 3 octets (a type, major and minor ++value). Specific meanings of these values are doumented in section 2.2 of ++RFC4578. ++This option is defined in RFC5970 ++.RE ++.PP + .SH DEFINING NEW OPTIONS + The Internet Systems Consortium DHCP client and server provide the + capability to define new options. Each DHCP option has a name, a +diff -up dhcp-4.2.3-P2/common/tables.c.rfc5970 dhcp-4.2.3-P2/common/tables.c +--- dhcp-4.2.3-P2/common/tables.c.rfc5970 2012-03-21 19:39:47.577002328 +0100 ++++ dhcp-4.2.3-P2/common/tables.c 2012-03-21 19:39:47.670001164 +0100 +@@ -461,6 +461,18 @@ static struct option dhcpv6_options[] = + { "lq-relay-data", "6X", &dhcpv6_universe, 47, 1 }, + { "lq-client-link", "6A", &dhcpv6_universe, 48, 1 }, + ++ /* RFC5970 OPTIONS */ ++ ++ { "bootfile-url", "t", &dhcpv6_universe, 59, 1}, ++#if 0 ++ /* Can't implement this until arrays of strings with length "StA" ++ * are implemented ++ */ ++ { "bootfile-param", "StA", &dhcpv6_universe, 60, 1}, ++#endif ++ { "arch-type", "Sa", &dhcpv6_universe, 61, 1}, ++ { "net-id", "BBB", &dhcpv6_universe, 62, 1}, ++ + { NULL, NULL, NULL, 0, 0 } + }; + +diff -up dhcp-4.2.3-P2/includes/dhcp6.h.rfc5970 dhcp-4.2.3-P2/includes/dhcp6.h +--- dhcp-4.2.3-P2/includes/dhcp6.h.rfc5970 2010-02-17 21:33:55.000000000 +0100 ++++ dhcp-4.2.3-P2/includes/dhcp6.h 2012-03-21 19:39:47.671001151 +0100 +@@ -75,6 +75,11 @@ + #define D6O_CLT_TIME 46 /* RFC5007 */ + #define D6O_LQ_RELAY_DATA 47 /* RFC5007 */ + #define D6O_LQ_CLIENT_LINK 48 /* RFC5007 */ ++/* 49-58 Not yet assigned */ ++#define D60_BOOT_URL 59 /* RFC5970 */ ++#define D60_BOOT_PARAMS 60 /* RFC5970 */ ++#define D60_CLIENT_ARCH 61 /* RFC5970 */ ++#define D60_CLIENT_NII 62 /* RFC5970 */ + + /* + * Status Codes, from RFC 3315 section 24.4, and RFC 3633, 5007. diff --git a/dhcp/patches/dhcp-4.2.3-dhclient-decline-onetry.patch b/dhcp/patches/dhcp-4.2.3-dhclient-decline-onetry.patch new file mode 100644 index 0000000..af3314d --- /dev/null +++ b/dhcp/patches/dhcp-4.2.3-dhclient-decline-onetry.patch @@ -0,0 +1,27 @@ +diff -up dhcp-4.2.3/client/dhclient.c.decline-onetry dhcp-4.2.3/client/dhclient.c +--- dhcp-4.2.3/client/dhclient.c.decline-onetry 2011-11-24 14:21:50.000000000 +0100 ++++ dhcp-4.2.3/client/dhclient.c 2011-11-24 14:23:44.472893215 +0100 +@@ -1704,11 +1704,18 @@ void bind_lease (client) + if (script_go (client)) { + make_decline (client, client -> new); + send_decline (client); +- destroy_client_lease (client -> new); +- client -> new = (struct client_lease *)0; +- client -> state = S_DECLINED; +- state_init (client); +- return; ++ if (onetry) { ++ if (!quiet) ++ log_info ("Unable to obtain a lease on first try.%s", ++ " Exiting."); ++ exit (2); ++ } else { ++ destroy_client_lease (client -> new); ++ client -> new = (struct client_lease *)0; ++ client -> state = S_DECLINED; ++ state_init (client); ++ return; ++ } + } + + /* Write out the new lease if it has been long enough. */ diff --git a/dhcp/patches/dhcp-4.2.3-paranoia.patch b/dhcp/patches/dhcp-4.2.3-paranoia.patch new file mode 100644 index 0000000..e6c1576 --- /dev/null +++ b/dhcp/patches/dhcp-4.2.3-paranoia.patch @@ -0,0 +1,49 @@ +diff -up dhcp-4.2.3-P1/server/dhcpd.c.paranoia dhcp-4.2.3-P1/server/dhcpd.c +--- dhcp-4.2.3-P1/server/dhcpd.c.paranoia 2011-12-20 18:02:26.000000000 +0100 ++++ dhcp-4.2.3-P1/server/dhcpd.c 2011-12-20 18:03:43.840037108 +0100 +@@ -771,22 +771,6 @@ main(int argc, char **argv) { + exit (0); + } + +-#if defined (PARANOIA) +- /* change uid to the specified one */ +- +- if (set_gid) { +- if (setgroups (0, (void *)0)) +- log_fatal ("setgroups: %m"); +- if (setgid (set_gid)) +- log_fatal ("setgid(%d): %m", (int) set_gid); +- } +- +- if (set_uid) { +- if (setuid (set_uid)) +- log_fatal ("setuid(%d): %m", (int) set_uid); +- } +-#endif /* PARANOIA */ +- + /* + * Deal with pid files. If the user told us + * not to write a file we don't read one either +@@ -823,6 +807,22 @@ main(int argc, char **argv) { + } + } + ++#if defined (PARANOIA) ++ /* change uid to the specified one */ ++ ++ if (set_gid) { ++ if (setgroups (0, (void *)0)) ++ log_fatal ("setgroups: %m"); ++ if (setgid (set_gid)) ++ log_fatal ("setgid(%d): %m", (int) set_gid); ++ } ++ ++ if (set_uid) { ++ if (setuid (set_uid)) ++ log_fatal ("setuid(%d): %m", (int) set_uid); ++ } ++#endif /* PARANOIA */ ++ + /* If we were requested to log to stdout on the command line, + keep doing so; otherwise, stop. */ + if (log_perror == -1) diff --git a/dhcp/patches/dhcp-4.2.4-64_bit_lease_parse.patch b/dhcp/patches/dhcp-4.2.4-64_bit_lease_parse.patch new file mode 100644 index 0000000..c1b978b --- /dev/null +++ b/dhcp/patches/dhcp-4.2.4-64_bit_lease_parse.patch @@ -0,0 +1,84 @@ +diff -up dhcp-4.2.4b1/common/parse.c.64-bit_lease_parse dhcp-4.2.4b1/common/parse.c +--- dhcp-4.2.4b1/common/parse.c.64-bit_lease_parse 2012-03-09 12:28:10.000000000 +0100 ++++ dhcp-4.2.4b1/common/parse.c 2012-04-16 17:30:55.867045149 +0200 +@@ -906,8 +906,8 @@ TIME + parse_date_core(cfile) + struct parse *cfile; + { +- int guess; +- int tzoff, year, mon, mday, hour, min, sec; ++ TIME guess; ++ long int tzoff, year, mon, mday, hour, min, sec; + const char *val; + enum dhcp_token token; + static int months[11] = { 31, 59, 90, 120, 151, 181, +@@ -933,7 +933,7 @@ parse_date_core(cfile) + } + + token = next_token(&val, NULL, cfile); /* consume number */ +- guess = atoi(val); ++ guess = atol(val); + + return((TIME)guess); + } +@@ -961,7 +961,7 @@ parse_date_core(cfile) + somebody invents a time machine, I think we can safely disregard + it. This actually works around a stupid Y2K bug that was present + in a very early beta release of dhcpd. */ +- year = atoi(val); ++ year = atol(val); + if (year > 1900) + year -= 1900; + +@@ -985,7 +985,7 @@ parse_date_core(cfile) + return((TIME)0); + } + token = next_token(&val, NULL, cfile); /* consume month */ +- mon = atoi(val) - 1; ++ mon = atol(val) - 1; + + /* Slash separating month from day... */ + token = peek_token(&val, NULL, cfile); +@@ -1007,7 +1007,7 @@ parse_date_core(cfile) + return((TIME)0); + } + token = next_token(&val, NULL, cfile); /* consume day of month */ +- mday = atoi(val); ++ mday = atol(val); + + /* Hour... */ + token = peek_token(&val, NULL, cfile); +@@ -1018,7 +1018,7 @@ parse_date_core(cfile) + return((TIME)0); + } + token = next_token(&val, NULL, cfile); /* consume hour */ +- hour = atoi(val); ++ hour = atol(val); + + /* Colon separating hour from minute... */ + token = peek_token(&val, NULL, cfile); +@@ -1040,7 +1040,7 @@ parse_date_core(cfile) + return((TIME)0); + } + token = next_token(&val, NULL, cfile); /* consume minute */ +- min = atoi(val); ++ min = atol(val); + + /* Colon separating minute from second... */ + token = peek_token(&val, NULL, cfile); +@@ -1062,13 +1062,13 @@ parse_date_core(cfile) + return((TIME)0); + } + token = next_token(&val, NULL, cfile); /* consume second */ +- sec = atoi(val); ++ sec = atol(val); + + tzoff = 0; + token = peek_token(&val, NULL, cfile); + if (token == NUMBER) { + token = next_token(&val, NULL, cfile); /* consume tzoff */ +- tzoff = atoi(val); ++ tzoff = atol(val); + } else if (token != SEMI) { + token = next_token(&val, NULL, cfile); + parse_warn(cfile, diff --git a/dhcp/patches/dhcp-4.2.4-P1-dhclient6-leases_semicolon_expected.patch b/dhcp/patches/dhcp-4.2.4-P1-dhclient6-leases_semicolon_expected.patch new file mode 100644 index 0000000..c18380d --- /dev/null +++ b/dhcp/patches/dhcp-4.2.4-P1-dhclient6-leases_semicolon_expected.patch @@ -0,0 +1,41 @@ +diff -up dhcp-4.2.4-P1/client/dhclient.c.dhclient6-leases_semicolon dhcp-4.2.4-P1/client/dhclient.c +--- dhcp-4.2.4-P1/client/dhclient.c.dhclient6-leases_semicolon 2012-07-25 15:20:22.187164614 +0200 ++++ dhcp-4.2.4-P1/client/dhclient.c 2012-07-25 15:20:26.648152028 +0200 +@@ -3236,10 +3236,21 @@ void write_lease_option (struct option_c + } + if (evaluate_option_cache (&ds, packet, lease, client_state, + in_options, cfg_options, scope, oc, MDL)) { +- fprintf(leaseFile, "%soption %s%s%s %s;\n", preamble, +- name, dot, oc->option->name, +- pretty_print_option(oc->option, ds.data, ds.len, +- 1, 1)); ++ /* The option name */ ++ fprintf(leaseFile, "%soption %s%s%s", preamble, ++ name, dot, oc->option->name); ++ ++ /* The option value if there is one */ ++ if ((oc->option->format == NULL) || ++ (oc->option->format[0] != 'Z')) { ++ fprintf(leaseFile, " %s", ++ pretty_print_option(oc->option, ds.data, ++ ds.len, 1, 1)); ++ } ++ ++ /* The closing semi-colon and newline */ ++ fprintf(leaseFile, ";\n"); ++ + data_string_forget (&ds, MDL); + } + } +diff -up dhcp-4.2.4-P1/common/parse.c.dhclient6-leases_semicolon dhcp-4.2.4-P1/common/parse.c +--- dhcp-4.2.4-P1/common/parse.c.dhclient6-leases_semicolon 2012-07-25 15:10:39.683557386 +0200 ++++ dhcp-4.2.4-P1/common/parse.c 2012-07-25 15:16:50.826762985 +0200 +@@ -5772,7 +5772,7 @@ int parse_option_decl (oc, cfile) + goto alloc; + + case 'Z': /* Zero-length option */ +- token = next_token(&val, (unsigned *)0, cfile); ++ token = peek_token(&val, (unsigned *)0, cfile); + if (token != SEMI) { + parse_warn(cfile, + "semicolon expected."); diff --git a/dhcp/patches/dhcp-4.2.4-P1-interval.patch b/dhcp/patches/dhcp-4.2.4-P1-interval.patch new file mode 100644 index 0000000..e8e89c1 --- /dev/null +++ b/dhcp/patches/dhcp-4.2.4-P1-interval.patch @@ -0,0 +1,25 @@ +diff -up dhcp-4.2.4/common/dispatch.c.foo dhcp-4.2.4/common/dispatch.c +--- dhcp-4.2.4/common/dispatch.c.foo 2012-07-26 21:31:43.875349675 -0500 ++++ dhcp-4.2.4/common/dispatch.c 2012-07-26 21:39:14.961710319 -0500 +@@ -324,7 +324,20 @@ void add_timeout (when, where, what, ref + q->next = timeouts; + timeouts = q; + +- isc_interval_set(&interval, sec & DHCP_SEC_MAX, usec * 1000); ++ /* isc_time_nowplusinterval() is not safe with 64-bit time_t and will ++ * return an error for sufficiently large intervals. We have to limit ++ * the interval to INT_MAX or less to ensure the interval doesn't ++ * overflow 32 bits, since the returned isc_time_t fields are ++ * 32-bit unsigned ints. ++ * ++ * HACK: The 9 is a magic number of seconds, since some time may have ++ * gone by since the last call to gettimeofday() and the one in ++ * isc_time_nowplusinterval(). ++ */ ++ if (sec > TIME_MAX) ++ sec = TIME_MAX - 9; ++ ++ isc_interval_set(&interval, sec, usec * 1000); + status = isc_time_nowplusinterval(&expires, &interval); + if (status != ISC_R_SUCCESS) { + /* diff --git a/dhcp/patches/dhcp-4.2.4-P1-remove-dst.patch b/dhcp/patches/dhcp-4.2.4-P1-remove-dst.patch new file mode 100644 index 0000000..6b8dbb0 --- /dev/null +++ b/dhcp/patches/dhcp-4.2.4-P1-remove-dst.patch @@ -0,0 +1,46 @@ +diff -up dhcp-4.2.4-P1/configure.ac.remove-dst dhcp-4.2.4-P1/configure.ac +--- dhcp-4.2.4-P1/configure.ac.remove-dst 2012-08-17 15:24:29.066454140 +0200 ++++ dhcp-4.2.4-P1/configure.ac 2012-08-17 15:24:29.071454073 +0200 +@@ -608,7 +608,6 @@ AC_OUTPUT([ + common/Makefile + common/tests/Makefile + dhcpctl/Makefile +- dst/Makefile + includes/Makefile + omapip/Makefile + relay/Makefile +diff -up dhcp-4.2.4-P1/includes/Makefile.am.remove-dst dhcp-4.2.4-P1/includes/Makefile.am +--- dhcp-4.2.4-P1/includes/Makefile.am.remove-dst 2012-07-13 08:17:54.000000000 +0200 ++++ dhcp-4.2.4-P1/includes/Makefile.am 2012-08-17 15:25:08.253922458 +0200 +@@ -1,7 +1,6 @@ + nobase_include_HEADERS = omapip/alloc.h omapip/buffer.h omapip/convert.h \ + omapip/hash.h omapip/isclib.h omapip/omapip.h \ +- omapip/omapip_p.h omapip/result.h omapip/trace.h \ +- isc-dhcp/dst.h ++ omapip/omapip_p.h omapip/result.h omapip/trace.h + + EXTRA_DIST = cdefs.h ctrace.h dhcp.h dhcp6.h dhcpd.h dhctoken.h failover.h \ + heap.h inet.h minires.h osdep.h site.h statement.h tree.h \ +diff -up dhcp-4.2.4-P1/Makefile.am.remove-dst dhcp-4.2.4-P1/Makefile.am +--- dhcp-4.2.4-P1/Makefile.am.remove-dst 2012-08-17 15:24:29.067454126 +0200 ++++ dhcp-4.2.4-P1/Makefile.am 2012-08-17 15:24:29.071454073 +0200 +@@ -27,7 +27,7 @@ else + SUBDIRS = + endif + +-SUBDIRS += includes tests common dst omapip client dhcpctl relay server ++SUBDIRS += includes tests common omapip client dhcpctl relay server + + nobase_include_HEADERS = dhcpctl/dhcpctl.h + +diff -up dhcp-4.2.4-P1/server/ddns.c.remove-dst dhcp-4.2.4-P1/server/ddns.c +--- dhcp-4.2.4-P1/server/ddns.c.remove-dst 2012-07-13 08:18:05.000000000 +0200 ++++ dhcp-4.2.4-P1/server/ddns.c 2012-08-17 15:24:29.072454060 +0200 +@@ -34,7 +34,6 @@ + */ + + #include "dhcpd.h" +-#include "dst/md5.h" + #include <dns/result.h> + + #ifdef NSUPDATE diff --git a/dhcp/patches/dhcp-4.2.4-PPP.patch b/dhcp/patches/dhcp-4.2.4-PPP.patch new file mode 100644 index 0000000..edb11bf --- /dev/null +++ b/dhcp/patches/dhcp-4.2.4-PPP.patch @@ -0,0 +1,150 @@ +diff -up dhcp-4.2.4b1/client/dhc6.c.PPP dhcp-4.2.4b1/client/dhc6.c +--- dhcp-4.2.4b1/client/dhc6.c.PPP 2012-04-16 17:37:23.243618764 +0200 ++++ dhcp-4.2.4b1/client/dhc6.c 2012-04-16 17:37:23.252618638 +0200 +@@ -133,7 +133,7 @@ extern int stateless; + * is not how it is intended. Upcoming rearchitecting the client should + * address this "one daemon model." + */ +-void ++isc_result_t + form_duid(struct data_string *duid, const char *file, int line) + { + struct interface_info *ip; +@@ -145,6 +145,15 @@ form_duid(struct data_string *duid, cons + if (ip == NULL) + log_fatal("Impossible condition at %s:%d.", MDL); + ++ while (ip && ip->hw_address.hbuf[0] == HTYPE_RESERVED) { ++ /* Try the other interfaces */ ++ log_debug("Cannot form default DUID from interface %s.", ip->name); ++ ip = ip->next; ++ } ++ if (ip == NULL) { ++ return ISC_R_UNEXPECTED; ++ } ++ + if ((ip->hw_address.hlen == 0) || + (ip->hw_address.hlen > sizeof(ip->hw_address.hbuf))) + log_fatal("Impossible hardware address length at %s:%d.", MDL); +@@ -180,6 +189,8 @@ form_duid(struct data_string *duid, cons + memcpy(duid->buffer->data + 4, ip->hw_address.hbuf + 1, + ip->hw_address.hlen - 1); + } ++ ++ return ISC_R_SUCCESS; + } + + /* +@@ -5130,7 +5141,8 @@ make_client6_options(struct client_state + */ + if ((oc = lookup_option(&dhcpv6_universe, *op, + D6O_CLIENTID)) == NULL) { +- if (!option_cache(&oc, &default_duid, NULL, clientid_option, ++ if (default_duid.len == 0 || ++ !option_cache(&oc, &default_duid, NULL, clientid_option, + MDL)) + log_fatal("Failure assembling a DUID."); + +diff -up dhcp-4.2.4b1/client/dhclient.c.PPP dhcp-4.2.4b1/client/dhclient.c +--- dhcp-4.2.4b1/client/dhclient.c.PPP 2012-04-16 17:37:23.214619170 +0200 ++++ dhcp-4.2.4b1/client/dhclient.c 2012-04-16 17:37:23.254618610 +0200 +@@ -919,8 +919,8 @@ main(int argc, char **argv) { + if (default_duid.buffer != NULL) + data_string_forget(&default_duid, MDL); + +- form_duid(&default_duid, MDL); +- write_duid(&default_duid); ++ if (form_duid(&default_duid, MDL) == ISC_R_SUCCESS) ++ write_duid(&default_duid); + } + + for (ip = interfaces ; ip != NULL ; ip = ip->next) { +diff -up dhcp-4.2.4b1/common/bpf.c.PPP dhcp-4.2.4b1/common/bpf.c +--- dhcp-4.2.4b1/common/bpf.c.PPP 2012-04-16 17:37:23.175619716 +0200 ++++ dhcp-4.2.4b1/common/bpf.c 2012-04-16 17:37:23.255618596 +0200 +@@ -599,6 +599,22 @@ get_hw_addr(const char *name, struct har + memcpy(&hw->hbuf[1], LLADDR(sa), sa->sdl_alen); + break; + #endif /* IFT_FDDI */ ++#if defined(IFT_PPP) ++ case IFT_PPP: ++ if (local_family != AF_INET6) ++ log_fatal("Unsupported device type %d for "%s"", ++ sa->sdl_type, name); ++ hw->hlen = 0; ++ hw->hbuf[0] = HTYPE_RESERVED; ++ /* 0xdeadbeef should never occur on the wire, ++ * and is a signature that something went wrong. ++ */ ++ hw->hbuf[1] = 0xde; ++ hw->hbuf[2] = 0xad; ++ hw->hbuf[3] = 0xbe; ++ hw->hbuf[4] = 0xef; ++ break; ++#endif + default: + log_fatal("Unsupported device type %d for "%s"", + sa->sdl_type, name); +diff -up dhcp-4.2.4b1/common/lpf.c.PPP dhcp-4.2.4b1/common/lpf.c +--- dhcp-4.2.4b1/common/lpf.c.PPP 2012-04-16 17:37:23.155619996 +0200 ++++ dhcp-4.2.4b1/common/lpf.c 2012-04-16 17:37:23.256618582 +0200 +@@ -503,6 +503,22 @@ get_hw_addr(const char *name, struct har + hw->hbuf[0] = HTYPE_FDDI; + memcpy(&hw->hbuf[1], sa->sa_data, 16); + break; ++#if defined(ARPHRD_PPP) ++ case ARPHRD_PPP: ++ if (local_family != AF_INET6) ++ log_fatal("Unsupported device type %d for "%s"", ++ sa->sa_family, name); ++ hw->hlen = 0; ++ hw->hbuf[0] = HTYPE_RESERVED; ++ /* 0xdeadbeef should never occur on the wire, ++ * and is a signature that something went wrong. ++ */ ++ hw->hbuf[1] = 0xde; ++ hw->hbuf[2] = 0xad; ++ hw->hbuf[3] = 0xbe; ++ hw->hbuf[4] = 0xef; ++ break; ++#endif + default: + log_fatal("Unsupported device type %ld for "%s"", + (long int)sa->sa_family, name); +diff -up dhcp-4.2.4b1/includes/dhcpd.h.PPP dhcp-4.2.4b1/includes/dhcpd.h +--- dhcp-4.2.4b1/includes/dhcpd.h.PPP 2012-04-16 17:37:23.239618820 +0200 ++++ dhcp-4.2.4b1/includes/dhcpd.h 2012-04-16 17:37:23.257618568 +0200 +@@ -2760,7 +2760,7 @@ void dhcpv4_client_assignments(void); + void dhcpv6_client_assignments(void); + + /* dhc6.c */ +-void form_duid(struct data_string *duid, const char *file, int line); ++isc_result_t form_duid(struct data_string *duid, const char *file, int line); + void dhc6_lease_destroy(struct dhc6_lease **src, const char *file, int line); + void start_init6(struct client_state *client); + void start_info_request6(struct client_state *client); +diff -up dhcp-4.2.4b1/includes/dhcp.h.PPP dhcp-4.2.4b1/includes/dhcp.h +--- dhcp-4.2.4b1/includes/dhcp.h.PPP 2012-04-16 17:37:23.000000000 +0200 ++++ dhcp-4.2.4b1/includes/dhcp.h 2012-04-16 17:38:34.675618138 +0200 +@@ -85,6 +85,8 @@ struct dhcp_packet { + * is no standard for this so we + * just steal a type */ + ++#define HTYPE_RESERVED 0 /* RFC 5494 */ ++ + /* Magic cookie validating dhcp options field (and bootp vendor + extensions field). */ + #define DHCP_OPTIONS_COOKIE "\143\202\123\143" +diff -up dhcp-4.2.4b1/server/dhcpv6.c.PPP dhcp-4.2.4b1/server/dhcpv6.c +--- dhcp-4.2.4b1/server/dhcpv6.c.PPP 2012-04-16 17:37:23.218619114 +0200 ++++ dhcp-4.2.4b1/server/dhcpv6.c 2012-04-16 17:37:23.260618526 +0200 +@@ -300,6 +300,9 @@ generate_new_server_duid(void) { + if (p->hw_address.hlen > 0) { + break; + } ++ if (p->next == NULL && p->hw_address.hbuf[0] == HTYPE_RESERVED) { ++ log_error("Can not generate DUID from interfaces which do not have hardware addresses, please configure server-duid!"); ++ } + } + if (p == NULL) { + return ISC_R_UNEXPECTED; diff --git a/dhcp/patches/dhcp-4.2.4-UseMulticast.patch b/dhcp/patches/dhcp-4.2.4-UseMulticast.patch new file mode 100644 index 0000000..d0c5dfe --- /dev/null +++ b/dhcp/patches/dhcp-4.2.4-UseMulticast.patch @@ -0,0 +1,239 @@ +diff -up dhcp-4.2.4b1/server/dhcpv6.c.UseMulticast dhcp-4.2.4b1/server/dhcpv6.c +--- dhcp-4.2.4b1/server/dhcpv6.c.UseMulticast 2012-04-11 00:14:04.000000000 +0200 ++++ dhcp-4.2.4b1/server/dhcpv6.c 2012-04-16 19:21:43.575923732 +0200 +@@ -346,6 +346,48 @@ generate_new_server_duid(void) { + } + + /* ++ * Is the D6O_UNICAST option defined in dhcpd.conf ? ++ */ ++static isc_boolean_t unicast_option_defined; ++ ++/* ++ * Did we already search dhcpd.conf for D6O_UNICAST option ? ++ * We need to store it here to not parse dhcpd.conf repeatedly. ++ */ ++static isc_boolean_t unicast_option_parsed = ISC_FALSE; ++ ++ ++/* ++ * Is the D6O_UNICAST option defined in dhcpd.conf ? ++ */ ++isc_boolean_t ++is_unicast_option_defined(void) { ++ struct option_state *opt_state; ++ struct option_cache *oc; ++ ++ /* ++ * If we are looking for the unicast option for the first time ++ */ ++ if (unicast_option_parsed == ISC_FALSE) { ++ unicast_option_parsed = ISC_TRUE; ++ opt_state = NULL; ++ if (!option_state_allocate(&opt_state, MDL)) { ++ log_fatal("No memory for option state."); ++ } ++ ++ execute_statements_in_scope(NULL, NULL, NULL, NULL, NULL, ++ opt_state, &global_scope, root_group, NULL); ++ ++ oc = lookup_option(&dhcpv6_universe, opt_state, D6O_UNICAST); ++ unicast_option_defined = (oc != NULL); ++ ++ option_state_dereference(&opt_state, MDL); ++ } ++ ++ return (unicast_option_defined); ++} ++ ++/* + * Get the client identifier from the packet. + */ + isc_result_t +@@ -1404,6 +1446,56 @@ lease_to_client(struct data_string *repl + reply.shared->group); + } + ++ /* reject unicast message, unless we set unicast option */ ++ if ((packet->unicast == ISC_TRUE) && !is_unicast_option_defined()) ++ /* ++ * RFC3315 section 18.2.1 (Request): ++ * ++ * When the server receives a Request message via unicast from a client ++ * to which the server has not sent a unicast option, the server ++ * discards the Request message and responds with a Reply message ++ * containing a Status Code option with the value UseMulticast, a Server ++ * Identifier option containing the server's DUID, the Client Identifier ++ * option from the client message, and no other options. ++ * ++ * Section 18.2.3 (Renew): ++ * ++ * When the server receives a Renew message via unicast from a client to ++ * which the server has not sent a unicast option, the server discards ++ * the Renew message and responds with a Reply message containing a ++ * Status Code option with the value UseMulticast, a Server Identifier ++ * option containing the server's DUID, the Client Identifier option ++ * from the client message, and no other options. ++ */ ++ { ++ /* Set the UseMulticast status code. */ ++ if (!set_status_code(STATUS_UseMulticast, ++ "Unicast not allowed by server.", ++ reply.opt_state)) { ++ log_error("lease_to_client: Unable to set " ++ "UseMulticast status code."); ++ goto exit; ++ } ++ ++ /* Rewind the cursor to the start. */ ++ reply.cursor = REPLY_OPTIONS_INDEX; ++ ++ /* ++ * Produce an reply that includes only: ++ * ++ * Status code. ++ * Server DUID. ++ * Client DUID. ++ */ ++ reply.cursor += store_options6((char *)reply.buf.data + ++ reply.cursor, ++ sizeof(reply.buf) - ++ reply.cursor, ++ reply.opt_state, reply.packet, ++ required_opts_NAA, ++ NULL); ++ } ++ + /* + * RFC3315 section 17.2.2 (Solicit): + * +@@ -1429,8 +1521,8 @@ lease_to_client(struct data_string *repl + * Sends a Renew/Rebind if the IA is not in the Reply message. + */ + #if defined (RFC3315_PRE_ERRATA_2010_08) +- if (no_resources_avail && (reply.ia_count != 0) && +- (reply.packet->dhcpv6_msg_type == DHCPV6_SOLICIT)) ++ else if (no_resources_avail && (reply.ia_count != 0) && ++ (reply.packet->dhcpv6_msg_type == DHCPV6_SOLICIT)) + { + /* Set the NoAddrsAvail status code. */ + if (!set_status_code(STATUS_NoAddrsAvail, +@@ -1477,6 +1569,7 @@ lease_to_client(struct data_string *repl + * Having stored the client's IA's, store any options that + * will fit in the remaining space. + */ ++ else + reply.cursor += store_options6((char *)reply.buf.data + reply.cursor, + sizeof(reply.buf) - reply.cursor, + reply.opt_state, reply.packet, +@@ -4126,7 +4219,6 @@ dhcpv6_solicit(struct data_string *reply + * Very similar to Solicit handling, except the server DUID is required. + */ + +-/* TODO: reject unicast messages, unless we set unicast option */ + static void + dhcpv6_request(struct data_string *reply_ret, struct packet *packet) { + struct data_string client_id; +@@ -4456,7 +4548,6 @@ exit: + * except for the error code of when addresses don't match. + */ + +-/* TODO: reject unicast messages, unless we set unicast option */ + static void + dhcpv6_renew(struct data_string *reply, struct packet *packet) { + struct data_string client_id; +@@ -4700,18 +4791,60 @@ iterate_over_ia_na(struct data_string *r + goto exit; + } + +- snprintf(status_msg, sizeof(status_msg), "%s received.", packet_type); +- if (!set_status_code(STATUS_Success, status_msg, opt_state)) { +- goto exit; +- } ++ /* reject unicast message, unless we set unicast option */ ++ if ((packet->unicast == ISC_TRUE) && !is_unicast_option_defined()) { ++ /* ++ * RFC3315 section 18.2.6 (Release): ++ * ++ * When the server receives a Release message via unicast from a client ++ * to which the server has not sent a unicast option, the server ++ * discards the Release message and responds with a Reply message ++ * containing a Status Code option with value UseMulticast, a Server ++ * Identifier option containing the server's DUID, the Client Identifier ++ * option from the client message, and no other options. ++ * ++ * Section 18.2.7 (Decline): ++ * ++ * When the server receives a Decline message via unicast from a client ++ * to which the server has not sent a unicast option, the server ++ * discards the Decline message and responds with a Reply message ++ * containing a Status Code option with the value UseMulticast, a Server ++ * Identifier option containing the server's DUID, the Client Identifier ++ * option from the client message, and no other options. ++ */ ++ snprintf(status_msg, sizeof(status_msg), ++ "%s received unicast.", packet_type); ++ if (!set_status_code(STATUS_UseMulticast, status_msg, opt_state)) { ++ goto exit; ++ } + +- /* +- * Add our options that are not associated with any IA_NA or IA_TA. +- */ +- reply_ofs += store_options6(reply_data+reply_ofs, +- sizeof(reply_data)-reply_ofs, ++ /* ++ * Produce an reply that includes only: ++ * ++ * Status code. ++ * Server DUID. ++ * Client DUID. ++ */ ++ reply_ofs += store_options6(reply_data+reply_ofs, ++ sizeof(reply_data)-reply_ofs, + opt_state, packet, +- required_opts, NULL); ++ required_opts_NAA, NULL); ++ ++ goto return_reply; ++ } else { ++ snprintf(status_msg, sizeof(status_msg), "%s received.", packet_type); ++ if (!set_status_code(STATUS_Success, status_msg, opt_state)) { ++ goto exit; ++ } ++ ++ /* ++ * Add our options that are not associated with any IA_NA or IA_TA. ++ */ ++ reply_ofs += store_options6(reply_data+reply_ofs, ++ sizeof(reply_data)-reply_ofs, ++ opt_state, packet, ++ required_opts, NULL); ++ } + + /* + * Loop through the IA_NA reported by the client, and deal with +@@ -4849,6 +4982,7 @@ iterate_over_ia_na(struct data_string *r + /* + * Return our reply to the caller. + */ ++return_reply: + reply_ret->len = reply_ofs; + reply_ret->buffer = NULL; + if (!buffer_allocate(&reply_ret->buffer, reply_ofs, MDL)) { +@@ -4894,7 +5028,6 @@ exit: + * we still need to be aware of this possibility. + */ + +-/* TODO: reject unicast messages, unless we set unicast option */ + /* TODO: IA_TA */ + static void + dhcpv6_decline(struct data_string *reply, struct packet *packet) { +@@ -5364,7 +5497,6 @@ exit: + * Release means a client is done with the leases. + */ + +-/* TODO: reject unicast messages, unless we set unicast option */ + static void + dhcpv6_release(struct data_string *reply, struct packet *packet) { + struct data_string client_id; diff --git a/dhcp/patches/dhcp-4.2.4-failOverPeer.patch b/dhcp/patches/dhcp-4.2.4-failOverPeer.patch new file mode 100644 index 0000000..1b0da7e --- /dev/null +++ b/dhcp/patches/dhcp-4.2.4-failOverPeer.patch @@ -0,0 +1,12 @@ +diff -up dhcp-4.2.4/server/ldap.c.failOverPeer dhcp-4.2.4/server/ldap.c +--- dhcp-4.2.4/server/ldap.c.failOverPeer 2012-07-23 12:53:26.815262322 +0200 ++++ dhcp-4.2.4/server/ldap.c 2012-07-23 12:54:31.002119299 +0200 +@@ -893,7 +893,7 @@ ldap_start (void) + static void + parse_external_dns (LDAPMessage * ent) + { +- char *search[] = {"dhcpOptionsDN", "dhcpSharedNetworkDN", "dhcpSubnetDN", ++ char *search[] = {"dhcpFailOverPeerDN", "dhcpOptionsDN", "dhcpSharedNetworkDN", "dhcpSubnetDN", + "dhcpGroupDN", "dhcpHostDN", "dhcpClassesDN", + "dhcpPoolDN", NULL}; + LDAPMessage * newres, * newent; diff --git a/dhcp/patches/dhcp-4.2.4-getifaddrs.patch b/dhcp/patches/dhcp-4.2.4-getifaddrs.patch new file mode 100644 index 0000000..fe22da0 --- /dev/null +++ b/dhcp/patches/dhcp-4.2.4-getifaddrs.patch @@ -0,0 +1,431 @@ +diff -up dhcp-4.2.4rc2/common/discover.c.getifaddrs dhcp-4.2.4rc2/common/discover.c +--- dhcp-4.2.4rc2/common/discover.c.getifaddrs 2012-05-25 18:05:29.592024035 +0200 ++++ dhcp-4.2.4rc2/common/discover.c 2012-05-25 18:12:05.254266023 +0200 +@@ -379,394 +379,13 @@ end_iface_scan(struct iface_conf_list *i + ifaces->sock = -1; + } + +-#elif __linux /* !HAVE_SIOCGLIFCONF */ +-/* +- * Linux support +- * ------------- +- * +- * In Linux, we use the /proc pseudo-filesystem to get information +- * about interfaces, along with selected ioctl() calls. +- * +- * Linux low level access is documented in the netdevice man page. +- */ +- +-/* +- * Structure holding state about the scan. +- */ +-struct iface_conf_list { +- int sock; /* file descriptor used to get information */ +- FILE *fp; /* input from /proc/net/dev */ +-#ifdef DHCPv6 +- FILE *fp6; /* input from /proc/net/if_inet6 */ +-#endif +-}; +- +-/* +- * Structure used to return information about a specific interface. +- */ +-struct iface_info { +- char name[IFNAMSIZ]; /* name of the interface, e.g. "eth0" */ +- struct sockaddr_storage addr; /* address information */ +- isc_uint64_t flags; /* interface flags, e.g. IFF_LOOPBACK */ +-}; +- +-/* +- * Start a scan of interfaces. +- * +- * The iface_conf_list structure maintains state for this process. +- */ +-int +-begin_iface_scan(struct iface_conf_list *ifaces) { +- char buf[256]; +- int len; +- int i; +- +- ifaces->fp = fopen("/proc/net/dev", "re"); +- if (ifaces->fp == NULL) { +- log_error("Error opening '/proc/net/dev' to list interfaces"); +- return 0; +- } +- +- /* +- * The first 2 lines are header information, so read and ignore them. +- */ +- for (i=0; i<2; i++) { +- if (fgets(buf, sizeof(buf), ifaces->fp) == NULL) { +- log_error("Error reading headers from '/proc/net/dev'"); +- fclose(ifaces->fp); +- ifaces->fp = NULL; +- return 0; +- } +- len = strlen(buf); +- if ((len <= 0) || (buf[len-1] != '\n')) { +- log_error("Bad header line in '/proc/net/dev'"); +- fclose(ifaces->fp); +- ifaces->fp = NULL; +- return 0; +- } +- } +- +- ifaces->sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); +- if (ifaces->sock < 0) { +- log_error("Error creating socket to list interfaces; %m"); +- fclose(ifaces->fp); +- ifaces->fp = NULL; +- return 0; +- } +- +-#ifdef DHCPv6 +- if ((local_family == AF_INET6) && !access("/proc/net/if_inet6", R_OK)) { +- ifaces->fp6 = fopen("/proc/net/if_inet6", "re"); +- if (ifaces->fp6 == NULL) { +- log_error("Error opening '/proc/net/if_inet6' to " +- "list IPv6 interfaces; %m"); +- close(ifaces->sock); +- ifaces->sock = -1; +- fclose(ifaces->fp); +- ifaces->fp = NULL; +- return 0; +- } +- } else { +- ifaces->fp6 = NULL; +- } +-#endif +- +- return 1; +-} +- +-/* +- * Read our IPv4 interfaces from /proc/net/dev. +- * +- * The file looks something like this: +- * +- * Inter-| Receive ... +- * face |bytes packets errs drop fifo frame ... +- * lo: 1580562 4207 0 0 0 0 ... +- * eth0: 0 0 0 0 0 0 ... +- * eth1:1801552440 37895 0 14 0 ... +- * +- * We only care about the interface name, which is at the start of +- * each line. +- * +- * We use an ioctl() to get the address and flags for each interface. +- */ +-static int +-next_iface4(struct iface_info *info, int *err, struct iface_conf_list *ifaces) { +- char buf[256]; +- int len; +- char *p; +- char *name; +- struct ifreq tmp; +- +- /* +- * Loop exits when we find an interface that has an address, or +- * when we run out of interfaces. +- */ +- for (;;) { +- do { +- /* +- * Read the next line in the file. +- */ +- if (fgets(buf, sizeof(buf), ifaces->fp) == NULL) { +- if (ferror(ifaces->fp)) { +- *err = 1; +- log_error("Error reading interface " +- "information"); +- } else { +- *err = 0; +- } +- return 0; +- } +- +- /* +- * Make sure the line is a nice, +- * newline-terminated line. +- */ +- len = strlen(buf); +- if ((len <= 0) || (buf[len-1] != '\n')) { +- log_error("Bad line reading interface " +- "information"); +- *err = 1; +- return 0; +- } +- +- /* +- * Figure out our name. +- */ +- p = strrchr(buf, ':'); +- if (p == NULL) { +- log_error("Bad line reading interface " +- "information (no colon)"); +- *err = 1; +- return 0; +- } +- *p = '\0'; +- name = buf; +- while (isspace(*name)) { +- name++; +- } +- +- /* +- * Copy our name into our interface structure. +- */ +- len = p - name; +- if (len >= sizeof(info->name)) { +- *err = 1; +- log_error("Interface name '%s' too long", name); +- return 0; +- } +- strcpy(info->name, name); +- +-#ifdef ALIAS_NAMED_PERMUTED +- /* interface aliases look like "eth0:1" or "wlan1:3" */ +- s = strchr(info->name, ':'); +- if (s != NULL) { +- *s = '\0'; +- } +-#endif +- +-#ifdef SKIP_DUMMY_INTERFACES +- } while (strncmp(info->name, "dummy", 5) == 0); +-#else +- } while (0); +-#endif +- +- memset(&tmp, 0, sizeof(tmp)); +- strcpy(tmp.ifr_name, name); +- if (ioctl(ifaces->sock, SIOCGIFADDR, &tmp) < 0) { +- if (errno == EADDRNOTAVAIL) { +- continue; +- } +- log_error("Error getting interface address " +- "for '%s'; %m", name); +- *err = 1; +- return 0; +- } +- memcpy(&info->addr, &tmp.ifr_addr, sizeof(tmp.ifr_addr)); +- +- memset(&tmp, 0, sizeof(tmp)); +- strcpy(tmp.ifr_name, name); +- if (ioctl(ifaces->sock, SIOCGIFFLAGS, &tmp) < 0) { +- log_error("Error getting interface flags for '%s'; %m", +- name); +- *err = 1; +- return 0; +- } +- info->flags = tmp.ifr_flags; +- +- *err = 0; +- return 1; +- } +-} +- +-#ifdef DHCPv6 +-/* +- * Read our IPv6 interfaces from /proc/net/if_inet6. +- * +- * The file looks something like this: +- * +- * fe80000000000000025056fffec00008 05 40 20 80 vmnet8 +- * 00000000000000000000000000000001 01 80 10 80 lo +- * fe80000000000000025056fffec00001 06 40 20 80 vmnet1 +- * 200108881936000202166ffffe497d9b 03 40 00 00 eth1 +- * fe8000000000000002166ffffe497d9b 03 40 20 80 eth1 +- * +- * We get IPv6 address from the start, the interface name from the end, +- * and ioctl() to get flags. +- */ +-static int +-next_iface6(struct iface_info *info, int *err, struct iface_conf_list *ifaces) { +- char buf[256]; +- int len; +- char *p; +- char *name; +- int i; +- struct sockaddr_in6 addr; +- struct ifreq tmp; +- +- do { +- /* +- * Read the next line in the file. +- */ +- if (fgets(buf, sizeof(buf), ifaces->fp6) == NULL) { +- if (ferror(ifaces->fp6)) { +- *err = 1; +- log_error("Error reading IPv6 " +- "interface information"); +- } else { +- *err = 0; +- } +- return 0; +- } +- +- /* +- * Make sure the line is a nice, newline-terminated line. +- */ +- len = strlen(buf); +- if ((len <= 0) || (buf[len-1] != '\n')) { +- log_error("Bad line reading IPv6 " +- "interface information"); +- *err = 1; +- return 0; +- } +- +- /* +- * Figure out our name. +- */ +- buf[--len] = '\0'; +- p = strrchr(buf, ' '); +- if (p == NULL) { +- log_error("Bad line reading IPv6 interface " +- "information (no space)"); +- *err = 1; +- return 0; +- } +- name = p+1; +- +- /* +- * Copy our name into our interface structure. +- */ +- len = strlen(name); +- if (len >= sizeof(info->name)) { +- *err = 1; +- log_error("IPv6 interface name '%s' too long", name); +- return 0; +- } +- strcpy(info->name, name); +- +-#ifdef SKIP_DUMMY_INTERFACES +- } while (strncmp(info->name, "dummy", 5) == 0); +-#else +- } while (0); +-#endif +- +- /* +- * Double-check we start with the IPv6 address. +- */ +- for (i=0; i<32; i++) { +- if (!isxdigit(buf[i]) || isupper(buf[i])) { +- *err = 1; +- log_error("Bad line reading IPv6 interface address " +- "for '%s'", name); +- return 0; +- } +- } +- +- /* +- * Load our socket structure. +- */ +- memset(&addr, 0, sizeof(addr)); +- addr.sin6_family = AF_INET6; +- for (i=0; i<16; i++) { +- unsigned char byte; +- static const char hex[] = "0123456789abcdef"; +- byte = ((index(hex, buf[i * 2]) - hex) << 4) | +- (index(hex, buf[i * 2 + 1]) - hex); +- addr.sin6_addr.s6_addr[i] = byte; +- } +- memcpy(&info->addr, &addr, sizeof(addr)); +- +- /* +- * Get our flags. +- */ +- memset(&tmp, 0, sizeof(tmp)); +- strcpy(tmp.ifr_name, name); +- if (ioctl(ifaces->sock, SIOCGIFFLAGS, &tmp) < 0) { +- log_error("Error getting interface flags for '%s'; %m", name); +- *err = 1; +- return 0; +- } +- info->flags = tmp.ifr_flags; +- +- *err = 0; +- return 1; +-} +-#endif /* DHCPv6 */ +- +-/* +- * Retrieve the next interface. +- * +- * Returns information in the info structure. +- * Sets err to 1 if there is an error, otherwise 0. +- */ +-int +-next_iface(struct iface_info *info, int *err, struct iface_conf_list *ifaces) { +- if (next_iface4(info, err, ifaces)) { +- return 1; +- } +-#ifdef DHCPv6 +- if (!(*err) && ifaces->fp6) { +- if (local_family == AF_INET6) +- return next_iface6(info, err, ifaces); +- } +-#endif +- return 0; +-} +- +-/* +- * End scan of interfaces. +- */ +-void +-end_iface_scan(struct iface_conf_list *ifaces) { +- fclose(ifaces->fp); +- ifaces->fp = NULL; +- close(ifaces->sock); +- ifaces->sock = -1; +-#ifdef DHCPv6 +- if (local_family == AF_INET6) { +- if (ifaces->fp6) +- fclose(ifaces->fp6); +- ifaces->fp6 = NULL; +- } +-#endif +-} + #else + + /* + * BSD support + * ----------- + * +- * FreeBSD, NetBSD, OpenBSD, and OS X all have the getifaddrs() ++ * FreeBSD, NetBSD, OpenBSD, OS X and Linux all have the getifaddrs() + * function. + * + * The getifaddrs() man page describes the use. +@@ -814,6 +433,8 @@ begin_iface_scan(struct iface_conf_list + */ + int + next_iface(struct iface_info *info, int *err, struct iface_conf_list *ifaces) { ++ size_t sa_len = 0; ++ + if (ifaces->next == NULL) { + *err = 0; + return 0; +@@ -825,8 +446,20 @@ next_iface(struct iface_info *info, int + return 0; + } + strcpy(info->name, ifaces->next->ifa_name); +- memcpy(&info->addr, ifaces->next->ifa_addr, +- ifaces->next->ifa_addr->sa_len); ++ ++ memset(&info->addr, 0 , sizeof(info->addr)); ++ ++ if (ifaces->next->ifa_addr != NULL) { ++#ifdef HAVE_SA_LEN ++ sa_len = ifaces->next->ifa_addr->sa_len; ++#else ++ if (ifaces->next->ifa_addr->sa_family == AF_INET) ++ sa_len = sizeof(struct sockaddr_in); ++ else if (ifaces->next->ifa_addr->sa_family == AF_INET6) ++ sa_len = sizeof(struct sockaddr_in6); ++#endif ++ memcpy(&info->addr, ifaces->next->ifa_addr, sa_len); ++ } + info->flags = ifaces->next->ifa_flags; + ifaces->next = ifaces->next->ifa_next; + *err = 0; diff --git a/dhcp/patches/dhcp-4.2.4-improved-xid.patch b/dhcp/patches/dhcp-4.2.4-improved-xid.patch new file mode 100644 index 0000000..f353fb0 --- /dev/null +++ b/dhcp/patches/dhcp-4.2.4-improved-xid.patch @@ -0,0 +1,138 @@ +diff -up dhcp-4.2.4b1/client/dhclient.c.improved-xid dhcp-4.2.4b1/client/dhclient.c +--- dhcp-4.2.4b1/client/dhclient.c.improved-xid 2012-04-16 17:42:37.444217424 +0200 ++++ dhcp-4.2.4b1/client/dhclient.c 2012-04-16 17:45:32.105770755 +0200 +@@ -888,6 +888,26 @@ main(int argc, char **argv) { + } + } + ++ /* We create a backup seed before rediscovering interfaces in order to ++ have a seed built using all of the available interfaces ++ It's interesting if required interfaces doesn't let us defined ++ a really unique seed due to a lack of valid HW addr later ++ (this is the case with DHCP over IB) ++ We only use the last device as using a sum could broke the ++ uniqueness of the seed among multiple nodes ++ */ ++ unsigned backup_seed = 0; ++ for (ip = interfaces; ip; ip = ip -> next) { ++ int junk; ++ if ( ip -> hw_address.hlen <= sizeof seed ) ++ continue; ++ memcpy (&junk, ++ &ip -> hw_address.hbuf [ip -> hw_address.hlen - ++ sizeof seed], sizeof seed); ++ backup_seed = junk; ++ } ++ ++ + /* At this point, all the interfaces that the script thinks + are relevant should be running, so now we once again call + discover_interfaces(), and this time ask it to actually set +@@ -902,14 +922,36 @@ main(int argc, char **argv) { + Not much entropy, but we're booting, so we're not likely to + find anything better. */ + seed = 0; ++ int seed_flag = 0; + for (ip = interfaces; ip; ip = ip->next) { + int junk; ++ if ( ip -> hw_address.hlen <= sizeof seed ) ++ continue; + memcpy(&junk, + &ip->hw_address.hbuf[ip->hw_address.hlen - + sizeof seed], sizeof seed); + seed += junk; ++ seed_flag = 1; + } +- srandom(seed + cur_time + (unsigned)getpid()); ++ if ( seed_flag == 0 ) { ++ if ( backup_seed != 0 ) { ++ seed = backup_seed; ++ log_info ("xid: rand init seed (0x%x) built using all" ++ " available interfaces",seed); ++ } ++ else { ++ seed = cur_time^((unsigned) gethostid()) ; ++ log_info ("xid: warning: no netdev with useable HWADDR found" ++ " for seed's uniqueness enforcement"); ++ log_info ("xid: rand init seed (0x%x) built using gethostid", ++ seed); ++ } ++ /* we only use seed and no current time as a broadcast reply */ ++ /* will certainly be used by the hwaddrless interface */ ++ srandom(seed); ++ } ++ else ++ srandom(seed + cur_time + (unsigned)getpid()); + + /* Setup specific Infiniband options */ + for (ip = interfaces; ip; ip = ip->next) { +@@ -1447,7 +1489,7 @@ void dhcpack (packet) + return; + } + +- log_info ("DHCPACK from %s", piaddr (packet -> client_addr)); ++ log_info ("DHCPACK from %s (xid=0x%x)", piaddr (packet -> client_addr), client -> xid); + + lease = packet_to_lease (packet, client); + if (!lease) { +@@ -2164,7 +2206,7 @@ void dhcpnak (packet) + return; + } + +- log_info ("DHCPNAK from %s", piaddr (packet -> client_addr)); ++ log_info ("DHCPNAK from %s (xid=0x%x)", piaddr (packet -> client_addr), client -> xid); + + if (!client -> active) { + #if defined (DEBUG) +@@ -2290,10 +2332,10 @@ void send_discover (cpp) + client -> packet.secs = htons (65535); + client -> secs = client -> packet.secs; + +- log_info ("DHCPDISCOVER on %s to %s port %d interval %ld", ++ log_info ("DHCPDISCOVER on %s to %s port %d interval %ld (xid=0x%x)", + client -> name ? client -> name : client -> interface -> name, + inet_ntoa (sockaddr_broadcast.sin_addr), +- ntohs (sockaddr_broadcast.sin_port), (long)(client -> interval)); ++ ntohs (sockaddr_broadcast.sin_port), (long)(client -> interval), client -> xid); + + /* Send out a packet. */ + result = send_packet(client->interface, NULL, &client->packet, +@@ -2577,10 +2619,10 @@ void send_request (cpp) + client -> packet.secs = htons (65535); + } + +- log_info ("DHCPREQUEST on %s to %s port %d", ++ log_info ("DHCPREQUEST on %s to %s port %d (xid=0x%x)", + client -> name ? client -> name : client -> interface -> name, + inet_ntoa (destination.sin_addr), +- ntohs (destination.sin_port)); ++ ntohs (destination.sin_port), client -> xid); + + if (destination.sin_addr.s_addr != INADDR_BROADCAST && + fallback_interface) { +@@ -2620,10 +2662,10 @@ void send_decline (cpp) + + int result; + +- log_info ("DHCPDECLINE on %s to %s port %d", ++ log_info ("DHCPDECLINE on %s to %s port %d (xid=0x%x)", + client->name ? client->name : client->interface->name, + inet_ntoa(sockaddr_broadcast.sin_addr), +- ntohs(sockaddr_broadcast.sin_port)); ++ ntohs(sockaddr_broadcast.sin_port), client -> xid); + + /* Send out a packet. */ + result = send_packet(client->interface, NULL, &client->packet, +@@ -2666,10 +2708,10 @@ void send_release (cpp) + return; + } + +- log_info ("DHCPRELEASE on %s to %s port %d", ++ log_info ("DHCPRELEASE on %s to %s port %d (xid=0x%x)", + client -> name ? client -> name : client -> interface -> name, + inet_ntoa (destination.sin_addr), +- ntohs (destination.sin_port)); ++ ntohs (destination.sin_port), client -> xid); + + if (fallback_interface) { + result = send_packet(fallback_interface, NULL, &client->packet, diff --git a/dhcp/patches/dhcp-4.2.4-lpf-ib.patch b/dhcp/patches/dhcp-4.2.4-lpf-ib.patch new file mode 100644 index 0000000..abf7af9 --- /dev/null +++ b/dhcp/patches/dhcp-4.2.4-lpf-ib.patch @@ -0,0 +1,549 @@ +diff -up dhcp-4.2.4/client/dhclient.c.lpf-ib dhcp-4.2.4/client/dhclient.c +--- dhcp-4.2.4/client/dhclient.c.lpf-ib 2012-07-18 21:08:48.100835005 +0200 ++++ dhcp-4.2.4/client/dhclient.c 2012-07-18 21:08:48.111834856 +0200 +@@ -113,6 +113,8 @@ static int check_domain_name_list(const + static int check_option_values(struct universe *universe, unsigned int opt, + const char *ptr, size_t len); + ++static void setup_ib_interface(struct interface_info *ip); ++ + int + main(int argc, char **argv) { + int fd; +@@ -909,6 +911,14 @@ main(int argc, char **argv) { + } + srandom(seed + cur_time + (unsigned)getpid()); + ++ /* Setup specific Infiniband options */ ++ for (ip = interfaces; ip; ip = ip->next) { ++ if (ip->client && ++ (ip->hw_address.hbuf[0] == HTYPE_INFINIBAND)) { ++ setup_ib_interface(ip); ++ } ++ } ++ + /* Start a configuration state machine for each interface. */ + #ifdef DHCPv6 + if (local_family == AF_INET6) { +@@ -1185,6 +1195,29 @@ int find_subnet (struct subnet **sp, + return 0; + } + ++static void setup_ib_interface(struct interface_info *ip) ++{ ++ struct group *g; ++ ++ /* Set the broadcast flag */ ++ ip->client->config->bootp_broadcast_always = 1; ++ ++ /* ++ * Find out if a dhcp-client-identifier option was specified either ++ * in the config file or on the command line ++ */ ++ for (g = ip->client->config->on_transmission; g != NULL; g = g->next) { ++ if ((g->statements != NULL) && ++ (strcmp(g->statements->data.option->option->name, ++ "dhcp-client-identifier") == 0)) { ++ return; ++ } ++ } ++ ++ /* No client ID specified */ ++ log_fatal("dhcp-client-identifier must be specified for InfiniBand"); ++} ++ + /* Individual States: + * + * Each routine is called from the dhclient_state_machine() in one of +diff -up dhcp-4.2.4/common/bpf.c.lpf-ib dhcp-4.2.4/common/bpf.c +--- dhcp-4.2.4/common/bpf.c.lpf-ib 2012-07-18 21:08:48.101834991 +0200 ++++ dhcp-4.2.4/common/bpf.c 2012-07-18 21:08:48.111834856 +0200 +@@ -198,11 +198,44 @@ struct bpf_insn dhcp_bpf_filter [] = { + BPF_STMT(BPF_RET+BPF_K, 0), + }; + ++/* Packet filter program for DHCP over Infiniband. ++ * ++ * XXX ++ * Changes to the filter program may require changes to the constant offsets ++ * used in lpf_gen_filter_setup to patch the port in the BPF program! ++ * XXX ++ */ ++struct bpf_insn dhcp_ib_bpf_filter [] = { ++ /* Packet filter for Infiniband */ ++ /* Make sure it's a UDP packet... */ ++ BPF_STMT(BPF_LD + BPF_B + BPF_ABS, 9), ++ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 6), ++ ++ /* Make sure this isn't a fragment... */ ++ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 6), ++ BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 4, 0), ++ ++ /* Get the IP header length... */ ++ BPF_STMT(BPF_LDX + BPF_B + BPF_MSH, 0), ++ ++ /* Make sure it's to the right port... */ ++ BPF_STMT(BPF_LD + BPF_H + BPF_IND, 2), ++ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 67, 0, 1), ++ ++ /* If we passed all the tests, ask for the whole packet. */ ++ BPF_STMT(BPF_RET + BPF_K, (u_int)-1), ++ ++ /* Otherwise, drop it. */ ++ BPF_STMT(BPF_RET + BPF_K, 0), ++}; ++ + #if defined (DEC_FDDI) + struct bpf_insn *bpf_fddi_filter; + #endif + + int dhcp_bpf_filter_len = sizeof dhcp_bpf_filter / sizeof (struct bpf_insn); ++int dhcp_ib_bpf_filter_len = sizeof dhcp_ib_bpf_filter / sizeof (struct bpf_insn); ++ + #if defined (HAVE_TR_SUPPORT) + struct bpf_insn dhcp_bpf_tr_filter [] = { + /* accept all token ring packets due to variable length header */ +diff -up dhcp-4.2.4/common/lpf.c.lpf-ib dhcp-4.2.4/common/lpf.c +--- dhcp-4.2.4/common/lpf.c.lpf-ib 2012-07-18 21:08:48.101834991 +0200 ++++ dhcp-4.2.4/common/lpf.c 2012-07-18 21:10:47.367210799 +0200 +@@ -42,6 +42,7 @@ + #include "includes/netinet/udp.h" + #include "includes/netinet/if_ether.h" + #include <net/if.h> ++#include <ifaddrs.h> + + #ifndef PACKET_AUXDATA + #define PACKET_AUXDATA 8 +@@ -59,6 +60,15 @@ struct tpacket_auxdata + /* Reinitializes the specified interface after an address change. This + is not required for packet-filter APIs. */ + ++/* Default broadcast address for IPoIB */ ++static unsigned char default_ib_bcast_addr[20] = { ++ 0x00, 0xff, 0xff, 0xff, ++ 0xff, 0x12, 0x40, 0x1b, ++ 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, ++ 0xff, 0xff, 0xff, 0xff ++}; ++ + #ifdef USE_LPF_SEND + void if_reinitialize_send (info) + struct interface_info *info; +@@ -86,10 +96,21 @@ int if_register_lpf (info) + struct sockaddr common; + } sa; + struct ifreq ifr; ++ int type; ++ int protocol; + + /* Make an LPF socket. */ +- if ((sock = socket(PF_PACKET, SOCK_RAW, +- htons((short)ETH_P_ALL))) < 0) { ++ get_hw_addr(info); ++ ++ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) { ++ type = SOCK_DGRAM; ++ protocol = ETHERTYPE_IP; ++ } else { ++ type = SOCK_RAW; ++ protocol = ETH_P_ALL; ++ } ++ ++ if ((sock = socket(PF_PACKET, type, htons((short)protocol))) < 0) { + if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || + errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || + errno == EAFNOSUPPORT || errno == EINVAL) { +@@ -112,6 +133,7 @@ int if_register_lpf (info) + /* Bind to the interface name */ + memset (&sa, 0, sizeof sa); + sa.ll.sll_family = AF_PACKET; ++ sa.ll.sll_protocol = htons(protocol); + sa.ll.sll_ifindex = ifr.ifr_ifindex; + if (bind (sock, &sa.common, sizeof sa)) { + if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || +@@ -127,8 +149,6 @@ int if_register_lpf (info) + log_fatal ("Bind socket to interface: %m"); + } + +- get_hw_addr(info->name, &info->hw_address); +- + return sock; + } + #endif /* USE_LPF_SEND || USE_LPF_RECEIVE */ +@@ -183,6 +203,8 @@ void if_deregister_send (info) + in bpf includes... */ + extern struct sock_filter dhcp_bpf_filter []; + extern int dhcp_bpf_filter_len; ++extern struct sock_filter dhcp_ib_bpf_filter []; ++extern int dhcp_ib_bpf_filter_len; + + #if defined (HAVE_TR_SUPPORT) + extern struct sock_filter dhcp_bpf_tr_filter []; +@@ -200,11 +222,13 @@ void if_register_receive (info) + /* 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 (info->hw_address.hbuf[0] != HTYPE_INFINIBAND) { ++ 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) +@@ -250,15 +274,28 @@ static void lpf_gen_filter_setup (info) + + memset(&p, 0, sizeof(p)); + +- /* Set up the bpf filter program structure. This is defined in +- bpf.c */ +- p.len = dhcp_bpf_filter_len; +- p.filter = dhcp_bpf_filter; +- +- /* Patch the server port into the LPF program... +- XXX changes to filter program may require changes +- to the insn number(s) used below! XXX */ +- dhcp_bpf_filter [8].k = ntohs ((short)local_port); ++ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) { ++ /* Set up the bpf filter program structure. */ ++ p.len = dhcp_ib_bpf_filter_len; ++ p.filter = dhcp_ib_bpf_filter; ++ ++ /* Patch the server port into the LPF program... ++ XXX ++ changes to filter program may require changes ++ to the insn number(s) used below! ++ XXX */ ++ dhcp_ib_bpf_filter[6].k = ntohs ((short)local_port); ++ } else { ++ /* Set up the bpf filter program structure. ++ This is defined in bpf.c */ ++ p.len = dhcp_bpf_filter_len; ++ p.filter = dhcp_bpf_filter; ++ ++ /* Patch the server port into the LPF program... ++ XXX changes to filter program may require changes ++ to the insn number(s) used below! XXX */ ++ dhcp_bpf_filter [8].k = ntohs ((short)local_port); ++ } + + if (setsockopt (info -> rfdesc, SOL_SOCKET, SO_ATTACH_FILTER, &p, + sizeof p) < 0) { +@@ -315,6 +352,54 @@ static void lpf_tr_filter_setup (info) + #endif /* USE_LPF_RECEIVE */ + + #ifdef USE_LPF_SEND ++ssize_t send_packet_ib(interface, packet, raw, len, from, to, hto) ++ struct interface_info *interface; ++ struct packet *packet; ++ struct dhcp_packet *raw; ++ size_t len; ++ struct in_addr from; ++ struct sockaddr_in *to; ++ struct hardware *hto; ++{ ++ unsigned ibufp = 0; ++ double ih [1536 / sizeof (double)]; ++ unsigned char *buf = (unsigned char *)ih; ++ ssize_t result; ++ ++ union sockunion { ++ struct sockaddr sa; ++ struct sockaddr_ll sll; ++ struct sockaddr_storage ss; ++ } su; ++ ++ assemble_udp_ip_header (interface, buf, &ibufp, from.s_addr, ++ to->sin_addr.s_addr, to->sin_port, ++ (unsigned char *)raw, len); ++ memcpy (buf + ibufp, raw, len); ++ ++ memset(&su, 0, sizeof(su)); ++ su.sll.sll_family = AF_PACKET; ++ su.sll.sll_protocol = htons(ETHERTYPE_IP); ++ ++ if (!(su.sll.sll_ifindex = if_nametoindex(interface->name))) { ++ errno = ENOENT; ++ log_error ("send_packet_ib: %m - failed to get if index"); ++ return -1; ++ } ++ ++ su.sll.sll_hatype = htons(HTYPE_INFINIBAND); ++ su.sll.sll_halen = sizeof(interface->bcast_addr); ++ memcpy(&su.sll.sll_addr, interface->bcast_addr, 20); ++ ++ result = sendto(interface->wfdesc, buf, ibufp + len, 0, ++ &su.sa, sizeof(su)); ++ ++ if (result < 0) ++ log_error ("send_packet_ib: %m"); ++ ++ return result; ++} ++ + ssize_t send_packet (interface, packet, raw, len, from, to, hto) + struct interface_info *interface; + struct packet *packet; +@@ -335,6 +420,11 @@ ssize_t send_packet (interface, packet, + return send_fallback (interface, packet, raw, + len, from, to, hto); + ++ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) { ++ return send_packet_ib(interface, packet, raw, len, from, ++ to, hto); ++ } ++ + if (hto == NULL && interface->anycast_mac_addr.hlen) + hto = &interface->anycast_mac_addr; + +@@ -356,6 +446,42 @@ ssize_t send_packet (interface, packet, + #endif /* USE_LPF_SEND */ + + #ifdef USE_LPF_RECEIVE ++ssize_t receive_packet_ib (interface, buf, len, from, hfrom) ++ struct interface_info *interface; ++ unsigned char *buf; ++ size_t len; ++ struct sockaddr_in *from; ++ struct hardware *hfrom; ++{ ++ int length = 0; ++ int offset = 0; ++ unsigned char ibuf [1536]; ++ unsigned bufix = 0; ++ unsigned paylen; ++ ++ length = read(interface->rfdesc, ibuf, sizeof(ibuf)); ++ ++ if (length <= 0) ++ return length; ++ ++ offset = decode_udp_ip_header(interface, ibuf, bufix, from, ++ (unsigned)length, &paylen, 0); ++ ++ if (offset < 0) ++ return 0; ++ ++ bufix += offset; ++ length -= offset; ++ ++ if (length < paylen) ++ log_fatal("Internal inconsistency at %s:%d.", MDL); ++ ++ /* Copy out the data in the packet... */ ++ memcpy(buf, &ibuf[bufix], paylen); ++ ++ return (ssize_t)paylen; ++} ++ + ssize_t receive_packet (interface, buf, len, from, hfrom) + struct interface_info *interface; + unsigned char *buf; +@@ -382,6 +508,10 @@ ssize_t receive_packet (interface, buf, + }; + struct cmsghdr *cmsg; + ++ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) { ++ return receive_packet_ib(interface, buf, len, from, hfrom); ++ } ++ + length = recvmsg (interface -> rfdesc, &msg, 0); + if (length <= 0) + return length; +@@ -461,11 +591,32 @@ void maybe_setup_fallback () + } + } + +-void +-get_hw_addr(const char *name, struct hardware *hw) { ++struct sockaddr_ll * ++get_ll (struct ifaddrs *ifaddrs, struct ifaddrs **ifa, char *name) ++{ ++ for (*ifa = ifaddrs; *ifa != NULL; *ifa = (*ifa)->ifa_next) { ++ if ((*ifa)->ifa_addr == NULL) ++ continue; ++ ++ if ((*ifa)->ifa_addr->sa_family != AF_PACKET) ++ continue; ++ ++ if ((*ifa)->ifa_flags & IFF_LOOPBACK) ++ continue; ++ ++ if (strcmp((*ifa)->ifa_name, name) == 0) ++ return (struct sockaddr_ll *)(void *)(*ifa)->ifa_addr; ++ } ++ return NULL; ++} ++ ++struct sockaddr_ll * ++ioctl_get_ll(char *name) ++{ + int sock; + struct ifreq tmp; +- struct sockaddr *sa; ++ struct sockaddr *sa = NULL; ++ struct sockaddr_ll *sll = NULL; + + if (strlen(name) >= sizeof(tmp.ifr_name)) { + log_fatal("Device name too long: "%s"", name); +@@ -479,16 +630,44 @@ get_hw_addr(const char *name, struct har + memset(&tmp, 0, sizeof(tmp)); + strcpy(tmp.ifr_name, name); + if (ioctl(sock, SIOCGIFHWADDR, &tmp) < 0) { +- log_fatal("Error getting hardware address for "%s": %m", ++ log_fatal("Error getting hardware address for "%s": %m", + name); + } + + sa = &tmp.ifr_hwaddr; +- switch (sa->sa_family) { ++ sll = dmalloc (sizeof (struct sockaddr_ll), MDL); ++ if (!sll) ++ log_fatal("Unable to allocate memory for link layer address"); ++ memcpy(&sll->sll_hatype, &sa->sa_family, sizeof (sll->sll_hatype)); ++ memcpy(sll->sll_addr, sa->sa_data, sizeof (sll->sll_addr)); ++ return sll; ++} ++ ++void ++get_hw_addr(struct interface_info *info) ++{ ++ struct hardware *hw = &info->hw_address; ++ char *name = info->name; ++ struct ifaddrs *ifaddrs = NULL; ++ struct ifaddrs *ifa = NULL; ++ struct sockaddr_ll *sll = NULL; ++ ++ if (getifaddrs(&ifaddrs) == -1) ++ log_fatal("Failed to get interfaces"); ++ ++ if ((sll = get_ll(ifaddrs, &ifa, name)) == NULL) { ++ /* ++ * We were unable to get link-layer address for name. ++ * Fall back to ioctl(SIOCGIFHWADDR). ++ */ ++ sll = ioctl_get_ll(name); ++ } ++ ++ switch (sll->sll_hatype) { + case ARPHRD_ETHER: + hw->hlen = 7; + hw->hbuf[0] = HTYPE_ETHER; +- memcpy(&hw->hbuf[1], sa->sa_data, 6); ++ memcpy(&hw->hbuf[1], sll->sll_addr, 6); + break; + case ARPHRD_IEEE802: + #ifdef ARPHRD_IEEE802_TR +@@ -496,18 +675,35 @@ get_hw_addr(const char *name, struct har + #endif /* ARPHRD_IEEE802_TR */ + hw->hlen = 7; + hw->hbuf[0] = HTYPE_IEEE802; +- memcpy(&hw->hbuf[1], sa->sa_data, 6); ++ memcpy(&hw->hbuf[1], sll->sll_addr, 6); + break; + case ARPHRD_FDDI: + hw->hlen = 17; + hw->hbuf[0] = HTYPE_FDDI; +- memcpy(&hw->hbuf[1], sa->sa_data, 16); ++ memcpy(&hw->hbuf[1], sll->sll_addr, 16); ++ break; ++ case ARPHRD_INFINIBAND: ++ /* For Infiniband, save the broadcast address and store ++ * the port GUID into the hardware address. ++ */ ++ if (ifa->ifa_flags & IFF_BROADCAST) { ++ struct sockaddr_ll *bll; ++ ++ bll = (struct sockaddr_ll *)ifa->ifa_broadaddr; ++ memcpy(&info->bcast_addr, bll->sll_addr, 20); ++ } else { ++ memcpy(&info->bcast_addr, default_ib_bcast_addr, ++ 20); ++ } ++ ++ hw->hlen = 1; ++ hw->hbuf[0] = HTYPE_INFINIBAND; + break; + #if defined(ARPHRD_PPP) + case ARPHRD_PPP: + if (local_family != AF_INET6) +- log_fatal("Unsupported device type %d for "%s"", +- sa->sa_family, name); ++ log_fatal("local_family != AF_INET6 for "%s"", ++ name); + hw->hlen = 0; + hw->hbuf[0] = HTYPE_RESERVED; + /* 0xdeadbeef should never occur on the wire, +@@ -520,10 +716,11 @@ get_hw_addr(const char *name, struct har + break; + #endif + default: +- log_fatal("Unsupported device type %ld for "%s"", +- (long int)sa->sa_family, name); ++ freeifaddrs(ifaddrs); ++ log_fatal("Unsupported device type %h for "%s"", ++ sll->sll_hatype, name); + } + +- close(sock); ++ freeifaddrs(ifaddrs); + } + #endif +diff -up dhcp-4.2.4/common/socket.c.lpf-ib dhcp-4.2.4/common/socket.c +--- dhcp-4.2.4/common/socket.c.lpf-ib 2012-03-09 12:28:11.000000000 +0100 ++++ dhcp-4.2.4/common/socket.c 2012-07-18 21:08:48.112834843 +0200 +@@ -325,7 +325,7 @@ void if_register_send (info) + info->wfdesc = if_register_socket(info, AF_INET, 0); + /* If this is a normal IPv4 address, get the hardware address. */ + if (strcmp(info->name, "fallback") != 0) +- get_hw_addr(info->name, &info->hw_address); ++ get_hw_addr(info); + #if defined (USE_SOCKET_FALLBACK) + /* Fallback only registers for send, but may need to receive as + well. */ +@@ -388,7 +388,7 @@ void if_register_receive (info) + #endif /* IP_PKTINFO... */ + /* If this is a normal IPv4 address, get the hardware address. */ + if (strcmp(info->name, "fallback") != 0) +- get_hw_addr(info->name, &info->hw_address); ++ get_hw_addr(info); + + if (!quiet_interface_discovery) + log_info ("Listening on Socket/%s%s%s", +@@ -498,7 +498,7 @@ if_register6(struct interface_info *info + if (req_multi) + if_register_multicast(info); + +- get_hw_addr(info->name, &info->hw_address); ++ get_hw_addr(info); + + if (!quiet_interface_discovery) { + if (info->shared_network != NULL) { +diff -up dhcp-4.2.4/includes/dhcpd.h.lpf-ib dhcp-4.2.4/includes/dhcpd.h +--- dhcp-4.2.4/includes/dhcpd.h.lpf-ib 2012-07-18 21:08:48.102834978 +0200 ++++ dhcp-4.2.4/includes/dhcpd.h 2012-07-18 21:08:48.114834815 +0200 +@@ -1243,6 +1243,7 @@ struct interface_info { + struct shared_network *shared_network; + /* Networks connected to this interface. */ + struct hardware hw_address; /* Its physical address. */ ++ u_int8_t bcast_addr[20]; /* Infiniband broadcast address */ + struct in_addr *addresses; /* Addresses associated with this + * interface. + */ +@@ -2360,7 +2361,7 @@ void print_dns_status (int, struct dhcp_ + #endif + const char *print_time(TIME); + +-void get_hw_addr(const char *name, struct hardware *hw); ++void get_hw_addr(struct interface_info *info); + + /* socket.c */ + #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \ diff --git a/dhcp/patches/dhcp-4.2.4-options.patch b/dhcp/patches/dhcp-4.2.4-options.patch new file mode 100644 index 0000000..b0080e1 --- /dev/null +++ b/dhcp/patches/dhcp-4.2.4-options.patch @@ -0,0 +1,391 @@ +diff -up dhcp-4.2.4b1/client/clparse.c.options dhcp-4.2.4b1/client/clparse.c +--- dhcp-4.2.4b1/client/clparse.c.options 2012-03-09 12:28:10.000000000 +0100 ++++ dhcp-4.2.4b1/client/clparse.c 2012-04-16 17:24:58.794047046 +0200 +@@ -154,6 +154,7 @@ isc_result_t read_client_conf () + /* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache) + */ + top_level_config.requested_lease = 7200; ++ top_level_config.bootp_broadcast_always = 0; + + group_allocate (&top_level_config.on_receipt, MDL); + if (!top_level_config.on_receipt) +@@ -320,7 +321,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; +@@ -739,6 +741,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; +diff -up dhcp-4.2.4b1/client/dhclient.c.options dhcp-4.2.4b1/client/dhclient.c +--- dhcp-4.2.4b1/client/dhclient.c.options 2012-04-11 22:43:24.000000000 +0200 ++++ dhcp-4.2.4b1/client/dhclient.c 2012-04-16 17:24:58.795047032 +0200 +@@ -39,6 +39,12 @@ + #include <limits.h> + #include <dns/result.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... */ + +@@ -87,6 +93,9 @@ int wanted_ia_na = -1; /* the absolute + int wanted_ia_ta = 0; + int wanted_ia_pd = 0; + char *mockup_relay = NULL; ++int bootp_broadcast_always = 0; ++ ++extern u_int32_t default_requested_options[]; + + void run_stateless(int exit_mode); + +@@ -123,6 +132,15 @@ main(int argc, char **argv) { + int local_family_set = 0; + #endif /* DHCPv6 */ + 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; + + /* Initialize client globals. */ + memset(&default_duid, 0, sizeof(default_duid)); +@@ -310,6 +328,88 @@ main(int argc, char **argv) { + } else if (!strcmp(argv[i], "--version")) { + log_info("isc-dhclient-%s", PACKAGE_VERSION); + exit(0); ++ } else if (!strcmp(argv[i], "-I")) { ++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) { ++ usage(); ++ exit(1); ++ } ++ ++ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) { ++ log_error("-I option dhcp-client-identifier string "%s" is too long - maximum length is: %d", argv[i], DHCP_MAX_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(); ++ exit(1); ++ } ++ ++ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) { ++ log_error("-H option host-name string "%s" is too long - maximum length is: %d", argv[i], DHCP_MAX_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(); ++ exit(1); ++ } ++ ++ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) { ++ log_error("-F option fqdn.fqdn string "%s" is too long - maximum length is: %d", argv[i], DHCP_MAX_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], "-timeout")) { ++ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) { ++ usage(); ++ exit(1); ++ } ++ ++ if ((timeout_arg = atoi(argv[i])) <= 0) { ++ log_error("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(); ++ exit(1); ++ } ++ ++ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) { ++ log_error("-V option vendor-class-identifier string "%s" is too long - maximum length is: %d", argv[i], DHCP_MAX_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(); ++ exit(1); ++ } ++ ++ dhclient_request_options = argv[i]; + } else if (argv[i][0] == '-') { + usage(); + } else if (interfaces_requested < 0) { +@@ -484,6 +584,156 @@ main(int argc, char **argv) { + /* 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 -timeout 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 -timeout 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/-timeout/-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/-timeout/-V/-R configuration arguments", 0); ++ ++ if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred)) ++ log_fatal("Cannot parse -I/-H/-F/-timeout/-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/-timeout/-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. ++ */ ++ for (ip=interfaces; ip; ip = ip->next) { ++ if (ip->client->config->timeout == 60) ++ ip->client->config->timeout = timeout_arg; ++ } ++ } ++ ++ 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(); + +@@ -2421,7 +2671,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); +@@ -2505,7 +2756,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); +@@ -2567,7 +2820,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-4.2.4b1/common/conflex.c.options dhcp-4.2.4b1/common/conflex.c +--- dhcp-4.2.4b1/common/conflex.c.options 2012-02-16 22:09:14.000000000 +0100 ++++ dhcp-4.2.4b1/common/conflex.c 2012-04-16 17:24:58.796047018 +0200 +@@ -808,6 +808,8 @@ intern(char *atom, enum dhcp_token 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-4.2.4b1/includes/dhcpd.h.options dhcp-4.2.4b1/includes/dhcpd.h +--- dhcp-4.2.4b1/includes/dhcpd.h.options 2012-04-10 02:55:06.000000000 +0200 ++++ dhcp-4.2.4b1/includes/dhcpd.h 2012-04-16 17:24:58.797047004 +0200 +@@ -1147,6 +1147,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-4.2.4b1/includes/dhctoken.h.options dhcp-4.2.4b1/includes/dhctoken.h +--- dhcp-4.2.4b1/includes/dhctoken.h.options 2012-02-16 22:09:15.000000000 +0100 ++++ dhcp-4.2.4b1/includes/dhctoken.h 2012-04-16 17:25:53.819276248 +0200 +@@ -364,7 +364,8 @@ enum dhcp_token { + GETHOSTBYNAME = 665, + PRIMARY6 = 666, + SECONDARY6 = 667, +- TOKEN_INFINIBAND = 668 ++ TOKEN_INFINIBAND = 668, ++ BOOTP_BROADCAST_ALWAYS = 669 + }; + + #define is_identifier(x) ((x) >= FIRST_TOKEN && \ diff --git a/dhcp/patches/dhcp-4.2.4-paths.patch b/dhcp/patches/dhcp-4.2.4-paths.patch new file mode 100644 index 0000000..a737571 --- /dev/null +++ b/dhcp/patches/dhcp-4.2.4-paths.patch @@ -0,0 +1,26 @@ +diff -up dhcp-4.2.4b1/includes/dhcpd.h.paths dhcp-4.2.4b1/includes/dhcpd.h +--- dhcp-4.2.4b1/includes/dhcpd.h.paths 2012-04-18 11:12:34.000000000 +0200 ++++ dhcp-4.2.4b1/includes/dhcpd.h 2012-04-18 11:14:38.541272405 +0200 +@@ -1420,7 +1420,7 @@ typedef unsigned char option_mask [16]; + #else /* !DEBUG */ + + #ifndef _PATH_DHCPD_CONF +-#define _PATH_DHCPD_CONF "/etc/dhcpd.conf" ++#define _PATH_DHCPD_CONF "/etc/dhcp/dhcpd.conf" + #endif /* DEBUG */ + + #ifndef _PATH_DHCPD_DB +@@ -1442,11 +1442,11 @@ typedef unsigned char option_mask [16]; + #endif /* DEBUG */ + + #ifndef _PATH_DHCLIENT_CONF +-#define _PATH_DHCLIENT_CONF "/etc/dhclient.conf" ++#define _PATH_DHCLIENT_CONF "/etc/dhcp/dhclient.conf" + #endif + + #ifndef _PATH_DHCLIENT_SCRIPT +-#define _PATH_DHCLIENT_SCRIPT "/sbin/dhclient-script" ++#define _PATH_DHCLIENT_SCRIPT "/usr/sbin/dhclient-script" + #endif + + #ifndef _PATH_DHCLIENT_PID diff --git a/dhcp/patches/dhcp-4.2.4-rfc3442-classless-static-routes.patch b/dhcp/patches/dhcp-4.2.4-rfc3442-classless-static-routes.patch new file mode 100644 index 0000000..a2fe219 --- /dev/null +++ b/dhcp/patches/dhcp-4.2.4-rfc3442-classless-static-routes.patch @@ -0,0 +1,405 @@ +diff -up dhcp-4.2.4b1/client/clparse.c.rfc3442 dhcp-4.2.4b1/client/clparse.c +--- dhcp-4.2.4b1/client/clparse.c.rfc3442 2012-04-16 17:34:27.546079944 +0200 ++++ dhcp-4.2.4b1/client/clparse.c 2012-04-16 17:34:27.605079118 +0200 +@@ -37,7 +37,7 @@ + + struct client_config top_level_config; + +-#define NUM_DEFAULT_REQUESTED_OPTS 14 ++#define NUM_DEFAULT_REQUESTED_OPTS 15 + struct option *default_requested_options[NUM_DEFAULT_REQUESTED_OPTS + 1]; + + static void parse_client_default_duid(struct parse *cfile); +@@ -90,7 +90,11 @@ isc_result_t read_client_conf () + dhcp_universe.code_hash, &code, 0, MDL); + + /* 4 */ +- code = DHO_ROUTERS; ++ /* The Classless Static Routes option code MUST appear in the parameter ++ * request list prior to both the Router option code and the Static ++ * Routes option code, if present. (RFC3442) ++ */ ++ code = DHO_CLASSLESS_STATIC_ROUTES; + option_code_hash_lookup(&default_requested_options[3], + dhcp_universe.code_hash, &code, 0, MDL); + +@@ -144,6 +148,11 @@ isc_result_t read_client_conf () + option_code_hash_lookup(&default_requested_options[13], + dhcp_universe.code_hash, &code, 0, MDL); + ++ /* 15 */ ++ code = DHO_ROUTERS; ++ option_code_hash_lookup(&default_requested_options[14], ++ dhcp_universe.code_hash, &code, 0, MDL); ++ + for (code = 0 ; code < NUM_DEFAULT_REQUESTED_OPTS ; code++) { + if (default_requested_options[code] == NULL) + log_fatal("Unable to find option definition for " +diff -up dhcp-4.2.4b1/common/dhcp-options.5.rfc3442 dhcp-4.2.4b1/common/dhcp-options.5 +--- dhcp-4.2.4b1/common/dhcp-options.5.rfc3442 2012-04-16 17:34:27.537080070 +0200 ++++ dhcp-4.2.4b1/common/dhcp-options.5 2012-04-16 17:34:27.606079104 +0200 +@@ -115,6 +115,26 @@ hexadecimal, separated by colons. For + or + option dhcp-client-identifier 43:4c:49:45:54:2d:46:4f:4f; + .fi ++.PP ++The ++.B destination-descriptor ++describe the IP subnet number and subnet mask ++of a particular destination using a compact encoding. This encoding ++consists of one octet describing the width of the subnet mask, ++followed by all the significant octets of the subnet number. ++The following table contains some examples of how various subnet ++number/mask combinations can be encoded: ++.nf ++.sp 1 ++Subnet number Subnet mask Destination descriptor ++0 0 0 ++10.0.0.0 255.0.0.0 8.10 ++10.0.0.0 255.255.255.0 24.10.0.0 ++10.17.0.0 255.255.0.0 16.10.17 ++10.27.129.0 255.255.255.0 24.10.27.129 ++10.229.0.128 255.255.255.128 25.10.229.0.128 ++10.198.122.47 255.255.255.255 32.10.198.122.47 ++.fi + .SH SETTING OPTION VALUES USING EXPRESSIONS + Sometimes it's helpful to be able to set the value of a DHCP option + based on some value that the client has sent. To do this, you can +@@ -931,6 +951,29 @@ dhclient-script will create routes: + .RE + .PP + .nf ++.B option \fBclassless-static-routes\fR \fIdestination-descriptor ip-address\fR ++ [\fB,\fR \fIdestination-descriptor ip-address\fR...]\fB;\fR ++.fi ++.RS 0.25i ++.PP ++This option (see RFC3442) specifies a list of classless static routes ++that the client should install in its routing cache. ++.PP ++This option can contain one or more static routes, each of which ++consists of a destination descriptor and the IP address of the router ++that should be used to reach that destination. ++.PP ++Many clients may not implement the Classless Static Routes option. ++DHCP server administrators should therefore configure their DHCP ++servers to send both a Router option and a Classless Static Routes ++option, and should specify the default router(s) both in the Router ++option and in the Classless Static Routes option. ++.PP ++If the DHCP server returns both a Classless Static Routes option and ++a Router option, the DHCP client ignores the Router option. ++.RE ++.PP ++.nf + .B option \fBstreettalk-directory-assistance-server\fR \fIip-address\fR + [\fB,\fR \fIip-address\fR...]\fB;\fR + .fi +diff -up dhcp-4.2.4b1/common/inet.c.rfc3442 dhcp-4.2.4b1/common/inet.c +--- dhcp-4.2.4b1/common/inet.c.rfc3442 2011-05-11 02:47:22.000000000 +0200 ++++ dhcp-4.2.4b1/common/inet.c 2012-04-16 17:34:27.607079090 +0200 +@@ -528,6 +528,60 @@ free_iaddrcidrnetlist(struct iaddrcidrne + return ISC_R_SUCCESS; + } + ++static const char * ++inet_ntopdd(const unsigned char *src, unsigned srclen, char *dst, size_t size) ++{ ++ char tmp[sizeof("32.255.255.255.255")]; ++ int len; ++ ++ switch (srclen) { ++ case 2: ++ len = sprintf (tmp, "%u.%u", src[0], src[1]); ++ break; ++ case 3: ++ len = sprintf (tmp, "%u.%u.%u", src[0], src[1], src[2]); ++ break; ++ case 4: ++ len = sprintf (tmp, "%u.%u.%u.%u", src[0], src[1], src[2], src[3]); ++ break; ++ case 5: ++ len = sprintf (tmp, "%u.%u.%u.%u.%u", src[0], src[1], src[2], src[3], src[4]); ++ break; ++ default: ++ return NULL; ++ } ++ if (len < 0) ++ return NULL; ++ ++ if (len > size) { ++ errno = ENOSPC; ++ return NULL; ++ } ++ ++ return strcpy (dst, tmp); ++} ++ ++/* pdestdesc() turns an iaddr structure into a printable dest. descriptor */ ++const char * ++pdestdesc(const struct iaddr addr) { ++ static char pbuf[sizeof("255.255.255.255.255")]; ++ ++ if (addr.len == 0) { ++ return "<null destination descriptor>"; ++ } ++ if (addr.len == 1) { ++ return "0"; ++ } ++ if ((addr.len >= 2) && (addr.len <= 5)) { ++ return inet_ntopdd(addr.iabuf, addr.len, pbuf, sizeof(pbuf)); ++ } ++ ++ log_fatal("pdestdesc():%s:%d: Invalid destination descriptor length %d.", ++ MDL, addr.len); ++ /* quell compiler warnings */ ++ return NULL; ++} ++ + /* piaddr() turns an iaddr structure into a printable address. */ + /* XXX: should use a const pointer rather than passing the structure */ + const char * +diff -up dhcp-4.2.4b1/common/options.c.rfc3442 dhcp-4.2.4b1/common/options.c +--- dhcp-4.2.4b1/common/options.c.rfc3442 2012-03-20 01:31:53.000000000 +0100 ++++ dhcp-4.2.4b1/common/options.c 2012-04-16 17:34:27.608079076 +0200 +@@ -706,7 +706,11 @@ cons_options(struct packet *inpacket, st + * packet. + */ + priority_list[priority_len++] = DHO_SUBNET_MASK; +- priority_list[priority_len++] = DHO_ROUTERS; ++ if (lookup_option(&dhcp_universe, cfg_options, ++ DHO_CLASSLESS_STATIC_ROUTES)) ++ priority_list[priority_len++] = DHO_CLASSLESS_STATIC_ROUTES; ++ else ++ priority_list[priority_len++] = DHO_ROUTERS; + priority_list[priority_len++] = DHO_DOMAIN_NAME_SERVERS; + priority_list[priority_len++] = DHO_HOST_NAME; + priority_list[priority_len++] = DHO_FQDN; +@@ -1683,6 +1687,7 @@ const char *pretty_print_option (option, + const unsigned char *dp = data; + char comma; + unsigned long tval; ++ unsigned int octets = 0; + + if (emit_commas) + comma = ','; +@@ -1691,6 +1696,7 @@ const char *pretty_print_option (option, + + memset (enumbuf, 0, sizeof enumbuf); + ++ if (option->format[0] != 'R') { /* see explanation lower */ + /* Figure out the size of the data. */ + for (l = i = 0; option -> format [i]; i++, l++) { + if (l >= sizeof(fmtbuf) - 1) +@@ -1840,6 +1846,33 @@ const char *pretty_print_option (option, + if (numhunk < 0) + numhunk = 1; + ++ } else { /* option->format[i] == 'R') */ ++ /* R (destination descriptor) has variable length. ++ * We can find it only in classless static route option, ++ * so we are for sure parsing classless static route option now. ++ * We go through whole the option to check whether there are no ++ * missing/extra bytes. ++ * I didn't find out how to improve the existing code and that's the ++ * reason for this separate 'else' where I do my own checkings. ++ * I know it's little bit unsystematic, but it works. ++ */ ++ numhunk = 0; ++ numelem = 2; /* RI */ ++ fmtbuf[0]='R'; fmtbuf[1]='I'; fmtbuf[2]=0; ++ for (i =0; i < len; i = i + octets + 5) { ++ if (data[i] > 32) { /* subnet mask width */ ++ log_error ("wrong subnet mask width in destination descriptor"); ++ break; ++ } ++ numhunk++; ++ octets = ((data[i]+7) / 8); ++ } ++ if (i != len) { ++ log_error ("classless static routes option has wrong size or " ++ "there's some garbage in format"); ++ } ++ } ++ + /* Cycle through the array (or hunk) printing the data. */ + for (i = 0; i < numhunk; i++) { + for (j = 0; j < numelem; j++) { +@@ -1978,6 +2011,20 @@ const char *pretty_print_option (option, + strcpy(op, piaddr(iaddr)); + dp += 4; + break; ++ ++ case 'R': ++ if (dp[0] <= 32) ++ iaddr.len = (((dp[0]+7)/8)+1); ++ else { ++ log_error ("wrong subnet mask width in destination descriptor"); ++ return "<error>"; ++ } ++ ++ memcpy(iaddr.iabuf, dp, iaddr.len); ++ strcpy(op, pdestdesc(iaddr)); ++ dp += iaddr.len; ++ break; ++ + case '6': + iaddr.len = 16; + memcpy(iaddr.iabuf, dp, 16); +diff -up dhcp-4.2.4b1/common/parse.c.rfc3442 dhcp-4.2.4b1/common/parse.c +--- dhcp-4.2.4b1/common/parse.c.rfc3442 2012-04-16 17:34:27.577079510 +0200 ++++ dhcp-4.2.4b1/common/parse.c 2012-04-16 17:34:27.610079048 +0200 +@@ -341,6 +341,39 @@ int parse_ip_addr (cfile, addr) + } + + /* ++ * destination-descriptor :== NUMBER DOT NUMBER | ++ * NUMBER DOT NUMBER DOT NUMBER | ++ * NUMBER DOT NUMBER DOT NUMBER DOT NUMBER | ++ * NUMBER DOT NUMBER DOT NUMBER DOT NUMBER DOT NUMBER ++ */ ++ ++int parse_destination_descriptor (cfile, addr) ++ struct parse *cfile; ++ struct iaddr *addr; ++{ ++ unsigned int mask_width, dest_dest_len; ++ addr -> len = 0; ++ if (parse_numeric_aggregate (cfile, addr -> iabuf, ++ &addr -> len, DOT, 10, 8)) { ++ mask_width = (unsigned int)addr->iabuf[0]; ++ dest_dest_len = (((mask_width+7)/8)+1); ++ if (mask_width > 32) { ++ parse_warn (cfile, ++ "subnet mask width (%u) greater than 32.", mask_width); ++ } ++ else if (dest_dest_len != addr->len) { ++ parse_warn (cfile, ++ "destination descriptor with subnet mask width %u " ++ "should have %u octets, but has %u octets.", ++ mask_width, dest_dest_len, addr->len); ++ } ++ ++ return 1; ++ } ++ return 0; ++} ++ ++/* + * Return true if every character in the string is hexadecimal. + */ + static int +@@ -704,8 +737,10 @@ unsigned char *parse_numeric_aggregate ( + if (count) { + token = peek_token (&val, (unsigned *)0, cfile); + if (token != separator) { +- if (!*max) ++ if (!*max) { ++ *max = count; + break; ++ } + if (token != RBRACE && token != LBRACE) + token = next_token (&val, + (unsigned *)0, +@@ -1628,6 +1663,9 @@ int parse_option_code_definition (cfile, + case IP_ADDRESS: + type = 'I'; + break; ++ case DESTINATION_DESCRIPTOR: ++ type = 'R'; ++ break; + case IP6_ADDRESS: + type = '6'; + break; +@@ -5375,6 +5413,15 @@ int parse_option_token (rv, cfile, fmt, + } + break; + ++ case 'R': /* destination descriptor */ ++ if (!parse_destination_descriptor (cfile, &addr)) { ++ return 0; ++ } ++ if (!make_const_data (&t, addr.iabuf, addr.len, 0, 1, MDL)) { ++ return 0; ++ } ++ break; ++ + case '6': /* IPv6 address. */ + if (!parse_ip6_addr(cfile, &addr)) { + return 0; +@@ -5635,6 +5682,13 @@ int parse_option_decl (oc, cfile) + goto exit; + len = ip_addr.len; + dp = ip_addr.iabuf; ++ goto alloc; ++ ++ case 'R': /* destination descriptor */ ++ if (!parse_destination_descriptor (cfile, &ip_addr)) ++ goto exit; ++ len = ip_addr.len; ++ dp = ip_addr.iabuf; + + alloc: + if (hunkix + len > sizeof hunkbuf) { +diff -up dhcp-4.2.4b1/common/tables.c.rfc3442 dhcp-4.2.4b1/common/tables.c +--- dhcp-4.2.4b1/common/tables.c.rfc3442 2012-04-16 17:34:27.566079664 +0200 ++++ dhcp-4.2.4b1/common/tables.c 2012-04-16 17:34:27.611079034 +0200 +@@ -52,6 +52,7 @@ HASH_FUNCTIONS (option_code, const unsig + Format codes: + + I - IPv4 address ++ R - destination descriptor (RFC3442) + 6 - IPv6 address + l - 32-bit signed integer + L - 32-bit unsigned integer +@@ -209,6 +210,7 @@ static struct option dhcp_options[] = { + { "default-url", "t", &dhcp_universe, 114, 1 }, + { "subnet-selection", "I", &dhcp_universe, 118, 1 }, + { "domain-search", "D", &dhcp_universe, 119, 1 }, ++ { "classless-static-routes", "RIA", &dhcp_universe, 121, 1 }, + { "vivco", "Evendor-class.", &dhcp_universe, 124, 1 }, + { "vivso", "Evendor.", &dhcp_universe, 125, 1 }, + #if 0 +diff -up dhcp-4.2.4b1/includes/dhcpd.h.rfc3442 dhcp-4.2.4b1/includes/dhcpd.h +--- dhcp-4.2.4b1/includes/dhcpd.h.rfc3442 2012-04-16 17:34:27.543079986 +0200 ++++ dhcp-4.2.4b1/includes/dhcpd.h 2012-04-16 17:34:27.613079006 +0200 +@@ -2666,6 +2666,7 @@ isc_result_t range2cidr(struct iaddrcidr + const struct iaddr *lo, const struct iaddr *hi); + isc_result_t free_iaddrcidrnetlist(struct iaddrcidrnetlist **result); + const char *piaddr (struct iaddr); ++const char *pdestdesc (struct iaddr); + char *piaddrmask(struct iaddr *, struct iaddr *); + char *piaddrcidr(const struct iaddr *, unsigned int); + u_int16_t validate_port(char *); +@@ -2873,6 +2874,7 @@ void parse_client_lease_declaration (str + int parse_option_decl (struct option_cache **, struct parse *); + void parse_string_list (struct parse *, struct string_list **, int); + int parse_ip_addr (struct parse *, struct iaddr *); ++int parse_destination_descriptor (struct parse *, struct iaddr *); + int parse_ip_addr_with_subnet(struct parse *, struct iaddrmatch *); + void parse_reject_statement (struct parse *, struct client_config *); + +diff -up dhcp-4.2.4b1/includes/dhcp.h.rfc3442 dhcp-4.2.4b1/includes/dhcp.h +--- dhcp-4.2.4b1/includes/dhcp.h.rfc3442 2012-02-16 22:09:14.000000000 +0100 ++++ dhcp-4.2.4b1/includes/dhcp.h 2012-04-16 17:34:27.613079006 +0200 +@@ -163,6 +163,7 @@ struct dhcp_packet { + #define DHO_ASSOCIATED_IP 92 + #define DHO_SUBNET_SELECTION 118 /* RFC3011! */ + #define DHO_DOMAIN_SEARCH 119 /* RFC3397 */ ++#define DHO_CLASSLESS_STATIC_ROUTES 121 /* RFC3442 */ + #define DHO_VIVCO_SUBOPTIONS 124 + #define DHO_VIVSO_SUBOPTIONS 125 + +diff -up dhcp-4.2.4b1/includes/dhctoken.h.rfc3442 dhcp-4.2.4b1/includes/dhctoken.h +--- dhcp-4.2.4b1/includes/dhctoken.h.rfc3442 2012-04-16 17:34:27.000000000 +0200 ++++ dhcp-4.2.4b1/includes/dhctoken.h 2012-04-16 17:35:15.028414805 +0200 +@@ -365,7 +365,8 @@ enum dhcp_token { + PRIMARY6 = 666, + SECONDARY6 = 667, + TOKEN_INFINIBAND = 668, +- BOOTP_BROADCAST_ALWAYS = 669 ++ BOOTP_BROADCAST_ALWAYS = 669, ++ DESTINATION_DESCRIPTOR = 670 + }; + + #define is_identifier(x) ((x) >= FIRST_TOKEN && \ diff --git a/dhcp/patches/dhcp-4.2.4-send_release.patch b/dhcp/patches/dhcp-4.2.4-send_release.patch new file mode 100644 index 0000000..3e0a618 --- /dev/null +++ b/dhcp/patches/dhcp-4.2.4-send_release.patch @@ -0,0 +1,23 @@ +diff -up dhcp-4.2.4b1/client/dhclient.c.send_release dhcp-4.2.4b1/client/dhclient.c +--- dhcp-4.2.4b1/client/dhclient.c.send_release 2012-04-16 17:48:52.000000000 +0200 ++++ dhcp-4.2.4b1/client/dhclient.c 2012-04-16 17:50:44.357396720 +0200 +@@ -2764,8 +2764,8 @@ void send_release (cpp) + inet_ntoa (destination.sin_addr), + ntohs (destination.sin_port), client -> xid); + +- if (fallback_interface) { +- result = send_packet(fallback_interface, NULL, &client->packet, ++ if (client -> interface) { ++ result = send_packet(client -> interface, NULL, &client->packet, + client->packet_length, from, &destination, + NULL); + if (result < 0) { +@@ -2776,7 +2776,7 @@ void send_release (cpp) + } + } else { + /* Send out a packet. */ +- result = send_packet(client->interface, NULL, &client->packet, ++ result = send_packet(fallback_interface, NULL, &client->packet, + client->packet_length, from, &destination, + NULL); + if (result < 0) { diff --git a/dhcp/patches/dhcp-4.2.4-systemtap.patch b/dhcp/patches/dhcp-4.2.4-systemtap.patch new file mode 100644 index 0000000..6f036a7 --- /dev/null +++ b/dhcp/patches/dhcp-4.2.4-systemtap.patch @@ -0,0 +1,808 @@ +diff -up dhcp-4.2.4b1/configure.ac.systemtap dhcp-4.2.4b1/configure.ac +--- dhcp-4.2.4b1/configure.ac.systemtap 2012-04-16 17:46:10.913227143 +0200 ++++ dhcp-4.2.4b1/configure.ac 2012-04-16 17:46:10.947226667 +0200 +@@ -504,6 +504,35 @@ else + AC_MSG_RESULT(no) + fi + ++AC_MSG_CHECKING([whether to include systemtap tracing support]) ++AC_ARG_ENABLE([systemtap], ++ [AS_HELP_STRING([--enable-systemtap], ++ [Enable inclusion of systemtap trace support])], ++ [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP='no']) ++AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test x$ENABLE_SYSTEMTAP = xyes]) ++AC_MSG_RESULT(${ENABLE_SYSTEMTAP}) ++ ++if test "x${ENABLE_SYSTEMTAP}" = xyes; then ++ # Additional configuration for --enable-systemtap is HERE ++ AC_CHECK_PROGS(DTRACE, dtrace) ++ if test -z "$DTRACE"; then ++ AC_MSG_ERROR([dtrace not found]) ++ fi ++ AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='yes'], ++ [SDT_H_FOUND='no'; ++ AC_MSG_ERROR([systemtap support needs sys/sdt.h header])]) ++ AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if using SystemTap probes.]) ++ AC_ARG_WITH([tapset-install-dir], ++ [AS_HELP_STRING([--with-tapset-install-dir], ++ [The absolute path where the tapset dir will be installed])], ++ [if test "x${withval}" = x; then ++ ABS_TAPSET_DIR="$(datadir)/systemtap/tapset" ++ else ++ ABS_TAPSET_DIR="${withval}" ++ fi], [ABS_TAPSET_DIR="$(datadir)/systemtap/tapset"]) ++ AC_SUBST(ABS_TAPSET_DIR) ++fi ++ + # Solaris needs some libraries for functions + AC_SEARCH_LIBS(socket, [socket]) + AC_SEARCH_LIBS(inet_ntoa, [nsl]) +@@ -650,6 +679,7 @@ AC_OUTPUT([ + relay/Makefile + server/Makefile + tests/Makefile ++ tapset/Makefile + ]) + + sh util/bindvar.sh +diff -up dhcp-4.2.4b1/Makefile.am.systemtap dhcp-4.2.4b1/Makefile.am +--- dhcp-4.2.4b1/Makefile.am.systemtap 2012-04-16 17:46:10.791228851 +0200 ++++ dhcp-4.2.4b1/Makefile.am 2012-04-16 17:46:10.947226667 +0200 +@@ -29,5 +29,8 @@ endif + + SUBDIRS += includes tests common omapip client dhcpctl relay server + ++SUBDIRS += tapset ++#DIST_SUBDIRS = $(SUBDIRS) ++ + nobase_include_HEADERS = dhcpctl/dhcpctl.h + +diff -up dhcp-4.2.4b1/server/dhcp.c.systemtap dhcp-4.2.4b1/server/dhcp.c +--- dhcp-4.2.4b1/server/dhcp.c.systemtap 2012-04-16 17:46:10.816228501 +0200 ++++ dhcp-4.2.4b1/server/dhcp.c 2012-04-16 17:48:11.528537555 +0200 +@@ -36,7 +36,7 @@ + #include <errno.h> + #include <limits.h> + #include <sys/time.h> +- ++#include "trace.h" + static void commit_leases_ackout(void *foo); + static void maybe_return_agent_options(struct packet *packet, + struct option_state *options); +@@ -275,6 +275,8 @@ void dhcpdiscover (packet, ms_nulltp) + dhcp_failover_state_t *peer; + #endif + ++ TRACE(DHCPD_DISCOVER_START()); ++ + find_lease (&lease, packet, packet -> shared_network, + 0, &peer_has_leases, (struct lease *)0, MDL); + +@@ -399,6 +401,8 @@ void dhcpdiscover (packet, ms_nulltp) + out: + if (lease) + lease_dereference (&lease, MDL); ++ ++ TRACE(DHCPD_DISCOVER_DONE()); + } + + void dhcprequest (packet, ms_nulltp, ip_lease) +@@ -421,6 +425,8 @@ void dhcprequest (packet, ms_nulltp, ip_ + #endif + int have_requested_addr = 0; + ++ TRACE(DHCPD_REQUEST_START()); ++ + oc = lookup_option (&dhcp_universe, packet -> options, + DHO_DHCP_REQUESTED_ADDRESS); + memset (&data, 0, sizeof data); +@@ -677,6 +683,9 @@ void dhcprequest (packet, ms_nulltp, ip_ + log_info ("%s: unknown lease %s.", msgbuf, piaddr (cip)); + + out: ++ ++ TRACE(DHCPD_REQUEST_DONE()); ++ + if (subnet) + subnet_dereference (&subnet, MDL); + if (lease) +@@ -695,6 +704,7 @@ void dhcprelease (packet, ms_nulltp) + const char *s; + char msgbuf [1024], cstr[16]; /* XXX */ + ++ TRACE(DHCPD_RELEASE_START()); + + /* DHCPRELEASE must not specify address in requested-address + option, but old protocol specs weren't explicit about this, +@@ -819,6 +829,8 @@ void dhcprelease (packet, ms_nulltp) + #endif + if (lease) + lease_dereference (&lease, MDL); ++ ++ TRACE(DHCPD_RELEASE_DONE()); + } + + void dhcpdecline (packet, ms_nulltp) +@@ -836,6 +848,8 @@ void dhcpdecline (packet, ms_nulltp) + struct option_cache *oc; + struct data_string data; + ++ TRACE(DHCPD_DECLINE_START()); ++ + /* DHCPDECLINE must specify address. */ + if (!(oc = lookup_option (&dhcp_universe, packet -> options, + DHO_DHCP_REQUESTED_ADDRESS))) +@@ -947,6 +961,8 @@ void dhcpdecline (packet, ms_nulltp) + option_state_dereference (&options, MDL); + if (lease) + lease_dereference (&lease, MDL); ++ ++ TRACE(DHCPD_DECLINE_DONE()); + } + + void dhcpinform (packet, ms_nulltp) +@@ -970,6 +986,8 @@ void dhcpinform (packet, ms_nulltp) + struct interface_info *interface; + int result; + ++ TRACE(DHCPD_INFORM_START()); ++ + /* The client should set ciaddr to its IP address, but apparently + it's common for clients not to do this, so we'll use their IP + source address if they didn't set ciaddr. */ +@@ -1327,6 +1345,8 @@ void dhcpinform (packet, ms_nulltp) + + if (subnet) + subnet_dereference (&subnet, MDL); ++ ++ TRACE(DHCPD_INFORM_DONE()); + } + + void nak_lease (packet, cip) +@@ -1343,6 +1363,8 @@ void nak_lease (packet, cip) + struct option_state *options = (struct option_state *)0; + struct option_cache *oc = (struct option_cache *)0; + ++ TRACE(DHCPD_NAK_LEASE_START()); ++ + option_state_allocate (&options, MDL); + memset (&outgoing, 0, sizeof outgoing); + memset (&raw, 0, sizeof raw); +@@ -1494,6 +1516,7 @@ void nak_lease (packet, cip) + packet->interface->name); + } + ++ TRACE(DHCPD_NAK_LEASE_DONE()); + } + + void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) +@@ -1535,6 +1558,8 @@ void ack_lease (packet, lease, offer, wh + if (lease -> state) + return; + ++ TRACE(DHCPD_ACK_LEASE_START()); ++ + /* Save original cltt for comparison later. */ + lease_cltt = lease->cltt; + +@@ -2897,6 +2922,8 @@ void ack_lease (packet, lease, offer, wh + #endif + dhcp_reply(lease); + } ++ ++ TRACE(DHCPD_ACK_LEASE_DONE()); + } + + /* +@@ -3049,6 +3076,8 @@ void dhcp_reply (lease) + if (!state) + log_fatal ("dhcp_reply was supplied lease with no state!"); + ++ TRACE(DHCPD_REPLY_START()); ++ + /* Compose a response for the client... */ + memset (&raw, 0, sizeof raw); + memset (&d1, 0, sizeof d1); +@@ -3270,6 +3299,8 @@ void dhcp_reply (lease) + + free_lease_state (state, MDL); + lease -> state = (struct lease_state *)0; ++ ++ TRACE(DHCPD_REPLY_DONE()); + } + + int find_lease (struct lease **lp, +@@ -3292,6 +3323,8 @@ int find_lease (struct lease **lp, + struct data_string client_identifier; + struct hardware h; + ++ TRACE(DHCPD_FIND_LEASE_START()); ++ + #if defined(FAILOVER_PROTOCOL) + /* Quick check to see if the peer has leases. */ + if (peer_has_leases) { +@@ -4019,6 +4052,9 @@ int find_lease (struct lease **lp, + #if defined (DEBUG_FIND_LEASE) + log_info ("Not returning a lease."); + #endif ++ ++ TRACE(DHCPD_FIND_LEASE_DONE()); ++ + return 0; + } + +diff -up dhcp-4.2.4b1/server/dhcpd.c.systemtap dhcp-4.2.4b1/server/dhcpd.c +--- dhcp-4.2.4b1/server/dhcpd.c.systemtap 2012-04-16 17:46:10.928226933 +0200 ++++ dhcp-4.2.4b1/server/dhcpd.c 2012-04-16 17:46:10.951226611 +0200 +@@ -58,6 +58,8 @@ static const char url [] = + # undef group + #endif /* PARANOIA */ + ++#include "trace.h" ++ + static void usage(void); + + struct iaddr server_identifier; +@@ -859,6 +861,7 @@ main(int argc, char **argv) { + omapi_set_int_value ((omapi_object_t *)dhcp_control_object, + (omapi_object_t *)0, "state", server_running); + ++ TRACE(DHCPD_MAIN()); + /* Receive packets and dispatch them... */ + dispatch (); + +diff -up dhcp-4.2.4b1/server/dhcpv6.c.systemtap dhcp-4.2.4b1/server/dhcpv6.c +--- dhcp-4.2.4b1/server/dhcpv6.c.systemtap 2012-04-16 17:46:10.925226975 +0200 ++++ dhcp-4.2.4b1/server/dhcpv6.c 2012-04-16 17:46:10.953226583 +0200 +@@ -15,6 +15,7 @@ + */ + + #include "dhcpd.h" ++#include "trace.h" + + #ifdef DHCPv6 + +@@ -4198,6 +4199,8 @@ static void + dhcpv6_solicit(struct data_string *reply_ret, struct packet *packet) { + struct data_string client_id; + ++ TRACE(DHCPD_6_SOLICIT_START()); ++ + /* + * Validate our input. + */ +@@ -4211,6 +4214,8 @@ dhcpv6_solicit(struct data_string *reply + * Clean up. + */ + data_string_forget(&client_id, MDL); ++ ++ TRACE(DHCPD_6_SOLICIT_DONE()); + } + + /* +@@ -4224,6 +4229,8 @@ dhcpv6_request(struct data_string *reply + struct data_string client_id; + struct data_string server_id; + ++ TRACE(DHCPD_6_REQUEST_START()); ++ + /* + * Validate our input. + */ +@@ -4241,6 +4248,8 @@ dhcpv6_request(struct data_string *reply + */ + data_string_forget(&client_id, MDL); + data_string_forget(&server_id, MDL); ++ ++ TRACE(DHCPD_6_REQUEST_DONE()); + } + + /* Find a DHCPv6 packet's shared network from hints in the packet. +@@ -4353,6 +4362,8 @@ dhcpv6_confirm(struct data_string *reply + struct dhcpv6_packet *reply = (struct dhcpv6_packet *)reply_data; + int reply_ofs = (int)(offsetof(struct dhcpv6_packet, options)); + ++ TRACE(DHCPD_6_CONFIRM_START()); ++ + /* + * Basic client message validation. + */ +@@ -4539,6 +4550,8 @@ exit: + option_state_dereference(&cli_enc_opt_state, MDL); + if (opt_state != NULL) + option_state_dereference(&opt_state, MDL); ++ ++ TRACE(DHCPD_6_CONFIRM_DONE()); + } + + /* +@@ -4553,6 +4566,8 @@ dhcpv6_renew(struct data_string *reply, + struct data_string client_id; + struct data_string server_id; + ++ TRACE(DHCPD_6_RENEW_START()); ++ + /* + * Validate the request. + */ +@@ -4570,6 +4585,8 @@ dhcpv6_renew(struct data_string *reply, + */ + data_string_forget(&server_id, MDL); + data_string_forget(&client_id, MDL); ++ ++ TRACE(DHCPD_6_RENEW_DONE()); + } + + /* +@@ -4583,6 +4600,8 @@ static void + dhcpv6_rebind(struct data_string *reply, struct packet *packet) { + struct data_string client_id; + ++ TRACE(DHCPD_6_REBIND_START()); ++ + if (!valid_client_msg(packet, &client_id)) { + return; + } +@@ -4590,6 +4609,8 @@ dhcpv6_rebind(struct data_string *reply, + lease_to_client(reply, packet, &client_id, NULL); + + data_string_forget(&client_id, MDL); ++ ++ TRACE(DHCPD_6_REBIND_DONE()); + } + + static void +@@ -5034,6 +5055,8 @@ dhcpv6_decline(struct data_string *reply + struct data_string client_id; + struct data_string server_id; + ++ TRACE(DHCPD_6_DECLINE_START()); ++ + /* + * Validate our input. + */ +@@ -5054,6 +5077,8 @@ dhcpv6_decline(struct data_string *reply + + data_string_forget(&server_id, MDL); + data_string_forget(&client_id, MDL); ++ ++ TRACE(DHCPD_6_DECLINE_DONE()); + } + + static void +@@ -5502,6 +5527,8 @@ dhcpv6_release(struct data_string *reply + struct data_string client_id; + struct data_string server_id; + ++ TRACE(DHCPD_6_RELEASE_START()); ++ + /* + * Validate our input. + */ +@@ -5523,6 +5550,8 @@ dhcpv6_release(struct data_string *reply + + data_string_forget(&server_id, MDL); + data_string_forget(&client_id, MDL); ++ ++ TRACE(DHCPD_6_RELEASE_DONE()); + } + + /* +@@ -5535,6 +5564,8 @@ dhcpv6_information_request(struct data_s + struct data_string client_id; + struct data_string server_id; + ++ TRACE(DHCPD_6_INFORMATION_REQUEST_START()); ++ + /* + * Validate our input. + */ +@@ -5566,6 +5597,8 @@ dhcpv6_information_request(struct data_s + data_string_forget(&client_id, MDL); + } + data_string_forget(&server_id, MDL); ++ ++ TRACE(DHCPD_6_INFORMATION_REQUEST_DONE()); + } + + /* +@@ -5594,6 +5627,8 @@ dhcpv6_relay_forw(struct data_string *re + struct dhcpv6_relay_packet *reply; + int reply_ofs; + ++ TRACE(DHCPD_6_RELAY_FORW_START()); ++ + /* + * Initialize variables for early exit. + */ +@@ -5853,6 +5888,8 @@ exit: + if (enc_packet != NULL) { + packet_dereference(&enc_packet, MDL); + } ++ ++ TRACE(DHCPD_6_RELAY_FORW_DONE()); + } + + static void +diff -up dhcp-4.2.4b1/server/failover.c.systemtap dhcp-4.2.4b1/server/failover.c +--- dhcp-4.2.4b1/server/failover.c.systemtap 2012-03-19 23:29:49.000000000 +0100 ++++ dhcp-4.2.4b1/server/failover.c 2012-04-16 17:46:10.955226555 +0200 +@@ -36,6 +36,8 @@ + #include "dhcpd.h" + #include <omapip/omapip_p.h> + ++#include "trace.h" ++ + #if defined (FAILOVER_PROTOCOL) + dhcp_failover_state_t *failover_states; + static isc_result_t do_a_failover_option (omapi_object_t *, +@@ -1712,6 +1714,8 @@ isc_result_t dhcp_failover_set_state (dh + struct lease *l; + struct timeval tv; + ++ TRACE(DHCPD_FAILOVER_SET_STATE_START(state->me.state, new_state)); ++ + /* If we're in certain states where we're sending updates, and the peer + * state changes, we need to re-schedule any pending updates just to + * be on the safe side. This results in retransmission. +@@ -1939,6 +1943,8 @@ isc_result_t dhcp_failover_set_state (dh + break; + } + ++ TRACE(DHCPD_FAILOVER_SET_STATE_DONE()); ++ + return ISC_R_SUCCESS; + } + +@@ -2422,6 +2428,8 @@ dhcp_failover_pool_dobalance(dhcp_failov + if (state -> me.state != normal) + return 0; + ++ TRACE(DHCPD_FAILOVER_POOL_DOBALANCE_START()); ++ + state->last_balance = cur_time; + + for (s = shared_networks ; s ; s = s->next) { +@@ -2582,6 +2590,8 @@ dhcp_failover_pool_dobalance(dhcp_failov + if (leases_queued) + commit_leases(); + ++ TRACE(DHCPD_FAILOVER_POOL_DOBALANCE_DONE()); ++ + return leases_queued; + } + +diff -up dhcp-4.2.4b1/server/Makefile.am.systemtap dhcp-4.2.4b1/server/Makefile.am +--- dhcp-4.2.4b1/server/Makefile.am.systemtap 2012-04-16 17:46:10.914227129 +0200 ++++ dhcp-4.2.4b1/server/Makefile.am 2012-04-16 17:46:10.956226541 +0200 +@@ -4,7 +4,7 @@ dist_sysconf_DATA = dhcpd.conf + sbin_PROGRAMS = dhcpd + dhcpd_SOURCES = 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 \ +- dhcpv6.c mdb6.c ldap.c ldap_casa.c ++ dhcpv6.c mdb6.c ldap.c ldap_casa.c probes.d trace.h + + dhcpd_CFLAGS = $(LDAP_CFLAGS) + dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \ +@@ -13,3 +13,13 @@ dhcpd_LDADD = ../common/libdhcp.a ../oma + man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5 + EXTRA_DIST = $(man_MANS) + ++if ENABLE_SYSTEMTAP ++BUILT_SOURCES = probes.h ++probes.h: probes.d ++ $(DTRACE) -C -h -s $< -o $@ ++ ++probes.o: probes.d ++ $(DTRACE) -C -G -s $< -o $@ ++ ++dhcpd_LDADD += probes.o ++endif +diff -up dhcp-4.2.4b1/server/probes.d.systemtap dhcp-4.2.4b1/server/probes.d +--- dhcp-4.2.4b1/server/probes.d.systemtap 2012-04-16 17:46:10.956226541 +0200 ++++ dhcp-4.2.4b1/server/probes.d 2012-04-16 17:46:10.956226541 +0200 +@@ -0,0 +1,43 @@ ++provider dhcpd { ++ probe main(); ++ probe discover_start() ++ probe discover_done() ++ probe request_start() ++ probe request_done() ++ probe release_start() ++ probe release_done() ++ probe decline_start() ++ probe decline_done() ++ probe inform_start() ++ probe inform_done() ++ probe nak_lease_start() ++ probe nak_lease_done() ++ probe ack_lease_start() ++ probe ack_lease_done() ++ probe reply_start() ++ probe reply_done() ++ probe find_lease_start() ++ probe find_lease_done() ++ probe 6_solicit_start() ++ probe 6_solicit_done() ++ probe 6_request_start() ++ probe 6_request_done() ++ probe 6_confirm_start() ++ probe 6_confirm_done() ++ probe 6_renew_start() ++ probe 6_renew_done() ++ probe 6_rebind_start() ++ probe 6_rebind_done() ++ probe 6_decline_start() ++ probe 6_decline_done() ++ probe 6_release_start() ++ probe 6_release_done() ++ probe 6_information_request_start() ++ probe 6_information_request_done() ++ probe 6_relay_forw_start() ++ probe 6_relay_forw_done() ++ probe failover_pool_dobalance_start() ++ probe failover_pool_dobalance_done() ++ probe failover_set_state_start(int, int) /* state, new_state */ ++ probe failover_set_state_done() ++}; +diff -up dhcp-4.2.4b1/server/trace.h.systemtap dhcp-4.2.4b1/server/trace.h +--- dhcp-4.2.4b1/server/trace.h.systemtap 2012-04-16 17:46:10.956226541 +0200 ++++ dhcp-4.2.4b1/server/trace.h 2012-04-16 17:46:10.956226541 +0200 +@@ -0,0 +1,11 @@ ++// trace.h ++ ++#include "config.h" ++#ifdef HAVE_SYSTEMTAP ++// include the generated probes header and put markers in code ++#include "probes.h" ++#define TRACE(probe) probe ++#else ++// Wrap the probe to allow it to be removed when no systemtap available ++#define TRACE(probe) ++#endif +diff -up dhcp-4.2.4b1/tapset/dhcpd.stp.systemtap dhcp-4.2.4b1/tapset/dhcpd.stp +--- dhcp-4.2.4b1/tapset/dhcpd.stp.systemtap 2012-04-16 17:46:10.957226527 +0200 ++++ dhcp-4.2.4b1/tapset/dhcpd.stp 2012-04-16 17:46:10.957226527 +0200 +@@ -0,0 +1,212 @@ ++/* dhcpd tapset ++ Copyright (C) 2011, Red Hat Inc. ++ */ ++ ++probe dhcpd_main = process("dhcpd").mark("main") ++{ ++ probestr = sprintf("%s(locals: %s)", $$name, $$locals); ++ ++} ++ ++probe dhcpd_discover_start = process("dhcpd").mark("discover_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_discover_done = process("dhcpd").mark("discover_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_request_start = process("dhcpd").mark("request_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_request_done = process("dhcpd").mark("request_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_release_start = process("dhcpd").mark("release_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_release_done = process("dhcpd").mark("release_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_decline_start = process("dhcpd").mark("decline_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_decline_done = process("dhcpd").mark("decline_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_inform_start = process("dhcpd").mark("inform_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_inform_done = process("dhcpd").mark("inform_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_nak_lease_start = process("dhcpd").mark("nak_lease_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_nak_lease_done = process("dhcpd").mark("nak_lease_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_ack_lease_start = process("dhcpd").mark("ack_lease_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_ack_lease_done = process("dhcpd").mark("ack_lease_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_reply_start = process("dhcpd").mark("reply_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_reply_done = process("dhcpd").mark("reply_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_find_lease_start = process("dhcpd").mark("find_lease_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_find_lease_done = process("dhcpd").mark("find_lease_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_solicit_start = process("dhcpd").mark("6_solicit_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_solicit_done = process("dhcpd").mark("6_solicit_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_request_start = process("dhcpd").mark("6_request_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_request_done = process("dhcpd").mark("6_request_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_confirm_start = process("dhcpd").mark("6_confirm_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_confirm_done = process("dhcpd").mark("6_confirm_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_renew_start = process("dhcpd").mark("6_renew_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_renew_done = process("dhcpd").mark("6_renew_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_rebind_start = process("dhcpd").mark("6_rebind_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_rebind_done = process("dhcpd").mark("6_rebind_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_decline_start = process("dhcpd").mark("6_decline_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_decline_done = process("dhcpd").mark("6_decline_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_release_start = process("dhcpd").mark("6_release_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_release_done = process("dhcpd").mark("6_release_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_information_request_start = process("dhcpd").mark("6_information_request_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_information_request_done = process("dhcpd").mark("6_information_request_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_relay_forw_start = process("dhcpd").mark("6_relay_forw_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_relay_forw_done = process("dhcpd").mark("6_relay_forw_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_failover_pool_dobalance_start = process("dhcpd").mark("failover_pool_dobalance_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_failover_pool_dobalance_done = process("dhcpd").mark("failover_pool_dobalance_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++ ++probe dhcpd_failover_set_state_start = process("dhcpd").mark("failover_set_state_start") ++{ ++ state = $arg1; ++ new_state = $arg2; ++ probestr = sprintf("%s(state=%d, new_state=%d)", $$name, state, new_state); ++} ++ ++probe dhcpd_failover_set_state_done = process("dhcpd").mark("failover_set_state_done") ++{ ++ probestr = sprintf("%s", $$name); ++} +diff -up dhcp-4.2.4b1/tapset/Makefile.am.systemtap dhcp-4.2.4b1/tapset/Makefile.am +--- dhcp-4.2.4b1/tapset/Makefile.am.systemtap 2012-04-16 17:46:10.957226527 +0200 ++++ dhcp-4.2.4b1/tapset/Makefile.am 2012-04-16 17:46:10.957226527 +0200 +@@ -0,0 +1,26 @@ ++# Makefile.am for dhcp/tapset ++# Jiri Popelka ++ ++.PHONY: clean-local install-data-hook uninstall-local ++ ++# ++EXTRA_DIST = dhcpd.stp ++TAPSET_FILES = $(EXTRA_DIST) ++TAPSET_INSTALL_DIR = $(DESTDIR)@ABS_TAPSET_DIR@ ++ ++if ENABLE_SYSTEMTAP ++all-local: $(TAPSET_FILES) ++ ++clean-local: ++ ++install-data-hook: ++ $(MKDIR_P) $(TAPSET_INSTALL_DIR) ++ $(INSTALL_DATA) $(TAPSET_FILES) $(TAPSET_INSTALL_DIR) ++ ++uninstall-local: ++ @list='$(TAPSET_FILES)'; for p in $$list; do \ ++ echo " rm -f '$(TAPSET_INSTALL_DIR)/$$p'"; \ ++ rm -f "$(TAPSET_INSTALL_DIR)/$$p"; \ ++ done ++endif ++ diff --git a/dhcp/patches/dhcp-4.2.4-unicast-bootp.patch b/dhcp/patches/dhcp-4.2.4-unicast-bootp.patch new file mode 100644 index 0000000..69ab4c8 --- /dev/null +++ b/dhcp/patches/dhcp-4.2.4-unicast-bootp.patch @@ -0,0 +1,101 @@ +diff -up dhcp-4.2.4b1/server/bootp.c.unicast dhcp-4.2.4b1/server/bootp.c +--- dhcp-4.2.4b1/server/bootp.c.unicast 2012-04-10 23:27:06.000000000 +0200 ++++ dhcp-4.2.4b1/server/bootp.c 2012-04-16 17:28:42.095919022 +0200 +@@ -59,6 +59,7 @@ void bootp (packet) + char msgbuf [1024]; + int ignorep; + int peer_has_leases = 0; ++ int norelay = 0; + + if (packet -> raw -> op != BOOTREQUEST) + return; +@@ -74,7 +75,7 @@ void bootp (packet) + ? 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; + } +@@ -399,6 +400,15 @@ void bootp (packet) + + goto out; + } ++ } else if (norelay == 2) { ++ to.sin_addr = raw.ciaddr; ++ to.sin_port = remote_port; ++ if (fallback_interface) { ++ result = send_packet (fallback_interface, NULL, &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 +diff -up dhcp-4.2.4b1/server/dhcp.c.unicast dhcp-4.2.4b1/server/dhcp.c +--- dhcp-4.2.4b1/server/dhcp.c.unicast 2012-03-09 12:28:12.000000000 +0100 ++++ dhcp-4.2.4b1/server/dhcp.c 2012-04-16 17:26:55.067418285 +0200 +@@ -4299,6 +4299,7 @@ int locate_network (packet) + struct data_string data; + struct subnet *subnet = (struct subnet *)0; + struct option_cache *oc; ++ int norelay = 0; + + /* See if there's a Relay Agent Link Selection Option, or a + * Subnet Selection Option. The Link-Select and Subnet-Select +@@ -4314,12 +4315,24 @@ int locate_network (packet) + 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 option indicating link connection, and it's valid, +@@ -4342,7 +4355,10 @@ int locate_network (packet) + 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. */ +@@ -4350,7 +4366,10 @@ int locate_network (packet) + 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. */ diff --git a/dhcp/systemd/dhcpd.service b/dhcp/systemd/dhcpd.service index 51f1a56..d2fdd03 100644 --- a/dhcp/systemd/dhcpd.service +++ b/dhcp/systemd/dhcpd.service @@ -1,9 +1,10 @@ [Unit] Description=DHCPv4 Server Daemon -After=syslog.target network.target +After=network.target
[Service] -ExecStart=/usr/sbin/dhcpd -d -user dhcpd -group dhcpd --no-pid +ExecStartPre=/usr/lib/network/helpers/dhcpd-config-helper create ipv4 +ExecStart=/usr/sbin/dhcpd -d -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid
[Install] WantedBy=multi-user.target diff --git a/dhcp/systemd/dhcpd6.service b/dhcp/systemd/dhcpd6.service index 0931264..54e4c27 100644 --- a/dhcp/systemd/dhcpd6.service +++ b/dhcp/systemd/dhcpd6.service @@ -1,9 +1,10 @@ [Unit] Description=DHCPv6 Server Daemon -After=syslog.target network.target +After=network.target
[Service] -ExecStart=/usr/sbin/dhcpd -d -6 -user dhcpd -group dhcpd --no-pid +ExecStartPre=/usr/lib/network/helpers/dhcpd-config-helper create ipv6 +ExecStart=/usr/sbin/dhcpd -d -6 -cf /etc/dhcp/dhcpd6.conf -user dhcpd -group dhcpd --no-pid
[Install] WantedBy=multi-user.target diff --git a/initscripts/initscripts.nm b/initscripts/initscripts.nm index b171219..0941a42 100644 --- a/initscripts/initscripts.nm +++ b/initscripts/initscripts.nm @@ -6,7 +6,7 @@ name = initscripts epoch = 1 version = 2.99 -release = 17 +release = 18
groups = System/Boot url = diff --git a/initscripts/patches/0001-ipcalc-Enhance-to-implode-explode-IPv6-addresses.patch b/initscripts/patches/0001-ipcalc-Enhance-to-implode-explode-IPv6-addresses.patch new file mode 100644 index 0000000..abba71f --- /dev/null +++ b/initscripts/patches/0001-ipcalc-Enhance-to-implode-explode-IPv6-addresses.patch @@ -0,0 +1,93 @@ +From 5baf67156ccb7fed775d8bd00298a6ccaed03214 Mon Sep 17 00:00:00 2001 +From: Michael Tremer michael.tremer@ipfire.org +Date: Sun, 9 Sep 2012 21:34:19 +0000 +Subject: [PATCH] ipcalc: Enhance to implode/explode IPv6 addresses. + +These functionalities are handy to work with IPv6 addresses +in shell scripts. + +implode: +Removes all leading zeroes from the IP address: + ::0:0:0:1 -> ::1 + +explode: +Adds all leading zeroes: + ::1 -> 0000:0000:0000:0000:0000:0000:0000:0001 +--- + src/ipcalc.1 | 10 ++++++++++ + src/ipcalc.c | 25 +++++++++++++++++++++++++ + 2 files changed, 35 insertions(+), 0 deletions(-) + +diff --git a/src/ipcalc.1 b/src/ipcalc.1 +index 30e0b20..654e2ba 100644 +--- a/src/ipcalc.1 ++++ b/src/ipcalc.1 +@@ -51,6 +51,16 @@ Show the prefix for the given mask/IP address. + Display the network address for the given IP address and netmask. + + .TP ++\fB-i\fR, \fB--implode\fR ++Implodes the given IPv6 address. Returns the shortest possible representation ++of the given IPv6 address. ++ ++.TP ++\fB-e\fR, \fB--explode\fR ++Explodes the given IPv6 address. Adds all leading zeroes and replaces ++:: with zeroes, too. ++ ++.TP + \fB-s\fR, \fB--silent\fR + Don't ever display error messages. + +diff --git a/src/ipcalc.c b/src/ipcalc.c +index 7316f05..c3f4604 100644 +--- a/src/ipcalc.c ++++ b/src/ipcalc.c +@@ -218,6 +218,7 @@ int main(int argc, const char **argv) { + int showHostname = 0, showNetmask = 0; + int beSilent = 0; + int doCheck = 0, familyIPv4 = 0, familyIPv6 = 0; ++ int implodeIP6Address = 0, explodeIP6Address = 0; + int rc; + poptContext optCon; + char *ipStr, *prefixStr, *netmaskStr, *chptr; +@@ -246,6 +247,10 @@ int main(int argc, const char **argv) { + "Display network prefix", }, + { "silent", 's', 0, &beSilent, 0, + "Don't ever display error messages" }, ++ { "implode", 'i', 0, &implodeIP6Address, 0, ++ "Implode given IPv6 address", }, ++ { "explode", 'e', 0, &explodeIP6Address, 0, ++ "Explode given IPv6 address", }, + POPT_AUTOHELP + { NULL, '\0', 0, 0, 0, NULL, NULL } + }; +@@ -472,5 +477,25 @@ int main(int argc, const char **argv) { + printf("HOSTNAME=%s\n", hostName); + } + ++ if (implodeIP6Address) { ++ if (inet_ntop(AF_INET6, &ip6, namebuf, INET6_ADDRSTRLEN) == NULL) { ++ perror("inet_ntop error"); ++ abort(); ++ } ++ ++ printf("ADDRESS6_IMPL=%s\n", namebuf); ++ } ++ ++ if (explodeIP6Address) { ++ sprintf(namebuf, "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", ++ (int)ip6.s6_addr[0], (int)ip6.s6_addr[1], (int)ip6.s6_addr[2], (int)ip6.s6_addr[3], ++ (int)ip6.s6_addr[4], (int)ip6.s6_addr[5], (int)ip6.s6_addr[6], (int)ip6.s6_addr[7], ++ (int)ip6.s6_addr[8], (int)ip6.s6_addr[9], (int)ip6.s6_addr[10], (int)ip6.s6_addr[11], ++ (int)ip6.s6_addr[12], (int)ip6.s6_addr[13], (int)ip6.s6_addr[14], (int)ip6.s6_addr[15] ++ ); ++ ++ printf("ADDRESS6_EXPL=%s\n", namebuf); ++ } ++ + return 0; + } +-- +1.7.8.2 + diff --git a/initscripts/patches/0001-ipcalc-Implement-prefix-for-IPv6.patch b/initscripts/patches/0001-ipcalc-Implement-prefix-for-IPv6.patch new file mode 100644 index 0000000..8fbde3e --- /dev/null +++ b/initscripts/patches/0001-ipcalc-Implement-prefix-for-IPv6.patch @@ -0,0 +1,84 @@ +From 027b87bd2fcfd1aa6fe48a363d51e40ff972f03d Mon Sep 17 00:00:00 2001 +From: Michael Tremer michael.tremer@ipfire.org +Date: Sat, 15 Sep 2012 10:50:32 +0000 +Subject: [PATCH] ipcalc: Implement --prefix for IPv6. + +The -p option will now return the prefix of the given IPv6 address. + +[root@os src]# ./ipcalc -p 2001:db8:abc:123::1/64 +PREFIX6=2001:db8:abc:123:: +[root@os src]# ./ipcalc -p 2001:db8:abc:123::2/48 +PREFIX6=2001:db8:abc:: +--- + src/ipcalc.c | 31 ++++++++++++++++++++++++++++--- + 1 files changed, 28 insertions(+), 3 deletions(-) + +diff --git a/src/ipcalc.c b/src/ipcalc.c +index c3f4604..039f4c7 100644 +--- a/src/ipcalc.c ++++ b/src/ipcalc.c +@@ -204,6 +204,21 @@ char *get_hostname(int family, void *addr) + return hostinfo->h_name; + } + ++void ipv6_prefix(struct in6_addr *dst, struct in6_addr *addr, unsigned int prefix) { ++ uint8_t i; ++ ++ /* Make a copy to work with, because we don't want to alter the input. */ ++ memcpy(dst, addr, sizeof(struct in6_addr)); ++ ++ for (i = 0; i < (128 - prefix) / 8; i++) { ++ dst->s6_addr[15-i] = 0; ++ } ++ ++ if ((128 - prefix) % 8) { ++ dst->s6_addr[15-i] &= ~((1 << ((128 - prefix) % 8)) - 1); ++ } ++} ++ + /*! + \fn main(int argc, const char **argv) + \brief wrapper program for ipcalc functions. +@@ -225,7 +240,7 @@ int main(int argc, const char **argv) { + char *hostName = NULL; + char namebuf[INET6_ADDRSTRLEN+1]; + struct in_addr ip, netmask, network, broadcast; +- struct in6_addr ip6; ++ struct in6_addr ip6, prefix6; + int prefix = -1; + char errBuf[250]; + struct poptOption optionsTable[] = { +@@ -394,7 +409,7 @@ int main(int argc, const char **argv) { + } + + if (familyIPv6 && +- (showBroadcast || showNetmask || showNetwork || showPrefix)) { ++ (showBroadcast || showNetmask || showNetwork)) { + if (!beSilent) { + fprintf(stderr, "ipcalc: unable to show setting for IPv6\n"); + } +@@ -429,10 +444,20 @@ int main(int argc, const char **argv) { + printf("NETMASK=%s\n", namebuf); + } + +- if (showPrefix) { ++ if (showPrefix && familyIPv4) { + if (prefix == -1) + prefix = mask2prefix(ip); + printf("PREFIX=%d\n", prefix); ++ ++ } else if (showPrefix && familyIPv6) { ++ ipv6_prefix(&prefix6, &ip6, prefix); ++ ++ if (inet_ntop(AF_INET6, &prefix6, namebuf, INET6_ADDRSTRLEN) == NULL) { ++ perror("inet_ntop error"); ++ abort(); ++ } ++ ++ printf("PREFIX6=%s\n", namebuf); + } + + if (showBroadcast) { +-- +1.7.8.2 + diff --git a/network/network.nm b/network/network.nm index d082a2c..0510263 100644 --- a/network/network.nm +++ b/network/network.nm @@ -5,7 +5,7 @@
name = network epoch = 1 -version = 004 +version = 005 release = 1 arch = noarch
@@ -37,8 +37,7 @@ packages requires aiccu bash >= 4.0 - bridge-utils - dhcp + dhcp >= 4.2.4-1 ebtables hostapd iproute2 @@ -52,9 +51,8 @@ packages sqlite systemd-units tunctl - vlan - wpa_supplicant - /usr/bin/ipcalc + wpa_supplicant >= 1.0-2 + /usr/bin/ipcalc >= 2.99-18 /usr/bin/logger end
diff --git a/wpa_supplicant/systemd/wpa_supplicant@.service b/wpa_supplicant/systemd/wpa_supplicant@.service new file mode 100644 index 0000000..b3bd340 --- /dev/null +++ b/wpa_supplicant/systemd/wpa_supplicant@.service @@ -0,0 +1,11 @@ +[Unit] +Description=wpa_supplicant for %I. + +[Service] +ExecStartPre=/usr/lib/network/helpers/wpa_supplicant-config-helper create %I +ExecStart=/usr/lib/network/helpers/wpa_supplicant %I +ExecStopPost=/usr/lib/network/helpers/wpa_supplicant-config-helper remove %I +PIDFile=/run/wpa_supplicant-%I.pid +Restart=on-failure +UtmpIdentifier=%I +KillMode=process diff --git a/wpa_supplicant/wpa_supplicant.nm b/wpa_supplicant/wpa_supplicant.nm index 92fac58..41f2ad6 100644 --- a/wpa_supplicant/wpa_supplicant.nm +++ b/wpa_supplicant/wpa_supplicant.nm @@ -5,7 +5,7 @@
name = wpa_supplicant version = 1.0 -release = 1 +release = 2
groups = Sytem/Base url = http://hostap.epitest.fi/releases/ @@ -53,6 +53,8 @@ end
packages package %{name} + requires += network >= 1:005 + end
package %{name}-debuginfo template DEBUGINFO
hooks/post-receive -- IPFire 3.x development tree