summaryrefslogtreecommitdiff
path: root/lib/vty.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2020-11-18 11:04:27 -0500
committerDonald Sharp <sharpd@nvidia.com>2020-11-18 11:04:27 -0500
commit0154d8ce45a5099d2d0b9dd3de4e67d4a902d3f5 (patch)
tree2d1cde92342b90447d03b52d89b8e6809a9fc265 /lib/vty.c
parentb83bb9aa629a0361bc76fa90beb6f6e7d2b57332 (diff)
bgpd, lib, nhrpd, zebra: verify return of sockunion2hostprefix
The return from sockunion2hostprefix tells us if the conversion succeeded or not. There are places in the code where we always assume that it just `works`, since it can fail notice and try to do the right thing. Please note that failure of this function for most cases of sockunion2hostprefix is highly highly unlikely as that the sockunion was already created and tested elsewhere it's just that this function can fail. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib/vty.c')
-rw-r--r--lib/vty.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/vty.c b/lib/vty.c
index fea4c49032..1eb4171630 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -1810,7 +1810,11 @@ static int vty_accept(struct thread *thread)
set_nonblocking(vty_sock);
set_cloexec(vty_sock);
- sockunion2hostprefix(&su, &p);
+ if (!sockunion2hostprefix(&su, &p)) {
+ zlog_info("Vty unable to convert prefix from sockunion %s",
+ sockunion2str(&su, buf, SU_ADDRSTRLEN));
+ return -1;
+ }
/* VTY's accesslist apply. */
if (p.family == AF_INET && vty_accesslist_name) {