summaryrefslogtreecommitdiff
path: root/isisd/isis_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'isisd/isis_misc.c')
-rw-r--r--isisd/isis_misc.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/isisd/isis_misc.c b/isisd/isis_misc.c
index 763ae243..cf558e83 100644
--- a/isisd/isis_misc.c
+++ b/isisd/isis_misc.c
@@ -28,12 +28,13 @@
#include <ctype.h>
#include <zebra.h>
#include <net/ethernet.h>
-
+#include <sys/utsname.h>
#include "stream.h"
#include "vty.h"
#include "hash.h"
#include "if.h"
+#include "command.h"
#include "isisd/dict.h"
#include "isisd/isis_constants.h"
@@ -432,7 +433,22 @@ newprefix2inaddr (u_char *prefix_start, u_char prefix_masklen)
return new_prefix;
}
+/*
+ * Returns host.name if any, otherwise
+ * it returns the system hostname.
+ */
+const char *
+unix_hostname(void)
+{
+ static struct utsname names;
+ const char *hostname;
+ extern struct host host;
+
+ hostname = host.name;
+ if (!hostname) {
+ uname(&names);
+ hostname = names.nodename;
+ }
-
-
-
+ return hostname;
+}