mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 15:33:56 +00:00
[lib] Fix infinite recursion for errors on vtys with terminal monitor enabled
2006-07-10 Andrew J. Schorr <ajschorr@alumni.princeton.edu> * vty.c: (vty_log_out, vty_read, vty_flush, vtysh_flush, vtysh_read) After an I/O error, must set vty->monitor to 0 before calling zlog_warn, otherwise an infinite recursion could occur (since zlog_warn triggers a message to be written to the vty, and that in turn triggers another error message when it fails, etc.).
This commit is contained in:
parent
1f2c2743ac
commit
74542d7301
@ -1,3 +1,11 @@
|
|||||||
|
2006-07-10 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
|
* vty.c: (vty_log_out, vty_read, vty_flush, vtysh_flush, vtysh_read)
|
||||||
|
After an I/O error, must set vty->monitor to 0 before calling
|
||||||
|
zlog_warn, otherwise an infinite recursion could occur
|
||||||
|
(since zlog_warn triggers a message to be written to the vty,
|
||||||
|
and that in turn triggers another error message when it fails, etc.).
|
||||||
|
|
||||||
2006-07-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
2006-07-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
* vty.c: (vty_log_out) Debug messages to terminal vty sessions
|
* vty.c: (vty_log_out) Debug messages to terminal vty sessions
|
||||||
|
@ -182,6 +182,7 @@ vty_log_out (struct vty *vty, const char *level, const char *proto_str,
|
|||||||
drop the data and ignore. */
|
drop the data and ignore. */
|
||||||
return -1;
|
return -1;
|
||||||
/* Fatal I/O error. */
|
/* Fatal I/O error. */
|
||||||
|
vty->monitor = 0; /* disable monitoring to avoid infinite recursion */
|
||||||
zlog_warn("%s: write failed to vty client fd %d, closing: %s",
|
zlog_warn("%s: write failed to vty client fd %d, closing: %s",
|
||||||
__func__, vty->fd, safe_strerror(errno));
|
__func__, vty->fd, safe_strerror(errno));
|
||||||
buffer_reset(vty->obuf);
|
buffer_reset(vty->obuf);
|
||||||
@ -1349,6 +1350,7 @@ vty_read (struct thread *thread)
|
|||||||
vty_event (VTY_READ, vty_sock, vty);
|
vty_event (VTY_READ, vty_sock, vty);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
vty->monitor = 0; /* disable monitoring to avoid infinite recursion */
|
||||||
zlog_warn("%s: read error on vty client fd %d, closing: %s",
|
zlog_warn("%s: read error on vty client fd %d, closing: %s",
|
||||||
__func__, vty->fd, safe_strerror(errno));
|
__func__, vty->fd, safe_strerror(errno));
|
||||||
}
|
}
|
||||||
@ -1571,6 +1573,7 @@ vty_flush (struct thread *thread)
|
|||||||
switch (flushrc)
|
switch (flushrc)
|
||||||
{
|
{
|
||||||
case BUFFER_ERROR:
|
case BUFFER_ERROR:
|
||||||
|
vty->monitor = 0; /* disable monitoring to avoid infinite recursion */
|
||||||
zlog_warn("buffer_flush failed on vty client fd %d, closing",
|
zlog_warn("buffer_flush failed on vty client fd %d, closing",
|
||||||
vty->fd);
|
vty->fd);
|
||||||
buffer_reset(vty->obuf);
|
buffer_reset(vty->obuf);
|
||||||
@ -2018,6 +2021,7 @@ vtysh_flush(struct vty *vty)
|
|||||||
vty_event(VTYSH_WRITE, vty->fd, vty);
|
vty_event(VTYSH_WRITE, vty->fd, vty);
|
||||||
break;
|
break;
|
||||||
case BUFFER_ERROR:
|
case BUFFER_ERROR:
|
||||||
|
vty->monitor = 0; /* disable monitoring to avoid infinite recursion */
|
||||||
zlog_warn("%s: write error to fd %d, closing", __func__, vty->fd);
|
zlog_warn("%s: write error to fd %d, closing", __func__, vty->fd);
|
||||||
buffer_reset(vty->obuf);
|
buffer_reset(vty->obuf);
|
||||||
vty_close(vty);
|
vty_close(vty);
|
||||||
@ -2053,6 +2057,7 @@ vtysh_read (struct thread *thread)
|
|||||||
vty_event (VTYSH_READ, sock, vty);
|
vty_event (VTYSH_READ, sock, vty);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
vty->monitor = 0; /* disable monitoring to avoid infinite recursion */
|
||||||
zlog_warn("%s: read failed on vtysh client fd %d, closing: %s",
|
zlog_warn("%s: read failed on vtysh client fd %d, closing: %s",
|
||||||
__func__, sock, safe_strerror(errno));
|
__func__, sock, safe_strerror(errno));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user