Blame SOURCES/dhcp-4.2.5-systemtap.patch

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