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_lsp.c b/isisd/isis_lsp.c
index 6bfb0fd..f797b9e 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -60,7 +60,6 @@
extern struct isis *isis;
extern struct thread_master *master;
-extern struct host host;
int
lsp_id_cmp (u_char *id1, u_char *id2)
@@ -638,7 +637,7 @@
if (dyn)
sprintf (id, "%.14s", dyn->name.name);
else if (!memcmp (isis->sysid, lsp_id, ISIS_SYS_ID_LEN) & dynhost)
- sprintf (id, "%.14s", host.name);
+ sprintf (id, "%.14s", unix_hostname());
else {
memcpy(id, sysid_print (lsp_id), 15);
}
@@ -1053,8 +1052,9 @@
if (area->dynhostname) {
lsp->tlv_data.hostname = XMALLOC (MTYPE_ISIS_TLV,
sizeof (struct hostname));
- memcpy (&lsp->tlv_data.hostname->name, host.name, strlen(host.name));
- lsp->tlv_data.hostname->namelen = strlen (host.name);
+ memcpy (&lsp->tlv_data.hostname->name, unix_hostname(),
+ strlen(unix_hostname()));
+ lsp->tlv_data.hostname->namelen = strlen (unix_hostname());
}
#ifdef TOPOLOGY_GENERATE
/*
@@ -1337,8 +1337,10 @@
if (area->dynhostname) {
lsp->tlv_data.hostname = XMALLOC (MTYPE_ISIS_TLV,
sizeof (struct hostname));
- memcpy (lsp->tlv_data.hostname->name, host.name, strlen (host.name));
- lsp->tlv_data.hostname->namelen = strlen (host.name);
+
+ memcpy (lsp->tlv_data.hostname->name, unix_hostname(),
+ strlen (unix_hostname()));
+ lsp->tlv_data.hostname->namelen = strlen (unix_hostname());
}
/*
@@ -1553,13 +1555,14 @@
if (area->dynhostname) {
tlv_ptr = lsppdu_realloc (lsp,MTYPE_ISIS_TLV, 2); /* the 2 is for the TL */
*tlv_ptr = DYNAMIC_HOSTNAME; /* Type */
- *(tlv_ptr+1) = strlen (host.name); /* Length */
+ *(tlv_ptr+1) = strlen (unix_hostname()); /* Length */
lsp->tlv_data.hostname = (struct hostname *)
(lsppdu_realloc(lsp,
MTYPE_ISIS_TLV,
/* the -1 is to fit the length in the struct */
- strlen (host.name)) - 1);
- memcpy (lsp->tlv_data.hostname->name, host.name, strlen(host.name));
+ strlen (unix_hostname())) - 1);
+ memcpy (lsp->tlv_data.hostname->name, unix_hostname(),
+ strlen(unix_hostname()));
}
}