From: Shawn Routhier Date: Tue, 12 Jan 2016 20:33:26 +0000 (-0800) Subject: [master] Hnadle dhcpv6 being disabled better X-Git-Tag: v4_3_4~42 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eda1d0aa5a24f46de742bf7fd2989ae58d72cf78;p=thirdparty%2Fdhcp.git [master] Hnadle dhcpv6 being disabled better The previous patches didn't handle dhvpv6 being disabled well. This change moves the #ifdefs a bit to handle it. --- diff --git a/RELNOTES b/RELNOTES index 17e8bc6df..55ee8dbb5 100644 --- a/RELNOTES +++ b/RELNOTES @@ -136,6 +136,7 @@ by Eric Young (eay@cryptsoft.com). print out a specific error message about the first error in addition to the usage string. This may be disabled by editing includes/site.h. [ISC-Bugs #40321] + [ISC-Bugs #41454] - The configure script will now exit with an error message if it cannot find a GNU-style make tool (needed when building BIND libraries) or pkg-config diff --git a/client/dhclient.c b/client/dhclient.c index 7a4ee1eb8..df7f8836e 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -71,10 +71,12 @@ int std_dhcid = 0; assert (state_is == state_shouldbe). */ #define ASSERT_STATE(state_is, state_shouldbe) {} +#ifndef UNIT_TEST static const char copyright[] = "Copyright 2004-2015 Internet Systems Consortium."; static const char arr [] = "All rights reserved."; static const char message [] = "Internet Systems Consortium DHCP Client"; static const char url [] = "For info, please visit https://www.isc.org/software/dhcp/"; +#endif /* UNIT_TEST */ u_int16_t local_port = 0; u_int16_t remote_port = 0; @@ -129,8 +131,9 @@ static void dhclient_ddns_cb_free(dhcp_ddns_cb_t *ddns_cb, * which isn't compiled when building for unit tests */ static const char use_noarg[] = "No argument for command: %s"; +#ifdef DHCPv6 static const char use_v6command[] = "Command not used for DHCPv4: %s"; -#endif /* !UNIT_TEST */ +#endif static void usage(const char *sfmt, const char *sarg) @@ -159,7 +162,6 @@ usage(const char *sfmt, const char *sarg) isc_file_basename(progname)); } -#ifndef UNIT_TEST int main(int argc, char **argv) { int fd; @@ -810,7 +812,6 @@ main(int argc, char **argv) { /* In fact dispatch() never returns. */ return 0; } -#endif /* !UNIT_TEST */ void run_stateless(int exit_mode) { @@ -899,6 +900,7 @@ void run_stateless(int exit_mode) #endif /* DHCPv6 */ return; } +#endif /* !UNIT_TEST */ isc_result_t find_class (struct class **c, const char *s, const char *file, int line) diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c index 6095ebcf2..e50032b8a 100644 --- a/relay/dhcrelay.c +++ b/relay/dhcrelay.c @@ -183,9 +183,11 @@ char *progname; * \return Nothing */ static const char use_noarg[] = "No argument for command: %s"; +#ifdef DHCPv6 static const char use_badproto[] = "Protocol already set, %s inappropriate"; static const char use_v4command[] = "Command not used for DHCPv6: %s"; static const char use_v6command[] = "Command not used for DHCPv4: %s"; +#endif static void usage(const char *sfmt, const char *sarg) { diff --git a/server/tests/simple_unittest.c b/server/tests/simple_unittest.c index 5e1db9197..c345aefdc 100644 --- a/server/tests/simple_unittest.c +++ b/server/tests/simple_unittest.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2012,2015-2016 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -67,7 +67,7 @@ ATF_TC_BODY(simple_test_case, tc) } - +#ifdef DHCPv6 ATF_TC(parse_byte_order); ATF_TC_HEAD(parse_byte_order, tc) @@ -110,7 +110,7 @@ ATF_TC_BODY(parse_byte_order, tc) atf_tc_pass(); } - +#endif /* DHCPv6 */ /* This macro defines main() method that will call specified test cases. tp and simple_test_case names can be whatever you want @@ -118,7 +118,8 @@ ATF_TC_BODY(parse_byte_order, tc) ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, simple_test_case); +#ifdef DHCPv6 ATF_TP_ADD_TC(tp, parse_byte_order); - +#endif return (atf_no_error()); }