philipp / rpms / dhcp

Forked from rpms/dhcp 4 years ago
Clone

Blame SOURCES/dhcp-4.2.5-systemtap.patch

c8bb8f
diff -up dhcp-4.2.5b1/configure.ac.systemtap dhcp-4.2.5b1/configure.ac
c8bb8f
--- dhcp-4.2.5b1/configure.ac.systemtap	2012-12-17 16:56:40.563881316 +0100
c8bb8f
+++ dhcp-4.2.5b1/configure.ac	2012-12-17 16:56:40.597880870 +0100
c8bb8f
@@ -554,6 +554,35 @@ else
c8bb8f
     AC_MSG_RESULT(no)
c8bb8f
 fi
c8bb8f
 
c8bb8f
+AC_MSG_CHECKING([whether to include systemtap tracing support])
c8bb8f
+AC_ARG_ENABLE([systemtap],
c8bb8f
+              [AS_HELP_STRING([--enable-systemtap],
c8bb8f
+                              [Enable inclusion of systemtap trace support])],
c8bb8f
+              [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP='no'])
c8bb8f
+AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test x$ENABLE_SYSTEMTAP = xyes])
c8bb8f
+AC_MSG_RESULT(${ENABLE_SYSTEMTAP})
c8bb8f
+
c8bb8f
+if test "x${ENABLE_SYSTEMTAP}" = xyes; then
c8bb8f
+  # Additional configuration for --enable-systemtap is HERE
c8bb8f
+  AC_CHECK_PROGS(DTRACE, dtrace)
c8bb8f
+  if test -z "$DTRACE"; then
c8bb8f
+    AC_MSG_ERROR([dtrace not found])
c8bb8f
+  fi
c8bb8f
+  AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='yes'],
c8bb8f
+                [SDT_H_FOUND='no';
c8bb8f
+                   AC_MSG_ERROR([systemtap support needs sys/sdt.h header])])
c8bb8f
+  AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if using SystemTap probes.])
c8bb8f
+  AC_ARG_WITH([tapset-install-dir],
c8bb8f
+	      [AS_HELP_STRING([--with-tapset-install-dir], 
c8bb8f
+	         [The absolute path where the tapset dir will be installed])],
c8bb8f
+	      [if test "x${withval}" = x; then
c8bb8f
+		 ABS_TAPSET_DIR="\$(datadir)/systemtap/tapset"
c8bb8f
+	       else
c8bb8f
+		 ABS_TAPSET_DIR="${withval}"
c8bb8f
+	       fi], [ABS_TAPSET_DIR="\$(datadir)/systemtap/tapset"])
c8bb8f
+  AC_SUBST(ABS_TAPSET_DIR)
c8bb8f
+fi
c8bb8f
+
c8bb8f
 # Solaris needs some libraries for functions
c8bb8f
 AC_SEARCH_LIBS(socket, [socket])
c8bb8f
 AC_SEARCH_LIBS(inet_ntoa, [nsl])
c8bb8f
@@ -701,6 +730,7 @@ AC_OUTPUT([
c8bb8f
   tests/Makefile
c8bb8f
   server/tests/Makefile
c8bb8f
   doc/devel/doxyfile
c8bb8f
+  tapset/Makefile
c8bb8f
 ])
c8bb8f
 
c8bb8f
 sh util/bindvar.sh
c8bb8f
diff -up dhcp-4.2.5b1/Makefile.am.systemtap dhcp-4.2.5b1/Makefile.am
c8bb8f
--- dhcp-4.2.5b1/Makefile.am.systemtap	2012-12-17 16:56:40.461882654 +0100
c8bb8f
+++ dhcp-4.2.5b1/Makefile.am	2012-12-17 16:56:40.597880870 +0100
c8bb8f
@@ -30,5 +30,8 @@ endif
c8bb8f
 
c8bb8f
 SUBDIRS += includes tests common omapip client dhcpctl relay server
c8bb8f
 
c8bb8f
+SUBDIRS += tapset
c8bb8f
+#DIST_SUBDIRS = $(SUBDIRS)
c8bb8f
+
c8bb8f
 nobase_include_HEADERS = dhcpctl/dhcpctl.h
c8bb8f
 
c8bb8f
diff -up dhcp-4.2.5b1/server/dhcp.c.systemtap dhcp-4.2.5b1/server/dhcp.c
c8bb8f
--- dhcp-4.2.5b1/server/dhcp.c.systemtap	2012-12-17 16:56:40.483882364 +0100
c8bb8f
+++ dhcp-4.2.5b1/server/dhcp.c	2012-12-17 16:56:40.599880842 +0100
c8bb8f
@@ -36,7 +36,7 @@
c8bb8f
 #include <errno.h>
c8bb8f
 #include <limits.h>
