net: ipconfig: Don't override command-line hostnames or domains
authorJosh Triplett <josh@joshtriplett.org>
Wed, 2 Jun 2021 01:38:41 +0000 (18:38 -0700)
committerSasha Levin <sashal@kernel.org>
Wed, 30 Jun 2021 12:48:47 +0000 (08:48 -0400)
commitc97aafab4bfab12493b3eed6a3e0c74519bdd21b
tree4a05c6fe05890911b52432ed85005c38fc6e83bc
parent4b2e0ac757bc0deb1f1115ea84ebb6928bbd9c55
net: ipconfig: Don't override command-line hostnames or domains

[ Upstream commit b508d5fb69c2211a1b860fc058aafbefc3b3c3cd ]

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/ipconfig.c