* [PATCH] net: ipconfig: Don't override command-line hostnames or domains
@ 2021-06-02 1:38 Josh Triplett
2021-06-02 20:30 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Josh Triplett @ 2021-06-02 1:38 UTC (permalink / raw)
To: netdev, linux-kernel, David S. Miller, Hideaki YOSHIFUJI,
David Ahern, Jakub Kicinski
If the user specifies a hostname or domain name as part of the ip=
command-line option, preserve it and don't overwrite it with one
supplied by DHCP/BOOTP.
For instance, ip=::::myhostname::dhcp will use "myhostname" rather than
ignoring and overwriting it.
Fix the comment on ic_bootp_string that suggests it only copies a string
"if not already set"; it doesn't have any such logic.
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
---
net/ipv4/ipconfig.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index bc2f6ca97152..816d8aad5a68 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -886,7 +886,7 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d
/*
- * Copy BOOTP-supplied string if not already set.
+ * Copy BOOTP-supplied string
*/
static int __init ic_bootp_string(char *dest, char *src, int len, int max)
{
@@ -935,12 +935,15 @@ static void __init ic_do_bootp_ext(u8 *ext)
}
break;
case 12: /* Host name */
- ic_bootp_string(utsname()->nodename, ext+1, *ext,
- __NEW_UTS_LEN);
- ic_host_name_set = 1;
+ if (!ic_host_name_set) {
+ ic_bootp_string(utsname()->nodename, ext+1, *ext,
+ __NEW_UTS_LEN);
+ ic_host_name_set = 1;
+ }
break;
case 15: /* Domain name (DNS) */
- ic_bootp_string(ic_domain, ext+1, *ext, sizeof(ic_domain));
+ if (!ic_domain[0])
+ ic_bootp_string(ic_domain, ext+1, *ext, sizeof(ic_domain));
break;
case 17: /* Root path */
if (!root_server_path[0])
--
2.32.0.rc0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: ipconfig: Don't override command-line hostnames or domains
2021-06-02 1:38 [PATCH] net: ipconfig: Don't override command-line hostnames or domains Josh Triplett
@ 2021-06-02 20:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-02 20:30 UTC (permalink / raw)
To: Josh Triplett; +Cc: netdev, linux-kernel, davem, yoshfuji, dsahern, kuba
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
On Tue, 1 Jun 2021 18:38:41 -0700 you wrote:
> If the user specifies a hostname or domain name as part of the ip=
> command-line option, preserve it and don't overwrite it with one
> supplied by DHCP/BOOTP.
>
> For instance, ip=::::myhostname::dhcp will use "myhostname" rather than
> ignoring and overwriting it.
>
> [...]
Here is the summary with links:
- net: ipconfig: Don't override command-line hostnames or domains
https://git.kernel.org/netdev/net/c/b508d5fb69c2
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-02 20:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02 1:38 [PATCH] net: ipconfig: Don't override command-line hostnames or domains Josh Triplett
2021-06-02 20:30 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.