c8bb8f
 #include <sys/time.h>
c8bb8f
-
c8bb8f
+#include "trace.h"
c8bb8f
 static void commit_leases_ackout(void *foo);
c8bb8f
 static void maybe_return_agent_options(struct packet *packet,
c8bb8f
 				       struct option_state *options);
c8bb8f
@@ -275,6 +275,8 @@ void dhcpdiscover (packet, ms_nulltp)
c8bb8f
 	dhcp_failover_state_t *peer;
c8bb8f
 #endif
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_DISCOVER_START());
c8bb8f
+
c8bb8f
 	find_lease (&lease, packet, packet -> shared_network,
c8bb8f
 		    0, &peer_has_leases, (struct lease *)0, MDL);
c8bb8f
 
c8bb8f
@@ -399,6 +401,8 @@ void dhcpdiscover (packet, ms_nulltp)
c8bb8f
       out:
c8bb8f
 	if (lease)
c8bb8f
 		lease_dereference (&lease, MDL);
c8bb8f
+
c8bb8f
+	TRACE(DHCPD_DISCOVER_DONE());
c8bb8f
 }
c8bb8f
 
c8bb8f
 void dhcprequest (packet, ms_nulltp, ip_lease)
c8bb8f
@@ -421,6 +425,8 @@ void dhcprequest (packet, ms_nulltp, ip_
c8bb8f
 #endif
c8bb8f
 	int have_requested_addr = 0;
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_REQUEST_START());
c8bb8f
+
c8bb8f
 	oc = lookup_option (&dhcp_universe, packet -> options,
c8bb8f
 			    DHO_DHCP_REQUESTED_ADDRESS);
c8bb8f
 	memset (&data, 0, sizeof data);
c8bb8f
@@ -700,6 +706,9 @@ void dhcprequest (packet, ms_nulltp, ip_
c8bb8f
 		log_info ("%s: unknown lease %s.", msgbuf, piaddr (cip));
c8bb8f
 
c8bb8f
       out:
c8bb8f
+
c8bb8f
+	TRACE(DHCPD_REQUEST_DONE());
c8bb8f
+
c8bb8f
 	if (subnet)
c8bb8f
 		subnet_dereference (&subnet, MDL);
c8bb8f
 	if (lease)
c8bb8f
@@ -718,6 +727,7 @@ void dhcprelease (packet, ms_nulltp)
c8bb8f
 	const char *s;
c8bb8f
 	char msgbuf [1024], cstr[16]; /* XXX */
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_RELEASE_START());
c8bb8f
 
c8bb8f
 	/* DHCPRELEASE must not specify address in requested-address
c8bb8f
 	   option, but old protocol specs weren't explicit about this,
c8bb8f
@@ -842,6 +852,8 @@ void dhcprelease (packet, ms_nulltp)
c8bb8f
 #endif
c8bb8f
 	if (lease)
c8bb8f
 		lease_dereference (&lease, MDL);
c8bb8f
+
c8bb8f
+	TRACE(DHCPD_RELEASE_DONE());
c8bb8f
 }
c8bb8f
 
c8bb8f
 void dhcpdecline (packet, ms_nulltp)
c8bb8f
@@ -859,6 +871,8 @@ void dhcpdecline (packet, ms_nulltp)
c8bb8f
 	struct option_cache *oc;
c8bb8f
 	struct data_string data;
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_DECLINE_START());
c8bb8f
+
c8bb8f
 	/* DHCPDECLINE must specify address. */
c8bb8f
 	if (!(oc = lookup_option (&dhcp_universe, packet -> options,
c8bb8f
 				  DHO_DHCP_REQUESTED_ADDRESS)))
c8bb8f
@@ -970,6 +984,8 @@ void dhcpdecline (packet, ms_nulltp)
c8bb8f
 		option_state_dereference (&options, MDL);
c8bb8f
 	if (lease)
c8bb8f
 		lease_dereference (&lease, MDL);
c8bb8f
+
c8bb8f
+	TRACE(DHCPD_DECLINE_DONE());
c8bb8f
 }
c8bb8f
 
c8bb8f
 void dhcpinform (packet, ms_nulltp)
c8bb8f
@@ -993,6 +1009,8 @@ void dhcpinform (packet, ms_nulltp)
c8bb8f
 	struct interface_info *interface;
c8bb8f
 	int result;
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_INFORM_START());
c8bb8f
+
c8bb8f
 	/* The client should set ciaddr to its IP address, but apparently
c8bb8f
 	   it's common for clients not to do this, so we'll use their IP
c8bb8f
 	   source address if they didn't set ciaddr. */
c8bb8f
@@ -1350,6 +1368,8 @@ void dhcpinform (packet, ms_nulltp)
c8bb8f
 
c8bb8f
 	if (subnet)
