From 89cb0c46868536a912b665a1889231eb197716b5 Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Jan 10 2013 09:52:15 +0000 Subject: 4.2.5 - don't build libdst, it hasn't been used since 4.2.0 (#849166) --- diff --git a/.gitignore b/.gitignore index 9c1b03b..d8077e0 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ /dhcp-4.2.4.tar.gz /dhcp-4.2.4-P1.tar.gz /dhcp-4.2.4-P2.tar.gz +/dhcp-4.2.5.tar.gz diff --git a/dhcp-4.2.1-manpages.patch b/dhcp-4.2.1-manpages.patch deleted file mode 100644 index e02f304..0000000 --- a/dhcp-4.2.1-manpages.patch +++ /dev/null @@ -1,157 +0,0 @@ -diff -up dhcp-4.2.1b1/client/dhclient.conf.5.man dhcp-4.2.1b1/client/dhclient.conf.5 ---- dhcp-4.2.1b1/client/dhclient.conf.5.man 2010-09-15 01:03:56.000000000 +0200 -+++ dhcp-4.2.1b1/client/dhclient.conf.5 2011-01-27 18:22:56.000000000 +0100 -@@ -186,7 +186,8 @@ responding to the client send the client - options. Only the option names should be specified in the request - statement - not option parameters. By default, the DHCPv4 client - requests the subnet-mask, broadcast-address, time-offset, routers, --domain-name, domain-name-servers and host-name options while the DHCPv6 -+domain-search, domain-name, domain-name-servers, host-name, nis-domain, -+nis-servers, ntp-servers and interface-mtu options while the DHCPv6 - client requests the dhcp6 name-servers and domain-search options. Note - that if you enter a \'request\' statement, you over-ride these defaults - and these options will not be requested. -@@ -672,6 +673,17 @@ know the DHCP service(s) anycast MAC add - client. The \fIlink-type\fR and \fImac-address\fR parameters are configured - in a similar manner to the \fBhardware\fR statement. - .PP -+ \fBbootp-broadcast-always;\fR -+.PP -+The -+.B bootp-broadcast-always -+statement instructs dhclient to always set the bootp broadcast flag in -+request packets, so that servers will always broadcast replies. -+This is equivalent to supplying the dhclient -B argument, and has -+the same effect as specifying 'always-broadcast' in the server's dhcpd.conf. -+This option is provided as an extension to enable dhclient to work -+on IBM s390 Linux guests. -+.PP - .SH SAMPLE - The following configuration file is used on a laptop running NetBSD - 1.3. The laptop has an IP alias of 192.5.5.213, and has one -@@ -697,7 +709,7 @@ interface "ep0" { - supersede domain-search "fugue.com", "rc.vix.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, domain-name-servers, host-name; - require subnet-mask, domain-name-servers; - script "CLIENTBINDIR/dhclient-script"; - media "media 10baseT/UTP", "media 10base2/BNC"; -diff -up dhcp-4.2.1b1/client/dhclient-script.8.man dhcp-4.2.1b1/client/dhclient-script.8 ---- dhcp-4.2.1b1/client/dhclient-script.8.man 2010-07-06 21:03:11.000000000 +0200 -+++ dhcp-4.2.1b1/client/dhclient-script.8 2011-01-27 18:24:44.000000000 +0100 -@@ -47,7 +47,7 @@ customizations are needed, they should b - exit hooks provided (see HOOKS for details). These hooks will allow the - user to override the default behaviour of the client in creating a - .B /etc/resolv.conf --file. -+file, and to handle DHCP options not handled by default. - .PP - No standard client script exists for some operating systems, even though - the actual client may work, so a pioneering user may well need to create -@@ -91,6 +91,26 @@ present. The - .B ETCDIR/dhclient-exit-hooks - script can modify the valid of exit_status to change the exit status - of dhclient-script. -+.PP -+Immediately after dhclient brings an interface UP with a new IP address, -+subnet mask, and routes, in the REBOOT/BOUND states, it will check for the -+existence of an executable -+.B ETCDIR/dhclient-up-hooks -+script, and source it if found. This script can handle DHCP options in -+the environment that are not handled by default. A per-interface. -+.B ETCDIR/dhclient-${IF}-up-hooks -+script will override the generic script and be sourced when interface -+$IF has been brought up. -+.PP -+Immediately before dhclient brings an interface DOWN, removing its IP -+address, subnet mask, and routes, in the STOP/RELEASE states, it will -+check for the existence of an executable -+.B ETCDIR/dhclient-down-hooks -+script, and source it if found. This script can handle DHCP options in -+the environment that are not handled by default. A per-interface -+.B ETCDIR/dhclient-${IF}-down-hooks -+script will override the generic script and be sourced when interface -+$IF is about to be brought down. - .SH OPERATION - When dhclient needs to invoke the client configuration script, it - defines a set of variables in the environment, and then invokes -diff -up dhcp-4.2.1b1/common/dhcp-options.5.man dhcp-4.2.1b1/common/dhcp-options.5 ---- dhcp-4.2.1b1/common/dhcp-options.5.man 2010-07-13 22:56:56.000000000 +0200 -+++ dhcp-4.2.1b1/common/dhcp-options.5 2011-01-27 18:25:57.000000000 +0100 -@@ -913,6 +913,21 @@ classless IP routing - it does not inclu - classless IP routing is now the most widely deployed routing standard, - this option is virtually useless, and is not implemented by any of the - popular DHCP clients, for example the Microsoft DHCP client. -+.PP -+NOTE to Fedora dhclient users: -+.br -+dhclient-script interprets trailing 0 octets of the target as indicating -+the subnet class of the route, so for the following static-routes value: -+.br -+ option static-routes 172.0.0.0 172.16.2.254, -+.br -+ 192.168.0.0 192.168.2.254; -+.br -+dhclient-script will create routes: -+.br -+ 172/8 via 172.16.2.254 dev $interface -+.br -+ 192.168/16 via 192.168.2.254 dev $interface - .RE - .PP - .nf -diff -up dhcp-4.2.1b1/server/dhcpd.conf.5.man dhcp-4.2.1b1/server/dhcpd.conf.5 ---- dhcp-4.2.1b1/server/dhcpd.conf.5.man 2010-07-06 21:03:12.000000000 +0200 -+++ dhcp-4.2.1b1/server/dhcpd.conf.5 2011-01-27 18:29:12.000000000 +0100 -@@ -519,6 +519,9 @@ pool { - }; - .fi - .PP -+Dynamic BOOTP leases are not compatible with failover, and, as such, -+you need to disallow BOOTP in pools that you are using failover for. -+.PP - The server currently does very little sanity checking, so if you - configure it wrong, it will just fail in odd ways. I would recommend - therefore that you either do failover or don't do failover, but don't -@@ -533,9 +536,9 @@ primary server might look like this: - failover peer "foo" { - primary; - address anthrax.rc.vix.com; -- port 519; -+ port 647; - peer address trantor.rc.vix.com; -- peer port 520; -+ peer port 847; - max-response-delay 60; - max-unacked-updates 10; - mclt 3600; -@@ -1305,7 +1308,7 @@ the zone containing PTR records - for IS - .PP - .nf - key DHCP_UPDATER { -- algorithm HMAC-MD5.SIG-ALG.REG.INT; -+ algorithm hmac-md5; - secret pRP5FapFoJ95JEL06sv4PQ==; - }; - -@@ -1328,7 +1331,7 @@ dhcpd.conf file: - .PP - .nf - key DHCP_UPDATER { -- algorithm HMAC-MD5.SIG-ALG.REG.INT; -+ algorithm hmac-md5; - secret pRP5FapFoJ95JEL06sv4PQ==; - }; - -@@ -2540,7 +2543,8 @@ statement - The \fInext-server\fR statement is used to specify the host address of - the server from which the initial boot file (specified in the - \fIfilename\fR statement) is to be loaded. \fIServer-name\fR should --be a numeric IP address or a domain name. -+be a numeric IP address or a domain name. If no \fInext-server\fR statement -+applies to a given client, the address 0.0.0.0 is used. - .RE - .PP - The diff --git a/dhcp-4.2.1-sendDecline.patch b/dhcp-4.2.1-sendDecline.patch deleted file mode 100644 index b2fa4af..0000000 --- a/dhcp-4.2.1-sendDecline.patch +++ /dev/null @@ -1,231 +0,0 @@ -diff -up dhcp-4.2.1-P1/client/dhc6.c.sendDecline dhcp-4.2.1-P1/client/dhc6.c ---- dhcp-4.2.1-P1/client/dhc6.c.sendDecline 2010-09-10 22:27:11.000000000 +0200 -+++ dhcp-4.2.1-P1/client/dhc6.c 2011-06-17 14:19:48.992099868 +0200 -@@ -95,6 +95,8 @@ void do_select6(void *input); - void do_refresh6(void *input); - static void do_release6(void *input); - static void start_bound(struct client_state *client); -+static void start_decline6(struct client_state *client); -+static void do_decline6(void *input); - static void start_informed(struct client_state *client); - void informed_handler(struct packet *packet, struct client_state *client); - void bound_handler(struct packet *packet, struct client_state *client); -@@ -2075,6 +2077,7 @@ start_release6(struct client_state *clie - cancel_timeout(do_select6, client); - cancel_timeout(do_refresh6, client); - cancel_timeout(do_release6, client); -+ cancel_timeout(do_decline6, client); - client->state = S_STOPPED; - - /* -@@ -2708,6 +2711,7 @@ dhc6_check_reply(struct client_state *cl - break; - - case S_STOPPED: -+ case S_DECLINED: - action = dhc6_stop_action; - break; - -@@ -2809,6 +2813,7 @@ dhc6_check_reply(struct client_state *cl - break; - - case S_STOPPED: -+ case S_DECLINED: - /* Nothing critical to do at this stage. */ - break; - -@@ -3799,17 +3804,23 @@ reply_handler(struct packet *packet, str - cancel_timeout(do_select6, client); - cancel_timeout(do_refresh6, client); - cancel_timeout(do_release6, client); -+ cancel_timeout(do_decline6, client); - - /* If this is in response to a Release/Decline, clean up and return. */ -- if (client->state == S_STOPPED) { -- if (client->active_lease == NULL) -- return; -+ if ((client->state == S_STOPPED) || -+ (client->state == S_DECLINED)) { -+ -+ if (client->active_lease != NULL) { -+ dhc6_lease_destroy(&client->active_lease, MDL); -+ client->active_lease = NULL; -+ /* We should never wait for nothing!? */ -+ if (stopping_finished()) -+ exit(0); -+ } -+ -+ if (client->state == S_DECLINED) -+ start_init6(client); - -- dhc6_lease_destroy(&client->active_lease, MDL); -- client->active_lease = NULL; -- /* We should never wait for nothing!? */ -- if (stopping_finished()) -- exit(0); - return; - } - -@@ -4336,7 +4347,11 @@ start_bound(struct client_state *client) - oldia, oldaddr); - dhc6_marshall_values("new_", client, lease, ia, addr); - -- script_go(client); -+ // when script returns 3, DAD failed -+ if (script_go(client) == 3) { -+ start_decline6(client); -+ return; -+ } - } - - /* XXX: maybe we should loop on the old values instead? */ -@@ -4382,6 +4397,149 @@ start_bound(struct client_state *client) - dhc6_check_times(client); - } - -+/* -+ * Decline addresses. -+ */ -+void -+start_decline6(struct client_state *client) -+{ -+ /* Cancel any pending transmissions */ -+ cancel_timeout(do_confirm6, client); -+ cancel_timeout(do_select6, client); -+ cancel_timeout(do_refresh6, client); -+ cancel_timeout(do_release6, client); -+ cancel_timeout(do_decline6, client); -+ client->state = S_DECLINED; -+ -+ if (client->active_lease == NULL) -+ return; -+ -+ /* Set timers per RFC3315 section 18.1.7. */ -+ client->IRT = DEC_TIMEOUT * 100; -+ client->MRT = 0; -+ client->MRC = DEC_MAX_RC; -+ client->MRD = 0; -+ -+ dhc6_retrans_init(client); -+ client->v6_handler = reply_handler; -+ -+ client->refresh_type = DHCPV6_DECLINE; -+ do_decline6(client); -+} -+ -+/* -+ * do_decline6() creates a Decline packet and transmits it. -+ */ -+static void -+do_decline6(void *input) -+{ -+ struct client_state *client; -+ struct data_string ds; -+ int send_ret; -+ struct timeval elapsed, tv; -+ -+ client = input; -+ -+ if ((client->active_lease == NULL) || !active_prefix(client)) -+ return; -+ -+ if ((client->MRC != 0) && (client->txcount > client->MRC)) { -+ log_info("Max retransmission count exceeded."); -+ goto decline_done; -+ } -+ -+ /* -+ * Start_time starts at the first transmission. -+ */ -+ if (client->txcount == 0) { -+ client->start_time.tv_sec = cur_tv.tv_sec; -+ client->start_time.tv_usec = cur_tv.tv_usec; -+ } -+ -+ /* elapsed = cur - start */ -+ elapsed.tv_sec = cur_tv.tv_sec - client->start_time.tv_sec; -+ elapsed.tv_usec = cur_tv.tv_usec - client->start_time.tv_usec; -+ if (elapsed.tv_usec < 0) { -+ elapsed.tv_sec -= 1; -+ elapsed.tv_usec += 1000000; -+ } -+ -+ memset(&ds, 0, sizeof(ds)); -+ if (!buffer_allocate(&ds.buffer, 4, MDL)) { -+ log_error("Unable to allocate memory for Decline."); -+ goto decline_done; -+ } -+ -+ ds.data = ds.buffer->data; -+ ds.len = 4; -+ ds.buffer->data[0] = DHCPV6_DECLINE; -+ memcpy(ds.buffer->data + 1, client->dhcpv6_transaction_id, 3); -+ -+ /* Form an elapsed option. */ -+ /* Maximum value is 65535 1/100s coded as 0xffff. */ -+ if ((elapsed.tv_sec < 0) || (elapsed.tv_sec > 655) || -+ ((elapsed.tv_sec == 655) && (elapsed.tv_usec > 350000))) { -+ client->elapsed = 0xffff; -+ } else { -+ client->elapsed = elapsed.tv_sec * 100; -+ client->elapsed += elapsed.tv_usec / 10000; -+ } -+ -+ client->elapsed = htons(client->elapsed); -+ -+ log_debug("XMT: Forming Decline."); -+ make_client6_options(client, &client->sent_options, -+ client->active_lease, DHCPV6_DECLINE); -+ dhcpv6_universe.encapsulate(&ds, NULL, NULL, client, NULL, -+ client->sent_options, &global_scope, -+ &dhcpv6_universe); -+ -+ /* Append IA's (but don't release temporary addresses). */ -+ if (wanted_ia_na && -+ dhc6_add_ia_na(client, &ds, client->active_lease, -+ DHCPV6_DECLINE) != ISC_R_SUCCESS) { -+ data_string_forget(&ds, MDL); -+ goto decline_done; -+ } -+ if (wanted_ia_pd && -+ dhc6_add_ia_pd(client, &ds, client->active_lease, -+ DHCPV6_DECLINE) != ISC_R_SUCCESS) { -+ data_string_forget(&ds, MDL); -+ goto decline_done; -+ } -+ -+ /* Transmit and wait. */ -+ log_info("XMT: Decline on %s, interval %ld0ms.", -+ client->name ? client->name : client->interface->name, -+ (long int)client->RT); -+ -+ send_ret = send_packet6(client->interface, ds.data, ds.len, -+ &DHCPv6DestAddr); -+ if (send_ret != ds.len) { -+ log_error("dhc6: sendpacket6() sent %d of %d bytes", -+ send_ret, ds.len); -+ } -+ -+ data_string_forget(&ds, MDL); -+ -+ /* Wait RT */ -+ tv.tv_sec = cur_tv.tv_sec + client->RT / 100; -+ tv.tv_usec = cur_tv.tv_usec + (client->RT % 100) * 10000; -+ if (tv.tv_usec >= 1000000) { -+ tv.tv_sec += 1; -+ tv.tv_usec -= 1000000; -+ } -+ add_timeout(&tv, do_decline6, client, NULL, NULL); -+ dhc6_retrans_advance(client); -+ return; -+ -+decline_done: -+ dhc6_lease_destroy(&client->active_lease, MDL); -+ client->active_lease = NULL; -+ start_init6(client); -+ return; -+} -+ - /* While bound, ignore packets. In the future we'll want to answer - * Reconfigure-Request messages and the like. - */ diff --git a/dhcp-4.2.2-CLOEXEC.patch b/dhcp-4.2.2-CLOEXEC.patch index b07e2ff..1198f77 100644 --- a/dhcp-4.2.2-CLOEXEC.patch +++ b/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-4.2.2-remove-bind.patch b/dhcp-4.2.2-remove-bind.patch deleted file mode 100644 index 6297772..0000000 --- a/dhcp-4.2.2-remove-bind.patch +++ /dev/null @@ -1,149 +0,0 @@ -diff -up dhcp-4.2.2/client/Makefile.am.rh637017 dhcp-4.2.2/client/Makefile.am ---- dhcp-4.2.2/client/Makefile.am.rh637017 2010-09-15 00:32:36.000000000 +0200 -+++ dhcp-4.2.2/client/Makefile.am 2011-08-11 17:28:58.923897561 +0200 -@@ -5,7 +5,7 @@ dhclient_SOURCES = clparse.c dhclient.c - scripts/netbsd scripts/nextstep scripts/openbsd \ - scripts/solaris scripts/openwrt - dhclient_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ -- ../bind/lib/libdns.a ../bind/lib/libisc.a -+ $(BIND9_LIBDIR) -ldns-export -lisc-export - man_MANS = dhclient.8 dhclient-script.8 dhclient.conf.5 dhclient.leases.5 - EXTRA_DIST = $(man_MANS) - -diff -up dhcp-4.2.2/common/tests/Makefile.am.rh637017 dhcp-4.2.2/common/tests/Makefile.am ---- dhcp-4.2.2/common/tests/Makefile.am.rh637017 2009-10-28 05:12:30.000000000 +0100 -+++ dhcp-4.2.2/common/tests/Makefile.am 2011-08-11 17:33:45.258637236 +0200 -@@ -6,6 +6,5 @@ TESTS = test_alloc - - test_alloc_SOURCES = test_alloc.c - test_alloc_LDADD = ../libdhcp.a ../../tests/libt_api.a \ -- ../../omapip/libomapi.a ../../bind/lib/libdns.a \ -- ../../bind/lib/libisc.a -- -+ ../../omapip/libomapi.a \ -+ $(BIND9_LIBDIR) -ldns-export -lisc-export -diff -up dhcp-4.2.2/configure.ac.rh637017 dhcp-4.2.2/configure.ac ---- dhcp-4.2.2/configure.ac.rh637017 2011-07-20 02:32:18.000000000 +0200 -+++ dhcp-4.2.2/configure.ac 2011-08-11 17:28:58.924897535 +0200 -@@ -512,20 +512,37 @@ AC_CHECK_MEMBER(struct msghdr.msg_contro - libbind= - AC_ARG_WITH(libbind, - AC_HELP_STRING([--with-libbind=PATH], -- [bind includes and libraries are in PATH -- (default is ./bind)]), -+ [bind includes are in PATH -+ (default is ./bind/includes)]), - use_libbind="$withval", use_libbind="no") - case "$use_libbind" in -+yes|no) -+ libbind="\${top_srcdir}/bind/include" -+ ;; -+*) -+ libbind="$use_libbind" -+ ;; -+esac -+ -+BIND9_LIBDIR='-L$(top_builddir)/bind/lib' -+AC_ARG_WITH(libbind-libs, -+ AC_HELP_STRING([--with-libbind-libs=PATH], -+ [bind9 export libraries are in PATH]), -+ [libbind_libs="$withval"], [libbind_libs='no']) -+case "$libbind_libs" in - yes) -- libbind="\${top_srcdir}/bind" -+ AC_MSG_ERROR([Specify path to bind9 libraries]) - ;; - no) -- libbind="\${top_srcdir}/bind" -+ BUNDLED_BIND=yes - ;; - *) -- libbind="$use_libbind" -+ BIND9_LIBDIR="-L$libbind_libs" -+ BUNDLED_BIND=no - ;; - esac -+AM_CONDITIONAL([BUNDLED_BIND], [test "$BUNDLED_BIND" = yes]) -+AC_SUBST([BIND9_LIBDIR]) - - # OpenLDAP support. - AC_ARG_WITH(ldap, -@@ -562,7 +579,7 @@ fi - CFLAGS="$CFLAGS $STD_CWARNINGS" - - # Try to add the bind include directory --CFLAGS="$CFLAGS -I$libbind/include" -+CFLAGS="$CFLAGS -I$libbind" - - AC_C_FLEXIBLE_ARRAY_MEMBER - -diff -up dhcp-4.2.2/dhcpctl/Makefile.am.rh637017 dhcp-4.2.2/dhcpctl/Makefile.am ---- dhcp-4.2.2/dhcpctl/Makefile.am.rh637017 2009-10-28 05:12:30.000000000 +0100 -+++ dhcp-4.2.2/dhcpctl/Makefile.am 2011-08-11 17:28:58.924897535 +0200 -@@ -6,10 +6,10 @@ EXTRA_DIST = $(man_MANS) - - omshell_SOURCES = omshell.c - omshell_LDADD = libdhcpctl.a ../common/libdhcp.a ../omapip/libomapi.a \ -- ../bind/lib/libdns.a ../bind/lib/libisc.a -+ $(BIND9_LIBDIR) -ldns-export -lisc-export - - libdhcpctl_a_SOURCES = dhcpctl.c callback.c remote.c - - cltest_SOURCES = cltest.c - cltest_LDADD = libdhcpctl.a ../common/libdhcp.a ../omapip/libomapi.a \ -- ../bind/lib/libdns.a ../bind/lib/libisc.a -\ No newline at end of file -+ $(BIND9_LIBDIR) -ldns-export -lisc-export -diff -up dhcp-4.2.2/Makefile.am.rh637017 dhcp-4.2.2/Makefile.am ---- dhcp-4.2.2/Makefile.am.rh637017 2010-03-25 00:30:38.000000000 +0100 -+++ dhcp-4.2.2/Makefile.am 2011-08-11 17:28:58.925897509 +0200 -@@ -21,7 +21,13 @@ EXTRA_DIST = RELNOTES LICENSE \ - util/bindvar.sh \ - bind/Makefile bind/bind.tar.gz bind/version.tmp - --SUBDIRS = bind includes tests common dst omapip client dhcpctl relay server -+if BUNDLED_BIND -+SUBDIRS = bind -+else -+SUBDIRS = -+endif -+ -+SUBDIRS += includes tests common dst omapip client dhcpctl relay server - - nobase_include_HEADERS = dhcpctl/dhcpctl.h - -diff -up dhcp-4.2.2/omapip/Makefile.am.rh637017 dhcp-4.2.2/omapip/Makefile.am ---- dhcp-4.2.2/omapip/Makefile.am.rh637017 2010-02-12 01:13:54.000000000 +0100 -+++ dhcp-4.2.2/omapip/Makefile.am 2011-08-11 17:28:58.939897149 +0200 -@@ -10,5 +10,5 @@ man_MANS = omapi.3 - EXTRA_DIST = $(man_MANS) - - svtest_SOURCES = test.c --svtest_LDADD = libomapi.a ../bind/lib/libdns.a ../bind/lib/libisc.a -+svtest_LDADD = libomapi.a $(BIND9_LIBDIR) -ldns-export -lisc-export - -diff -up dhcp-4.2.2/relay/Makefile.am.rh637017 dhcp-4.2.2/relay/Makefile.am ---- dhcp-4.2.2/relay/Makefile.am.rh637017 2009-10-28 05:12:30.000000000 +0100 -+++ dhcp-4.2.2/relay/Makefile.am 2011-08-11 17:28:58.940897123 +0200 -@@ -3,7 +3,7 @@ AM_CPPFLAGS = -DLOCALSTATEDIR='"@localst - sbin_PROGRAMS = dhcrelay - dhcrelay_SOURCES = dhcrelay.c - dhcrelay_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ -- ../bind/lib/libdns.a ../bind/lib/libisc.a -+ $(BIND9_LIBDIR) -ldns-export -lisc-export - man_MANS = dhcrelay.8 - EXTRA_DIST = $(man_MANS) - -diff -up dhcp-4.2.2/server/Makefile.am.rh637017 dhcp-4.2.2/server/Makefile.am ---- dhcp-4.2.2/server/Makefile.am.rh637017 2010-03-24 22:49:47.000000000 +0100 -+++ dhcp-4.2.2/server/Makefile.am 2011-08-11 17:28:58.944897021 +0200 -@@ -8,8 +8,7 @@ dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c c - - dhcpd_CFLAGS = $(LDAP_CFLAGS) - dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ -- ../dhcpctl/libdhcpctl.a ../bind/lib/libdns.a \ -- ../bind/lib/libisc.a -+ ../dhcpctl/libdhcpctl.a $(BIND9_LIBDIR) -ldns-export -lisc-export - - man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5 - EXTRA_DIST = $(man_MANS) diff --git a/dhcp-4.2.2-sharedlib.patch b/dhcp-4.2.2-sharedlib.patch deleted file mode 100644 index d30b8e1..0000000 --- a/dhcp-4.2.2-sharedlib.patch +++ /dev/null @@ -1,119 +0,0 @@ -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-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 --dhclient_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ -+dhclient_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \ - $(BIND9_LIBDIR) -ldns-export -lisc-export $(CAPNG_LDADD) - 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-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 - --AC_PROG_RANLIB -+# Use libtool to simplify building of shared libraries -+AC_PROG_LIBTOOL - AC_CONFIG_HEADERS([includes/config.h]) - - # 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-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 -+lib_LTLIBRARIES = libdhcpctl.la - noinst_PROGRAMS = cltest - man_MANS = omshell.1 dhcpctl.3 - EXTRA_DIST = $(man_MANS) - - omshell_SOURCES = omshell.c --omshell_LDADD = libdhcpctl.a ../common/libdhcp.a ../omapip/libomapi.a \ -+omshell_LDADD = libdhcpctl.la ../common/libdhcp.a ../omapip/libomapi.la \ - $(BIND9_LIBDIR) -ldns-export -lisc-export - --libdhcpctl_a_SOURCES = dhcpctl.c callback.c remote.c -+libdhcpctl_la_SOURCES = dhcpctl.c callback.c remote.c - - cltest_SOURCES = cltest.c --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-10-09 20:07:40.000000000 +0200 -@@ -64,6 +64,7 @@ static const char rcsid[] = "$Id: base64 - - #include - -+#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-10-09 20:07:40.000000000 +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-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 - noinst_PROGRAMS = svtest - --libomapi_a_SOURCES = protocol.c buffer.c alloc.c result.c connection.c \ -+libomapi_la_SOURCES = protocol.c buffer.c alloc.c result.c connection.c \ - errwarn.c listener.c dispatch.c generic.c support.c \ - handle.c message.c convert.c hash.c auth.c inet_addr.c \ - array.c trace.c toisc.c iscprint.c isclib.c -@@ -10,5 +10,5 @@ man_MANS = omapi.3 - EXTRA_DIST = $(man_MANS) - - svtest_SOURCES = test.c --svtest_LDADD = libomapi.a $(BIND9_LIBDIR) -ldns-export -lisc-export -+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-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 - dhcrelay_SOURCES = dhcrelay.c --dhcrelay_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ -+dhcrelay_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \ - $(BIND9_LIBDIR) -ldns-export -lisc-export $(CAPNG_LDADD) - 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-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 -+dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \ -+ ../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-4.2.3-P2-rfc5970-dhcpv6-options-for-network-boot.patch b/dhcp-4.2.3-P2-rfc5970-dhcpv6-options-for-network-boot.patch deleted file mode 100644 index 3bcb5da..0000000 --- a/dhcp-4.2.3-P2-rfc5970-dhcpv6-options-for-network-boot.patch +++ /dev/null @@ -1,89 +0,0 @@ -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-4.2.4-P1-dhclient6-leases_semicolon_expected.patch b/dhcp-4.2.4-P1-dhclient6-leases_semicolon_expected.patch deleted file mode 100644 index c18380d..0000000 --- a/dhcp-4.2.4-P1-dhclient6-leases_semicolon_expected.patch +++ /dev/null @@ -1,41 +0,0 @@ -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-4.2.4-P1-remove-dst.patch b/dhcp-4.2.4-P1-remove-dst.patch new file mode 100644 index 0000000..6b8dbb0 --- /dev/null +++ b/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 + + #ifdef NSUPDATE diff --git a/dhcp-4.2.4-PPP.patch b/dhcp-4.2.4-PPP.patch deleted file mode 100644 index edb11bf..0000000 --- a/dhcp-4.2.4-PPP.patch +++ /dev/null @@ -1,150 +0,0 @@ -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-4.2.4-lpf-ib.patch b/dhcp-4.2.4-lpf-ib.patch deleted file mode 100644 index 17b850b..0000000 --- a/dhcp-4.2.4-lpf-ib.patch +++ /dev/null @@ -1,559 +0,0 @@ -diff -up dhcp-4.2.4-P2/client/dhclient.c.lpf-ib dhcp-4.2.4-P2/client/dhclient.c ---- dhcp-4.2.4-P2/client/dhclient.c.lpf-ib 2012-11-30 14:05:07.399394154 +0100 -+++ dhcp-4.2.4-P2/client/dhclient.c 2012-11-30 14:05:07.406394070 +0100 -@@ -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-P2/common/bpf.c.lpf-ib dhcp-4.2.4-P2/common/bpf.c ---- dhcp-4.2.4-P2/common/bpf.c.lpf-ib 2012-11-30 14:05:07.394394214 +0100 -+++ dhcp-4.2.4-P2/common/bpf.c 2012-11-30 14:05:07.407394058 +0100 -@@ -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-P2/common/lpf.c.lpf-ib dhcp-4.2.4-P2/common/lpf.c ---- dhcp-4.2.4-P2/common/lpf.c.lpf-ib 2012-11-30 14:05:07.394394214 +0100 -+++ dhcp-4.2.4-P2/common/lpf.c 2012-11-30 14:19:27.211031532 +0100 -@@ -42,6 +42,7 @@ - #include "includes/netinet/udp.h" - #include "includes/netinet/if_ether.h" - #include -+#include - - #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,52 @@ 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); - } -+ close(sock); - - sa = &tmp.ifr_hwaddr; -- switch (sa->sa_family) { -+ // needs to be freed outside this function -+ 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; -+ int sll_allocated = 0; -+ -+ 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); -+ if (sll != NULL) -+ sll_allocated = 1; -+ else -+ // shouldn't happed -+ log_fatal("Unexpected internal error"); -+ } -+ -+ 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 +683,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 +724,13 @@ 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); -+ if (sll_allocated) -+ dfree(sll, MDL); -+ freeifaddrs(ifaddrs); - } - #endif -diff -up dhcp-4.2.4-P2/common/socket.c.lpf-ib dhcp-4.2.4-P2/common/socket.c ---- dhcp-4.2.4-P2/common/socket.c.lpf-ib 2012-08-24 21:11:21.000000000 +0200 -+++ dhcp-4.2.4-P2/common/socket.c 2012-11-30 14:05:07.408394046 +0100 -@@ -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-P2/includes/dhcpd.h.lpf-ib dhcp-4.2.4-P2/includes/dhcpd.h ---- dhcp-4.2.4-P2/includes/dhcpd.h.lpf-ib 2012-11-30 14:05:07.400394142 +0100 -+++ dhcp-4.2.4-P2/includes/dhcpd.h 2012-11-30 14:05:07.409394034 +0100 -@@ -1249,6 +1249,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. - */ -@@ -2368,7 +2369,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-4.2.4-rfc3442-classless-static-routes.patch b/dhcp-4.2.4-rfc3442-classless-static-routes.patch deleted file mode 100644 index a2fe219..0000000 --- a/dhcp-4.2.4-rfc3442-classless-static-routes.patch +++ /dev/null @@ -1,405 +0,0 @@ -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 ""; -+ } -+ 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 ""; -+ } -+ -+ 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-4.2.4-systemtap.patch b/dhcp-4.2.4-systemtap.patch deleted file mode 100644 index bba60b1..0000000 --- a/dhcp-4.2.4-systemtap.patch +++ /dev/null @@ -1,808 +0,0 @@ -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 dst 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 - #include - #include -- -+#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 - -+#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-4.2.5-PPP.patch b/dhcp-4.2.5-PPP.patch new file mode 100644 index 0000000..1bc1e3f --- /dev/null +++ b/dhcp-4.2.5-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, 6); + 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-4.2.5-lpf-ib.patch b/dhcp-4.2.5-lpf-ib.patch new file mode 100644 index 0000000..a136c6c --- /dev/null +++ b/dhcp-4.2.5-lpf-ib.patch @@ -0,0 +1,559 @@ +diff -up dhcp-4.2.4-P2/client/dhclient.c.lpf-ib dhcp-4.2.4-P2/client/dhclient.c +--- dhcp-4.2.4-P2/client/dhclient.c.lpf-ib 2012-11-30 14:05:07.399394154 +0100 ++++ dhcp-4.2.4-P2/client/dhclient.c 2012-11-30 14:05:07.406394070 +0100 +@@ -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-P2/common/bpf.c.lpf-ib dhcp-4.2.4-P2/common/bpf.c +--- dhcp-4.2.4-P2/common/bpf.c.lpf-ib 2012-11-30 14:05:07.394394214 +0100 ++++ dhcp-4.2.4-P2/common/bpf.c 2012-11-30 14:05:07.407394058 +0100 +@@ -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-P2/common/lpf.c.lpf-ib dhcp-4.2.4-P2/common/lpf.c +--- dhcp-4.2.4-P2/common/lpf.c.lpf-ib 2012-11-30 14:05:07.394394214 +0100 ++++ dhcp-4.2.4-P2/common/lpf.c 2012-11-30 14:19:27.211031532 +0100 +@@ -42,6 +42,7 @@ + #include "includes/netinet/udp.h" + #include "includes/netinet/if_ether.h" + #include ++#include + + #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,52 @@ 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); + } ++ close(sock); + + sa = &tmp.ifr_hwaddr; +- switch (sa->sa_family) { ++ // needs to be freed outside this function ++ 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; ++ int sll_allocated = 0; ++ ++ 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); ++ if (sll != NULL) ++ sll_allocated = 1; ++ else ++ // shouldn't happed ++ log_fatal("Unexpected internal error"); ++ } ++ ++ 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 +683,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 = 7; + hw->hbuf[0] = HTYPE_FDDI; +- memcpy(&hw->hbuf[1], sa->sa_data, 6); ++ memcpy(&hw->hbuf[1], sll->sll_addr, 6); ++ 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 +724,13 @@ 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); ++ if (sll_allocated) ++ dfree(sll, MDL); ++ freeifaddrs(ifaddrs); + } + #endif +diff -up dhcp-4.2.4-P2/common/socket.c.lpf-ib dhcp-4.2.4-P2/common/socket.c +--- dhcp-4.2.4-P2/common/socket.c.lpf-ib 2012-08-24 21:11:21.000000000 +0200 ++++ dhcp-4.2.4-P2/common/socket.c 2012-11-30 14:05:07.408394046 +0100 +@@ -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-P2/includes/dhcpd.h.lpf-ib dhcp-4.2.4-P2/includes/dhcpd.h +--- dhcp-4.2.4-P2/includes/dhcpd.h.lpf-ib 2012-11-30 14:05:07.400394142 +0100 ++++ dhcp-4.2.4-P2/includes/dhcpd.h 2012-11-30 14:05:07.409394034 +0100 +@@ -1249,6 +1249,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. + */ +@@ -2368,7 +2369,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-4.2.5-manpages.patch b/dhcp-4.2.5-manpages.patch new file mode 100644 index 0000000..fb931bc --- /dev/null +++ b/dhcp-4.2.5-manpages.patch @@ -0,0 +1,157 @@ +diff -up dhcp-4.2.5b1/client/dhclient.conf.5.man dhcp-4.2.5b1/client/dhclient.conf.5 +--- dhcp-4.2.5b1/client/dhclient.conf.5.man 2012-12-05 02:17:38.000000000 +0100 ++++ dhcp-4.2.5b1/client/dhclient.conf.5 2012-12-17 12:49:52.818451301 +0100 +@@ -202,7 +202,8 @@ responding to the client send the client + options. Only the option names should be specified in the request + statement - not option parameters. By default, the DHCPv4 client + requests the subnet-mask, broadcast-address, time-offset, routers, +-domain-name, domain-name-servers and host-name options while the DHCPv6 ++domain-search, domain-name, domain-name-servers, host-name, nis-domain, ++nis-servers, ntp-servers and interface-mtu options while the DHCPv6 + client requests the dhcp6 name-servers and domain-search options. Note + that if you enter a \'request\' statement, you over-ride these defaults + and these options will not be requested. +@@ -688,6 +689,17 @@ know the DHCP service(s) anycast MAC add + client. The \fIlink-type\fR and \fImac-address\fR parameters are configured + in a similar manner to the \fBhardware\fR statement. + .PP ++ \fBbootp-broadcast-always;\fR ++.PP ++The ++.B bootp-broadcast-always ++statement instructs dhclient to always set the bootp broadcast flag in ++request packets, so that servers will always broadcast replies. ++This is equivalent to supplying the dhclient -B argument, and has ++the same effect as specifying 'always-broadcast' in the server's dhcpd.conf. ++This option is provided as an extension to enable dhclient to work ++on IBM s390 Linux guests. ++.PP + .SH SAMPLE + The following configuration file is used on a laptop running NetBSD + 1.3. The laptop has an IP alias of 192.5.5.213, and has one +@@ -713,7 +725,7 @@ interface "ep0" { + supersede domain-search "fugue.com", "rc.vix.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, domain-name-servers, host-name; + require subnet-mask, domain-name-servers; + script "CLIENTBINDIR/dhclient-script"; + media "media 10baseT/UTP", "media 10base2/BNC"; +diff -up dhcp-4.2.5b1/client/dhclient-script.8.man dhcp-4.2.5b1/client/dhclient-script.8 +--- dhcp-4.2.5b1/client/dhclient-script.8.man 2012-12-05 02:17:38.000000000 +0100 ++++ dhcp-4.2.5b1/client/dhclient-script.8 2012-12-17 12:47:48.410130998 +0100 +@@ -48,7 +48,7 @@ customizations are needed, they should b + exit hooks provided (see HOOKS for details). These hooks will allow the + user to override the default behaviour of the client in creating a + .B /etc/resolv.conf +-file. ++file, and to handle DHCP options not handled by default. + .PP + No standard client script exists for some operating systems, even though + the actual client may work, so a pioneering user may well need to create +@@ -92,6 +92,26 @@ present. The + .B ETCDIR/dhclient-exit-hooks + script can modify the valid of exit_status to change the exit status + of dhclient-script. ++.PP ++Immediately after dhclient brings an interface UP with a new IP address, ++subnet mask, and routes, in the REBOOT/BOUND states, it will check for the ++existence of an executable ++.B ETCDIR/dhclient-up-hooks ++script, and source it if found. This script can handle DHCP options in ++the environment that are not handled by default. A per-interface. ++.B ETCDIR/dhclient-${IF}-up-hooks ++script will override the generic script and be sourced when interface ++$IF has been brought up. ++.PP ++Immediately before dhclient brings an interface DOWN, removing its IP ++address, subnet mask, and routes, in the STOP/RELEASE states, it will ++check for the existence of an executable ++.B ETCDIR/dhclient-down-hooks ++script, and source it if found. This script can handle DHCP options in ++the environment that are not handled by default. A per-interface ++.B ETCDIR/dhclient-${IF}-down-hooks ++script will override the generic script and be sourced when interface ++$IF is about to be brought down. + .SH OPERATION + When dhclient needs to invoke the client configuration script, it + defines a set of variables in the environment, and then invokes +diff -up dhcp-4.2.5b1/common/dhcp-options.5.man dhcp-4.2.5b1/common/dhcp-options.5 +--- dhcp-4.2.5b1/common/dhcp-options.5.man 2012-12-05 02:17:38.000000000 +0100 ++++ dhcp-4.2.5b1/common/dhcp-options.5 2012-12-17 12:47:48.411130985 +0100 +@@ -914,6 +914,21 @@ classless IP routing - it does not inclu + classless IP routing is now the most widely deployed routing standard, + this option is virtually useless, and is not implemented by any of the + popular DHCP clients, for example the Microsoft DHCP client. ++.PP ++NOTE to Fedora dhclient users: ++.br ++dhclient-script interprets trailing 0 octets of the target as indicating ++the subnet class of the route, so for the following static-routes value: ++.br ++ option static-routes 172.0.0.0 172.16.2.254, ++.br ++ 192.168.0.0 192.168.2.254; ++.br ++dhclient-script will create routes: ++.br ++ 172/8 via 172.16.2.254 dev $interface ++.br ++ 192.168/16 via 192.168.2.254 dev $interface + .RE + .PP + .nf +diff -up dhcp-4.2.5b1/server/dhcpd.conf.5.man dhcp-4.2.5b1/server/dhcpd.conf.5 +--- dhcp-4.2.5b1/server/dhcpd.conf.5.man 2012-12-05 02:17:39.000000000 +0100 ++++ dhcp-4.2.5b1/server/dhcpd.conf.5 2012-12-17 12:50:52.117650542 +0100 +@@ -519,6 +519,9 @@ pool { + }; + .fi + .PP ++Dynamic BOOTP leases are not compatible with failover, and, as such, ++you need to disallow BOOTP in pools that you are using failover for. ++.PP + The server currently does very little sanity checking, so if you + configure it wrong, it will just fail in odd ways. I would recommend + therefore that you either do failover or don't do failover, but don't +@@ -533,9 +536,9 @@ primary server might look like this: + failover peer "foo" { + primary; + address anthrax.rc.vix.com; +- port 519; ++ port 647; + peer address trantor.rc.vix.com; +- peer port 520; ++ peer port 847; + max-response-delay 60; + max-unacked-updates 10; + mclt 3600; +@@ -1318,7 +1321,7 @@ the zone containing PTR records - for IS + .PP + .nf + key DHCP_UPDATER { +- algorithm HMAC-MD5.SIG-ALG.REG.INT; ++ algorithm hmac-md5; + secret pRP5FapFoJ95JEL06sv4PQ==; + }; + +@@ -1341,7 +1344,7 @@ dhcpd.conf file: + .PP + .nf + key DHCP_UPDATER { +- algorithm HMAC-MD5.SIG-ALG.REG.INT; ++ algorithm hmac-md5; + secret pRP5FapFoJ95JEL06sv4PQ==; + }; + +@@ -2555,7 +2558,8 @@ statement + The \fInext-server\fR statement is used to specify the host address of + the server from which the initial boot file (specified in the + \fIfilename\fR statement) is to be loaded. \fIServer-name\fR should +-be a numeric IP address or a domain name. ++be a numeric IP address or a domain name. If no \fInext-server\fR statement ++applies to a given client, the address 0.0.0.0 is used. + .RE + .PP + The diff --git a/dhcp-4.2.5-remove-bind.patch b/dhcp-4.2.5-remove-bind.patch new file mode 100644 index 0000000..d3ef6b7 --- /dev/null +++ b/dhcp-4.2.5-remove-bind.patch @@ -0,0 +1,164 @@ +diff -up dhcp-4.2.5b1/client/Makefile.am.remove-bind dhcp-4.2.5b1/client/Makefile.am +--- dhcp-4.2.5b1/client/Makefile.am.remove-bind 2012-12-05 02:17:38.000000000 +0100 ++++ dhcp-4.2.5b1/client/Makefile.am 2012-12-17 16:20:58.692538252 +0100 +@@ -5,7 +5,7 @@ dhclient_SOURCES = clparse.c dhclient.c + scripts/netbsd scripts/nextstep scripts/openbsd \ + scripts/solaris scripts/openwrt + dhclient_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ +- ../bind/lib/libdns.a ../bind/lib/libisc.a ++ $(BIND9_LIBDIR) -ldns-export -lisc-export + man_MANS = dhclient.8 dhclient-script.8 dhclient.conf.5 dhclient.leases.5 + EXTRA_DIST = $(man_MANS) + +diff -up dhcp-4.2.5b1/common/tests/Makefile.am.remove-bind dhcp-4.2.5b1/common/tests/Makefile.am +--- dhcp-4.2.5b1/common/tests/Makefile.am.remove-bind 2012-12-05 02:17:38.000000000 +0100 ++++ dhcp-4.2.5b1/common/tests/Makefile.am 2012-12-17 16:20:58.693538239 +0100 +@@ -13,8 +13,8 @@ ATF_TESTS += alloc_unittest + alloc_unittest_SOURCES = test_alloc.c $(top_srcdir)/tests/t_api_dhcp.c + alloc_unittest_LDADD = $(ATF_LDFLAGS) + alloc_unittest_LDADD += ../libdhcp.a \ +- ../../omapip/libomapi.a ../../bind/lib/libdns.a \ +- ../../bind/lib/libisc.a ++ ../../omapip/libomapi.a \ ++ $(BIND9_LIBDIR) -ldns-export -lisc-export + + check: $(ATF_TESTS) + atf-run | atf-report +diff -up dhcp-4.2.5b1/configure.ac.remove-bind dhcp-4.2.5b1/configure.ac +--- dhcp-4.2.5b1/configure.ac.remove-bind 2012-12-05 02:18:44.000000000 +0100 ++++ dhcp-4.2.5b1/configure.ac 2012-12-17 16:20:58.693538239 +0100 +@@ -581,20 +581,37 @@ AC_CHECK_MEMBER(struct msghdr.msg_contro + libbind= + AC_ARG_WITH(libbind, + AC_HELP_STRING([--with-libbind=PATH], +- [bind includes and libraries are in PATH +- (default is ./bind)]), ++ [bind includes are in PATH ++ (default is ./bind/includes)]), + use_libbind="$withval", use_libbind="no") + case "$use_libbind" in ++yes|no) ++ libbind="\${top_srcdir}/bind/include" ++ ;; ++*) ++ libbind="$use_libbind" ++ ;; ++esac ++ ++BIND9_LIBDIR='-L$(top_builddir)/bind/lib' ++AC_ARG_WITH(libbind-libs, ++ AC_HELP_STRING([--with-libbind-libs=PATH], ++ [bind9 export libraries are in PATH]), ++ [libbind_libs="$withval"], [libbind_libs='no']) ++case "$libbind_libs" in + yes) +- libbind="\${top_srcdir}/bind" ++ AC_MSG_ERROR([Specify path to bind9 libraries]) + ;; + no) +- libbind="\${top_srcdir}/bind" ++ BUNDLED_BIND=yes + ;; + *) +- libbind="$use_libbind" ++ BIND9_LIBDIR="-L$libbind_libs" ++ BUNDLED_BIND=no + ;; + esac ++AM_CONDITIONAL([BUNDLED_BIND], [test "$BUNDLED_BIND" = yes]) ++AC_SUBST([BIND9_LIBDIR]) + + # OpenLDAP support. + AC_ARG_WITH(ldap, +@@ -631,7 +648,7 @@ fi + CFLAGS="$CFLAGS $STD_CWARNINGS" + + # Try to add the bind include directory +-CFLAGS="$CFLAGS -I$libbind/include" ++CFLAGS="$CFLAGS -I$libbind" + + AC_C_FLEXIBLE_ARRAY_MEMBER + +diff -up dhcp-4.2.5b1/dhcpctl/Makefile.am.remove-bind dhcp-4.2.5b1/dhcpctl/Makefile.am +--- dhcp-4.2.5b1/dhcpctl/Makefile.am.remove-bind 2012-12-05 02:17:39.000000000 +0100 ++++ dhcp-4.2.5b1/dhcpctl/Makefile.am 2012-12-17 16:20:58.693538239 +0100 +@@ -6,10 +6,10 @@ EXTRA_DIST = $(man_MANS) + + omshell_SOURCES = omshell.c + omshell_LDADD = libdhcpctl.a ../common/libdhcp.a ../omapip/libomapi.a \ +- ../bind/lib/libdns.a ../bind/lib/libisc.a ++ $(BIND9_LIBDIR) -ldns-export -lisc-export + + libdhcpctl_a_SOURCES = dhcpctl.c callback.c remote.c + + cltest_SOURCES = cltest.c + cltest_LDADD = libdhcpctl.a ../common/libdhcp.a ../omapip/libomapi.a \ +- ../bind/lib/libdns.a ../bind/lib/libisc.a +\ No newline at end of file ++ $(BIND9_LIBDIR) -ldns-export -lisc-export +diff -up dhcp-4.2.5b1/Makefile.am.remove-bind dhcp-4.2.5b1/Makefile.am +--- dhcp-4.2.5b1/Makefile.am.remove-bind 2012-12-05 02:17:38.000000000 +0100 ++++ dhcp-4.2.5b1/Makefile.am 2012-12-17 16:20:58.693538239 +0100 +@@ -22,7 +22,13 @@ EXTRA_DIST = RELNOTES LICENSE \ + bind/Makefile bind/bind.tar.gz bind/version.tmp \ + common/tests/Atffile server/tests/Atffile + +-SUBDIRS = bind includes tests common dst omapip client dhcpctl relay server ++if BUNDLED_BIND ++SUBDIRS = bind ++else ++SUBDIRS = ++endif ++ ++SUBDIRS += includes tests common dst omapip client dhcpctl relay server + + nobase_include_HEADERS = dhcpctl/dhcpctl.h + +diff -up dhcp-4.2.5b1/omapip/Makefile.am.remove-bind dhcp-4.2.5b1/omapip/Makefile.am +--- dhcp-4.2.5b1/omapip/Makefile.am.remove-bind 2012-12-05 02:17:39.000000000 +0100 ++++ dhcp-4.2.5b1/omapip/Makefile.am 2012-12-17 16:20:58.693538239 +0100 +@@ -10,5 +10,5 @@ man_MANS = omapi.3 + EXTRA_DIST = $(man_MANS) + + svtest_SOURCES = test.c +-svtest_LDADD = libomapi.a ../bind/lib/libdns.a ../bind/lib/libisc.a ++svtest_LDADD = libomapi.a $(BIND9_LIBDIR) -ldns-export -lisc-export + +diff -up dhcp-4.2.5b1/relay/Makefile.am.remove-bind dhcp-4.2.5b1/relay/Makefile.am +--- dhcp-4.2.5b1/relay/Makefile.am.remove-bind 2012-12-05 02:17:39.000000000 +0100 ++++ dhcp-4.2.5b1/relay/Makefile.am 2012-12-17 16:20:58.694538225 +0100 +@@ -3,7 +3,7 @@ AM_CPPFLAGS = -DLOCALSTATEDIR='"@localst + sbin_PROGRAMS = dhcrelay + dhcrelay_SOURCES = dhcrelay.c + dhcrelay_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ +- ../bind/lib/libdns.a ../bind/lib/libisc.a ++ $(BIND9_LIBDIR) -ldns-export -lisc-export + man_MANS = dhcrelay.8 + EXTRA_DIST = $(man_MANS) + +diff -up dhcp-4.2.5b1/server/Makefile.am.remove-bind dhcp-4.2.5b1/server/Makefile.am +--- dhcp-4.2.5b1/server/Makefile.am.remove-bind 2012-12-05 02:17:39.000000000 +0100 ++++ dhcp-4.2.5b1/server/Makefile.am 2012-12-17 16:20:58.694538225 +0100 +@@ -14,8 +14,7 @@ dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c c + + dhcpd_CFLAGS = $(LDAP_CFLAGS) + dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ +- ../dhcpctl/libdhcpctl.a ../bind/lib/libdns.a \ +- ../bind/lib/libisc.a ++ ../dhcpctl/libdhcpctl.a $(BIND9_LIBDIR) -ldns-export -lisc-export + + man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5 + EXTRA_DIST = $(man_MANS) +diff -up dhcp-4.2.5b1/server/tests/Makefile.am.remove-bind dhcp-4.2.5b1/server/tests/Makefile.am +--- dhcp-4.2.5b1/server/tests/Makefile.am.remove-bind 2012-12-05 02:17:39.000000000 +0100 ++++ dhcp-4.2.5b1/server/tests/Makefile.am 2012-12-17 16:26:01.093346768 +0100 +@@ -18,8 +18,7 @@ DHCPSRC = ../dhcp.c ../bootp.c ../confpa + ../ldap.c ../ldap_casa.c ../dhcpd.c + + DHCPLIBS = $(top_builddir)/common/libdhcp.a $(top_builddir)/omapip/libomapi.a \ +- $(top_builddir)/dhcpctl/libdhcpctl.a $(top_builddir)/bind/lib/libdns.a \ +- $(top_builddir)/bind/lib/libisc.a ++ $(top_builddir)/dhcpctl/libdhcpctl.a $(BIND9_LIBDIR) -ldns-export -lisc-export + + ATF_TESTS = + TESTS = diff --git a/dhcp-4.2.5-rfc3442-classless-static-routes.patch b/dhcp-4.2.5-rfc3442-classless-static-routes.patch new file mode 100644 index 0000000..62a2b69 --- /dev/null +++ b/dhcp-4.2.5-rfc3442-classless-static-routes.patch @@ -0,0 +1,405 @@ +diff -up dhcp-4.2.5b1/client/clparse.c.rfc3442 dhcp-4.2.5b1/client/clparse.c +--- dhcp-4.2.5b1/client/clparse.c.rfc3442 2012-12-17 13:23:34.387564654 +0100 ++++ dhcp-4.2.5b1/client/clparse.c 2012-12-17 13:23:34.437563996 +0100 +@@ -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.5b1/common/dhcp-options.5.rfc3442 dhcp-4.2.5b1/common/dhcp-options.5 +--- dhcp-4.2.5b1/common/dhcp-options.5.rfc3442 2012-12-17 13:23:34.376564797 +0100 ++++ dhcp-4.2.5b1/common/dhcp-options.5 2012-12-17 13:25:18.435141385 +0100 +@@ -116,6 +116,26 @@ hexadecimal, separated by colons. For e + 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 +@@ -932,6 +952,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.5b1/common/inet.c.rfc3442 dhcp-4.2.5b1/common/inet.c +--- dhcp-4.2.5b1/common/inet.c.rfc3442 2012-12-05 02:17:38.000000000 +0100 ++++ dhcp-4.2.5b1/common/inet.c 2012-12-17 13:23:34.440563957 +0100 +@@ -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 ""; ++ } ++ 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.5b1/common/options.c.rfc3442 dhcp-4.2.5b1/common/options.c +--- dhcp-4.2.5b1/common/options.c.rfc3442 2012-12-05 02:17:38.000000000 +0100 ++++ dhcp-4.2.5b1/common/options.c 2012-12-17 13:29:38.961536040 +0100 +@@ -713,7 +713,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; +@@ -1694,6 +1698,7 @@ const char *pretty_print_option (option, + unsigned long tval; + isc_boolean_t a_array = ISC_FALSE; + int len_used; ++ unsigned int octets = 0; + + if (emit_commas) + comma = ','; +@@ -1702,6 +1707,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) +@@ -1876,6 +1882,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++) { + if ((a_array == ISC_TRUE) && (i != 0) && (numelem > 0)) { +@@ -2031,6 +2064,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 ""; ++ } ++ ++ 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.5b1/common/parse.c.rfc3442 dhcp-4.2.5b1/common/parse.c +--- dhcp-4.2.5b1/common/parse.c.rfc3442 2012-12-17 13:23:34.408564378 +0100 ++++ dhcp-4.2.5b1/common/parse.c 2012-12-17 13:23:34.444563905 +0100 +@@ -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 +@@ -719,8 +752,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, +@@ -1660,6 +1695,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; +@@ -5418,6 +5456,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; +@@ -5695,6 +5742,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.5b1/common/tables.c.rfc3442 dhcp-4.2.5b1/common/tables.c +--- dhcp-4.2.5b1/common/tables.c.rfc3442 2012-12-17 13:23:34.398564508 +0100 ++++ dhcp-4.2.5b1/common/tables.c 2012-12-17 13:23:34.445563891 +0100 +@@ -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 +@@ -210,6 +211,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.5b1/includes/dhcpd.h.rfc3442 dhcp-4.2.5b1/includes/dhcpd.h +--- dhcp-4.2.5b1/includes/dhcpd.h.rfc3442 2012-12-17 13:23:34.382564719 +0100 ++++ dhcp-4.2.5b1/includes/dhcpd.h 2012-12-17 13:23:34.446563877 +0100 +@@ -2678,6 +2678,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 *); +@@ -2887,6 +2888,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.5b1/includes/dhcp.h.rfc3442 dhcp-4.2.5b1/includes/dhcp.h +--- dhcp-4.2.5b1/includes/dhcp.h.rfc3442 2012-10-23 21:02:13.000000000 +0200 ++++ dhcp-4.2.5b1/includes/dhcp.h 2012-12-17 13:23:34.446563877 +0100 +@@ -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.5b1/includes/dhctoken.h.rfc3442 dhcp-4.2.5b1/includes/dhctoken.h +--- dhcp-4.2.5b1/includes/dhctoken.h.rfc3442 2012-12-17 13:23:34.348565167 +0100 ++++ dhcp-4.2.5b1/includes/dhctoken.h 2012-12-17 13:23:34.446563877 +0100 +@@ -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-4.2.5-rfc5970-dhcpv6-options-for-network-boot.patch b/dhcp-4.2.5-rfc5970-dhcpv6-options-for-network-boot.patch new file mode 100644 index 0000000..3b844e0 --- /dev/null +++ b/dhcp-4.2.5-rfc5970-dhcpv6-options-for-network-boot.patch @@ -0,0 +1,89 @@ +diff -up dhcp-4.2.5b1/common/dhcp-options.5.rfc5970 dhcp-4.2.5b1/common/dhcp-options.5 +--- dhcp-4.2.5b1/common/dhcp-options.5.rfc5970 2012-12-17 13:43:44.000000000 +0100 ++++ dhcp-4.2.5b1/common/dhcp-options.5 2012-12-17 13:45:18.777638579 +0100 +@@ -1771,7 +1771,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.5b1/common/tables.c.rfc5970 dhcp-4.2.5b1/common/tables.c +--- dhcp-4.2.5b1/common/tables.c.rfc5970 2012-12-17 13:43:44.204939024 +0100 ++++ dhcp-4.2.5b1/common/tables.c 2012-12-17 13:43:44.286937948 +0100 +@@ -463,6 +463,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.5b1/includes/dhcp6.h.rfc5970 dhcp-4.2.5b1/includes/dhcp6.h +--- dhcp-4.2.5b1/includes/dhcp6.h.rfc5970 2012-12-04 20:45:42.000000000 +0100 ++++ dhcp-4.2.5b1/includes/dhcp6.h 2012-12-17 13:43:44.286937948 +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-4.2.5-sendDecline.patch b/dhcp-4.2.5-sendDecline.patch new file mode 100644 index 0000000..0853730 --- /dev/null +++ b/dhcp-4.2.5-sendDecline.patch @@ -0,0 +1,231 @@ +diff -up dhcp-4.2.5b1/client/dhc6.c.sendDecline dhcp-4.2.5b1/client/dhc6.c +--- dhcp-4.2.5b1/client/dhc6.c.sendDecline 2012-12-05 02:17:38.000000000 +0100 ++++ dhcp-4.2.5b1/client/dhc6.c 2012-12-17 13:21:16.922444939 +0100 +@@ -96,6 +96,8 @@ void do_select6(void *input); + void do_refresh6(void *input); + static void do_release6(void *input); + static void start_bound(struct client_state *client); ++static void start_decline6(struct client_state *client); ++static void do_decline6(void *input); + static void start_informed(struct client_state *client); + void informed_handler(struct packet *packet, struct client_state *client); + void bound_handler(struct packet *packet, struct client_state *client); +@@ -2080,6 +2082,7 @@ start_release6(struct client_state *clie + cancel_timeout(do_select6, client); + cancel_timeout(do_refresh6, client); + cancel_timeout(do_release6, client); ++ cancel_timeout(do_decline6, client); + client->state = S_STOPPED; + + /* +@@ -2713,6 +2716,7 @@ dhc6_check_reply(struct client_state *cl + break; + + case S_STOPPED: ++ case S_DECLINED: + action = dhc6_stop_action; + break; + +@@ -2814,6 +2818,7 @@ dhc6_check_reply(struct client_state *cl + break; + + case S_STOPPED: ++ case S_DECLINED: + /* Nothing critical to do at this stage. */ + break; + +@@ -3804,17 +3809,23 @@ reply_handler(struct packet *packet, str + cancel_timeout(do_select6, client); + cancel_timeout(do_refresh6, client); + cancel_timeout(do_release6, client); ++ cancel_timeout(do_decline6, client); + + /* If this is in response to a Release/Decline, clean up and return. */ +- if (client->state == S_STOPPED) { +- if (client->active_lease == NULL) +- return; ++ if ((client->state == S_STOPPED) || ++ (client->state == S_DECLINED)) { ++ ++ if (client->active_lease != NULL) { ++ dhc6_lease_destroy(&client->active_lease, MDL); ++ client->active_lease = NULL; ++ /* We should never wait for nothing!? */ ++ if (stopping_finished()) ++ exit(0); ++ } ++ ++ if (client->state == S_DECLINED) ++ start_init6(client); + +- dhc6_lease_destroy(&client->active_lease, MDL); +- client->active_lease = NULL; +- /* We should never wait for nothing!? */ +- if (stopping_finished()) +- exit(0); + return; + } + +@@ -4342,7 +4353,11 @@ start_bound(struct client_state *client) + dhc6_marshall_values("new_", client, lease, ia, addr); + script_write_requested6(client); + +- script_go(client); ++ // when script returns 3, DAD failed ++ if (script_go(client) == 3) { ++ start_decline6(client); ++ return; ++ } + } + + /* XXX: maybe we should loop on the old values instead? */ +@@ -4390,6 +4405,149 @@ start_bound(struct client_state *client) + dhc6_check_times(client); + } + ++/* ++ * Decline addresses. ++ */ ++void ++start_decline6(struct client_state *client) ++{ ++ /* Cancel any pending transmissions */ ++ cancel_timeout(do_confirm6, client); ++ cancel_timeout(do_select6, client); ++ cancel_timeout(do_refresh6, client); ++ cancel_timeout(do_release6, client); ++ cancel_timeout(do_decline6, client); ++ client->state = S_DECLINED; ++ ++ if (client->active_lease == NULL) ++ return; ++ ++ /* Set timers per RFC3315 section 18.1.7. */ ++ client->IRT = DEC_TIMEOUT * 100; ++ client->MRT = 0; ++ client->MRC = DEC_MAX_RC; ++ client->MRD = 0; ++ ++ dhc6_retrans_init(client); ++ client->v6_handler = reply_handler; ++ ++ client->refresh_type = DHCPV6_DECLINE; ++ do_decline6(client); ++} ++ ++/* ++ * do_decline6() creates a Decline packet and transmits it. ++ */ ++static void ++do_decline6(void *input) ++{ ++ struct client_state *client; ++ struct data_string ds; ++ int send_ret; ++ struct timeval elapsed, tv; ++ ++ client = input; ++ ++ if ((client->active_lease == NULL) || !active_prefix(client)) ++ return; ++ ++ if ((client->MRC != 0) && (client->txcount > client->MRC)) { ++ log_info("Max retransmission count exceeded."); ++ goto decline_done; ++ } ++ ++ /* ++ * Start_time starts at the first transmission. ++ */ ++ if (client->txcount == 0) { ++ client->start_time.tv_sec = cur_tv.tv_sec; ++ client->start_time.tv_usec = cur_tv.tv_usec; ++ } ++ ++ /* elapsed = cur - start */ ++ elapsed.tv_sec = cur_tv.tv_sec - client->start_time.tv_sec; ++ elapsed.tv_usec = cur_tv.tv_usec - client->start_time.tv_usec; ++ if (elapsed.tv_usec < 0) { ++ elapsed.tv_sec -= 1; ++ elapsed.tv_usec += 1000000; ++ } ++ ++ memset(&ds, 0, sizeof(ds)); ++ if (!buffer_allocate(&ds.buffer, 4, MDL)) { ++ log_error("Unable to allocate memory for Decline."); ++ goto decline_done; ++ } ++ ++ ds.data = ds.buffer->data; ++ ds.len = 4; ++ ds.buffer->data[0] = DHCPV6_DECLINE; ++ memcpy(ds.buffer->data + 1, client->dhcpv6_transaction_id, 3); ++ ++ /* Form an elapsed option. */ ++ /* Maximum value is 65535 1/100s coded as 0xffff. */ ++ if ((elapsed.tv_sec < 0) || (elapsed.tv_sec > 655) || ++ ((elapsed.tv_sec == 655) && (elapsed.tv_usec > 350000))) { ++ client->elapsed = 0xffff; ++ } else { ++ client->elapsed = elapsed.tv_sec * 100; ++ client->elapsed += elapsed.tv_usec / 10000; ++ } ++ ++ client->elapsed = htons(client->elapsed); ++ ++ log_debug("XMT: Forming Decline."); ++ make_client6_options(client, &client->sent_options, ++ client->active_lease, DHCPV6_DECLINE); ++ dhcpv6_universe.encapsulate(&ds, NULL, NULL, client, NULL, ++ client->sent_options, &global_scope, ++ &dhcpv6_universe); ++ ++ /* Append IA's (but don't release temporary addresses). */ ++ if (wanted_ia_na && ++ dhc6_add_ia_na(client, &ds, client->active_lease, ++ DHCPV6_DECLINE) != ISC_R_SUCCESS) { ++ data_string_forget(&ds, MDL); ++ goto decline_done; ++ } ++ if (wanted_ia_pd && ++ dhc6_add_ia_pd(client, &ds, client->active_lease, ++ DHCPV6_DECLINE) != ISC_R_SUCCESS) { ++ data_string_forget(&ds, MDL); ++ goto decline_done; ++ } ++ ++ /* Transmit and wait. */ ++ log_info("XMT: Decline on %s, interval %ld0ms.", ++ client->name ? client->name : client->interface->name, ++ (long int)client->RT); ++ ++ send_ret = send_packet6(client->interface, ds.data, ds.len, ++ &DHCPv6DestAddr); ++ if (send_ret != ds.len) { ++ log_error("dhc6: sendpacket6() sent %d of %d bytes", ++ send_ret, ds.len); ++ } ++ ++ data_string_forget(&ds, MDL); ++ ++ /* Wait RT */ ++ tv.tv_sec = cur_tv.tv_sec + client->RT / 100; ++ tv.tv_usec = cur_tv.tv_usec + (client->RT % 100) * 10000; ++ if (tv.tv_usec >= 1000000) { ++ tv.tv_sec += 1; ++ tv.tv_usec -= 1000000; ++ } ++ add_timeout(&tv, do_decline6, client, NULL, NULL); ++ dhc6_retrans_advance(client); ++ return; ++ ++decline_done: ++ dhc6_lease_destroy(&client->active_lease, MDL); ++ client->active_lease = NULL; ++ start_init6(client); ++ return; ++} ++ + /* While bound, ignore packets. In the future we'll want to answer + * Reconfigure-Request messages and the like. + */ diff --git a/dhcp-4.2.5-sharedlib.patch b/dhcp-4.2.5-sharedlib.patch new file mode 100644 index 0000000..d543ab7 --- /dev/null +++ b/dhcp-4.2.5-sharedlib.patch @@ -0,0 +1,120 @@ +diff -up dhcp-4.2.5b1/client/Makefile.am.sharedlib dhcp-4.2.5b1/client/Makefile.am +--- dhcp-4.2.5b1/client/Makefile.am.sharedlib 2012-12-17 16:26:53.350623790 +0100 ++++ dhcp-4.2.5b1/client/Makefile.am 2012-12-17 16:26:53.384623342 +0100 +@@ -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 +-dhclient_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ ++dhclient_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \ + $(BIND9_LIBDIR) -ldns-export -lisc-export $(CAPNG_LDADD) + man_MANS = dhclient.8 dhclient-script.8 dhclient.conf.5 dhclient.leases.5 + EXTRA_DIST = $(man_MANS) +diff -up dhcp-4.2.5b1/common/tests/Makefile.am.sharedlib dhcp-4.2.5b1/common/tests/Makefile.am +--- dhcp-4.2.5b1/common/tests/Makefile.am.sharedlib 2012-12-17 16:26:53.271624835 +0100 ++++ dhcp-4.2.5b1/common/tests/Makefile.am 2012-12-17 16:26:53.384623342 +0100 +@@ -13,7 +13,7 @@ ATF_TESTS += alloc_unittest + alloc_unittest_SOURCES = test_alloc.c $(top_srcdir)/tests/t_api_dhcp.c + alloc_unittest_LDADD = $(ATF_LDFLAGS) + alloc_unittest_LDADD += ../libdhcp.a \ +- ../../omapip/libomapi.a \ ++ ../../omapip/libomapi.la \ + $(BIND9_LIBDIR) -ldns-export -lisc-export + + check: $(ATF_TESTS) +diff -up dhcp-4.2.5b1/configure.ac.sharedlib dhcp-4.2.5b1/configure.ac +--- dhcp-4.2.5b1/configure.ac.sharedlib 2012-12-17 16:26:53.350623790 +0100 ++++ dhcp-4.2.5b1/configure.ac 2012-12-17 16:26:53.384623342 +0100 +@@ -37,7 +37,8 @@ fi + # Use this to define _GNU_SOURCE to pull in the IPv6 Advanced Socket API. + AC_USE_SYSTEM_EXTENSIONS + +-AC_PROG_RANLIB ++# Use libtool to simplify building of shared libraries ++AC_PROG_LIBTOOL + AC_CONFIG_HEADERS([includes/config.h]) + + # we sometimes need to know byte order for building packets +diff -up dhcp-4.2.5b1/dhcpctl/Makefile.am.sharedlib dhcp-4.2.5b1/dhcpctl/Makefile.am +--- dhcp-4.2.5b1/dhcpctl/Makefile.am.sharedlib 2012-12-17 16:26:53.271624835 +0100 ++++ dhcp-4.2.5b1/dhcpctl/Makefile.am 2012-12-17 16:26:53.385623329 +0100 +@@ -1,15 +1,15 @@ + bin_PROGRAMS = omshell +-lib_LIBRARIES = libdhcpctl.a ++lib_LTLIBRARIES = libdhcpctl.la + noinst_PROGRAMS = cltest + man_MANS = omshell.1 dhcpctl.3 + EXTRA_DIST = $(man_MANS) + + omshell_SOURCES = omshell.c +-omshell_LDADD = libdhcpctl.a ../common/libdhcp.a ../omapip/libomapi.a \ ++omshell_LDADD = libdhcpctl.la ../common/libdhcp.a ../omapip/libomapi.la \ + $(BIND9_LIBDIR) -ldns-export -lisc-export + +-libdhcpctl_a_SOURCES = dhcpctl.c callback.c remote.c ++libdhcpctl_la_SOURCES = dhcpctl.c callback.c remote.c + + cltest_SOURCES = cltest.c +-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.5b1/omapip/Makefile.am.sharedlib dhcp-4.2.5b1/omapip/Makefile.am +--- dhcp-4.2.5b1/omapip/Makefile.am.sharedlib 2012-12-17 16:26:53.272624822 +0100 ++++ dhcp-4.2.5b1/omapip/Makefile.am 2012-12-17 16:26:53.385623329 +0100 +@@ -1,7 +1,7 @@ +-lib_LIBRARIES = libomapi.a ++lib_LTLIBRARIES = libomapi.la + noinst_PROGRAMS = svtest + +-libomapi_a_SOURCES = protocol.c buffer.c alloc.c result.c connection.c \ ++libomapi_la_SOURCES = protocol.c buffer.c alloc.c result.c connection.c \ + errwarn.c listener.c dispatch.c generic.c support.c \ + handle.c message.c convert.c hash.c auth.c inet_addr.c \ + array.c trace.c toisc.c iscprint.c isclib.c +@@ -10,5 +10,5 @@ man_MANS = omapi.3 + EXTRA_DIST = $(man_MANS) + + svtest_SOURCES = test.c +-svtest_LDADD = libomapi.a $(BIND9_LIBDIR) -ldns-export -lisc-export ++svtest_LDADD = libomapi.la $(BIND9_LIBDIR) -ldns-export -lisc-export + +diff -up dhcp-4.2.5b1/relay/Makefile.am.sharedlib dhcp-4.2.5b1/relay/Makefile.am +--- dhcp-4.2.5b1/relay/Makefile.am.sharedlib 2012-12-17 16:26:53.351623777 +0100 ++++ dhcp-4.2.5b1/relay/Makefile.am 2012-12-17 16:26:53.385623329 +0100 +@@ -2,7 +2,7 @@ AM_CPPFLAGS = -DLOCALSTATEDIR='"@localst + + sbin_PROGRAMS = dhcrelay + dhcrelay_SOURCES = dhcrelay.c +-dhcrelay_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ ++dhcrelay_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \ + $(BIND9_LIBDIR) -ldns-export -lisc-export $(CAPNG_LDADD) + man_MANS = dhcrelay.8 + EXTRA_DIST = $(man_MANS) +diff -up dhcp-4.2.5b1/server/Makefile.am.sharedlib dhcp-4.2.5b1/server/Makefile.am +--- dhcp-4.2.5b1/server/Makefile.am.sharedlib 2012-12-17 16:26:53.272624822 +0100 ++++ dhcp-4.2.5b1/server/Makefile.am 2012-12-17 16:26:53.385623329 +0100 +@@ -13,8 +13,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 ++dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \ ++ ../dhcpctl/libdhcpctl.la $(BIND9_LIBDIR) -ldns-export -lisc-export + + man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5 + EXTRA_DIST = $(man_MANS) +diff -up dhcp-4.2.5b1/server/tests/Makefile.am.sharedlib dhcp-4.2.5b1/server/tests/Makefile.am +--- dhcp-4.2.5b1/server/tests/Makefile.am.sharedlib 2012-12-17 16:26:53.000000000 +0100 ++++ dhcp-4.2.5b1/server/tests/Makefile.am 2012-12-17 16:28:25.898349545 +0100 +@@ -17,8 +17,8 @@ DHCPSRC = ../dhcp.c ../bootp.c ../confpa + ../ddns.c ../dhcpleasequery.c ../dhcpv6.c ../mdb6.c \ + ../ldap.c ../ldap_casa.c ../dhcpd.c + +-DHCPLIBS = $(top_builddir)/common/libdhcp.a $(top_builddir)/omapip/libomapi.a \ +- $(top_builddir)/dhcpctl/libdhcpctl.a $(BIND9_LIBDIR) -ldns-export -lisc-export ++DHCPLIBS = $(top_builddir)/common/libdhcp.a $(top_builddir)/omapip/libomapi.la \ ++ $(top_builddir)/dhcpctl/libdhcpctl.la $(BIND9_LIBDIR) -ldns-export -lisc-export + + ATF_TESTS = + TESTS = diff --git a/dhcp-4.2.5-systemtap.patch b/dhcp-4.2.5-systemtap.patch new file mode 100644 index 0000000..ad774ad --- /dev/null +++ b/dhcp-4.2.5-systemtap.patch @@ -0,0 +1,822 @@ +diff -up dhcp-4.2.5b1/configure.ac.systemtap dhcp-4.2.5b1/configure.ac +--- dhcp-4.2.5b1/configure.ac.systemtap 2012-12-17 16:56:40.563881316 +0100 ++++ dhcp-4.2.5b1/configure.ac 2012-12-17 16:56:40.597880870 +0100 +@@ -554,6 +554,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]) +@@ -701,6 +730,7 @@ AC_OUTPUT([ + tests/Makefile + server/tests/Makefile + doc/devel/doxyfile ++ tapset/Makefile + ]) + + sh util/bindvar.sh +diff -up dhcp-4.2.5b1/Makefile.am.systemtap dhcp-4.2.5b1/Makefile.am +--- dhcp-4.2.5b1/Makefile.am.systemtap 2012-12-17 16:56:40.461882654 +0100 ++++ dhcp-4.2.5b1/Makefile.am 2012-12-17 16:56:40.597880870 +0100 +@@ -30,5 +30,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.5b1/server/dhcp.c.systemtap dhcp-4.2.5b1/server/dhcp.c +--- dhcp-4.2.5b1/server/dhcp.c.systemtap 2012-12-17 16:56:40.483882364 +0100 ++++ dhcp-4.2.5b1/server/dhcp.c 2012-12-17 16:56:40.599880842 +0100 +@@ -36,7 +36,7 @@ + #include + #include + #include +- ++#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); +@@ -700,6 +706,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) +@@ -718,6 +727,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, +@@ -842,6 +852,8 @@ void dhcprelease (packet, ms_nulltp) + #endif + if (lease) + lease_dereference (&lease, MDL); ++ ++ TRACE(DHCPD_RELEASE_DONE()); + } + + void dhcpdecline (packet, ms_nulltp) +@@ -859,6 +871,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))) +@@ -970,6 +984,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) +@@ -993,6 +1009,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. */ +@@ -1350,6 +1368,8 @@ void dhcpinform (packet, ms_nulltp) + + if (subnet) + subnet_dereference (&subnet, MDL); ++ ++ TRACE(DHCPD_INFORM_DONE()); + } + + void nak_lease (packet, cip) +@@ -1366,6 +1386,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); +@@ -1532,6 +1554,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) +@@ -1573,6 +1596,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; + +@@ -2936,6 +2961,8 @@ void ack_lease (packet, lease, offer, wh + #endif + dhcp_reply(lease); + } ++ ++ TRACE(DHCPD_ACK_LEASE_DONE()); + } + + /* +@@ -3088,6 +3115,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); +@@ -3309,6 +3338,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, +@@ -3331,6 +3362,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) { +@@ -4058,6 +4091,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.5b1/server/dhcpd.c.systemtap dhcp-4.2.5b1/server/dhcpd.c +--- dhcp-4.2.5b1/server/dhcpd.c.systemtap 2012-12-17 16:56:40.578881119 +0100 ++++ dhcp-4.2.5b1/server/dhcpd.c 2012-12-17 16:56:40.599880842 +0100 +@@ -58,6 +58,8 @@ static const char url [] = + # undef group + #endif /* PARANOIA */ + ++#include "trace.h" ++ + #ifndef UNIT_TEST + static void usage(void); + #endif +@@ -865,6 +867,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.5b1/server/dhcpv6.c.systemtap dhcp-4.2.5b1/server/dhcpv6.c +--- dhcp-4.2.5b1/server/dhcpv6.c.systemtap 2012-12-17 16:56:40.571881210 +0100 ++++ dhcp-4.2.5b1/server/dhcpv6.c 2012-12-17 16:56:40.601880816 +0100 +@@ -15,6 +15,7 @@ + */ + + #include "dhcpd.h" ++#include "trace.h" + + #ifdef DHCPv6 + +@@ -4212,6 +4213,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. + */ +@@ -4225,6 +4228,8 @@ dhcpv6_solicit(struct data_string *reply + * Clean up. + */ + data_string_forget(&client_id, MDL); ++ ++ TRACE(DHCPD_6_SOLICIT_DONE()); + } + + /* +@@ -4238,6 +4243,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. + */ +@@ -4255,6 +4262,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. +@@ -4367,6 +4376,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. + */ +@@ -4553,6 +4564,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()); + } + + /* +@@ -4567,6 +4580,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. + */ +@@ -4584,6 +4599,8 @@ dhcpv6_renew(struct data_string *reply, + */ + data_string_forget(&server_id, MDL); + data_string_forget(&client_id, MDL); ++ ++ TRACE(DHCPD_6_RENEW_DONE()); + } + + /* +@@ -4597,6 +4614,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; + } +@@ -4604,6 +4623,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 +@@ -5048,6 +5069,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. + */ +@@ -5068,6 +5091,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 +@@ -5516,6 +5541,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. + */ +@@ -5537,6 +5564,8 @@ dhcpv6_release(struct data_string *reply + + data_string_forget(&server_id, MDL); + data_string_forget(&client_id, MDL); ++ ++ TRACE(DHCPD_6_RELEASE_DONE()); + } + + /* +@@ -5549,6 +5578,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. + */ +@@ -5580,6 +5611,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()); + } + + /* +@@ -5608,6 +5641,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. + */ +@@ -5867,6 +5902,8 @@ exit: + if (enc_packet != NULL) { + packet_dereference(&enc_packet, MDL); + } ++ ++ TRACE(DHCPD_6_RELAY_FORW_DONE()); + } + + static void +diff -up dhcp-4.2.5b1/server/failover.c.systemtap dhcp-4.2.5b1/server/failover.c +--- dhcp-4.2.5b1/server/failover.c.systemtap 2012-12-05 02:17:39.000000000 +0100 ++++ dhcp-4.2.5b1/server/failover.c 2012-12-17 16:56:40.603880790 +0100 +@@ -36,6 +36,8 @@ + #include "dhcpd.h" + #include + ++#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.5b1/server/Makefile.am.systemtap dhcp-4.2.5b1/server/Makefile.am +--- dhcp-4.2.5b1/server/Makefile.am.systemtap 2012-12-17 16:56:40.563881316 +0100 ++++ dhcp-4.2.5b1/server/Makefile.am 2012-12-17 16:56:40.603880790 +0100 +@@ -10,7 +10,7 @@ dist_sysconf_DATA = dhcpd.conf.example + 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 \ +@@ -19,3 +19,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.5b1/server/probes.d.systemtap dhcp-4.2.5b1/server/probes.d +--- dhcp-4.2.5b1/server/probes.d.systemtap 2012-12-17 16:56:40.603880790 +0100 ++++ dhcp-4.2.5b1/server/probes.d 2012-12-17 16:56:40.603880790 +0100 +@@ -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.5b1/server/tests/Makefile.am.systemtap dhcp-4.2.5b1/server/tests/Makefile.am +--- dhcp-4.2.5b1/server/tests/Makefile.am.systemtap 2012-12-17 16:56:40.564881302 +0100 ++++ dhcp-4.2.5b1/server/tests/Makefile.am 2012-12-17 16:56:57.505650518 +0100 +@@ -20,6 +20,10 @@ DHCPSRC = ../dhcp.c ../bootp.c ../confpa + DHCPLIBS = $(top_builddir)/common/libdhcp.a $(top_builddir)/omapip/libomapi.la \ + $(top_builddir)/dhcpctl/libdhcpctl.la $(BIND9_LIBDIR) -ldns-export -lisc-export + ++if ENABLE_SYSTEMTAP ++DHCPLIBS += ../probes.o ++endif ++ + ATF_TESTS = + TESTS = + if HAVE_ATF +diff -up dhcp-4.2.5b1/server/trace.h.systemtap dhcp-4.2.5b1/server/trace.h +--- dhcp-4.2.5b1/server/trace.h.systemtap 2012-12-17 16:56:40.604880777 +0100 ++++ dhcp-4.2.5b1/server/trace.h 2012-12-17 16:56:40.604880777 +0100 +@@ -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.5b1/tapset/dhcpd.stp.systemtap dhcp-4.2.5b1/tapset/dhcpd.stp +--- dhcp-4.2.5b1/tapset/dhcpd.stp.systemtap 2012-12-17 16:56:40.604880777 +0100 ++++ dhcp-4.2.5b1/tapset/dhcpd.stp 2012-12-17 16:56:40.604880777 +0100 +@@ -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.5b1/tapset/Makefile.am.systemtap dhcp-4.2.5b1/tapset/Makefile.am +--- dhcp-4.2.5b1/tapset/Makefile.am.systemtap 2012-12-17 16:56:40.604880777 +0100 ++++ dhcp-4.2.5b1/tapset/Makefile.am 2012-12-17 16:56:40.604880777 +0100 +@@ -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.spec b/dhcp.spec index aa44e50..ef7acbc 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -8,17 +8,17 @@ %global dhcpconfdir %{_sysconfdir}/dhcp -%global patchver P2 +#%%global patchver P2 #%%global prever rc2 -%global VERSION %{version}-%{patchver} +#%%global VERSION %{version}-%{patchver} #%%global VERSION %{version}%{prever} -#%%global VERSION %{version} +%global VERSION %{version} Summary: Dynamic host configuration protocol software Name: dhcp -Version: 4.2.4 -Release: 19.%{patchver}%{?dist} +Version: 4.2.5 +Release: 1%{?dist} # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # dcantrell maintaining the package) made incorrect use of the epoch and # that's why it is at 12 now. It should have never been used, but it was. @@ -37,7 +37,6 @@ Source6: dhcpd.service Source7: dhcpd6.service Source8: dhcrelay.service - Patch0: dhcp-4.2.0-errwarn-message.patch Patch1: dhcp-4.2.4-dhclient-options.patch Patch2: dhcp-4.2.0-release-by-ifup.patch @@ -45,7 +44,7 @@ Patch3: dhcp-4.2.0-dhclient-decline-backoff.patch Patch4: dhcp-4.2.4-unicast-bootp.patch Patch7: dhcp-4.2.0-default-requested-options.patch Patch8: dhcp-4.2.2-xen-checksum.patch -Patch10: dhcp-4.2.1-manpages.patch +Patch10: dhcp-4.2.5-manpages.patch Patch11: dhcp-4.2.4-paths.patch Patch12: dhcp-4.2.2-CLOEXEC.patch Patch14: dhcp-4.2.0-garbage-chars.patch @@ -55,25 +54,25 @@ Patch18: dhcp-4.2.4-64_bit_lease_parse.patch Patch19: dhcp-4.2.2-capability.patch Patch20: dhcp-4.2.0-logpid.patch Patch21: dhcp-4.2.4-UseMulticast.patch -Patch22: dhcp-4.2.1-sendDecline.patch +Patch22: dhcp-4.2.5-sendDecline.patch Patch23: dhcp-4.2.1-retransmission.patch -Patch25: dhcp-4.2.4-rfc3442-classless-static-routes.patch +Patch25: dhcp-4.2.5-rfc3442-classless-static-routes.patch Patch27: dhcp-4.2.0-honor-expired.patch -Patch29: dhcp-4.2.2-remove-bind.patch -Patch30: dhcp-4.2.2-sharedlib.patch -Patch31: dhcp-4.2.4-PPP.patch +Patch28: dhcp-4.2.5-remove-bind.patch +Patch29: dhcp-4.2.4-P1-remove-dst.patch +Patch30: dhcp-4.2.5-sharedlib.patch +Patch31: dhcp-4.2.5-PPP.patch Patch32: dhcp-4.2.3-paranoia.patch -Patch33: dhcp-4.2.4-lpf-ib.patch +Patch33: dhcp-4.2.5-lpf-ib.patch Patch34: dhcp-4.2.4-improved-xid.patch Patch35: dhcp-4.2.2-gpxe-cid.patch -Patch36: dhcp-4.2.4-systemtap.patch +Patch36: dhcp-4.2.5-systemtap.patch Patch37: dhcp-4.2.3-dhclient-decline-onetry.patch Patch38: dhcp-4.2.3-P2-log_perror.patch Patch39: dhcp-4.2.4-getifaddrs.patch Patch40: dhcp-4.2.4-send_release.patch -Patch41: dhcp-4.2.3-P2-rfc5970-dhcpv6-options-for-network-boot.patch +Patch41: dhcp-4.2.5-rfc5970-dhcpv6-options-for-network-boot.patch Patch42: dhcp-4.2.4-failOverPeer.patch -Patch43: dhcp-4.2.4-P1-dhclient6-leases_semicolon_expected.patch Patch44: dhcp-4.2.4-P1-interval.patch Patch45: dhcp-4.2.4-P2-conflex-do-forward-updates.patch @@ -170,8 +169,16 @@ libdhcpctl and libomapi static libraries are also included in this package. # Remove bundled BIND source rm bind/bind.tar.gz +# Remove libdst +rm -rf dst/ +rm -rf includes/isc-dhcp + # Fire away bundled BIND source. -%patch29 -p1 -b .remove-bind %{?_rawbuild} +%patch28 -p1 -b .remove-bind %{?_rawbuild} + +# Fire away libdst +# (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #30692]) +%patch29 -p1 -b .remove-dst %{?_rawbuild} # Replace the standard ISC warning message about requesting help with an # explanation that this is a patched build of ISC DHCP and bugs should be @@ -266,8 +273,8 @@ rm bind/bind.tar.gz # DHCPv6 over PPP support (#626514) %patch31 -p1 -b .PPP -# Write PID file BEFORE changing of the effective user/group ID. -# (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #25806]) +# dhcpd: BEFORE changing of the effective user/group ID: +# - write PID file (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #25806]) %patch32 -p1 -b .paranoia # IPoIB support (#660681) @@ -303,17 +310,13 @@ rm bind/bind.tar.gz # (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #30402]) %patch42 -p1 -b .failOverPeer -# Dhclient does not correctly parse zero-length options in dhclient6.leases (#633318) -# (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #27314]) -%patch43 -p1 -b .dhclient6-leases_semicolon - # isc_time_nowplusinterval() is not safe with 64-bit time_t (#662254, #789601) # (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #28038]) %patch44 -p1 -b .interval # do-forward-updates statement wasn't recognized (#863646) # (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #31328]) -%patch45 -p1 -b .forward-updates.patch +%patch45 -p1 -b .forward-updates pushd contrib %{__chmod} -x 3.0b1-lease-convert dhclient-tz-exithook.sh ldap/dhcpd-conf-to-ldap @@ -371,9 +374,9 @@ CFLAGS="%{optflags} -fno-strict-aliasing" \ %install %{__make} install DESTDIR=%{buildroot} -# Remove files we don't want -%{__rm} -f %{buildroot}%{_sysconfdir}/dhclient.conf -%{__rm} -f %{buildroot}%{_sysconfdir}/dhcpd.conf +# We don't want example conf files in /etc +%{__rm} -f %{buildroot}%{_sysconfdir}/dhclient.conf.example +%{__rm} -f %{buildroot}%{_sysconfdir}/dhcpd.conf.example # dhclient-script %{__mkdir} -p %{buildroot}%{_sbindir} @@ -428,10 +431,8 @@ DHCPDARGS="" EOF # Copy sample conf files into position (called by doc macro) -%{__cp} -p client/dhclient.conf dhclient.conf.sample -%{__cp} -p server/dhcpd.conf dhcpd.conf.sample -%{__cp} -p doc/examples/dhclient-dhcpv6.conf dhclient6.conf.sample -%{__cp} -p doc/examples/dhcpd-dhcpv6.conf dhcpd6.conf.sample +%{__cp} -p doc/examples/dhclient-dhcpv6.conf client/dhclient6.conf.example +%{__cp} -p doc/examples/dhcpd-dhcpv6.conf server/dhcpd6.conf.example # Install default (empty) dhcpd.conf: %{__mkdir} -p %{buildroot}%{dhcpconfdir} @@ -513,7 +514,7 @@ fi %files -%doc dhcpd.conf.sample dhcpd6.conf.sample +%doc server/dhcpd.conf.example server/dhcpd6.conf.example %doc contrib/* %attr(0750,root,root) %dir %{dhcpconfdir} %attr(0755,dhcpd,dhcpd) %dir %{_localstatedir}/lib/dhcpd @@ -544,7 +545,7 @@ fi %endif %files -n dhclient -%doc dhclient.conf.sample dhclient6.conf.sample README.dhclient.d +%doc client/dhclient.conf.example client/dhclient6.conf.example README.dhclient.d %attr(0750,root,root) %dir %{dhcpconfdir} %dir %{dhcpconfdir}/dhclient.d %dir %{_localstatedir}/lib/dhclient @@ -567,21 +568,22 @@ fi %files libs %{_libdir}/libdhcpctl.so.* %{_libdir}/libomapi.so.* -%{_libdir}/libdst.so.* %files devel %doc doc/IANA-arp-parameters doc/api+protocol %{_includedir}/dhcpctl -%{_includedir}/isc-dhcp %{_includedir}/omapip %{_libdir}/libdhcpctl.so %{_libdir}/libomapi.so -%{_libdir}/libdst.so %attr(0644,root,root) %{_mandir}/man3/dhcpctl.3.gz %attr(0644,root,root) %{_mandir}/man3/omapi.3.gz %changelog +* Thu Jan 10 2013 Jiri Popelka - 12:4.2.5-1 +- 4.2.5 +- don't build libdst, it hasn't been used since 4.2.0 (#849166) + * Fri Nov 30 2012 Jiri Popelka - 12:4.2.4-19.P2 - fix two resource leaks in lpf-ib.patch diff --git a/sources b/sources index 3b72467..e7cd8d9 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -fe36056f2d274fa4b82a5422f192e65f dhcp-4.2.4-P2.tar.gz +6489e919ac093d17249270ee9be1020e dhcp-4.2.5.tar.gz