diff options
-rw-r--r-- | usr.sbin/bgpctl/bgpctl.h | 4 | ||||
-rw-r--r-- | usr.sbin/bgpctl/output.c | 4 | ||||
-rw-r--r-- | usr.sbin/bgpctl/output_json.c | 8 |
3 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.h b/usr.sbin/bgpctl/bgpctl.h index 7014095ba75..e911bd5cf66 100644 --- a/usr.sbin/bgpctl/bgpctl.h +++ b/usr.sbin/bgpctl/bgpctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpctl.h,v 1.17 2022/10/17 12:01:19 claudio Exp $ */ +/* $OpenBSD: bgpctl.h,v 1.18 2022/11/09 14:20:11 claudio Exp $ */ /* * Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org> @@ -58,3 +58,5 @@ const char *fmt_community(uint16_t, uint16_t); const char *fmt_large_community(uint32_t, uint32_t, uint32_t); const char *fmt_ext_community(uint8_t *); const char *fmt_set_type(struct ctl_show_set *); + +#define MPLS_LABEL_OFFSET 12 diff --git a/usr.sbin/bgpctl/output.c b/usr.sbin/bgpctl/output.c index 4c746b10def..1597d48be81 100644 --- a/usr.sbin/bgpctl/output.c +++ b/usr.sbin/bgpctl/output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output.c,v 1.31 2022/11/07 11:33:24 mbuhl Exp $ */ +/* $OpenBSD: output.c,v 1.32 2022/11/09 14:20:11 claudio Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -477,6 +477,8 @@ show_fib(struct kroute_full *kf) printf("link#%u", kf->ifindex); else printf("%s", log_addr(&kf->nexthop)); + if (kf->flags & F_MPLS) + printf(" mpls %d", ntohl(kf->mplslabel) >> MPLS_LABEL_OFFSET); printf("\n"); } diff --git a/usr.sbin/bgpctl/output_json.c b/usr.sbin/bgpctl/output_json.c index 6def8a3ac23..22752f11cea 100644 --- a/usr.sbin/bgpctl/output_json.c +++ b/usr.sbin/bgpctl/output_json.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output_json.c,v 1.25 2022/11/07 11:33:24 mbuhl Exp $ */ +/* $OpenBSD: output_json.c,v 1.26 2022/11/09 14:20:11 claudio Exp $ */ /* * Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org> @@ -385,6 +385,12 @@ json_fib(struct kroute_full *kf) else json_do_printf("nexthop", "%s", log_addr(&kf->nexthop)); + if (kf->flags & F_MPLS) { + json_do_array("mplslabel"); + json_do_uint("mplslabel", + ntohl(kf->mplslabel) >> MPLS_LABEL_OFFSET); + json_do_end(); + } json_do_end(); } |