mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-10-27 01:55:32 +03:00
Merge pull request #14321 from yuwata/network-generator-14319
network-generator: allow empty hostname
This commit is contained in:
commit
3e761fe2c9
@ -574,7 +574,7 @@ static int parse_netmask_or_prefixlen(int family, const char **value, unsigned c
|
||||
|
||||
static int parse_cmdline_ip_address(Context *context, int family, const char *value) {
|
||||
union in_addr_union addr = {}, peer = {}, gateway = {};
|
||||
const char *hostname, *ifname, *dhcp_type, *dns, *p;
|
||||
const char *hostname = NULL, *ifname, *dhcp_type, *dns, *p;
|
||||
unsigned char prefixlen;
|
||||
int r;
|
||||
|
||||
@ -599,9 +599,11 @@ static int parse_cmdline_ip_address(Context *context, int family, const char *va
|
||||
if (!p)
|
||||
return -EINVAL;
|
||||
|
||||
hostname = strndupa(value, p - value);
|
||||
if (!hostname_is_valid(hostname, false))
|
||||
return -EINVAL;
|
||||
if (p != value) {
|
||||
hostname = strndupa(value, p - value);
|
||||
if (!hostname_is_valid(hostname, false))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
value = p + 1;
|
||||
|
||||
|
@ -0,0 +1,17 @@
|
||||
# Automatically generated by systemd-network-generator
|
||||
|
||||
[Match]
|
||||
Name=enp3s0
|
||||
|
||||
[Link]
|
||||
|
||||
[Network]
|
||||
DHCP=no
|
||||
|
||||
[DHCP]
|
||||
|
||||
[Address]
|
||||
Address=10.99.37.44/16
|
||||
|
||||
[Route]
|
||||
Gateway=10.99.10.1
|
1
test/TEST-35-NETWORK-GENERATOR/test-03-issue-14319.input
Normal file
1
test/TEST-35-NETWORK-GENERATOR/test-03-issue-14319.input
Normal file
@ -0,0 +1 @@
|
||||
root=/dev/nfs nfsroot=10.99.37.240:/srv/netroot,v3,tcp ip=10.99.37.44::10.99.10.1:255.255.0.0::enp3s0:off
|
Loading…
Reference in New Issue
Block a user