c8bb8f
 		subnet_dereference (&subnet, MDL);
c8bb8f
+
c8bb8f
+	TRACE(DHCPD_INFORM_DONE());
c8bb8f
 }
c8bb8f
 
c8bb8f
 void nak_lease (packet, cip)
c8bb8f
@@ -1366,6 +1386,8 @@ void nak_lease (packet, cip)
c8bb8f
 	struct option_state *options = (struct option_state *)0;
c8bb8f
 	struct option_cache *oc = (struct option_cache *)0;
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_NAK_LEASE_START());
c8bb8f
+
c8bb8f
 	option_state_allocate (&options, MDL);
c8bb8f
 	memset (&outgoing, 0, sizeof outgoing);
c8bb8f
 	memset (&raw, 0, sizeof raw);
c8bb8f
@@ -1532,6 +1554,7 @@ void nak_lease (packet, cip)
c8bb8f
                            packet->interface->name);
c8bb8f
         }
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_NAK_LEASE_DONE());
c8bb8f
 }
c8bb8f
 
c8bb8f
 void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp)
c8bb8f
@@ -1573,6 +1596,8 @@ void ack_lease (packet, lease, offer, wh
c8bb8f
 	if (lease -> state)
c8bb8f
 		return;
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_ACK_LEASE_START());
c8bb8f
+
c8bb8f
 	/* Save original cltt for comparison later. */
c8bb8f
 	lease_cltt = lease->cltt;
c8bb8f
 
c8bb8f
@@ -2936,6 +2961,8 @@ void ack_lease (packet, lease, offer, wh
c8bb8f
 #endif
c8bb8f
 			dhcp_reply(lease);
c8bb8f
 	}
c8bb8f
+
c8bb8f
+	TRACE(DHCPD_ACK_LEASE_DONE());
c8bb8f
 }
c8bb8f
 
c8bb8f
 /*
c8bb8f
@@ -3088,6 +3115,8 @@ void dhcp_reply (lease)
c8bb8f
 	if (!state)
c8bb8f
 		log_fatal ("dhcp_reply was supplied lease with no state!");
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_REPLY_START());
c8bb8f
+
c8bb8f
 	/* Compose a response for the client... */
c8bb8f
 	memset (&raw, 0, sizeof raw);
c8bb8f
 	memset (&d1, 0, sizeof d1);
c8bb8f
@@ -3309,6 +3338,8 @@ void dhcp_reply (lease)
c8bb8f
 
c8bb8f
 	free_lease_state (state, MDL);
c8bb8f
 	lease -> state = (struct lease_state *)0;
c8bb8f
+
c8bb8f
+	TRACE(DHCPD_REPLY_DONE());
c8bb8f
 }
c8bb8f
 
