1 Star 0 Fork 24

yoo/dhcp

forked from src-openEuler/dhcp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-0017-Send-unicast-request-release-via-correct-interface.patch 2.58 KB
一键复制 编辑 原始数据 按行查看 历史
renmingshuai 提交于 2022-11-01 15:46 . update to v4.4.3
Reference: https://src.fedoraproject.org/rpms/dhcp/blob/rawhide/f/0017-Send-unicast-request-release-via-correct-interface.patch
From d45463c2007a78623f2c90c250bb8e2f3e34a852 Mon Sep 17 00:00:00 2001
From: Pavel Zhukov <pzhukov@redhat.com>
Date: Thu, 21 Feb 2019 10:39:36 +0100
Subject: [PATCH 17/28] Send unicast request/release via correct interface
(#800561, #1177351)
(Submitted to dhcp-bugs@isc.org - [ISC-Bugs #30544])
---
client/dhclient.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/client/dhclient.c b/client/dhclient.c
index 444d251..d607975 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -3417,6 +3417,14 @@ void send_request (cpp)
#endif
if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
fallback_interface) {
+#if defined(SO_BINDTODEVICE)
+ if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
+ SO_BINDTODEVICE, client->interface->name,
+ strlen(client->interface->name)) < 0) {
+ log_error("%s:%d: Failed to bind fallback interface"
+ " to %s: %m", MDL, client->interface->name);
+ }
+#endif
result = send_packet(fallback_interface, NULL, &client->packet,
client->packet_length, from, &destination,
NULL);
@@ -3426,6 +3434,13 @@ void send_request (cpp)
client->packet_length,
fallback_interface->name);
}
+#if defined(SO_BINDTODEVICE)
+ if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
+ SO_BINDTODEVICE, NULL, 0) < 0) {
+ log_fatal("%s:%d: Failed to unbind fallback interface:"
+ " %m", MDL);
+ }
+#endif
}
else {
/* Send out a packet. */
@@ -3543,6 +3558,14 @@ void send_release (cpp)
} else
#endif
if (fallback_interface) {
+#if defined(SO_BINDTODEVICE)
+ if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
+ SO_BINDTODEVICE, client->interface->name,
+ strlen(client->interface->name)) < 0) {
+ log_error("%s:%d: Failed to bind fallback interface"
+ " to %s: %m", MDL, client->interface->name);
+ }
+#endif
result = send_packet(fallback_interface, NULL, &client->packet,
client->packet_length, from, &destination,
NULL);
@@ -3552,6 +3575,13 @@ void send_release (cpp)
client->packet_length,
fallback_interface->name);
}
+#if defined(SO_BINDTODEVICE)
+ if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
+ SO_BINDTODEVICE, NULL, 0) < 0) {
+ log_fatal("%s:%d: Failed to unbind fallback interface:"
+ " %m", MDL);
+ }
+#endif
} else {
/* Send out a packet. */
result = send_packet(client->interface, NULL, &client->packet,
--
2.35.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mdLUbG/dhcp.git
git@gitee.com:mdLUbG/dhcp.git
mdLUbG
dhcp
dhcp
master

搜索帮助