integ/base/dhcp/centos/patches/dhclient-restrict-interfaces-to-command-line.patch
Long Li b2c483a806 CentOS 8: Upgrade dhcp to version 4.3.6
(1)Release Version Upgrade
(2)Matching code changes with el7 to el8

Set hostname based on ipv6 lease if not set

Story: 2006729
Task: 37684
Depends-On: https://review.opendev.org/#/c/696481/
Depends-On: https://review.opendev.org/#/c/696050/
Change-Id: Iba34ddd1cfcdbdcfc152a9b88227c72f398b3b1b
Signed-off-by: Long Li <lilong-neu@neusoft.com>
2019-12-18 11:30:28 +00:00

67 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: 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 076ea6a..983e280 100644
--- a/client/clparse.c
+++ b/client/clparse.c
@@ -1022,8 +1022,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 b61da43..3f78848 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -67,6 +67,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 } };
@@ -342,6 +343,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 d534f8c..e5cfb26 100644
--- a/includes/dhcpd.h
+++ b/includes/dhcpd.h
@@ -2924,6 +2924,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;
--
2.7.4