devices may still use the previous method.
+ Don't run ethtool as root. Kernels older than 2.6.19 won't get
link information anymore.
+ + Add "configure system hostname ." option to not use a FQDN
+ for system name.
* Fixes:
+ Handle team interfaces like a bond. Real MAC address cannot be
retrieved yet.
#include <unistd.h>
#include <string.h>
+#include <sys/utsname.h>
#include "client.h"
#include "../log.h"
cmd_hostname(struct lldpctl_conn_t *conn, struct writer *w,
struct cmd_env *env, void *arg)
{
+ struct utsname un;
log_debug("lldpctl", "set system name");
lldpctl_atom_t *config = lldpctl_get_configuration(conn);
}
const char *value = cmdenv_get(env, "hostname");
+ if (value && strlen(value) == 1 && value[0] == '.') {
+ if (uname(&un) < 0) {
+ log_warn("lldpctl", "cannot get node name");
+ return 0;
+ }
+ value = un.nodename;
+ }
if (lldpctl_atom_set_str(config,
lldpctl_k_config_hostname, value) == NULL) {
log_warnx("lldpctl", "unable to set system name. %s",
.Cd system hostname Ar name
.Bd -ragged -offset XXXXXX
Override system hostname with the provided value. By default, the
-system name is found from the resolved value of
+system name is the FQDN found from the resolved value of
.Ic uname -n .
+As a special value, use "." (dot) to use the short hostname instead of
+a FQDN.
.Ed
.Cd unconfigure