Add debian package for dhcp
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
This commit is contained in:
parent
229a6b32af
commit
ddf1b6eca6
@ -0,0 +1,18 @@
|
|||||||
|
The dhcp upstream commit 9261cb141 introduces a function
|
||||||
|
set_hostname() set host name, and the commit also implements
|
||||||
|
the DHCPv6 Handlers, so insert the set_hostname to the
|
||||||
|
BOUND6|RENEW6|REBIND6 implementation.
|
||||||
|
|
||||||
|
Yue Tao <yue.tao@windriver.com>
|
||||||
|
|
||||||
|
--- a/debian/dhclient-script.linux
|
||||||
|
+++ b/debian/dhclient-script.linux
|
||||||
|
@@ -393,6 +393,8 @@ case "$reason" in
|
||||||
|
;;
|
||||||
|
|
||||||
|
BOUND6|RENEW6|REBIND6)
|
||||||
|
+ set_hostname
|
||||||
|
+
|
||||||
|
if [ "${new_ip6_address}" ]; then
|
||||||
|
# set leased IP
|
||||||
|
ip -6 addr add ${new_ip6_address} \
|
1
base/dhcp/debian/deb_patches/series
Normal file
1
base/dhcp/debian/deb_patches/series
Normal file
@ -0,0 +1 @@
|
|||||||
|
dhclient-dhcp6-set-hostname.patch
|
7
base/dhcp/debian/meta_data.yaml
Normal file
7
base/dhcp/debian/meta_data.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
debver: 4.4.1-2.3
|
||||||
|
debname: isc-dhcp
|
||||||
|
archive: https://snapshot.debian.org/archive/debian/20210529T084123Z/pool/main/i/isc-dhcp/
|
||||||
|
revision:
|
||||||
|
dist: $STX_DIST
|
||||||
|
PKG_GITREVCOUNT: true
|
@ -0,0 +1,48 @@
|
|||||||
|
From f1df67309b435da1d9e02b77100a793ba0165f04 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Scott Little <scott.little@windriver.com>
|
||||||
|
Date: Mon, 2 Oct 2017 15:25:18 -0400
|
||||||
|
Subject: [PATCH 3/7] WRS: Patch103: dhclient-ipv6-bind-to-interface.patch
|
||||||
|
|
||||||
|
---
|
||||||
|
common/socket.c | 18 +++++++++---------
|
||||||
|
1 file changed, 9 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/common/socket.c b/common/socket.c
|
||||||
|
index f30c171..b236c4a 100644
|
||||||
|
--- a/common/socket.c
|
||||||
|
+++ b/common/socket.c
|
||||||
|
@@ -252,6 +252,15 @@ if_register_socket(struct interface_info
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#if defined(SO_BINDTODEVICE)
|
||||||
|
+ /* Bind this socket to this interface. */
|
||||||
|
+ if ((!do_multicast || !*do_multicast) && info->ifp &&
|
||||||
|
+ setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE,
|
||||||
|
+ (char *)(info -> ifp), sizeof(*(info -> ifp))) < 0) {
|
||||||
|
+ log_error("setsockopt: SO_BINDTODEVICE: %m");
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/* Bind the socket to this interface's IP address. */
|
||||||
|
if (bind(sock, (struct sockaddr *)&name, name_len) < 0) {
|
||||||
|
log_error("Can't bind to dhcp address: %m");
|
||||||
|
@@ -262,15 +271,6 @@ if_register_socket(struct interface_info
|
||||||
|
log_fatal("includes a bootp server.");
|
||||||
|
}
|
||||||
|
|
||||||
|
-#if defined(SO_BINDTODEVICE)
|
||||||
|
- /* Bind this socket to this interface. */
|
||||||
|
- if ((local_family != AF_INET6) && (info->ifp != NULL) &&
|
||||||
|
- setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE,
|
||||||
|
- (char *)(info -> ifp), sizeof(*(info -> ifp))) < 0) {
|
||||||
|
- log_fatal("setsockopt: SO_BINDTODEVICE: %m");
|
||||||
|
- }
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
/* IP_BROADCAST_IF instructs the kernel which interface to send
|
||||||
|
* IP packets whose destination address is 255.255.255.255. These
|
||||||
|
* will be treated as subnet broadcasts on the interface identified
|
||||||
|
--
|
||||||
|
1.9.1
|
||||||
|
|
@ -0,0 +1,24 @@
|
|||||||
|
The dhcp upstream commit 9261cb141 introduces a function
|
||||||
|
set_hostname() set host name, and the commit also implements
|
||||||
|
the DHCPv6 Handlers, so insert the set_hostname to the
|
||||||
|
BOUND6|RENEW6|REBIND6 implementation.
|
||||||
|
|
||||||
|
Yue Tao <yue.tao@windriver.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
client/scripts/linux | 13 +++++++++++++
|
||||||
|
1 file changed, 13 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/client/scripts/linux b/client/scripts/linux
|
||||||
|
index 14655f0..59e764f 100755
|
||||||
|
--- a/client/scripts/linux
|
||||||
|
+++ b/client/scripts/linux
|
||||||
|
@@ -460,6 +460,8 @@ case "$reason" in
|
||||||
|
make_resolv_conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
+ set_hostname
|
||||||
|
+
|
||||||
|
;;
|
||||||
|
|
||||||
|
DEPREF6)
|
@ -0,0 +1,67 @@
|
|||||||
|
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
|
||||||
|
|
3
base/dhcp/debian/patches/series
Normal file
3
base/dhcp/debian/patches/series
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
dhclient-restrict-interfaces-to-command-line.patch
|
||||||
|
dhclient-ipv6-bind-to-interface.patch
|
||||||
|
dhclient-ipv6-conditionally-set-hostname.patch
|
Loading…
Reference in New Issue
Block a user