ddf1b6eca6
Porting 3 source patches for CentOS dhclient-ipv6-bind-to-interface.patch dhclient-ipv6-conditionally-set-hostname.patch dhclient-restrict-interfaces-to-command-line.patch Ignore 0001-dhcp-set-the-prefixlen-to-64.patch, which disables a patch from dhcp-4.2.5-82.el7.centos.src.rpm. Porting dhclient-dhcp6-set-hostname.patch based on the dhclient-script.linux of Debian package. Story: 2009221 Task: 43440 Signed-off-by: Yue Tao <yue.tao@windriver.com> Change-Id: I457230bc08a23abb1efa1a7619c0cba8ff4d7967
68 lines
2.1 KiB
Diff
68 lines
2.1 KiB
Diff
From 15b7057f9b9f2b232cf2f9f674c63140e903e379 Mon Sep 17 00:00:00 2001
|
|
From: Scott Little <scott.little@windriver.com>
|
|
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
|
|
@@ -980,8 +980,12 @@ void parse_interface_declaration (cfile,
|
|
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
|
|
@@ -57,6 +57,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 } };
|
|
@@ -399,6 +400,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(use_noarg, argv[i-1]);
|
|
diff --git a/includes/dhcpd.h b/includes/dhcpd.h
|
|
index 1d2bf2c..b1f16bf 100644
|
|
--- a/includes/dhcpd.h
|
|
+++ b/includes/dhcpd.h
|
|
@@ -2973,6 +2973,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;
|
|
extern const char *path_dhclient_duid;
|
|
--
|
|
1.9.1
|
|
|