philipp / rpms / dhcp

Forked from rpms/dhcp 4 years ago
Clone

Blame SOURCES/dhcp-4.2.5-systemtap.patch

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