1
1
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:
Lennart Poettering 2019-12-12 17:52:09 +01:00 committed by GitHub
commit 3e761fe2c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 4 deletions

View File

@ -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;

View File

@ -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

View 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