From b8955080cb5ff8e24479cc6638d420ca9c0d9817 Mon Sep 17 00:00:00 2001 From: Georg Sauthoff Date: Fri, 24 Nov 2023 20:06:06 +0100 Subject: [PATCH] client: translate dot into the short hostname as documented in lldpcli(8): configure system hostname name Override system hostname with the provided value. By default, the system name is the FQDN found from the resolved value of uname -n. As a special value, use "." (dot) to use the short hostname instead of a FQDN. --- src/client/conf-system.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/client/conf-system.c b/src/client/conf-system.c index 554f6fc2..57a62f85 100644 --- a/src/client/conf-system.c +++ b/src/client/conf-system.c @@ -205,6 +205,9 @@ cmd_hostname(struct lldpctl_conn_t *conn, struct writer *w, struct cmd_env *env, lldpctl_atom_dec_ref(config); return 0; } + char *c = strchr(un.nodename, '.'); + if (c) + *c = 0; value = un.nodename; } if (lldpctl_atom_set_str(config, lldpctl_k_config_hostname, value) == NULL) { -- 2.39.5