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.
diff --git a/isisd/isis_misc.c b/isisd/isis_misc.c
index 763ae24..cf558e8 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 @@
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;
+}