c8bb8f
 int find_lease (struct lease **lp,
c8bb8f
@@ -3331,6 +3362,8 @@ int find_lease (struct lease **lp,
c8bb8f
 	struct data_string client_identifier;
c8bb8f
 	struct hardware h;
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_FIND_LEASE_START());
c8bb8f
+
c8bb8f
 #if defined(FAILOVER_PROTOCOL)
c8bb8f
 	/* Quick check to see if the peer has leases. */
c8bb8f
 	if (peer_has_leases) {
c8bb8f
@@ -4058,6 +4091,9 @@ int find_lease (struct lease **lp,
c8bb8f
 #if defined (DEBUG_FIND_LEASE)
c8bb8f
 	log_info ("Not returning a lease.");
c8bb8f
 #endif
c8bb8f
+
c8bb8f
+	TRACE(DHCPD_FIND_LEASE_DONE());
c8bb8f
+
c8bb8f
 	return 0;
c8bb8f
 }
c8bb8f
 
c8bb8f
diff -up dhcp-4.2.5b1/server/dhcpd.c.systemtap dhcp-4.2.5b1/server/dhcpd.c
c8bb8f
--- dhcp-4.2.5b1/server/dhcpd.c.systemtap	2012-12-17 16:56:40.578881119 +0100
c8bb8f
+++ dhcp-4.2.5b1/server/dhcpd.c	2012-12-17 16:56:40.599880842 +0100
c8bb8f
@@ -58,6 +58,8 @@ static const char url [] =
c8bb8f
 #  undef group
c8bb8f
 #endif /* PARANOIA */
c8bb8f
 
c8bb8f
+#include "trace.h"
c8bb8f
+
c8bb8f
 #ifndef UNIT_TEST
c8bb8f
 static void usage(void);
c8bb8f
 #endif
c8bb8f
@@ -865,6 +867,7 @@ main(int argc, char **argv) {
c8bb8f
 	omapi_set_int_value ((omapi_object_t *)dhcp_control_object,
c8bb8f
 			     (omapi_object_t *)0, "state", server_running);
c8bb8f
 
c8bb8f
+        TRACE(DHCPD_MAIN());
c8bb8f
 	/* Receive packets and dispatch them... */
c8bb8f
 	dispatch ();
c8bb8f
 
c8bb8f
diff -up dhcp-4.2.5b1/server/dhcpv6.c.systemtap dhcp-4.2.5b1/server/dhcpv6.c
c8bb8f
--- dhcp-4.2.5b1/server/dhcpv6.c.systemtap	2012-12-17 16:56:40.571881210 +0100
c8bb8f
+++ dhcp-4.2.5b1/server/dhcpv6.c	2012-12-17 16:56:40.601880816 +0100
c8bb8f
@@ -15,6 +15,7 @@
c8bb8f
  */
c8bb8f
 
c8bb8f
 #include "dhcpd.h"
c8bb8f
+#include "trace.h"
c8bb8f
 
c8bb8f
 #ifdef DHCPv6
c8bb8f
 
c8bb8f
@@ -4212,6 +4213,8 @@ static void
c8bb8f
 dhcpv6_solicit(struct data_string *reply_ret, struct packet *packet) {
c8bb8f
 	struct data_string client_id;
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_6_SOLICIT_START());
c8bb8f
+
c8bb8f
 	/* 
c8bb8f
 	 * Validate our input.
c8bb8f
 	 */
c8bb8f
@@ -4225,6 +4228,8 @@ dhcpv6_solicit(struct data_string *reply
c8bb8f
 	 * Clean up.
c8bb8f
 	 */
c8bb8f
 	data_string_forget(&client_id, MDL);
c8bb8f
+
c8bb8f
+	TRACE(DHCPD_6_SOLICIT_DONE());
c8bb8f
 }
c8bb8f
 
c8bb8f
 /*
c8bb8f
@@ -4238,6 +4243,8 @@ dhcpv6_request(struct data_string *reply
c8bb8f
 	struct data_string client_id;
c8bb8f
 	struct data_string server_id;
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_6_REQUEST_START());
c8bb8f
+
c8bb8f
 	/*
c8bb8f
 	 * Validate our input.
c8bb8f
 	 */
c8bb8f
@@ -4255,6 +4262,8 @@ dhcpv6_request(struct data_string *reply
c8bb8f
 	 */
c8bb8f
 	data_string_forget(&client_id, MDL);
c8bb8f
 	data_string_forget(&server_id, MDL);
c8bb8f
+
c8bb8f
+	TRACE(DHCPD_6_REQUEST_DONE());
c8bb8f
 }
c8bb8f
 
c8bb8f
 /* Find a DHCPv6 packet's shared network from hints in the packet.
c8bb8f
@@ -4367,6 +4376,8 @@ dhcpv6_confirm(struct data_string *reply
c8bb8f
 	struct dhcpv6_packet *reply = (struct dhcpv6_packet *)reply_data;
c8bb8f
 	int reply_ofs = (int)(offsetof(struct dhcpv6_packet, options));
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_6_CONFIRM_START());
c8bb8f
+
c8bb8f
 	/* 
c8bb8f
 	 * Basic client message validation.
c8bb8f
 	 */
c8bb8f
@@ -4553,6 +4564,8 @@ exit:
c8bb8f
 		option_state_dereference(&cli_enc_opt_state, MDL);
c8bb8f
 	if (opt_state != NULL)
c8bb8f
 		option_state_dereference(&opt_state, MDL);
c8bb8f
+
c8bb8f
+	TRACE(DHCPD_6_CONFIRM_DONE());
c8bb8f
 }
c8bb8f
 
c8bb8f
 /*
c8bb8f
@@ -4567,6 +4580,8 @@ dhcpv6_renew(struct data_string *reply,
c8bb8f
 	struct data_string client_id;
c8bb8f
 	struct data_string server_id;
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_6_RENEW_START());
c8bb8f
+
c8bb8f
 	/* 
c8bb8f
 	 * Validate the request.
c8bb8f
 	 */
c8bb8f
@@ -4584,6 +4599,8 @@ dhcpv6_renew(struct data_string *reply,
c8bb8f
 	 */
c8bb8f
 	data_string_forget(&server_id, MDL);
c8bb8f
 	data_string_forget(&client_id, MDL);
c8bb8f
+
c8bb8f
+	TRACE(DHCPD_6_RENEW_DONE());
c8bb8f
 }
c8bb8f
 
c8bb8f
 /*
c8bb8f
@@ -4597,6 +4614,8 @@ static void
c8bb8f
 dhcpv6_rebind(struct data_string *reply, struct packet *packet) {
c8bb8f
 	struct data_string client_id;
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_6_REBIND_START());
c8bb8f
+
c8bb8f
 	if (!valid_client_msg(packet, &client_id)) {
c8bb8f
 		return;
c8bb8f
 	}
c8bb8f
@@ -4604,6 +4623,8 @@ dhcpv6_rebind(struct data_string *reply,
c8bb8f
 	lease_to_client(reply, packet, &client_id, NULL);
c8bb8f
 
c8bb8f
 	data_string_forget(&client_id, MDL);
c8bb8f
+
c8bb8f
+	TRACE(DHCPD_6_REBIND_DONE());
c8bb8f
 }
c8bb8f
 
c8bb8f
 static void
c8bb8f
@@ -5048,6 +5069,8 @@ dhcpv6_decline(struct data_string *reply
c8bb8f
 	struct data_string client_id;
c8bb8f
 	struct data_string server_id;
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_6_DECLINE_START());
c8bb8f
+
c8bb8f
 	/* 
c8bb8f
 	 * Validate our input.
c8bb8f
 	 */
c8bb8f
@@ -5068,6 +5091,8 @@ dhcpv6_decline(struct data_string *reply
c8bb8f
 
c8bb8f
 	data_string_forget(&server_id, MDL);
c8bb8f
 	data_string_forget(&client_id, MDL);
c8bb8f
+
c8bb8f
+	TRACE(DHCPD_6_DECLINE_DONE());
c8bb8f
 }
c8bb8f
 
c8bb8f
 static void
c8bb8f
@@ -5516,6 +5541,8 @@ dhcpv6_release(struct data_string *reply
c8bb8f
 	struct data_string client_id;
c8bb8f
 	struct data_string server_id;
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_6_RELEASE_START());
c8bb8f
+
c8bb8f
 	/* 
c8bb8f
 	 * Validate our input.
c8bb8f
 	 */
c8bb8f
@@ -5537,6 +5564,8 @@ dhcpv6_release(struct data_string *reply
c8bb8f
 
c8bb8f
 	data_string_forget(&server_id, MDL);
c8bb8f
 	data_string_forget(&client_id, MDL);
c8bb8f
+
c8bb8f
+	TRACE(DHCPD_6_RELEASE_DONE());
c8bb8f
 }
c8bb8f
 
c8bb8f
 /*
c8bb8f
@@ -5549,6 +5578,8 @@ dhcpv6_information_request(struct data_s
c8bb8f
 	struct data_string client_id;
c8bb8f
 	struct data_string server_id;
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_6_INFORMATION_REQUEST_START());
c8bb8f
+
c8bb8f
 	/*
c8bb8f
 	 * Validate our input.
c8bb8f
 	 */
c8bb8f
@@ -5580,6 +5611,8 @@ dhcpv6_information_request(struct data_s
c8bb8f
 		data_string_forget(&client_id, MDL);
c8bb8f
 	}
c8bb8f
 	data_string_forget(&server_id, MDL);
c8bb8f
+
c8bb8f
+	TRACE(DHCPD_6_INFORMATION_REQUEST_DONE());
c8bb8f
 }
c8bb8f
 
c8bb8f
 /* 
c8bb8f
@@ -5608,6 +5641,8 @@ dhcpv6_relay_forw(struct data_string *re
c8bb8f
 	struct dhcpv6_relay_packet *reply;
c8bb8f
 	int reply_ofs;
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_6_RELAY_FORW_START());
c8bb8f
+
c8bb8f
 	/* 
c8bb8f
 	 * Initialize variables for early exit.
c8bb8f
 	 */
c8bb8f
@@ -5867,6 +5902,8 @@ exit:
c8bb8f
 	if (enc_packet != NULL) {
c8bb8f
 		packet_dereference(&enc_packet, MDL);
c8bb8f
 	}
c8bb8f
+
c8bb8f
+	TRACE(DHCPD_6_RELAY_FORW_DONE());
c8bb8f
 }
