summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ldpd/neighbor.c7
-rw-r--r--lib/libospf.h2
-rw-r--r--lib/vty.c38
-rw-r--r--ospf6d/ospf6_lsdb.c3
-rw-r--r--zebra/kernel_socket.c1
5 files changed, 32 insertions, 19 deletions
diff --git a/ldpd/neighbor.c b/ldpd/neighbor.c
index 9a92a00d32..7cd3a3fd7d 100644
--- a/ldpd/neighbor.c
+++ b/ldpd/neighbor.c
@@ -287,6 +287,8 @@ nbr_new(struct in_addr id, int af, int ds_tlv, union ldpd_addr *addr,
void
nbr_del(struct nbr *nbr)
{
+ struct adj *adj;
+
log_debug("%s: lsr-id %s", __func__, inet_ntoa(nbr->id));
nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION);
@@ -312,6 +314,11 @@ nbr_del(struct nbr *nbr)
mapping_list_clr(&nbr->release_list);
mapping_list_clr(&nbr->abortreq_list);
+ while ((adj = RB_ROOT(&nbr->adj_tree)) != NULL) {
+ adj->nbr = NULL;
+ RB_REMOVE(nbr_adj_head, &nbr->adj_tree, adj);
+ }
+
if (nbr->peerid)
RB_REMOVE(nbr_pid_head, &nbrs_by_pid, nbr);
RB_REMOVE(nbr_id_head, &nbrs_by_id, nbr);
diff --git a/lib/libospf.h b/lib/libospf.h
index a1ff9c24a2..ec6e642f89 100644
--- a/lib/libospf.h
+++ b/lib/libospf.h
@@ -35,7 +35,7 @@
/* Architectual Constants */
#ifdef DEBUG
-#define OSPF_LS_REFRESH_TIME 60
+#define OSPF_LS_REFRESH_TIME 120
#else
#define OSPF_LS_REFRESH_TIME 1800
#endif
diff --git a/lib/vty.c b/lib/vty.c
index 9b4badb096..4ba790e7c7 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -322,6 +322,7 @@ vty_new ()
{
struct vty *new = XCALLOC (MTYPE_VTY, sizeof (struct vty));
+ new->fd = new->wfd = -1;
new->obuf = buffer_new(0); /* Use default buffer size. */
new->buf = XCALLOC (MTYPE_VTY, VTY_BUFSIZ);
new->error_buf = XCALLOC (MTYPE_VTY, VTY_BUFSIZ);
@@ -2250,18 +2251,22 @@ vty_close (struct vty *vty)
XFREE (MTYPE_VTY_HIST, vty->hist[i]);
/* Unset vector. */
- vector_unset (vtyvec, vty->fd);
+ if (vty->fd != -1)
+ vector_unset(vtyvec, vty->fd);
if (vty->wfd > 0 && vty->type == VTY_FILE)
fsync (vty->wfd);
- /* Close socket. */
- if (vty->fd > 0)
- {
- close (vty->fd);
- if (vty->wfd > 0 && vty->wfd != vty->fd)
- close (vty->wfd);
- }
+ /* Close socket.
+ * note check is for fd > STDERR_FILENO, not fd != -1.
+ * We never close stdin/stdout/stderr here, because we may be
+ * running in foreground mode with logging to stdout. Also,
+ * additionally, we'd need to replace these fds with /dev/null. */
+ if (vty->wfd > STDERR_FILENO && vty->wfd != vty->fd)
+ close(vty->wfd);
+
+ if (vty->fd > STDERR_FILENO)
+ close(vty->fd);
else
was_stdio = true;
@@ -2311,13 +2316,14 @@ vty_read_file (FILE *confp)
unsigned int line_num = 0;
vty = vty_new ();
- vty->wfd = dup(STDERR_FILENO); /* vty_close() will close this */
- if (vty->wfd < 0)
- {
- /* Fine, we couldn't make a new fd. vty_close doesn't close stdout. */
- vty->wfd = STDOUT_FILENO;
- }
- vty->fd = STDIN_FILENO;
+ /* vty_close won't close stderr; if some config command prints
+ * something it'll end up there. (not ideal; it'd be beter if output
+ * from a file-load went to logging instead. Also note that if this
+ * function is called after daemonizing, stderr will be /dev/null.)
+ *
+ * vty->fd will be -1 from vty_new()
+ */
+ vty->wfd = STDERR_FILENO;
vty->type = VTY_FILE;
vty->node = CONFIG_NODE;
@@ -2325,7 +2331,7 @@ vty_read_file (FILE *confp)
ret = config_from_file (vty, confp, &line_num);
/* Flush any previous errors before printing messages below */
- buffer_flush_all (vty->obuf, vty->fd);
+ buffer_flush_all (vty->obuf, vty->wfd);
if ( !((ret == CMD_SUCCESS) || (ret == CMD_ERR_NOTHING_TODO)) )
{
diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c
index 1d4b557cd5..55f3db89d9 100644
--- a/ospf6d/ospf6_lsdb.c
+++ b/ospf6d/ospf6_lsdb.c
@@ -92,8 +92,7 @@ _lsdb_count_assert (struct ospf6_lsdb *lsdb)
lsdb, lsdb->count, num);
for (debug = ospf6_lsdb_head (lsdb); debug;
debug = ospf6_lsdb_next (debug))
- zlog_debug ("%p %p %s lsdb[%p]", debug->prev, debug->next, debug->name,
- debug->lsdb);
+ zlog_debug ("%s lsdb[%p]", debug->name, debug->lsdb);
zlog_debug ("DUMP END");
assert (num == lsdb->count);
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index eeccd1f175..70effade27 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -628,6 +628,7 @@ ifm_read (struct if_msghdr *ifm)
#ifdef HAVE_NET_RT_IFLIST
ifp->stats = ifm->ifm_data;
#endif /* HAVE_NET_RT_IFLIST */
+ ifp->speed = ifm->ifm_data.ifi_baudrate / 1000000;
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug ("%s: interface %s index %d",