? ldpctl ? ldpctl-impnull.patch ? ldpctl.cat8 Index: ldpctl.c =================================================================== RCS file: /cvs/src/usr.sbin/ldpctl/ldpctl.c,v retrieving revision 1.8 diff -u -r1.8 ldpctl.c --- ldpctl.c 3 Mar 2010 10:18:35 -0000 1.8 +++ ldpctl.c 10 Apr 2010 15:56:13 -0000 @@ -320,19 +320,29 @@ { struct ctl_rt *rt; char *dstnet, *remote; + int remote_label, no_label; + no_label = ((NO_LABEL << MPLS_LABEL_OFFSET) + & MPLS_LABEL_MASK) >> MPLS_LABEL_OFFSET; switch (imsg->hdr.type) { case IMSG_CTL_SHOW_LIB: rt = imsg->data; if (asprintf(&dstnet, "%s/%d", inet_ntoa(rt->prefix), rt->prefixlen) == -1) err(1, NULL); - - if (rt->connected || !rt->in_use) { + remote_label = ntohl(rt->remote_label) >> MPLS_LABEL_OFFSET; + if (!rt->in_use) { if (asprintf(&remote, "-") == -1) err(1, NULL); + } else if (rt->connected + || (remote_label == no_label)) { + if (asprintf(&remote, "Untagged") == -1) + err(1, NULL); + } else if (remote_label == MPLS_LABEL_IMPLNULL) { + if (asprintf(&remote, "Pop tag") == -1) + err(1, NULL); } else { - if (asprintf(&remote, "%u", (ntohl(rt->remote_label) >> MPLS_LABEL_OFFSET)) == -1) + if (asprintf(&remote, "%u", remote_label) == -1) err(1, NULL); } @@ -429,17 +439,24 @@ else if (k->flags & F_CONNECTED) printf("link#%-13u", k->ifindex); - if (k->local_label != NO_LABEL) { + if (k->local_label == NO_LABEL) { + printf("- "); + } else if (ntohl(k->local_label) >> MPLS_LABEL_OFFSET + == MPLS_LABEL_IMPLNULL) { + printf("imp-null "); + } else printf("%-18u", (ntohl(k->local_label) >> MPLS_LABEL_OFFSET)); - } else - printf("- "); - if (k->remote_label != NO_LABEL) { + if (k->remote_label == NO_LABEL) { + printf("-"); + } else if (htonl(k->remote_label) >> MPLS_LABEL_OFFSET + == MPLS_LABEL_IMPLNULL) { + printf("Pop"); + } else { printf("%u", (ntohl(k->remote_label) >> MPLS_LABEL_OFFSET)); - } else - printf("-"); + } printf("\n");