]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blame - dhcp/patches/dhcp-4.2.5-systemtap.patch
dhcp: Update to 4.2.5.
[people/ms/ipfire-3.x.git] / dhcp / patches / dhcp-4.2.5-systemtap.patch
CommitLineData
177b938a
MT
1diff -up dhcp-4.2.5b1/configure.ac.systemtap dhcp-4.2.5b1/configure.ac
2--- dhcp-4.2.5b1/configure.ac.systemtap 2012-12-17 16:56:40.563881316 +0100
3+++ dhcp-4.2.5b1/configure.ac 2012-12-17 16:56:40.597880870 +0100
4@@ -554,6 +554,35 @@ else
6df985df
SS
5 AC_MSG_RESULT(no)
6 fi
7
8+AC_MSG_CHECKING([whether to include systemtap tracing support])
9+AC_ARG_ENABLE([systemtap],
10+ [AS_HELP_STRING([--enable-systemtap],
11+ [Enable inclusion of systemtap trace support])],
12+ [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP='no'])
13+AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test x$ENABLE_SYSTEMTAP = xyes])
14+AC_MSG_RESULT(${ENABLE_SYSTEMTAP})
15+
16+if test "x${ENABLE_SYSTEMTAP}" = xyes; then
17+ # Additional configuration for --enable-systemtap is HERE
18+ AC_CHECK_PROGS(DTRACE, dtrace)
19+ if test -z "$DTRACE"; then
20+ AC_MSG_ERROR([dtrace not found])
21+ fi
22+ AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='yes'],
23+ [SDT_H_FOUND='no';
24+ AC_MSG_ERROR([systemtap support needs sys/sdt.h header])])
25+ AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if using SystemTap probes.])
26+ AC_ARG_WITH([tapset-install-dir],
27+ [AS_HELP_STRING([--with-tapset-install-dir],
28+ [The absolute path where the tapset dir will be installed])],
29+ [if test "x${withval}" = x; then
30+ ABS_TAPSET_DIR="\$(datadir)/systemtap/tapset"
31+ else
32+ ABS_TAPSET_DIR="${withval}"
33+ fi], [ABS_TAPSET_DIR="\$(datadir)/systemtap/tapset"])
34+ AC_SUBST(ABS_TAPSET_DIR)
35+fi
36+
37 # Solaris needs some libraries for functions
38 AC_SEARCH_LIBS(socket, [socket])
39 AC_SEARCH_LIBS(inet_ntoa, [nsl])
177b938a 40@@ -701,6 +730,7 @@ AC_OUTPUT([
6df985df 41 tests/Makefile
177b938a
MT
42 server/tests/Makefile
43 doc/devel/doxyfile
6df985df
SS
44+ tapset/Makefile
45 ])
46
47 sh util/bindvar.sh
177b938a
MT
48diff -up dhcp-4.2.5b1/Makefile.am.systemtap dhcp-4.2.5b1/Makefile.am
49--- dhcp-4.2.5b1/Makefile.am.systemtap 2012-12-17 16:56:40.461882654 +0100
50+++ dhcp-4.2.5b1/Makefile.am 2012-12-17 16:56:40.597880870 +0100
51@@ -30,5 +30,8 @@ endif
6df985df 52
444c1184 53 SUBDIRS += includes tests common omapip client dhcpctl relay server
6df985df
SS
54
55+SUBDIRS += tapset
56+#DIST_SUBDIRS = $(SUBDIRS)
57+
58 nobase_include_HEADERS = dhcpctl/dhcpctl.h
59
177b938a
MT
60diff -up dhcp-4.2.5b1/server/dhcp.c.systemtap dhcp-4.2.5b1/server/dhcp.c
61--- dhcp-4.2.5b1/server/dhcp.c.systemtap 2012-12-17 16:56:40.483882364 +0100
62+++ dhcp-4.2.5b1/server/dhcp.c 2012-12-17 16:56:40.599880842 +0100
6df985df
SS
63@@ -36,7 +36,7 @@
64 #include <errno.h>
65 #include <limits.h>
66 #include <sys/time.h>
67-
68+#include "trace.h"
69 static void commit_leases_ackout(void *foo);
70 static void maybe_return_agent_options(struct packet *packet,
71 struct option_state *options);
72@@ -275,6 +275,8 @@ void dhcpdiscover (packet, ms_nulltp)
73 dhcp_failover_state_t *peer;
74 #endif
75
76+ TRACE(DHCPD_DISCOVER_START());
77+
78 find_lease (&lease, packet, packet -> shared_network,
79 0, &peer_has_leases, (struct lease *)0, MDL);
80
81@@ -399,6 +401,8 @@ void dhcpdiscover (packet, ms_nulltp)
82 out:
83 if (lease)
84 lease_dereference (&lease, MDL);
85+
86+ TRACE(DHCPD_DISCOVER_DONE());
87 }
88
89 void dhcprequest (packet, ms_nulltp, ip_lease)
444c1184
MT
90@@ -421,6 +425,8 @@ void dhcprequest (packet, ms_nulltp, ip_
91 #endif
6df985df
SS
92 int have_requested_addr = 0;
93
94+ TRACE(DHCPD_REQUEST_START());
95+
96 oc = lookup_option (&dhcp_universe, packet -> options,
97 DHO_DHCP_REQUESTED_ADDRESS);
98 memset (&data, 0, sizeof data);
177b938a 99@@ -700,6 +706,9 @@ void dhcprequest (packet, ms_nulltp, ip_
6df985df
SS
100 log_info ("%s: unknown lease %s.", msgbuf, piaddr (cip));
101
102 out:
103+
104+ TRACE(DHCPD_REQUEST_DONE());
105+
106 if (subnet)
107 subnet_dereference (&subnet, MDL);
108 if (lease)
177b938a 109@@ -718,6 +727,7 @@ void dhcprelease (packet, ms_nulltp)
6df985df
SS
110 const char *s;
111 char msgbuf [1024], cstr[16]; /* XXX */
112
113+ TRACE(DHCPD_RELEASE_START());
114
115 /* DHCPRELEASE must not specify address in requested-address
116 option, but old protocol specs weren't explicit about this,
177b938a 117@@ -842,6 +852,8 @@ void dhcprelease (packet, ms_nulltp)
6df985df
SS
118 #endif
119 if (lease)
120 lease_dereference (&lease, MDL);
121+
122+ TRACE(DHCPD_RELEASE_DONE());
123 }
124
125 void dhcpdecline (packet, ms_nulltp)
177b938a 126@@ -859,6 +871,8 @@ void dhcpdecline (packet, ms_nulltp)
6df985df
SS
127 struct option_cache *oc;
128 struct data_string data;
129
130+ TRACE(DHCPD_DECLINE_START());
131+
132 /* DHCPDECLINE must specify address. */
133 if (!(oc = lookup_option (&dhcp_universe, packet -> options,
134 DHO_DHCP_REQUESTED_ADDRESS)))
177b938a 135@@ -970,6 +984,8 @@ void dhcpdecline (packet, ms_nulltp)
6df985df
SS
136 option_state_dereference (&options, MDL);
137 if (lease)
138 lease_dereference (&lease, MDL);
139+
140+ TRACE(DHCPD_DECLINE_DONE());
141 }
142
143 void dhcpinform (packet, ms_nulltp)
177b938a 144@@ -993,6 +1009,8 @@ void dhcpinform (packet, ms_nulltp)
444c1184
MT
145 struct interface_info *interface;
146 int result;
6df985df
SS
147
148+ TRACE(DHCPD_INFORM_START());
149+
150 /* The client should set ciaddr to its IP address, but apparently
151 it's common for clients not to do this, so we'll use their IP
152 source address if they didn't set ciaddr. */
177b938a 153@@ -1350,6 +1368,8 @@ void dhcpinform (packet, ms_nulltp)
444c1184 154
6df985df
SS
155 if (subnet)
156 subnet_dereference (&subnet, MDL);
157+
158+ TRACE(DHCPD_INFORM_DONE());
159 }
160
161 void nak_lease (packet, cip)
177b938a 162@@ -1366,6 +1386,8 @@ void nak_lease (packet, cip)
6df985df
SS
163 struct option_state *options = (struct option_state *)0;
164 struct option_cache *oc = (struct option_cache *)0;
165
166+ TRACE(DHCPD_NAK_LEASE_START());
167+
168 option_state_allocate (&options, MDL);
169 memset (&outgoing, 0, sizeof outgoing);
170 memset (&raw, 0, sizeof raw);
177b938a 171@@ -1532,6 +1554,7 @@ void nak_lease (packet, cip)
444c1184
MT
172 packet->interface->name);
173 }
174
6df985df
SS
175+ TRACE(DHCPD_NAK_LEASE_DONE());
176 }
177
178 void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp)
177b938a 179@@ -1573,6 +1596,8 @@ void ack_lease (packet, lease, offer, wh
6df985df
SS
180 if (lease -> state)
181 return;
182
183+ TRACE(DHCPD_ACK_LEASE_START());
184+
185 /* Save original cltt for comparison later. */
186 lease_cltt = lease->cltt;
187
177b938a 188@@ -2936,6 +2961,8 @@ void ack_lease (packet, lease, offer, wh
6df985df
SS
189 #endif
190 dhcp_reply(lease);
191 }
192+
193+ TRACE(DHCPD_ACK_LEASE_DONE());
194 }
195
196 /*
177b938a 197@@ -3088,6 +3115,8 @@ void dhcp_reply (lease)
6df985df
SS
198 if (!state)
199 log_fatal ("dhcp_reply was supplied lease with no state!");
200
201+ TRACE(DHCPD_REPLY_START());
202+
203 /* Compose a response for the client... */
204 memset (&raw, 0, sizeof raw);
205 memset (&d1, 0, sizeof d1);
177b938a 206@@ -3309,6 +3338,8 @@ void dhcp_reply (lease)
6df985df
SS
207
208 free_lease_state (state, MDL);
209 lease -> state = (struct lease_state *)0;
210+
211+ TRACE(DHCPD_REPLY_DONE());
212 }
213
214 int find_lease (struct lease **lp,
177b938a 215@@ -3331,6 +3362,8 @@ int find_lease (struct lease **lp,
6df985df
SS
216 struct data_string client_identifier;
217 struct hardware h;
218
219+ TRACE(DHCPD_FIND_LEASE_START());
220+
221 #if defined(FAILOVER_PROTOCOL)
222 /* Quick check to see if the peer has leases. */
223 if (peer_has_leases) {
177b938a 224@@ -4058,6 +4091,9 @@ int find_lease (struct lease **lp,
6df985df
SS
225 #if defined (DEBUG_FIND_LEASE)
226 log_info ("Not returning a lease.");
227 #endif
228+
229+ TRACE(DHCPD_FIND_LEASE_DONE());
230+
231 return 0;
232 }
233
177b938a
MT
234diff -up dhcp-4.2.5b1/server/dhcpd.c.systemtap dhcp-4.2.5b1/server/dhcpd.c
235--- dhcp-4.2.5b1/server/dhcpd.c.systemtap 2012-12-17 16:56:40.578881119 +0100
236+++ dhcp-4.2.5b1/server/dhcpd.c 2012-12-17 16:56:40.599880842 +0100
444c1184
MT
237@@ -58,6 +58,8 @@ static const char url [] =
238 # undef group
239 #endif /* PARANOIA */
6df985df
SS
240
241+#include "trace.h"
242+
177b938a 243 #ifndef UNIT_TEST
6df985df 244 static void usage(void);
177b938a
MT
245 #endif
246@@ -865,6 +867,7 @@ main(int argc, char **argv) {
444c1184
MT
247 omapi_set_int_value ((omapi_object_t *)dhcp_control_object,
248 (omapi_object_t *)0, "state", server_running);
249
250+ TRACE(DHCPD_MAIN());
6df985df
SS
251 /* Receive packets and dispatch them... */
252 dispatch ();
253
177b938a
MT
254diff -up dhcp-4.2.5b1/server/dhcpv6.c.systemtap dhcp-4.2.5b1/server/dhcpv6.c
255--- dhcp-4.2.5b1/server/dhcpv6.c.systemtap 2012-12-17 16:56:40.571881210 +0100
256+++ dhcp-4.2.5b1/server/dhcpv6.c 2012-12-17 16:56:40.601880816 +0100
6df985df
SS
257@@ -15,6 +15,7 @@
258 */
259
260 #include "dhcpd.h"
261+#include "trace.h"
262
263 #ifdef DHCPv6
264
177b938a 265@@ -4212,6 +4213,8 @@ static void
6df985df
SS
266 dhcpv6_solicit(struct data_string *reply_ret, struct packet *packet) {
267 struct data_string client_id;
268
269+ TRACE(DHCPD_6_SOLICIT_START());
270+
271 /*
272 * Validate our input.
273 */
177b938a 274@@ -4225,6 +4228,8 @@ dhcpv6_solicit(struct data_string *reply
6df985df
SS
275 * Clean up.
276 */
277 data_string_forget(&client_id, MDL);
278+
279+ TRACE(DHCPD_6_SOLICIT_DONE());
280 }
281
282 /*
177b938a 283@@ -4238,6 +4243,8 @@ dhcpv6_request(struct data_string *reply
6df985df
SS
284 struct data_string client_id;
285 struct data_string server_id;
286
287+ TRACE(DHCPD_6_REQUEST_START());
288+
289 /*
290 * Validate our input.
291 */
177b938a 292@@ -4255,6 +4262,8 @@ dhcpv6_request(struct data_string *reply
6df985df
SS
293 */
294 data_string_forget(&client_id, MDL);
295 data_string_forget(&server_id, MDL);
296+
297+ TRACE(DHCPD_6_REQUEST_DONE());
298 }
299
300 /* Find a DHCPv6 packet's shared network from hints in the packet.
177b938a 301@@ -4367,6 +4376,8 @@ dhcpv6_confirm(struct data_string *reply
6df985df
SS
302 struct dhcpv6_packet *reply = (struct dhcpv6_packet *)reply_data;
303 int reply_ofs = (int)(offsetof(struct dhcpv6_packet, options));
304
305+ TRACE(DHCPD_6_CONFIRM_START());
306+
307 /*
308 * Basic client message validation.
309 */
177b938a 310@@ -4553,6 +4564,8 @@ exit:
6df985df
SS
311 option_state_dereference(&cli_enc_opt_state, MDL);
312 if (opt_state != NULL)
313 option_state_dereference(&opt_state, MDL);
314+
315+ TRACE(DHCPD_6_CONFIRM_DONE());
316 }
317
318 /*
177b938a 319@@ -4567,6 +4580,8 @@ dhcpv6_renew(struct data_string *reply,
6df985df
SS
320 struct data_string client_id;
321 struct data_string server_id;
322
323+ TRACE(DHCPD_6_RENEW_START());
324+
325 /*
326 * Validate the request.
327 */
177b938a 328@@ -4584,6 +4599,8 @@ dhcpv6_renew(struct data_string *reply,
6df985df
SS
329 */
330 data_string_forget(&server_id, MDL);
331 data_string_forget(&client_id, MDL);
332+
333+ TRACE(DHCPD_6_RENEW_DONE());
334 }
335
336 /*
177b938a 337@@ -4597,6 +4614,8 @@ static void
6df985df
SS
338 dhcpv6_rebind(struct data_string *reply, struct packet *packet) {
339 struct data_string client_id;
340
341+ TRACE(DHCPD_6_REBIND_START());
342+
343 if (!valid_client_msg(packet, &client_id)) {
344 return;
345 }
177b938a 346@@ -4604,6 +4623,8 @@ dhcpv6_rebind(struct data_string *reply,
6df985df
SS
347 lease_to_client(reply, packet, &client_id, NULL);
348
349 data_string_forget(&client_id, MDL);
350+
351+ TRACE(DHCPD_6_REBIND_DONE());
352 }
353
354 static void
177b938a 355@@ -5048,6 +5069,8 @@ dhcpv6_decline(struct data_string *reply
6df985df
SS
356 struct data_string client_id;
357 struct data_string server_id;
358
359+ TRACE(DHCPD_6_DECLINE_START());
360+
361 /*
362 * Validate our input.
363 */
177b938a 364@@ -5068,6 +5091,8 @@ dhcpv6_decline(struct data_string *reply
6df985df
SS
365
366 data_string_forget(&server_id, MDL);
367 data_string_forget(&client_id, MDL);
368+
369+ TRACE(DHCPD_6_DECLINE_DONE());
370 }
371
372 static void
177b938a 373@@ -5516,6 +5541,8 @@ dhcpv6_release(struct data_string *reply
6df985df
SS
374 struct data_string client_id;
375 struct data_string server_id;
376
377+ TRACE(DHCPD_6_RELEASE_START());
378+
379 /*
380 * Validate our input.
381 */
177b938a 382@@ -5537,6 +5564,8 @@ dhcpv6_release(struct data_string *reply
6df985df
SS
383
384 data_string_forget(&server_id, MDL);
385 data_string_forget(&client_id, MDL);
386+
387+ TRACE(DHCPD_6_RELEASE_DONE());
388 }
389
390 /*
177b938a 391@@ -5549,6 +5578,8 @@ dhcpv6_information_request(struct data_s
6df985df
SS
392 struct data_string client_id;
393 struct data_string server_id;
394
395+ TRACE(DHCPD_6_INFORMATION_REQUEST_START());
396+
397 /*
398 * Validate our input.
399 */
177b938a 400@@ -5580,6 +5611,8 @@ dhcpv6_information_request(struct data_s
6df985df
SS
401 data_string_forget(&client_id, MDL);
402 }
403 data_string_forget(&server_id, MDL);
404+
405+ TRACE(DHCPD_6_INFORMATION_REQUEST_DONE());
406 }
407
408 /*
177b938a 409@@ -5608,6 +5641,8 @@ dhcpv6_relay_forw(struct data_string *re
6df985df
SS
410 struct dhcpv6_relay_packet *reply;
411 int reply_ofs;
412
413+ TRACE(DHCPD_6_RELAY_FORW_START());
414+
415 /*
416 * Initialize variables for early exit.
417 */
177b938a 418@@ -5867,6 +5902,8 @@ exit:
6df985df
SS
419 if (enc_packet != NULL) {
420 packet_dereference(&enc_packet, MDL);
421 }
422+
423+ TRACE(DHCPD_6_RELAY_FORW_DONE());
424 }
425
426 static void
177b938a
MT
427diff -up dhcp-4.2.5b1/server/failover.c.systemtap dhcp-4.2.5b1/server/failover.c
428--- dhcp-4.2.5b1/server/failover.c.systemtap 2012-12-05 02:17:39.000000000 +0100
429+++ dhcp-4.2.5b1/server/failover.c 2012-12-17 16:56:40.603880790 +0100
444c1184 430@@ -36,6 +36,8 @@
6df985df
SS
431 #include "dhcpd.h"
432 #include <omapip/omapip_p.h>
433
434+#include "trace.h"
435+
436 #if defined (FAILOVER_PROTOCOL)
437 dhcp_failover_state_t *failover_states;
438 static isc_result_t do_a_failover_option (omapi_object_t *,
444c1184 439@@ -1712,6 +1714,8 @@ isc_result_t dhcp_failover_set_state (dh
6df985df
SS
440 struct lease *l;
441 struct timeval tv;
442
443+ TRACE(DHCPD_FAILOVER_SET_STATE_START(state->me.state, new_state));
444+
445 /* If we're in certain states where we're sending updates, and the peer
446 * state changes, we need to re-schedule any pending updates just to
447 * be on the safe side. This results in retransmission.
444c1184 448@@ -1939,6 +1943,8 @@ isc_result_t dhcp_failover_set_state (dh
6df985df
SS
449 break;
450 }
451
452+ TRACE(DHCPD_FAILOVER_SET_STATE_DONE());
453+
454 return ISC_R_SUCCESS;
455 }
456
444c1184 457@@ -2422,6 +2428,8 @@ dhcp_failover_pool_dobalance(dhcp_failov
6df985df
SS
458 if (state -> me.state != normal)
459 return 0;
460
461+ TRACE(DHCPD_FAILOVER_POOL_DOBALANCE_START());
462+
463 state->last_balance = cur_time;
464
465 for (s = shared_networks ; s ; s = s->next) {
444c1184 466@@ -2582,6 +2590,8 @@ dhcp_failover_pool_dobalance(dhcp_failov
6df985df
SS
467 if (leases_queued)
468 commit_leases();
469
470+ TRACE(DHCPD_FAILOVER_POOL_DOBALANCE_DONE());
471+
472 return leases_queued;
473 }
474
177b938a
MT
475diff -up dhcp-4.2.5b1/server/Makefile.am.systemtap dhcp-4.2.5b1/server/Makefile.am
476--- dhcp-4.2.5b1/server/Makefile.am.systemtap 2012-12-17 16:56:40.563881316 +0100
477+++ dhcp-4.2.5b1/server/Makefile.am 2012-12-17 16:56:40.603880790 +0100
478@@ -10,7 +10,7 @@ dist_sysconf_DATA = dhcpd.conf.example
6df985df
SS
479 sbin_PROGRAMS = dhcpd
480 dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c confpars.c db.c class.c failover.c \
481 omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.c \
482- dhcpv6.c mdb6.c ldap.c ldap_casa.c
483+ dhcpv6.c mdb6.c ldap.c ldap_casa.c probes.d trace.h
484
485 dhcpd_CFLAGS = $(LDAP_CFLAGS)
486 dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \
177b938a 487@@ -19,3 +19,13 @@ dhcpd_LDADD = ../common/libdhcp.a ../oma
6df985df
SS
488 man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5
489 EXTRA_DIST = $(man_MANS)
490
491+if ENABLE_SYSTEMTAP
492+BUILT_SOURCES = probes.h
493+probes.h: probes.d
494+ $(DTRACE) -C -h -s $< -o $@
495+
496+probes.o: probes.d
497+ $(DTRACE) -C -G -s $< -o $@
498+
499+dhcpd_LDADD += probes.o
500+endif
177b938a
MT
501diff -up dhcp-4.2.5b1/server/probes.d.systemtap dhcp-4.2.5b1/server/probes.d
502--- dhcp-4.2.5b1/server/probes.d.systemtap 2012-12-17 16:56:40.603880790 +0100
503+++ dhcp-4.2.5b1/server/probes.d 2012-12-17 16:56:40.603880790 +0100
6df985df
SS
504@@ -0,0 +1,43 @@
505+provider dhcpd {
506+ probe main();
507+ probe discover_start()
508+ probe discover_done()
509+ probe request_start()
510+ probe request_done()
511+ probe release_start()
512+ probe release_done()
513+ probe decline_start()
514+ probe decline_done()
515+ probe inform_start()
516+ probe inform_done()
517+ probe nak_lease_start()
518+ probe nak_lease_done()
519+ probe ack_lease_start()
520+ probe ack_lease_done()
521+ probe reply_start()
522+ probe reply_done()
523+ probe find_lease_start()
524+ probe find_lease_done()
525+ probe 6_solicit_start()
526+ probe 6_solicit_done()
527+ probe 6_request_start()
528+ probe 6_request_done()
529+ probe 6_confirm_start()
530+ probe 6_confirm_done()
531+ probe 6_renew_start()
532+ probe 6_renew_done()
533+ probe 6_rebind_start()
534+ probe 6_rebind_done()
535+ probe 6_decline_start()
536+ probe 6_decline_done()
537+ probe 6_release_start()
538+ probe 6_release_done()
539+ probe 6_information_request_start()
540+ probe 6_information_request_done()
541+ probe 6_relay_forw_start()
542+ probe 6_relay_forw_done()
543+ probe failover_pool_dobalance_start()
544+ probe failover_pool_dobalance_done()
545+ probe failover_set_state_start(int, int) /* state, new_state */
546+ probe failover_set_state_done()
547+};
177b938a
MT
548diff -up dhcp-4.2.5b1/server/tests/Makefile.am.systemtap dhcp-4.2.5b1/server/tests/Makefile.am
549--- dhcp-4.2.5b1/server/tests/Makefile.am.systemtap 2012-12-17 16:56:40.564881302 +0100
550+++ dhcp-4.2.5b1/server/tests/Makefile.am 2012-12-17 16:56:57.505650518 +0100
551@@ -20,6 +20,10 @@ DHCPSRC = ../dhcp.c ../bootp.c ../confpa
552 DHCPLIBS = $(top_builddir)/common/libdhcp.a $(top_builddir)/omapip/libomapi.la \
553 $(top_builddir)/dhcpctl/libdhcpctl.la $(BIND9_LIBDIR) -ldns-export -lisc-export
554
555+if ENABLE_SYSTEMTAP
556+DHCPLIBS += ../probes.o
557+endif
558+
559 ATF_TESTS =
560 TESTS =
561 if HAVE_ATF
562diff -up dhcp-4.2.5b1/server/trace.h.systemtap dhcp-4.2.5b1/server/trace.h
563--- dhcp-4.2.5b1/server/trace.h.systemtap 2012-12-17 16:56:40.604880777 +0100
564+++ dhcp-4.2.5b1/server/trace.h 2012-12-17 16:56:40.604880777 +0100
6df985df
SS
565@@ -0,0 +1,11 @@
566+// trace.h
567+
568+#include "config.h"
569+#ifdef HAVE_SYSTEMTAP
570+// include the generated probes header and put markers in code
571+#include "probes.h"
572+#define TRACE(probe) probe
573+#else
574+// Wrap the probe to allow it to be removed when no systemtap available
575+#define TRACE(probe)
576+#endif
177b938a
MT
577diff -up dhcp-4.2.5b1/tapset/dhcpd.stp.systemtap dhcp-4.2.5b1/tapset/dhcpd.stp
578--- dhcp-4.2.5b1/tapset/dhcpd.stp.systemtap 2012-12-17 16:56:40.604880777 +0100
579+++ dhcp-4.2.5b1/tapset/dhcpd.stp 2012-12-17 16:56:40.604880777 +0100
6df985df
SS
580@@ -0,0 +1,212 @@
581+/* dhcpd tapset
582+ Copyright (C) 2011, Red Hat Inc.
583+ */
584+
585+probe dhcpd_main = process("dhcpd").mark("main")
586+{
587+ probestr = sprintf("%s(locals: %s)", $$name, $$locals);
588+
589+}
590+
591+probe dhcpd_discover_start = process("dhcpd").mark("discover_start")
592+{
593+ probestr = sprintf("%s", $$name);
594+}
595+
596+probe dhcpd_discover_done = process("dhcpd").mark("discover_done")
597+{
598+ probestr = sprintf("%s", $$name);
599+}
600+
601+probe dhcpd_request_start = process("dhcpd").mark("request_start")
602+{
603+ probestr = sprintf("%s", $$name);
604+}
605+
606+probe dhcpd_request_done = process("dhcpd").mark("request_done")
607+{
608+ probestr = sprintf("%s", $$name);
609+}
610+
611+probe dhcpd_release_start = process("dhcpd").mark("release_start")
612+{
613+ probestr = sprintf("%s", $$name);
614+}
615+
616+probe dhcpd_release_done = process("dhcpd").mark("release_done")
617+{
618+ probestr = sprintf("%s", $$name);
619+}
620+
621+probe dhcpd_decline_start = process("dhcpd").mark("decline_start")
622+{
623+ probestr = sprintf("%s", $$name);
624+}
625+
626+probe dhcpd_decline_done = process("dhcpd").mark("decline_done")
627+{
628+ probestr = sprintf("%s", $$name);
629+}
630+
631+probe dhcpd_inform_start = process("dhcpd").mark("inform_start")
632+{
633+ probestr = sprintf("%s", $$name);
634+}
635+
636+probe dhcpd_inform_done = process("dhcpd").mark("inform_done")
637+{
638+ probestr = sprintf("%s", $$name);
639+}
640+
641+probe dhcpd_nak_lease_start = process("dhcpd").mark("nak_lease_start")
642+{
643+ probestr = sprintf("%s", $$name);
644+}
645+
646+probe dhcpd_nak_lease_done = process("dhcpd").mark("nak_lease_done")
647+{
648+ probestr = sprintf("%s", $$name);
649+}
650+
651+probe dhcpd_ack_lease_start = process("dhcpd").mark("ack_lease_start")
652+{
653+ probestr = sprintf("%s", $$name);
654+}
655+
656+probe dhcpd_ack_lease_done = process("dhcpd").mark("ack_lease_done")
657+{
658+ probestr = sprintf("%s", $$name);
659+}
660+
661+probe dhcpd_reply_start = process("dhcpd").mark("reply_start")
662+{
663+ probestr = sprintf("%s", $$name);
664+}
665+
666+probe dhcpd_reply_done = process("dhcpd").mark("reply_done")
667+{
668+ probestr = sprintf("%s", $$name);
669+}
670+
671+probe dhcpd_find_lease_start = process("dhcpd").mark("find_lease_start")
672+{
673+ probestr = sprintf("%s", $$name);
674+}
675+
676+probe dhcpd_find_lease_done = process("dhcpd").mark("find_lease_done")
677+{
678+ probestr = sprintf("%s", $$name);
679+}
680+
681+probe dhcpd_6_solicit_start = process("dhcpd").mark("6_solicit_start")
682+{
683+ probestr = sprintf("%s", $$name);
684+}
685+
686+probe dhcpd_6_solicit_done = process("dhcpd").mark("6_solicit_done")
687+{
688+ probestr = sprintf("%s", $$name);
689+}
690+
691+probe dhcpd_6_request_start = process("dhcpd").mark("6_request_start")
692+{
693+ probestr = sprintf("%s", $$name);
694+}
695+
696+probe dhcpd_6_request_done = process("dhcpd").mark("6_request_done")
697+{
698+ probestr = sprintf("%s", $$name);
699+}
700+
701+probe dhcpd_6_confirm_start = process("dhcpd").mark("6_confirm_start")
702+{
703+ probestr = sprintf("%s", $$name);
704+}
705+
706+probe dhcpd_6_confirm_done = process("dhcpd").mark("6_confirm_done")
707+{
708+ probestr = sprintf("%s", $$name);
709+}
710+
711+probe dhcpd_6_renew_start = process("dhcpd").mark("6_renew_start")
712+{
713+ probestr = sprintf("%s", $$name);
714+}
715+
716+probe dhcpd_6_renew_done = process("dhcpd").mark("6_renew_done")
717+{
718+ probestr = sprintf("%s", $$name);
719+}
720+
721+probe dhcpd_6_rebind_start = process("dhcpd").mark("6_rebind_start")
722+{
723+ probestr = sprintf("%s", $$name);
724+}
725+
726+probe dhcpd_6_rebind_done = process("dhcpd").mark("6_rebind_done")
727+{
728+ probestr = sprintf("%s", $$name);
729+}
730+
731+probe dhcpd_6_decline_start = process("dhcpd").mark("6_decline_start")
732+{
733+ probestr = sprintf("%s", $$name);
734+}
735+
736+probe dhcpd_6_decline_done = process("dhcpd").mark("6_decline_done")
737+{
738+ probestr = sprintf("%s", $$name);
739+}
740+
741+probe dhcpd_6_release_start = process("dhcpd").mark("6_release_start")
742+{
743+ probestr = sprintf("%s", $$name);
744+}
745+
746+probe dhcpd_6_release_done = process("dhcpd").mark("6_release_done")
747+{
748+ probestr = sprintf("%s", $$name);
749+}
750+
751+probe dhcpd_6_information_request_start = process("dhcpd").mark("6_information_request_start")
752+{
753+ probestr = sprintf("%s", $$name);
754+}
755+
756+probe dhcpd_6_information_request_done = process("dhcpd").mark("6_information_request_done")
757+{
758+ probestr = sprintf("%s", $$name);
759+}
760+
761+probe dhcpd_6_relay_forw_start = process("dhcpd").mark("6_relay_forw_start")
762+{
763+ probestr = sprintf("%s", $$name);
764+}
765+
766+probe dhcpd_6_relay_forw_done = process("dhcpd").mark("6_relay_forw_done")
767+{
768+ probestr = sprintf("%s", $$name);
769+}
770+
771+probe dhcpd_failover_pool_dobalance_start = process("dhcpd").mark("failover_pool_dobalance_start")
772+{
773+ probestr = sprintf("%s", $$name);
774+}
775+
776+probe dhcpd_failover_pool_dobalance_done = process("dhcpd").mark("failover_pool_dobalance_done")
777+{
778+ probestr = sprintf("%s", $$name);
779+}
780+
781+
782+probe dhcpd_failover_set_state_start = process("dhcpd").mark("failover_set_state_start")
783+{
784+ state = $arg1;
785+ new_state = $arg2;
786+ probestr = sprintf("%s(state=%d, new_state=%d)", $$name, state, new_state);
787+}
788+
789+probe dhcpd_failover_set_state_done = process("dhcpd").mark("failover_set_state_done")
790+{
791+ probestr = sprintf("%s", $$name);
792+}
177b938a
MT
793diff -up dhcp-4.2.5b1/tapset/Makefile.am.systemtap dhcp-4.2.5b1/tapset/Makefile.am
794--- dhcp-4.2.5b1/tapset/Makefile.am.systemtap 2012-12-17 16:56:40.604880777 +0100
795+++ dhcp-4.2.5b1/tapset/Makefile.am 2012-12-17 16:56:40.604880777 +0100
6df985df
SS
796@@ -0,0 +1,26 @@
797+# Makefile.am for dhcp/tapset
798+# Jiri Popelka
799+
800+.PHONY: clean-local install-data-hook uninstall-local
801+
802+#
803+EXTRA_DIST = dhcpd.stp
804+TAPSET_FILES = $(EXTRA_DIST)
805+TAPSET_INSTALL_DIR = $(DESTDIR)@ABS_TAPSET_DIR@
806+
807+if ENABLE_SYSTEMTAP
808+all-local: $(TAPSET_FILES)
809+
810+clean-local:
811+
812+install-data-hook:
813+ $(MKDIR_P) $(TAPSET_INSTALL_DIR)
814+ $(INSTALL_DATA) $(TAPSET_FILES) $(TAPSET_INSTALL_DIR)
815+
816+uninstall-local:
817+ @list='$(TAPSET_FILES)'; for p in $$list; do \
818+ echo " rm -f '$(TAPSET_INSTALL_DIR)/$$p'"; \
819+ rm -f "$(TAPSET_INSTALL_DIR)/$$p"; \
820+ done
821+endif
822+