mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-26 12:00:48 -09:00
package/systemd: Backport fix for network-generator
The systemd-network-generator.service will fail to parse the bootarg "ip=xxx" if it's missing the (optional) hostname field. Backport this fix from systemd v245. Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com> Reviewed-by: Yann E. MORIN <yann.morin.1998@free.fr> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
committed by
Peter Korsgaard
parent
bd5de6ab6a
commit
eb81345aa9
@@ -0,0 +1,44 @@
|
||||
From 21a925a4ac7955e7d7e6cfd477e96d3a2aaee7db Mon Sep 17 00:00:00 2001
|
||||
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Date: Thu, 12 Dec 2019 19:01:21 +0900
|
||||
Subject: [PATCH 1/1] network-generator: allow empty hostname
|
||||
|
||||
Fixes #14319.
|
||||
|
||||
[Brandon: backport from https://github.com/systemd/systemd/commit/21a925a4ac7955e7d7e6cfd477e96d3a2aaee7db]
|
||||
Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
|
||||
---
|
||||
src/network/generator/network-generator.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c
|
||||
index 81afa95307..bed1e42697 100644
|
||||
--- a/src/network/generator/network-generator.c
|
||||
+++ b/src/network/generator/network-generator.c
|
||||
@@ -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;
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
Reference in New Issue
Block a user