Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152847332
D4559.id11553.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D4559.id11553.diff
View Options
Index: head/lib/libstand/bootp.c
===================================================================
--- head/lib/libstand/bootp.c
+++ head/lib/libstand/bootp.c
@@ -354,6 +354,7 @@
u_char *ep;
int size;
u_char tag;
+ const char *val;
#ifdef BOOTP_DEBUG
if (debug)
@@ -380,15 +381,17 @@
}
if (tag == TAG_SWAPSERVER) {
/* let it override bp_siaddr */
- bcopy(cp, &rootip.s_addr, sizeof(swapip.s_addr));
+ bcopy(cp, &rootip.s_addr, sizeof(rootip.s_addr));
}
if (tag == TAG_ROOTPATH) {
- strncpy(rootpath, (char *)cp, sizeof(rootpath));
- rootpath[size] = '\0';
+ if ((val = getenv("dhcp.root-path")) == NULL)
+ val = (const char *)cp;
+ strlcpy(rootpath, val, sizeof(rootpath));
}
if (tag == TAG_HOSTNAME) {
- strncpy(hostname, (char *)cp, sizeof(hostname));
- hostname[size] = '\0';
+ if ((val = getenv("dhcp.host-name")) == NULL)
+ val = (const char *)cp;
+ strlcpy(hostname, val, sizeof(hostname));
}
#ifdef SUPPORT_DHCP
if (tag == TAG_DHCP_MSGTYPE) {
@@ -730,7 +733,11 @@
sprintf(env, op->desc, opts[0].desc, tag);
else
sprintf(env, "%s%s", opts[0].desc, op->desc);
- setenv(env, buf, 1);
+ /*
+ * Do not replace existing values in the environment, so that
+ * locally-obtained values can override server-provided values.
+ */
+ setenv(env, buf, 0);
}
}
if (tp != tags) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 18, 11:58 AM (11 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31717815
Default Alt Text
D4559.id11553.diff (1 KB)
Attached To
Mode
D4559: Allow dhcp/bootp server-provided values to be overriden from environment variables in loader(8) and other libstand applications.
Attached
Detach File
Event Timeline
Log In to Comment