c8bb8f
 
c8bb8f
 static void
c8bb8f
diff -up dhcp-4.2.5b1/server/failover.c.systemtap dhcp-4.2.5b1/server/failover.c
c8bb8f
--- dhcp-4.2.5b1/server/failover.c.systemtap	2012-12-05 02:17:39.000000000 +0100
c8bb8f
+++ dhcp-4.2.5b1/server/failover.c	2012-12-17 16:56:40.603880790 +0100
c8bb8f
@@ -36,6 +36,8 @@
c8bb8f
 #include "dhcpd.h"
c8bb8f
 #include <omapip/omapip_p.h>
c8bb8f
 
c8bb8f
+#include "trace.h"
c8bb8f
+
c8bb8f
 #if defined (FAILOVER_PROTOCOL)
c8bb8f
 dhcp_failover_state_t *failover_states;
c8bb8f
 static isc_result_t do_a_failover_option (omapi_object_t *,
c8bb8f
@@ -1712,6 +1714,8 @@ isc_result_t dhcp_failover_set_state (dh
c8bb8f
     struct lease *l;
c8bb8f
     struct timeval tv;
c8bb8f
 
c8bb8f
+    TRACE(DHCPD_FAILOVER_SET_STATE_START(state->me.state, new_state));
c8bb8f
+
c8bb8f
     /* If we're in certain states where we're sending updates, and the peer
c8bb8f
      * state changes, we need to re-schedule any pending updates just to
c8bb8f
      * be on the safe side.  This results in retransmission.
c8bb8f
@@ -1939,6 +1943,8 @@ isc_result_t dhcp_failover_set_state (dh
c8bb8f
 	    break;
c8bb8f
     }
c8bb8f
 
c8bb8f
+    TRACE(DHCPD_FAILOVER_SET_STATE_DONE());
c8bb8f
+
c8bb8f
     return ISC_R_SUCCESS;
c8bb8f
 }
c8bb8f
 
c8bb8f
@@ -2422,6 +2428,8 @@ dhcp_failover_pool_dobalance(dhcp_failov
c8bb8f
 	if (state -> me.state != normal)
c8bb8f
 		return 0;
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_FAILOVER_POOL_DOBALANCE_START());
c8bb8f
+
c8bb8f
 	state->last_balance = cur_time;
c8bb8f
 
c8bb8f
 	for (s = shared_networks ; s ; s = s->next) {
c8bb8f
@@ -2582,6 +2590,8 @@ dhcp_failover_pool_dobalance(dhcp_failov
c8bb8f
 	if (leases_queued)
c8bb8f
 		commit_leases();
c8bb8f
 
c8bb8f
+	TRACE(DHCPD_FAILOVER_POOL_DOBALANCE_DONE());
c8bb8f
+
c8bb8f
 	return leases_queued;
c8bb8f
 }
c8bb8f
 
c8bb8f
diff -up dhcp-4.2.5b1/server/Makefile.am.systemtap dhcp-4.2.5b1/server/Makefile.am
c8bb8f
--- dhcp-4.2.5b1/server/Makefile.am.systemtap	2012-12-17 16:56:40.563881316 +0100
c8bb8f
+++ dhcp-4.2.5b1/server/Makefile.am	2012-12-17 16:56:40.603880790 +0100
c8bb8f
@@ -10,7 +10,7 @@ dist_sysconf_DATA = dhcpd.conf.example
c8bb8f
 sbin_PROGRAMS = dhcpd
c8bb8f
 dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c confpars.c db.c class.c failover.c \
c8bb8f
 		omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.c \
c8bb8f
-		dhcpv6.c mdb6.c ldap.c ldap_casa.c
c8bb8f
+		dhcpv6.c mdb6.c ldap.c ldap_casa.c probes.d trace.h
c8bb8f
 
c8bb8f
 dhcpd_CFLAGS = $(LDAP_CFLAGS)
c8bb8f
 dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \
c8bb8f
@@ -19,3 +19,13 @@ dhcpd_LDADD = ../common/libdhcp.a ../oma
c8bb8f
 man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5
c8bb8f
 EXTRA_DIST = $(man_MANS)
c8bb8f
 
c8bb8f
+if ENABLE_SYSTEMTAP
c8bb8f
+BUILT_SOURCES = probes.h
c8bb8f
+probes.h: probes.d
c8bb8f
+	$(DTRACE) -C -h -s $< -o $@
c8bb8f
+
c8bb8f
+probes.o: probes.d
c8bb8f
+	$(DTRACE) -C -G -s $< -o $@
c8bb8f
+
c8bb8f
+dhcpd_LDADD += probes.o
c8bb8f
+endif
c8bb8f
diff -up dhcp-4.2.5b1/server/probes.d.systemtap dhcp-4.2.5b1/server/probes.d
c8bb8f
--- dhcp-4.2.5b1/server/probes.d.systemtap	2012-12-17 16:56:40.603880790 +0100
c8bb8f
+++ dhcp-4.2.5b1/server/probes.d	2012-12-17 16:56:40.603880790 +0100
c8bb8f
@@ -0,0 +1,43 @@
c8bb8f
+provider dhcpd {
c8bb8f
+	 probe main();
c8bb8f
+	 probe discover_start()
c8bb8f
+	 probe discover_done()
c8bb8f
+	 probe request_start()
c8bb8f
+	 probe request_done()
c8bb8f
+	 probe release_start()
c8bb8f
+	 probe release_done()
c8bb8f
+	 probe decline_start()
c8bb8f
+	 probe decline_done()
c8bb8f
+	 probe inform_start()
c8bb8f
+	 probe inform_done()
c8bb8f
+	 probe nak_lease_start()
c8bb8f
+	 probe nak_lease_done()
c8bb8f
+	 probe ack_lease_start()
c8bb8f
+	 probe ack_lease_done()
c8bb8f
+	 probe reply_start()
c8bb8f
+	 probe reply_done()
c8bb8f
+	 probe find_lease_start()
c8bb8f
+	 probe find_lease_done()
c8bb8f
+	 probe 6_solicit_start()
c8bb8f
+	 probe 6_solicit_done()
c8bb8f
+	 probe 6_request_start()
c8bb8f
+	 probe 6_request_done()
c8bb8f
+	 probe 6_confirm_start()
c8bb8f
+	 probe 6_confirm_done()
c8bb8f
+	 probe 6_renew_start()
c8bb8f
+	 probe 6_renew_done()
c8bb8f
+	 probe 6_rebind_start()
c8bb8f
+	 probe 6_rebind_done()
c8bb8f
+	 probe 6_decline_start()
c8bb8f
+	 probe 6_decline_done()
c8bb8f
+	 probe 6_release_start()
c8bb8f
+	 probe 6_release_done()
c8bb8f
+	 probe 6_information_request_start()
c8bb8f
+	 probe 6_information_request_done()
c8bb8f
+	 probe 6_relay_forw_start()
c8bb8f
+	 probe 6_relay_forw_done()
c8bb8f
+	 probe failover_pool_dobalance_start()
c8bb8f
+	 probe failover_pool_dobalance_done()
c8bb8f
+	 probe failover_set_state_start(int, int) /* state, new_state */
c8bb8f
+	 probe failover_set_state_done()
c8bb8f
+};
c8bb8f
diff -up dhcp-4.2.5b1/server/tests/Makefile.am.systemtap dhcp-4.2.5b1/server/tests/Makefile.am
c8bb8f
--- dhcp-4.2.5b1/server/tests/Makefile.am.systemtap	2012-12-17 16:56:40.564881302 +0100
c8bb8f
+++ dhcp-4.2.5b1/server/tests/Makefile.am	2012-12-17 16:56:57.505650518 +0100
c8bb8f
@@ -20,6 +20,10 @@ DHCPSRC = ../dhcp.c ../bootp.c ../confpa
c8bb8f
 DHCPLIBS = $(top_builddir)/common/libdhcp.a $(top_builddir)/omapip/libomapi.la    \
c8bb8f
           $(top_builddir)/dhcpctl/libdhcpctl.la $(BIND9_LIBDIR) -ldns-export -lisc-export
c8bb8f
 
c8bb8f
+if ENABLE_SYSTEMTAP
c8bb8f
+DHCPLIBS += ../probes.o
c8bb8f
+endif
c8bb8f
+
c8bb8f
 ATF_TESTS =
c8bb8f
 TESTS = 
c8bb8f
 if HAVE_ATF
c8bb8f
diff -up dhcp-4.2.5b1/server/trace.h.systemtap dhcp-4.2.5b1/server/trace.h
c8bb8f
--- dhcp-4.2.5b1/server/trace.h.systemtap	2012-12-17 16:56:40.604880777 +0100
c8bb8f
+++ dhcp-4.2.5b1/server/trace.h	2012-12-17 16:56:40.604880777 +0100
c8bb8f
@@ -0,0 +1,11 @@
c8bb8f
+// trace.h
c8bb8f
+
c8bb8f
+#include "config.h"
c8bb8f
+#ifdef HAVE_SYSTEMTAP
c8bb8f
+// include the generated probes header and put markers in code
c8bb8f
+#include "probes.h"
c8bb8f
+#define TRACE(probe) probe
c8bb8f
+#else
c8bb8f
+// Wrap the probe to allow it to be removed when no systemtap available
c8bb8f
+#define TRACE(probe)
c8bb8f
+#endif
c8bb8f
diff -up dhcp-4.2.5b1/tapset/dhcpd.stp.systemtap dhcp-4.2.5b1/tapset/dhcpd.stp
c8bb8f
--- dhcp-4.2.5b1/tapset/dhcpd.stp.systemtap	2012-12-17 16:56:40.604880777 +0100
c8bb8f
+++ dhcp-4.2.5b1/tapset/dhcpd.stp	2012-12-17 16:56:40.604880777 +0100
c8bb8f
@@ -0,0 +1,212 @@
c8bb8f
+/* dhcpd tapset
c8bb8f
+   Copyright (C) 2011, Red Hat Inc.
c8bb8f
+ */
c8bb8f
+
c8bb8f
+probe dhcpd_main = process("dhcpd").mark("main")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s(locals: %s)", $$name, $$locals);
c8bb8f
+  
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_discover_start = process("dhcpd").mark("discover_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_discover_done = process("dhcpd").mark("discover_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_request_start = process("dhcpd").mark("request_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_request_done = process("dhcpd").mark("request_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_release_start = process("dhcpd").mark("release_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_release_done = process("dhcpd").mark("release_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_decline_start = process("dhcpd").mark("decline_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_decline_done = process("dhcpd").mark("decline_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_inform_start = process("dhcpd").mark("inform_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_inform_done = process("dhcpd").mark("inform_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_nak_lease_start = process("dhcpd").mark("nak_lease_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_nak_lease_done = process("dhcpd").mark("nak_lease_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_ack_lease_start = process("dhcpd").mark("ack_lease_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_ack_lease_done = process("dhcpd").mark("ack_lease_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_reply_start = process("dhcpd").mark("reply_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_reply_done = process("dhcpd").mark("reply_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_find_lease_start = process("dhcpd").mark("find_lease_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_find_lease_done = process("dhcpd").mark("find_lease_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_solicit_start = process("dhcpd").mark("6_solicit_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_solicit_done = process("dhcpd").mark("6_solicit_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_request_start = process("dhcpd").mark("6_request_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_request_done = process("dhcpd").mark("6_request_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_confirm_start = process("dhcpd").mark("6_confirm_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_confirm_done = process("dhcpd").mark("6_confirm_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_renew_start = process("dhcpd").mark("6_renew_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_renew_done = process("dhcpd").mark("6_renew_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_rebind_start = process("dhcpd").mark("6_rebind_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_rebind_done = process("dhcpd").mark("6_rebind_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_decline_start = process("dhcpd").mark("6_decline_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_decline_done = process("dhcpd").mark("6_decline_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_release_start = process("dhcpd").mark("6_release_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_release_done = process("dhcpd").mark("6_release_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_information_request_start = process("dhcpd").mark("6_information_request_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_information_request_done = process("dhcpd").mark("6_information_request_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_relay_forw_start = process("dhcpd").mark("6_relay_forw_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_6_relay_forw_done = process("dhcpd").mark("6_relay_forw_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_failover_pool_dobalance_start = process("dhcpd").mark("failover_pool_dobalance_start")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_failover_pool_dobalance_done = process("dhcpd").mark("failover_pool_dobalance_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
+
c8bb8f
+
c8bb8f
+probe dhcpd_failover_set_state_start = process("dhcpd").mark("failover_set_state_start")
c8bb8f
+{
c8bb8f
+  state = $arg1;
c8bb8f
+  new_state = $arg2;
c8bb8f
+  probestr = sprintf("%s(state=%d, new_state=%d)", $$name, state, new_state);
c8bb8f
+}
c8bb8f
+
c8bb8f
+probe dhcpd_failover_set_state_done = process("dhcpd").mark("failover_set_state_done")
c8bb8f
+{
c8bb8f
+  probestr = sprintf("%s", $$name);
c8bb8f
+}
c8bb8f
diff -up dhcp-4.2.5b1/tapset/Makefile.am.systemtap dhcp-4.2.5b1/tapset/Makefile.am
c8bb8f
--- dhcp-4.2.5b1/tapset/Makefile.am.systemtap	2012-12-17 16:56:40.604880777 +0100
c8bb8f
+++ dhcp-4.2.5b1/tapset/Makefile.am	2012-12-17 16:56:40.604880777 +0100
c8bb8f
@@ -0,0 +1,26 @@
c8bb8f
+# Makefile.am for dhcp/tapset
c8bb8f
+# Jiri Popelka
c8bb8f
+
c8bb8f
+.PHONY: clean-local install-data-hook uninstall-local
c8bb8f
+
c8bb8f
+#
c8bb8f
+EXTRA_DIST = dhcpd.stp
c8bb8f
+TAPSET_FILES = $(EXTRA_DIST)
c8bb8f
+TAPSET_INSTALL_DIR = $(DESTDIR)@ABS_TAPSET_DIR@
c8bb8f
+
c8bb8f
+if ENABLE_SYSTEMTAP
c8bb8f
+all-local: $(TAPSET_FILES)
c8bb8f
+
c8bb8f
+clean-local:
c8bb8f
+
c8bb8f
+install-data-hook:
c8bb8f
+	$(MKDIR_P) $(TAPSET_INSTALL_DIR)
c8bb8f
+	$(INSTALL_DATA) $(TAPSET_FILES) $(TAPSET_INSTALL_DIR)
c8bb8f
+
c8bb8f
+uninstall-local:
c8bb8f
+	@list='$(TAPSET_FILES)'; for p in $$list; do \
c8bb8f
+	  echo " rm -f '$(TAPSET_INSTALL_DIR)/$$p'"; \
c8bb8f
+	  rm -f "$(TAPSET_INSTALL_DIR)/$$p"; \
c8bb8f
+	done
c8bb8f
+endif
c8bb8f
+