summaryrefslogtreecommitdiff
path: root/isisd/isis_misc.c
diff options
context:
space:
mode:
authorjardin <jardin>2003-12-23 08:56:18 +0000
committerjardin <jardin>2003-12-23 08:56:18 +0000
commit9e867fe663c4eb43c36f35067c0dd092e8c83c14 (patch)
treef29461b6a2dc8c38037dc0cf91e70392f9ed4ab2 /isisd/isis_misc.c
parenteb5d44eb8dcf25a1b328e57d1eabb1f89e3bc59b (diff)
Merge isisd into the Quagga's framework:
- add privs support - use misc quagga's definitions - make it compile"able" - fix segfault cases related to hostname() - add debug isis xxx command This patch has been approved by Paul Jakma.
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;
+}