integ/base/dhcp/centos/patches/dhclient-ipv6-bind-to-interface.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

49 lines
1.6 KiB
Diff

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: 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 94ce334..17d32e4 100644
--- a/common/socket.c
+++ b/common/socket.c
@@ -234,6 +234,15 @@ if_register_socket(struct interface_info *info, int family,
}
#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");
@@ -244,15 +253,6 @@ if_register_socket(struct interface_info *info, int family,
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
--
2.7.4