integ/base/dhcp/debian/patches/dhclient-ipv6-bind-to-interface.patch
Yue Tao ddf1b6eca6 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
2021-11-12 08:58:34 +08: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: [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