1 Star 0 Fork 25

luofeng14/dhcp

forked from src-openEuler/dhcp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
IAID-is-output-has-hexe-if-it-contains-or.patch 1.79 KB
一键复制 编辑 原始数据 按行查看 历史
renmingshuai 提交于 2024-01-20 03:23 . rebase from 22.03-LTS-Next
From fb971ee6b5403c21e64fa66c8711f688f763518c Mon Sep 17 00:00:00 2001
From: renmingshuai <renmingshuai@huawei.com>
Date: Sat, 20 Jan 2024 02:51:53 +0000
Subject: [PATCH] IAID is output has hexe if it contains '\' or '"'
Signed-off-by: renmingshuai <renmingshuai@huawei.com>
---
client/dhclient.conf.5 | 6 +++---
common/print.c | 4 +++-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/client/dhclient.conf.5 b/client/dhclient.conf.5
index 566a881..2e2dc56 100644
--- a/client/dhclient.conf.5
+++ b/client/dhclient.conf.5
@@ -617,9 +617,9 @@ pairs, separated by colons.
Currently, the values written out based on lease-id-format are the default-duid
and the IAID value (DHCPv6 only). The client automatically reads the values
in either format. Note that when the format is octal, rather than as an octal
-string, IAID is output as hex if it contains no printable characters or as a
-string if contains only printable characters. This is done to maintain backward
-compatibility.
+string, IAID is output as hex if it contains special character '"', '\' or
+no printable characters, or as a string if contains only printable characters.
+This is done to maintain backward compatibility.
.PP
\fBreject \fIcidr-ip-address\fR [\fB,\fR \fI...\fB \fIcidr-ip-address\fR ] \fB;\fR
.PP
diff --git a/common/print.c b/common/print.c
index b42e7bc..6835eb1 100644
--- a/common/print.c
+++ b/common/print.c
@@ -427,7 +427,9 @@ void print_hex_or_string (len, data, limit, buf)
return;
for (i = 0; (i < (limit - 3)) && (i < len); i++) {
- if (!isascii(data[i]) || !isprint(data[i])) {
+ /* print as hex if the characters contain '"' or '\' */
+ if (!isascii(data[i]) || !isprint(data[i]) ||
+ (data[i] == '"' || data[i] == '\\')) {
print_hex_only(len, data, limit, buf);
return;
}
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/luofeng14/dhcp.git
git@gitee.com:luofeng14/dhcp.git
luofeng14
dhcp
dhcp
master

搜索帮助