From 15b7057f9b9f2b232cf2f9f674c63140e903e379 Mon Sep 17 00:00:00 2001 From: Scott Little Date: Mon, 2 Oct 2017 15:25:15 -0400 Subject: [PATCH 2/7] WRS: Patch102: dhclient-restrict-interfaces-to-command-line.patch --- client/clparse.c | 8 ++++++-- client/dhclient.c | 3 +++ includes/dhcpd.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/clparse.c b/client/clparse.c index b609caf..3ae632a 100644 --- a/client/clparse.c +++ b/client/clparse.c @@ -943,8 +943,12 @@ void parse_interface_declaration (cfile, outer_config, name) if (!client -> config) make_client_config (client, outer_config); - ip -> flags &= ~INTERFACE_AUTOMATIC; - interfaces_requested = 1; + if (restrict_interfaces != ISC_TRUE) { + ip -> flags &= ~INTERFACE_AUTOMATIC; + interfaces_requested = 1; + } else { + log_info("%s not in command line interfaces; ignoring", ip->name); + } token = next_token (&val, (unsigned *)0, cfile); if (token != LBRACE) { diff --git a/client/dhclient.c b/client/dhclient.c index 0db4703..00b4240 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -71,6 +71,7 @@ isc_boolean_t no_pid_file = ISC_FALSE; int dhcp_max_agent_option_packet_length = 0; int interfaces_requested = 0; +int restrict_interfaces = ISC_FALSE; struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } }; struct iaddr iaddr_any = { 4, { 0, 0, 0, 0 } }; @@ -242,6 +243,8 @@ main(int argc, char **argv) { no_dhclient_pid = 1; } else if (!strcmp(argv[i], "--no-pid")) { no_pid_file = ISC_TRUE; + } else if (!strcmp(argv[i], "--restrict-interfaces")) { + restrict_interfaces = ISC_TRUE; } else if (!strcmp(argv[i], "-cf")) { if (++i == argc) usage(); diff --git a/includes/dhcpd.h b/includes/dhcpd.h index 1d2bf2c..b1f16bf 100644 --- a/includes/dhcpd.h +++ b/includes/dhcpd.h @@ -2693,6 +2693,7 @@ extern const char *path_dhclient_db; extern const char *path_dhclient_pid; extern char *path_dhclient_script; extern int interfaces_requested; +extern int restrict_interfaces; extern struct data_string default_duid; extern int duid_type; -- 1.9.1