diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ldpctl/ldpctl.c | 12 | ||||
-rw-r--r-- | usr.sbin/ldpd/lde_lib.c | 10 | ||||
-rw-r--r-- | usr.sbin/ldpd/ldpd.h | 3 |
3 files changed, 14 insertions, 11 deletions
diff --git a/usr.sbin/ldpctl/ldpctl.c b/usr.sbin/ldpctl/ldpctl.c index 5369d86b928..0388149326a 100644 --- a/usr.sbin/ldpctl/ldpctl.c +++ b/usr.sbin/ldpctl/ldpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldpctl.c,v 1.6 2009/11/02 20:35:20 claudio Exp $ +/* $OpenBSD: ldpctl.c,v 1.7 2010/01/02 14:56:02 michele Exp $ * * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -117,8 +117,8 @@ main(int argc, char *argv[]) imsg_compose(ibuf, IMSG_CTL_SHOW_NBR, 0, 0, -1, NULL, 0); break; case SHOW_LIB: - printf("%-20s %-17s %-17s %s\n", "Destination", - "Nexthop", "Local Label", "Remote Label"); + printf("%-20s %-17s %-14s %-14s %-10s\n", "Destination", + "Nexthop", "Local Label", "Remote Label", "In Use"); imsg_compose(ibuf, IMSG_CTL_SHOW_LIB, 0, 0, -1, NULL, 0); break; case SHOW_LFIB: @@ -328,7 +328,7 @@ show_lib_msg(struct imsg *imsg) rt->prefixlen) == -1) err(1, NULL); - if (rt->connected) { + if (rt->connected || !rt->in_use) { if (asprintf(&remote, "-") == -1) err(1, NULL); } else { @@ -336,10 +336,10 @@ show_lib_msg(struct imsg *imsg) err(1, NULL); } - printf("%-20s %-17s %-17u %s\n", dstnet, + printf("%-20s %-17s %-14u %-14s %s\n", dstnet, inet_ntoa(rt->nexthop), (ntohl(rt->local_label) >> MPLS_LABEL_OFFSET), - remote); + remote, rt->in_use ? "yes" : "no"); free(remote); free(dstnet); diff --git a/usr.sbin/ldpd/lde_lib.c b/usr.sbin/ldpd/lde_lib.c index a6022a83dd5..7a4b319c685 100644 --- a/usr.sbin/ldpd/lde_lib.c +++ b/usr.sbin/ldpd/lde_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lde_lib.c,v 1.6 2009/09/28 09:48:46 michele Exp $ */ +/* $OpenBSD: lde_lib.c,v 1.7 2010/01/02 14:56:02 michele Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -111,9 +111,6 @@ rt_dump(pid_t pid) static struct ctl_rt rtctl; RB_FOREACH(r, rt_tree, &rt) { - if (!r->present) - continue; - rtctl.prefix.s_addr = r->prefix.s_addr; rtctl.prefixlen = r->prefixlen; rtctl.nexthop.s_addr = r->nexthop.s_addr; @@ -121,6 +118,11 @@ rt_dump(pid_t pid) rtctl.local_label = r->local_label; rtctl.remote_label = r->remote_label; + if (!r->present) + rtctl.in_use = 0; + else + rtctl.in_use = 1; + if (rtctl.nexthop.s_addr == htonl(INADDR_LOOPBACK)) rtctl.connected = 1; else diff --git a/usr.sbin/ldpd/ldpd.h b/usr.sbin/ldpd/ldpd.h index 2f59d9ea32e..ce02a1811a0 100644 --- a/usr.sbin/ldpd/ldpd.h +++ b/usr.sbin/ldpd/ldpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ldpd.h,v 1.8 2009/11/02 20:34:58 claudio Exp $ */ +/* $OpenBSD: ldpd.h,v 1.9 2010/01/02 14:56:02 michele Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -364,6 +364,7 @@ struct ctl_rt { u_int8_t flags; u_int8_t prefixlen; u_int8_t connected; + u_int8_t in_use; }; struct ctl_sum { |