diff options
| -rw-r--r-- | ldpd/address.c | 12 | ||||
| -rw-r--r-- | ldpd/adjacency.c | 27 | ||||
| -rw-r--r-- | ldpd/control.c | 3 | ||||
| -rw-r--r-- | ldpd/hello.c | 3 | ||||
| -rw-r--r-- | ldpd/init.c | 1 | ||||
| -rw-r--r-- | ldpd/keepalive.c | 1 | ||||
| -rw-r--r-- | ldpd/labelmapping.c | 29 | ||||
| -rw-r--r-- | ldpd/lde_lib.c | 29 | ||||
| -rw-r--r-- | ldpd/ldp_vty.h | 1 | ||||
| -rw-r--r-- | ldpd/ldp_vty.xml | 27 | ||||
| -rw-r--r-- | ldpd/ldp_vty_exec.c | 943 | ||||
| -rw-r--r-- | ldpd/ldpd.c | 4 | ||||
| -rw-r--r-- | ldpd/ldpd.h | 35 | ||||
| -rw-r--r-- | ldpd/ldpe.c | 28 | ||||
| -rw-r--r-- | ldpd/ldpe.h | 4 | ||||
| -rw-r--r-- | ldpd/neighbor.c | 5 | ||||
| -rw-r--r-- | ldpd/notification.c | 1 | ||||
| -rw-r--r-- | ldpd/packet.c | 36 | ||||
| -rw-r--r-- | ldpd/pfkey.c | 6 |
19 files changed, 1046 insertions, 149 deletions
diff --git a/ldpd/address.c b/ldpd/address.c index ad23ca690b..584240de84 100644 --- a/ldpd/address.c +++ b/ldpd/address.c @@ -104,6 +104,18 @@ send_address(struct nbr *nbr, int af, struct if_addr_head *addr_list, } evbuf_enqueue(&nbr->tcp->wbuf, buf); + + /* no errors - update per neighbor message counters */ + switch (msg_type) { + case MSG_TYPE_ADDR: + nbr->stats.addr_sent++; + break; + case MSG_TYPE_ADDRWITHDRAW: + nbr->stats.addrwdraw_sent++; + break; + default: + break; + } } nbr_fsm(nbr, NBR_EVT_PDU_SENT); diff --git a/ldpd/adjacency.c b/ldpd/adjacency.c index 2e7b43296a..8659202ee4 100644 --- a/ldpd/adjacency.c +++ b/ldpd/adjacency.c @@ -41,6 +41,16 @@ RB_GENERATE(tnbr_head, tnbr, entry, tnbr_compare) static __inline int adj_compare(struct adj *a, struct adj *b) { + if (adj_get_af(a) < adj_get_af(b)) + return (-1); + if (adj_get_af(a) > adj_get_af(b)) + return (1); + + if (ntohl(a->lsr_id.s_addr) < ntohl(b->lsr_id.s_addr)) + return (-1); + if (ntohl(a->lsr_id.s_addr) > ntohl(b->lsr_id.s_addr)) + return (1); + if (a->source.type < b->source.type) return (-1); if (a->source.type > b->source.type) @@ -54,21 +64,13 @@ adj_compare(struct adj *a, struct adj *b) if (strcmp(a->source.link.ia->iface->name, b->source.link.ia->iface->name) > 0) return (1); - if (a->source.link.ia->af < b->source.link.ia->af) - return (-1); - if (a->source.link.ia->af > b->source.link.ia->af) - return (1); return (ldp_addrcmp(a->source.link.ia->af, &a->source.link.src_addr, &b->source.link.src_addr)); case HELLO_TARGETED: - if (a->source.target->af < b->source.target->af) - return (-1); - if (a->source.target->af > b->source.target->af) - return (1); return (ldp_addrcmp(a->source.target->af, &a->source.target->addr, &b->source.target->addr)); default: - fatalx("adj_get_af: unknown hello type"); + fatalx("adj_compare: unknown hello type"); } return (0); @@ -150,9 +152,10 @@ adj_del(struct adj *adj, uint32_t notif_status) } struct adj * -adj_find(struct hello_source *source) +adj_find(struct in_addr lsr_id, struct hello_source *source) { struct adj adj; + adj.lsr_id = lsr_id; adj.source = *source; return (RB_FIND(global_adj_head, &global.adj_tree, &adj)); } @@ -372,13 +375,17 @@ adj_to_ctl(struct adj *adj) case HELLO_LINK: memcpy(actl.ifname, adj->source.link.ia->iface->name, sizeof(actl.ifname)); + actl.src_addr = adj->source.link.src_addr; break; case HELLO_TARGETED: actl.src_addr = adj->source.target->addr; break; } actl.holdtime = adj->holdtime; + actl.holdtime_remaining = + thread_timer_remain_second(adj->inactivity_timer); actl.trans_addr = adj->trans_addr; + actl.ds_tlv = adj->ds_tlv; return (&actl); } diff --git a/ldpd/control.c b/ldpd/control.c index 0bfe0abc9d..5c530e1b70 100644 --- a/ldpd/control.c +++ b/ldpd/control.c @@ -242,6 +242,9 @@ control_dispatch_imsg(struct thread *thread) case IMSG_CTL_SHOW_DISCOVERY: ldpe_adj_ctl(c); break; + case IMSG_CTL_SHOW_DISCOVERY_DTL: + ldpe_adj_detail_ctl(c); + break; case IMSG_CTL_SHOW_LIB: case IMSG_CTL_SHOW_L2VPN_PW: case IMSG_CTL_SHOW_L2VPN_BINDING: diff --git a/ldpd/hello.c b/ldpd/hello.c index e7935899b7..dd67f68f70 100644 --- a/ldpd/hello.c +++ b/ldpd/hello.c @@ -291,7 +291,7 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af, source.link.src_addr = *src; } - adj = adj_find(&source); + adj = adj_find(lsr_id, &source); nbr = nbr_find_ldpid(lsr_id.s_addr); /* check dual-stack tlv */ @@ -373,6 +373,7 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af, RB_INSERT(nbr_adj_head, &nbr->adj_tree, adj); } } + adj->ds_tlv = ds_tlv; /* * If the hello adjacency's address-family doesn't match the local diff --git a/ldpd/init.c b/ldpd/init.c index bc3a69edc7..8b2abe85e5 100644 --- a/ldpd/init.c +++ b/ldpd/init.c @@ -261,6 +261,7 @@ send_capability(struct nbr *nbr, uint16_t capability, int enable) evbuf_enqueue(&nbr->tcp->wbuf, buf); nbr_fsm(nbr, NBR_EVT_PDU_SENT); + nbr->stats.capability_sent++; } int diff --git a/ldpd/keepalive.c b/ldpd/keepalive.c index f9a7d850fd..ba5f223316 100644 --- a/ldpd/keepalive.c +++ b/ldpd/keepalive.c @@ -40,6 +40,7 @@ send_keepalive(struct nbr *nbr) debug_kalive_send("keepalive: lsr-id %s", inet_ntoa(nbr->id)); evbuf_enqueue(&nbr->tcp->wbuf, buf); + nbr->stats.kalive_sent++; } int diff --git a/ldpd/labelmapping.c b/ldpd/labelmapping.c index e8ce7fbdf5..f53bc8333d 100644 --- a/ldpd/labelmapping.c +++ b/ldpd/labelmapping.c @@ -26,13 +26,13 @@ #include "mpls.h" -static void enqueue_pdu(struct nbr *, struct ibuf *, uint16_t); +static void enqueue_pdu(struct nbr *, uint16_t, struct ibuf *, uint16_t); static int gen_label_tlv(struct ibuf *, uint32_t); static int gen_reqid_tlv(struct ibuf *, uint32_t); static void log_msg_mapping(int, uint16_t, struct nbr *, struct map *); static void -enqueue_pdu(struct nbr *nbr, struct ibuf *buf, uint16_t size) +enqueue_pdu(struct nbr *nbr, uint16_t type, struct ibuf *buf, uint16_t size) { struct ldp_hdr *ldp_hdr; @@ -81,7 +81,7 @@ send_labelmessage(struct nbr *nbr, uint16_t type, struct mapping_head *mh) /* maximum pdu length exceeded, we need a new ldp pdu */ if (size + msg_size > nbr->max_pdu_len) { - enqueue_pdu(nbr, buf, size); + enqueue_pdu(nbr, type, buf, size); first = 1; continue; } @@ -108,11 +108,32 @@ send_labelmessage(struct nbr *nbr, uint16_t type, struct mapping_head *mh) log_msg_mapping(1, type, nbr, &me->map); + /* no errors - update per neighbor message counters */ + switch (type) { + case MSG_TYPE_LABELMAPPING: + nbr->stats.labelmap_sent++; + break; + case MSG_TYPE_LABELREQUEST: + nbr->stats.labelreq_sent++; + break; + case MSG_TYPE_LABELWITHDRAW: + nbr->stats.labelwdraw_sent++; + break; + case MSG_TYPE_LABELRELEASE: + nbr->stats.labelrel_sent++; + break; + case MSG_TYPE_LABELABORTREQ: + nbr->stats.labelabreq_sent++; + break; + default: + break; + } + TAILQ_REMOVE(mh, me, entry); free(me); } - enqueue_pdu(nbr, buf, size); + enqueue_pdu(nbr, type, buf, size); nbr_fsm(nbr, NBR_EVT_PDU_SENT); } diff --git a/ldpd/lde_lib.c b/ldpd/lde_lib.c index 4444a1e1ac..db2682a173 100644 --- a/ldpd/lde_lib.c +++ b/ldpd/lde_lib.c @@ -162,7 +162,7 @@ rt_dump(pid_t pid) RB_EMPTY(&fn->downstream)) continue; - rtctl.first = 1; + memset(&rtctl, 0, sizeof(rtctl)); switch (fn->fec.type) { case FEC_TYPE_IPV4: rtctl.af = AF_INET; @@ -179,23 +179,30 @@ rt_dump(pid_t pid) } rtctl.local_label = fn->local_label; - RB_FOREACH(me, lde_map_head, &fn->downstream) { - rtctl.in_use = lde_nbr_is_nexthop(fn, me->nexthop); - rtctl.nexthop = me->nexthop->id; - rtctl.remote_label = me->map.label; - - lde_imsg_compose_ldpe(IMSG_CTL_SHOW_LIB, 0, pid, - &rtctl, sizeof(rtctl)); - rtctl.first = 0; - } if (RB_EMPTY(&fn->downstream)) { rtctl.in_use = 0; rtctl.nexthop.s_addr = INADDR_ANY; rtctl.remote_label = NO_LABEL; + rtctl.no_downstream = 1; + } + lde_imsg_compose_ldpe(IMSG_CTL_SHOW_LIB_BEGIN, 0, pid, &rtctl, + sizeof(rtctl)); - lde_imsg_compose_ldpe(IMSG_CTL_SHOW_LIB, 0, pid, + RB_FOREACH(me, lde_map_head, &fn->upstream) { + rtctl.nexthop = me->nexthop->id; + lde_imsg_compose_ldpe(IMSG_CTL_SHOW_LIB_SENT, 0, pid, + &rtctl, sizeof(rtctl)); + } + + RB_FOREACH(me, lde_map_head, &fn->downstream) { + rtctl.in_use = lde_nbr_is_nexthop(fn, me->nexthop); + rtctl.nexthop = me->nexthop->id; + rtctl.remote_label = me->map.label; + lde_imsg_compose_ldpe(IMSG_CTL_SHOW_LIB_RCVD, 0, pid, &rtctl, sizeof(rtctl)); } + lde_imsg_compose_ldpe(IMSG_CTL_SHOW_LIB_END, 0, pid, &rtctl, + sizeof(rtctl)); } } diff --git a/ldpd/ldp_vty.h b/ldpd/ldp_vty.h index b0dc291434..0b05e6fbf1 100644 --- a/ldpd/ldp_vty.h +++ b/ldpd/ldp_vty.h @@ -71,6 +71,7 @@ int ldp_vty_l2vpn_pw_pwstatus(struct vty *, struct vty_arg *[]); int ldp_vty_show_binding(struct vty *, struct vty_arg *[]); int ldp_vty_show_discovery(struct vty *, struct vty_arg *[]); int ldp_vty_show_interface(struct vty *, struct vty_arg *[]); +int ldp_vty_show_capabilities(struct vty *, struct vty_arg *[]); int ldp_vty_show_neighbor(struct vty *, struct vty_arg *[]); int ldp_vty_show_atom_binding(struct vty *, struct vty_arg *[]); int ldp_vty_show_atom_vc(struct vty *, struct vty_arg *[]); diff --git a/ldpd/ldp_vty.xml b/ldpd/ldp_vty.xml index 966b634c27..cd5c92c7b1 100644 --- a/ldpd/ldp_vty.xml +++ b/ldpd/ldp_vty.xml @@ -333,11 +333,17 @@ <!-- exec mode commands --> <subtree name="ldp_show_af"> - <option name="binding" help="Label Information Base (LIB) information"> - <option name="json" arg="json" optional="true" help="JavaScript Object Notation" function="ldp_vty_show_binding"/> + <option name="binding" help="Label Information Base (LIB) information" function="ldp_vty_show_binding"> + <option name="json" arg="json" help="JavaScript Object Notation" function="ldp_vty_show_binding"/> + <option name="detail" arg="detail" help="Show detailed information"> + <option name="json" arg="json" optional="true" help="JavaScript Object Notation" function="ldp_vty_show_binding"/> + </option> </option> - <option name="discovery" help="Discovery Hello Information"> - <option name="json" arg="json" optional="true" help="JavaScript Object Notation" function="ldp_vty_show_discovery"/> + <option name="discovery" help="Discovery Hello Information" function="ldp_vty_show_discovery"> + <option name="json" arg="json" help="JavaScript Object Notation" function="ldp_vty_show_discovery"/> + <option name="detail" arg="detail" help="Show detailed information"> + <option name="json" arg="json" optional="true" help="JavaScript Object Notation" function="ldp_vty_show_discovery"/> + </option> </option> <option name="interface" help="interface information"> <option name="json" arg="json" optional="true" help="JavaScript Object Notation" function="ldp_vty_show_interface"/> @@ -347,8 +353,17 @@ <option name="show" help="Show running system information"> <option name="mpls" help="MPLS information"> <option name="ldp" help="Label Distribution Protocol"> - <option name="neighbor" help="Neighbor information"> - <option name="json" arg="json" optional="true" help="JavaScript Object Notation" function="ldp_vty_show_neighbor"/> + <option name="capabilities" help="Display LDP Capabilities information"> + <option name="json" arg="json" optional="true" help="JavaScript Object Notation" function="ldp_vty_show_capabilities"/> + </option> + <option name="neighbor" help="Neighbor information" function="ldp_vty_show_neighbor"> + <option name="capabilities" arg="capabilities" help="Display neighbor capability information"> + <option name="json" arg="json" optional="true" help="JavaScript Object Notation" function="ldp_vty_show_neighbor"/> + </option> + <option name="json" arg="json" help="JavaScript Object Notation" function="ldp_vty_show_neighbor"/> + <option name="detail" arg="detail" help="Show detailed information"> + <option name="json" arg="json" optional="true" help="JavaScript Object Notation" function="ldp_vty_show_neighbor"/> + </option> </option> <include subtree="ldp_show_af"/> <select options="address-family" arg="address-family"> diff --git a/ldpd/ldp_vty_exec.c b/ldpd/ldp_vty_exec.c index 56a64c84f3..616847b363 100644 --- a/ldpd/ldp_vty_exec.c +++ b/ldpd/ldp_vty_exec.c @@ -46,6 +46,8 @@ struct show_params { int family; union ldpd_addr addr; uint8_t prefixlen; + int capabilities; + int detail; int json; }; @@ -55,24 +57,46 @@ static int show_interface_msg(struct vty *, struct imsg *, struct show_params *); static int show_interface_msg_json(struct imsg *, struct show_params *, json_object *); -static void show_discovery_adj(struct vty *, char *, - struct ctl_adj *); static int show_discovery_msg(struct vty *, struct imsg *, struct show_params *); -static void show_discovery_adj_json(json_object *, +static void show_discovery_detail_adj(struct vty *, char *, struct ctl_adj *); +static int show_discovery_detail_msg(struct vty *, struct imsg *, + struct show_params *); static int show_discovery_msg_json(struct imsg *, struct show_params *, json_object *); -static void show_nbr_adj(struct vty *, char *, struct ctl_adj *); +static void show_discovery_detail_adj_json(json_object *, + struct ctl_adj *); +static int show_discovery_detail_msg_json(struct imsg *, + struct show_params *, json_object *); + static int show_nbr_msg(struct vty *, struct imsg *, struct show_params *); -static void show_nbr_adj_json(struct ctl_adj *, json_object *); static int show_nbr_msg_json(struct imsg *, struct show_params *, json_object *); +static void show_nbr_detail_adj(struct vty *, char *, + struct ctl_adj *); +static int show_nbr_detail_msg(struct vty *, struct imsg *, + struct show_params *); +static void show_nbr_detail_adj_json(struct ctl_adj *, + json_object *); +static int show_nbr_detail_msg_json(struct imsg *, + struct show_params *, json_object *); +static void show_nbr_capabilities(struct vty *, struct ctl_nbr *); +static int show_nbr_capabilities_msg(struct vty *, struct imsg *, + struct show_params *); +static void show_nbr_capabilities_json(struct ctl_nbr *, + json_object *); +static int show_nbr_capabilities_msg_json(struct imsg *, + struct show_params *, json_object *); static int show_lib_msg(struct vty *, struct imsg *, struct show_params *); +static int show_lib_detail_msg(struct vty *, struct imsg *, + struct show_params *); static int show_lib_msg_json(struct imsg *, struct show_params *, json_object *); +static int show_lib_detail_msg_json(struct imsg *, + struct show_params *, json_object *); static int show_l2vpn_binding_msg(struct vty *, struct imsg *, struct show_params *); static int show_l2vpn_binding_msg_json(struct imsg *, @@ -164,22 +188,73 @@ show_interface_msg_json(struct imsg *imsg, struct show_params *params, return (0); } +static int +show_discovery_msg(struct vty *vty, struct imsg *imsg, + struct show_params *params) +{ + struct ctl_adj *adj; + const char *addr; + + switch (imsg->hdr.type) { + case IMSG_CTL_SHOW_DISCOVERY: + adj = imsg->data; + + if (params->family != AF_UNSPEC && params->family != adj->af) + break; + + vty_out(vty, "%-4s %-15s ", af_name(adj->af), + inet_ntoa(adj->id)); + switch(adj->type) { + case HELLO_LINK: + vty_out(vty, "%-8s %-15s ", "Link", adj->ifname); + break; + case HELLO_TARGETED: + addr = log_addr(adj->af, &adj->src_addr); + + vty_out(vty, "%-8s %-15s ", "Targeted", addr); + if (strlen(addr) > 15) + vty_out(vty, "\n%46s", " "); + break; + } + vty_out(vty, "%9u\n", adj->holdtime); + break; + case IMSG_CTL_END: + vty_out(vty, "%s", VTY_NEWLINE); + return (1); + default: + break; + } + + return (0); +} + static void -show_discovery_adj(struct vty *vty, char *buffer, struct ctl_adj *adj) +show_discovery_detail_adj(struct vty *vty, char *buffer, struct ctl_adj *adj) { size_t buflen = strlen(buffer); snprintf(buffer + buflen, LDPBUFSIZ - buflen, - " LDP Id: %s:0, Transport address: %s%s", - inet_ntoa(adj->id), log_addr(adj->af, - &adj->trans_addr), VTY_NEWLINE); + " LSR Id: %s:0%s", inet_ntoa(adj->id), VTY_NEWLINE); + buflen = strlen(buffer); + snprintf(buffer + buflen, LDPBUFSIZ - buflen, + " Source address: %s%s", + log_addr(adj->af, &adj->src_addr), VTY_NEWLINE); + buflen = strlen(buffer); + snprintf(buffer + buflen, LDPBUFSIZ - buflen, + " Transport address: %s%s", + log_addr(adj->af, &adj->trans_addr), VTY_NEWLINE); + buflen = strlen(buffer); + snprintf(buffer + buflen, LDPBUFSIZ - buflen, + " Hello hold time: %u secs (due in %u secs)%s", + adj->holdtime, adj->holdtime_remaining, VTY_NEWLINE); buflen = strlen(buffer); snprintf(buffer + buflen, LDPBUFSIZ - buflen, - " Hold time: %u sec%s", adj->holdtime, VTY_NEWLINE); + " Dual-stack capability TLV: %s%s", + (adj->ds_tlv) ? "yes" : "no", VTY_NEWLINE); } static int -show_discovery_msg(struct vty *vty, struct imsg *imsg, +show_discovery_detail_msg(struct vty *vty, struct imsg *imsg, struct show_params *params) { struct ctl_adj *adj; @@ -207,7 +282,7 @@ show_discovery_msg(struct vty *vty, struct imsg *imsg, buflen = strlen(ifaces_buffer); snprintf(ifaces_buffer + buflen, LDPBUFSIZ - buflen, " %s: %s%s", iface->name, (iface->no_adj) ? - "xmit" : "xmit/recv", VTY_NEWLINE); + "(no adjacencies)" : "", VTY_NEWLINE); break; case IMSG_CTL_SHOW_DISC_TNBR: tnbr = imsg->data; @@ -220,8 +295,8 @@ show_discovery_msg(struct vty *vty, struct imsg *imsg, buflen = strlen(tnbrs_buffer); snprintf(tnbrs_buffer + buflen, LDPBUFSIZ - buflen, " %s -> %s: %s%s", log_addr(tnbr->af, trans_addr), - log_addr(tnbr->af, &tnbr->addr), (tnbr->no_adj) ? "xmit" : - "xmit/recv", VTY_NEWLINE); + log_addr(tnbr->af, &tnbr->addr), (tnbr->no_adj) ? + "(no adjacencies)" : "", VTY_NEWLINE); break; case IMSG_CTL_SHOW_DISC_ADJ: adj = imsg->data; @@ -231,17 +306,26 @@ show_discovery_msg(struct vty *vty, struct imsg *imsg, switch(adj->type) { case HELLO_LINK: - show_discovery_adj(vty, ifaces_buffer, adj); + show_discovery_detail_adj(vty, ifaces_buffer, adj); break; case HELLO_TARGETED: - show_discovery_adj(vty, tnbrs_buffer, adj); + show_discovery_detail_adj(vty, tnbrs_buffer, adj); break; } break; case IMSG_CTL_END: rtr_id.s_addr = ldp_rtr_id_get(ldpd_conf); - vty_out(vty, "Local LDP Identifier: %s:0%s", inet_ntoa(rtr_id), + vty_out(vty, "Local:%s", VTY_NEWLINE); + vty_out(vty, " LSR Id: %s:0%s", inet_ntoa(rtr_id), VTY_NEWLINE); + if (ldpd_conf->ipv4.flags & F_LDPD_AF_ENABLED) + vty_out(vty, " Transport Address (IPv4): %s%s", + log_addr(AF_INET, &ldpd_conf->ipv4.trans_addr), + VTY_NEWLINE); + if (ldpd_conf->ipv6.flags & F_LDPD_AF_ENABLED) + vty_out(vty, " Transport Address (IPv6): %s%s", + log_addr(AF_INET6, &ldpd_conf->ipv6.trans_addr), + VTY_NEWLINE); vty_out(vty, "Discovery Sources:%s", VTY_NEWLINE); vty_out(vty, " Interfaces:%s", VTY_NEWLINE); vty_out(vty, "%s", ifaces_buffer); @@ -256,8 +340,59 @@ show_discovery_msg(struct vty *vty, struct imsg *imsg, return (0); } +static int +show_discovery_msg_json(struct imsg *imsg, struct show_params *params, + json_object *json) +{ + struct ctl_adj *adj; + json_object *json_array; + json_object *json_adj; + + switch (imsg->hdr.type) { + case IMSG_CTL_SHOW_DISCOVERY: + adj = imsg->data; + + if (params->family != AF_UNSPEC && params->family != adj->af) + break; + + json_object_object_get_ex(json, "adjacencies", &json_array); + if (!json_array) { + json_array = json_object_new_array(); + json_object_object_add(json, "adjacencies", json_array); + } + + json_adj = json_object_new_object(); + json_object_string_add(json_adj, "addressFamily", + af_name(adj->af)); + json_object_string_add(json_adj, "neighborId", + inet_ntoa(adj->id)); + switch(adj->type) { + case HELLO_LINK: + json_object_string_add(json_adj, "type", "link"); + json_object_string_add(json_adj, "interface", + adj->ifname); + break; + case HELLO_TARGETED: + json_object_string_add(json_adj, "type", "targeted"); + json_object_string_add(json_adj, "peer", + log_addr(adj->af, &adj->src_addr)); + break; + } + json_object_int_add(json_adj, "helloHoldtime", adj->holdtime); + + json_object_array_add(json_array, json_adj); + break; + case IMSG_CTL_END: + return (1); + default: + break; + } + + return (0); +} + static void -show_discovery_adj_json(json_object *json, struct ctl_adj *adj) +show_discovery_detail_adj_json(json_object *json, struct ctl_adj *adj) { json_object *json_adj; json_object *json_array; @@ -269,15 +404,21 @@ show_discovery_adj_json(json_object *json, struct ctl_adj *adj) } json_adj = json_object_new_object(); - json_object_string_add(json_adj, "id", inet_ntoa(adj->id)); + json_object_string_add(json_adj, "lsrId", inet_ntoa(adj->id)); + json_object_string_add(json_adj, "sourceAddress", log_addr(adj->af, + &adj->src_addr)); json_object_string_add(json_adj, "transportAddress", log_addr(adj->af, &adj->trans_addr)); - json_object_int_add(json_adj, "holdtime", adj->holdtime); + json_object_int_add(json_adj, "helloHoldtime", adj->holdtime); + json_object_int_add(json_adj, "helloHoldtimeRemaining", + adj->holdtime_remaining); + json_object_int_add(json_adj, "dualStackCapabilityTlv", + adj->ds_tlv); json_object_array_add(json_array, json_adj); } static int -show_discovery_msg_json(struct imsg *imsg, struct show_params *params, +show_discovery_detail_msg_json(struct imsg *imsg, struct show_params *params, json_object *json) { struct ctl_adj *adj; @@ -294,7 +435,13 @@ show_discovery_msg_json(struct imsg *imsg, struct show_params *params, switch (imsg->hdr.type) { case IMSG_CTL_SHOW_DISCOVERY: rtr_id.s_addr = ldp_rtr_id_get(ldpd_conf); - json_object_string_add(json, "id", inet_ntoa(rtr_id)); + json_object_string_add(json, "lsrId", inet_ntoa(rtr_id)); + if (ldpd_conf->ipv4.flags & F_LDPD_AF_ENABLED) + json_object_string_add(json, "transportAddressIPv4", + log_addr(AF_INET, &ldpd_conf->ipv4.trans_addr)); + if (ldpd_conf->ipv6.flags & F_LDPD_AF_ENABLED) + json_object_string_add(json, "transportAddressIPv6", + log_addr(AF_INET6, &ldpd_conf->ipv6.trans_addr)); json_interfaces = json_object_new_object(); json_object_object_add(json, "interfaces", json_interfaces); json_targets = json_object_new_object(); @@ -310,10 +457,6 @@ show_discovery_msg_json(struct imsg *imsg, struct show_params *params, break; json_interface = json_object_new_object(); - json_object_boolean_true_add(json_interface, "transmit"); - if (!iface->no_adj) - json_object_boolean_true_add(json_interface, "receive"); - json_object_object_add(json_interfaces, iface->name, json_interface); json_container = json_interface; @@ -329,10 +472,6 @@ show_discovery_msg_json(struct imsg *imsg, struct show_params *params, json_target = json_object_new_object(); json_object_string_add(json_target, "sourceAddress", log_addr(tnbr->af, trans_addr)); - json_object_boolean_true_add(json_target, "transmit"); - if (!tnbr->no_adj) - json_object_boolean_true_add(json_target, "receive"); - json_object_object_add(json_targets, log_addr(tnbr->af, &tnbr->addr), json_target); json_container = json_target; @@ -345,10 +484,10 @@ show_discovery_msg_json(struct imsg *imsg, struct show_params *params, switch(adj->type) { case HELLO_LINK: - show_discovery_adj_json(json_container, adj); + show_discovery_detail_adj_json(json_container, adj); break; case HELLO_TARGETED: - show_discovery_adj_json(json_container, adj); + show_discovery_detail_adj_json(json_container, adj); break; } break; @@ -361,8 +500,37 @@ show_discovery_msg_json(struct imsg *imsg, struct show_params *params, return (0); } +static int +show_nbr_msg(struct vty *vty, struct imsg *imsg, struct show_params *params) +{ + struct ctl_nbr *nbr; + const char *addr; + + switch (imsg->hdr.type) { + case IMSG_CTL_SHOW_NBR: + nbr = imsg->data; + + addr = log_addr(nbr->af, &nbr->raddr); + + vty_out(vty, "%-4s %-15s %-11s %-15s", + af_name(nbr->af), inet_ntoa(nbr->id), + nbr_state_name(nbr->nbr_state), addr); + if (strlen(addr) > 15) + vty_out(vty, "\n%48s", " "); + vty_out(vty, " %8s\n", nbr->uptime == 0 ? "-" : + log_time(nbr->uptime)); + break; + case IMSG_CTL_END: + return (1); + default: + break; + } + + return (0); +} + static void -show_nbr_adj(struct vty *vty, char *buffer, struct ctl_adj *adj) +show_nbr_detail_adj(struct vty *vty, char *buffer, struct ctl_adj *adj) { size_t buflen = strlen(buffer); @@ -380,9 +548,11 @@ show_nbr_adj(struct vty *vty, char *buffer, struct ctl_adj *adj) } static int -show_nbr_msg(struct vty *vty, struct imsg *imsg, struct show_params *params) +show_nbr_detail_msg(struct vty *vty, struct imsg *imsg, + struct show_params *params) { struct ctl_nbr *nbr; + struct ldp_stats *stats; struct ctl_adj *adj; static char v4adjs_buffer[LDPBUFSIZ]; static char v6adjs_buffer[LDPBUFSIZ]; @@ -399,25 +569,54 @@ show_nbr_msg(struct vty *vty, struct imsg *imsg, struct show_params *params) log_addr(nbr->af, &nbr->laddr), ntohs(nbr->lport), log_addr(nbr->af, &nbr->raddr), ntohs(nbr->rport), VTY_NEWLINE); - vty_out(vty, " Session Holdtime: %u sec%s", nbr->holdtime, - VTY_NEWLINE); + vty_out(vty, " Authentication: %s%s", + (nbr->auth_method == AUTH_MD5SIG) ? "TCP MD5 Signature" : + "none", VTY_NEWLINE); + vty_out(vty, " Session Holdtime: %u secs; " + "KeepAlive interval: %u secs%s", nbr->holdtime, + nbr->holdtime / KEEPALIVE_PER_PERIOD, VTY_NEWLINE); vty_out(vty, " State: %s; Downstream-Unsolicited%s", nbr_state_name(nbr->nbr_state), VTY_NEWLINE); vty_out(vty, " Up time: %s%s", log_time(nbr->uptime), VTY_NEWLINE); + + stats = &nbr->stats; + vty_out(vty, " Messages sent/rcvd:%s", VTY_NEWLINE); + vty_out(vty, " - Keepalive Messages: %u/%u%s", + stats->kalive_sent, stats->kalive_rcvd, VTY_NEWLINE); + vty_out(vty, " - Address Messages: %u/%u%s", + stats->addr_sent, stats->addr_rcvd, VTY_NEWLINE); + vty_out(vty, " - Address Withdraw Messages: %u/%u%s", + stats->addrwdraw_sent, stats->addrwdraw_rcvd, VTY_NEWLINE); + vty_out(vty, " - Notification Messages: %u/%u%s", + stats->notif_sent, stats->notif_rcvd, VTY_NEWLINE); + vty_out(vty, " - Capability Messages: %u/%u%s", + stats->capability_sent, stats->capability_rcvd, VTY_NEWLINE); + vty_out(vty, " - Label Mapping Messages: %u/%u%s", + stats->labelmap_sent, stats->labelmap_rcvd, VTY_NEWLINE); + vty_out(vty, " - Label Request Messages: %u/%u%s", + stats->labelreq_sent, stats->labelreq_rcvd, VTY_NEWLINE); + vty_out(vty, " - Label Withdraw Messages: %u/%u%s", + stats->labelwdraw_sent, stats->labelwdraw_rcvd, VTY_NEWLINE); + vty_out(vty, " - Label Release Messages: %u/%u%s", + stats->labelrel_sent, stats->labelrel_rcvd, VTY_NEWLINE); + vty_out(vty, " - Label Abort Request Messages: %u/%u%s", + stats->labelabreq_sent, stats->labelabreq_rcvd, VTY_NEWLINE); + + show_nbr_capabilities(vty, nbr); break; case IMSG_CTL_SHOW_NBR_DISC: adj = imsg->data; switch (adj->af) { case AF_INET: - show_nbr_adj(vty, v4adjs_buffer, adj); + show_nbr_detail_adj(vty, v4adjs_buffer, adj); break; case AF_INET6: - show_nbr_adj(vty, v6adjs_buffer, adj); + show_nbr_detail_adj(vty, v6adjs_buffer, adj); break; default: - fatalx("show_nbr_msg: unknown af"); + fatalx("show_nbr_detail_msg: unknown af"); } break; case IMSG_CTL_SHOW_NBR_END: @@ -441,8 +640,49 @@ show_nbr_msg(struct vty *vty, struct imsg *imsg, struct show_params *params) return (0); } +static int +show_nbr_msg_json(struct imsg *imsg, struct show_params *params, + json_object *json) +{ + struct ctl_nbr *nbr; + json_object *json_array; + json_object *json_nbr; + + switch (imsg->hdr.type) { + case IMSG_CTL_SHOW_NBR: + nbr = imsg->data; + + json_object_object_get_ex(json, "neighbors", &json_array); + if (!json_array) { + json_array = json_object_new_array(); + json_object_object_add(json, "neighbors", json_array); + } + + json_nbr = json_object_new_object(); + json_object_string_add(json_nbr, "addressFamily", + af_name(nbr->af)); + json_object_string_add(json_nbr, "neighborId", + inet_ntoa(nbr->id)); + json_object_string_add(json_nbr, "state", + nbr_state_name(nbr->nbr_state)); + json_object_string_add(json_nbr, "transportAddress", + log_addr(nbr->af, &nbr->raddr)); + json_object_string_add(json_nbr, "upTime", + log_time(nbr->uptime)); + + json_object_array_add(json_array, json_nbr); + break; + case IMSG_CTL_END: + return (1); + default: + break; + } + + return (0); +} + static void -show_nbr_adj_json(struct ctl_adj *adj, json_object *adj_list) +show_nbr_detail_adj_json(struct ctl_adj *adj, json_object *adj_list) { char adj_string[128]; @@ -462,12 +702,15 @@ show_nbr_adj_json(struct ctl_adj *adj, json_object *adj_list) } static int -show_nbr_msg_json(struct imsg *imsg, struct show_params *params, +show_nbr_detail_msg_json(struct imsg *imsg, struct show_params *params, json_object *json) { struct ctl_nbr *nbr; + struct ldp_stats *stats; struct ctl_adj *adj; json_object *json_nbr; + json_object *json_array; + json_object *json_counter; static json_object *json_nbr_sources; static json_object *json_v4adjs; static json_object *json_v6adjs; @@ -477,6 +720,8 @@ show_nbr_msg_json(struct imsg *imsg, struct show_params *params, nbr = imsg->data; json_nbr = json_object_new_object(); + json_object_object_add(json, inet_ntoa(nbr->id), json_nbr); + json_object_string_add(json_nbr, "peerId", inet_ntoa(nbr->id)); json_object_string_add(json_nbr, "tcpLocalAddress", log_addr(nbr->af, &nbr->laddr)); @@ -486,13 +731,109 @@ show_nbr_msg_json(struct imsg *imsg, struct show_params *params, log_addr(nbr->af, &nbr->raddr)); json_object_int_add(json_nbr, "tcpRemotePort", ntohs(nbr->rport)); - json_object_int_add(json_nbr, "holdtime", nbr->holdtime); + json_object_string_add(json_nbr, "authentication", + (nbr->auth_method == AUTH_MD5SIG) ? "TCP MD5 Signature" : + "none"); + json_object_int_add(json_nbr, "sessionHoldtime", nbr->holdtime); + json_object_int_add(json_nbr, "keepAliveInterval", + nbr->holdtime / KEEPALIVE_PER_PERIOD); json_object_string_add(json_nbr, "state", nbr_state_name(nbr->nbr_state)); json_object_string_add(json_nbr, "upTime", log_time(nbr->uptime)); - json_object_object_add(json, inet_ntoa(nbr->id), json_nbr); + /* message_counters */ + stats = &nbr->stats; + json_array = json_object_new_array(); + json_object_object_add(json_nbr, "sentMessages", json_array); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "keepalive", + stats->kalive_sent); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "address", + stats->addr_sent); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "addressWithdraw", + stats->addrwdraw_sent); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "notification", + stats->notif_sent); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "capability", + stats->capability_sent); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "labelMapping", + stats->labelmap_sent); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "labelRequest", + stats->labelreq_sent); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "labelWithdraw", + stats->labelwdraw_sent); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "labelRelease", + stats->labelrel_sent); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "labelAbortRequest", + stats->labelabreq_sent); + json_object_array_add(json_array, json_counter); + + json_array = json_object_new_array(); + json_object_object_add(json_nbr, "receivedMessages", json_array); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "keepalive", + stats->kalive_rcvd); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "address", + stats->addr_rcvd); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "addressWithdraw", + stats->addrwdraw_rcvd); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "notification", + stats->notif_rcvd); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "capability", + stats->capability_rcvd); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "labelMapping", + stats->labelmap_rcvd); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "labelRequest", + stats->labelreq_rcvd); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "labelWithdraw", + stats->labelwdraw_rcvd); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "labelRelease", + stats->labelrel_rcvd); + json_object_array_add(json_array, json_counter); + json_counter = json_object_new_object(); + json_object_int_add(json_counter, "labelAbortRequest", + stats->labelabreq_rcvd); + json_object_array_add(json_array, json_counter); + + /* capabilities */ + show_nbr_capabilities_json(nbr, json_nbr); + + /* discovery sources */ json_nbr_sources = json_object_new_object(); json_object_object_add(json_nbr, "discoverySources", json_nbr_sources); @@ -509,7 +850,7 @@ show_nbr_msg_json(struct imsg *imsg, struct show_params *params, json_object_object_add(json_nbr_sources, "ipv4", json_v4adjs); } - show_nbr_adj_json(adj, json_v4adjs); + show_nbr_detail_adj_json(adj, json_v4adjs); break; case AF_INET6: if (!json_v6adjs) { @@ -517,10 +858,10 @@ show_nbr_msg_json(struct imsg *imsg, struct show_params *params, json_object_object_add(json_nbr_sources, "ipv6", json_v6adjs); } - show_nbr_adj_json(adj, json_v6adjs); + show_nbr_detail_adj_json(adj, json_v6adjs); break; default: - fatalx("show_nbr_msg_json: unknown af"); + fatalx("show_nbr_detail_msg_json: unknown af"); } break; case IMSG_CTL_SHOW_NBR_END: @@ -534,6 +875,139 @@ show_nbr_msg_json(struct imsg *imsg, struct show_params *params, return (0); } +void +show_nbr_capabilities(struct vty *vty, struct ctl_nbr *nbr) +{ + vty_out(vty, " Capabilities Sent:%s" + " - Dynamic Announcement (0x0506)%s" + " - Typed Wildcard (0x050B)%s" + " - Unrecognized Notification (0x0603)%s", + VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); + vty_out(vty, " Capabilities Received:%s", VTY_NEWLINE); + if (nbr->flags & F_NBR_CAP_DYNAMIC) + vty_out(vty, " - Dynamic Announcement (0x0506)%s", + VTY_NEWLINE); + if (nbr->flags & F_NBR_CAP_TWCARD) + vty_out(vty, " - Typed Wildcard (0x050B)%s", VTY_NEWLINE); + if (nbr->flags & F_NBR_CAP_UNOTIF) + vty_out(vty, " - Unrecognized Notification (0x0603)%s", + VTY_NEWLINE); +} + +static int +show_nbr_capabilities_msg(struct vty *vty, struct imsg *imsg, struct show_params *params) +{ + struct ctl_nbr *nbr; + + switch (imsg->hdr.type) { + case IMSG_CTL_SHOW_NBR: + nbr = imsg->data; + + if (nbr->nbr_state != NBR_STA_OPER) + break; + + vty_out(vty, "Peer LDP Identifier: %s:0%s", inet_ntoa(nbr->id), + VTY_NEWLINE); + show_nbr_capabilities(vty, nbr); + break; + case IMSG_CTL_END: + vty_out(vty, "%s", VTY_NEWLINE); + return (1); + default: + break; + } + + return (0); +} + +static void +show_nbr_capabilities_json(struct ctl_nbr *nbr, json_object *json_nbr) +{ + json_object *json_array; + json_object *json_cap; + + /* sent capabilities */ + json_array = json_object_new_array(); + json_object_object_add(json_nbr, "sentCapabilities", json_array); + + /* Dynamic Announcement (0x0506) */ + json_cap = json_object_new_object(); + json_object_string_add(json_cap, "description", "Dynamic Announcement"); + json_object_string_add(json_cap, "tlvType", "0x0506"); + json_object_array_add(json_array, json_cap); + + /* Typed Wildcard (0x050B) */ + json_cap = json_object_new_object(); + json_object_string_add(json_cap, "description", "Typed Wildcard"); + json_object_string_add(json_cap, "tlvType", "0x050B"); + json_object_array_add(json_array, json_cap); + + /* Unrecognized Notification (0x0603) */ + json_cap = json_object_new_object(); + json_object_string_add(json_cap, "description", + "Unrecognized Notification"); + json_object_string_add(json_cap, "tlvType", "0x0603"); + json_object_array_add(json_array, json_cap); + + /* received capabilities */ + json_array = json_object_new_array(); + json_object_object_add(json_nbr, "receivedCapabilities", json_array); + + /* Dynamic Announcement (0x0506) */ + if (nbr->flags & F_NBR_CAP_DYNAMIC) { + json_cap = json_object_new_object(); + json_object_string_add(json_cap, "description", + "Dynamic Announcement"); + json_object_string_add(json_cap, "tlvType", "0x0506"); + json_object_array_add(json_array, json_cap); + } + + /* Typed Wildcard (0x050B) */ + if (nbr->flags & F_NBR_CAP_TWCARD) { + json_cap = json_object_new_object(); + json_object_string_add(json_cap, "description", + "Typed Wildcard"); + json_object_string_add(json_cap, "tlvType", "0x050B"); + json_object_array_add(json_array, json_cap); + } + + /* Unrecognized Notification (0x0603) */ + if (nbr->flags & F_NBR_CAP_UNOTIF) { + json_cap = json_object_new_object(); + json_object_string_add(json_cap, "description", + "Unrecognized Notification"); + json_object_string_add(json_cap, "tlvType", "0x0603"); + json_object_array_add(json_array, json_cap); + } +} + +static int +show_nbr_capabilities_msg_json(struct imsg *imsg, struct show_params *params, + json_object *json) +{ + struct ctl_nbr *nbr; + json_object *json_nbr; + + switch (imsg->hdr.type) { + case IMSG_CTL_SHOW_NBR: + nbr = imsg->data; + + if (nbr->nbr_state != NBR_STA_OPER) + break; + + json_nbr = json_object_new_object(); + json_object_object_add(json, inet_ntoa(nbr->id), json_nbr); + show_nbr_capabilities_json(nbr, json_nbr); + break; + case IMSG_CTL_END: + return (1); + default: + break; + } + + return (0); +} + static int show_lib_msg(struct vty *vty, struct imsg *imsg, struct show_params *params) { @@ -541,34 +1015,99 @@ show_lib_msg(struct vty *vty, struct imsg *imsg, struct show_params *params) char dstnet[BUFSIZ]; switch (imsg->hdr.type) { - case IMSG_CTL_SHOW_LIB: + case IMSG_CTL_SHOW_LIB_BEGIN: + case IMSG_CTL_SHOW_LIB_RCVD: rt = imsg->data; + if (imsg->hdr.type == IMSG_CTL_SHOW_LIB_BEGIN && + !rt->no_downstream) + break; + if (params->family != AF_UNSPEC && params->family != rt->af) break; snprintf(dstnet, sizeof(dstnet), "%s/%d", log_addr(rt->af, &rt->prefix), rt->prefixlen); - if (rt->first) { - vty_out(vty, "%s%s", dstnet, VTY_NEWLINE); - vty_out(vty, "%-8sLocal binding: label: %s%s", "", - log_label(rt->local_label), VTY_NEWLINE); - - if (rt->remote_label != NO_LABEL) { - vty_out(vty, "%-8sRemote bindings:%s", "", - VTY_NEWLINE); - vty_out(vty, "%-12sPeer Label%s", - "", VTY_NEWLINE); - vty_out(vty, "%-12s----------------- " - "---------%s", "", VTY_NEWLINE); - } else - vty_out(vty, "%-8sNo remote bindings%s", "", - VTY_NEWLINE); + vty_out(vty, "%-4s %-20s", af_name(rt->af), dstnet); + if (strlen(dstnet) > 20) + vty_out(vty, "\n%25s", " "); + vty_out(vty, " %-15s %-11s %-13s %6s\n", inet_ntoa(rt->nexthop), + log_label(rt->local_label), log_label(rt->remote_label), + rt->in_use ? "yes" : "no"); + break; + case IMSG_CTL_END: + vty_out(vty, "%s", VTY_NEWLINE); + return (1); + default: + break; + } + + return (0); +} + +static int +show_lib_detail_msg(struct vty *vty, struct imsg *imsg, struct show_params *params) +{ + struct ctl_rt *rt; + char dstnet[BUFSIZ]; + static int upstream, downstream; + size_t buflen; + static char sent_buffer[LDPBUFSIZ]; + static char rcvd_buffer[LDPBUFSIZ]; + + switch (imsg->hdr.type) { + case IMSG_CTL_SHOW_LIB_BEGIN: + case IMSG_CTL_SHOW_LIB_SENT: + case IMSG_CTL_SHOW_LIB_RCVD: + case IMSG_CTL_SHOW_LIB_END: + rt = imsg->data; + if (params->family != AF_UNSPEC && params->family != rt->af) + return (0); + break; + default: + break; + } + + switch (imsg->hdr.type) { + case IMSG_CTL_SHOW_LIB_BEGIN: + upstream = 0; + downstream = 0; + sent_buffer[0] = '\0'; + rcvd_buffer[0] = '\0'; + + snprintf(dstnet, sizeof(dstnet), "%s/%d", + log_addr(rt->af, &rt->prefix), rt->prefixlen); + + vty_out(vty, "%s%s", dstnet, VTY_NEWLINE); + vty_out(vty, "%-8sLocal binding: label: %s%s", "", + log_label(rt->local_label), VTY_NEWLINE); + break; + case IMSG_CTL_SHOW_LIB_SENT: + upstream = 1; + buflen = strlen(sent_buffer); + snprintf(sent_buffer + buflen, LDPBUFSIZ - buflen, + "%12s%s:0%s", "", inet_ntoa(rt->nexthop), VTY_NEWLINE); + break; + case IMSG_CTL_SHOW_LIB_RCVD: + downstream = 1; + buflen = strlen(rcvd_buffer); + snprintf(rcvd_buffer + buflen, LDPBUFSIZ - buflen, + "%12s%s:0, label %s%s%s", "", inet_ntoa(rt->nexthop), + log_label(rt->remote_label), + rt->in_use ? " (in use)" : "", VTY_NEWLINE); + break; + case IMSG_CTL_SHOW_LIB_END: + if (upstream) { + vty_out(vty, "%-8sAdvertised to:%s", "", VTY_NEWLINE); + vty_out(vty, "%s", sent_buffer); } - if (rt->remote_label != NO_LABEL) - vty_out(vty, "%12s%-20s%s%s", "", inet_ntoa(rt->nexthop), - log_label(rt->remote_label), VTY_NEWLINE); + if (downstream) { + vty_out(vty, "%-8sRemote bindings:%s", "", VTY_NEWLINE); + vty_out(vty, "%s", rcvd_buffer); + } else + vty_out(vty, "%-8sNo remote bindings%s", "", + VTY_NEWLINE); break; case IMSG_CTL_END: vty_out(vty, "%s", VTY_NEWLINE); @@ -584,42 +1123,109 @@ static int show_lib_msg_json(struct imsg *imsg, struct show_params *params, json_object *json) { + struct ctl_rt *rt; + json_object *json_array; + json_object *json_lib_entry; + char dstnet[BUFSIZ]; + + switch (imsg->hdr.type) { + case IMSG_CTL_SHOW_LIB_BEGIN: + case IMSG_CTL_SHOW_LIB_RCVD: + rt = imsg->data; + + if (imsg->hdr.type == IMSG_CTL_SHOW_LIB_BEGIN && + !rt->no_downstream) + break; + + json_object_object_get_ex(json, "bindings", &json_array); + if (!json_array) { + json_array = json_object_new_array(); + json_object_object_add(json, "bindings", json_array); + } + + json_lib_entry = json_object_new_object(); + json_object_string_add(json_lib_entry, "addressFamily", + af_name(rt->af)); + snprintf(dstnet, sizeof(dstnet), "%s/%d", + log_addr(rt->af, &rt->prefix), rt->prefixlen); + json_object_string_add(json_lib_entry, "prefix", dstnet); + json_object_string_add(json_lib_entry, "neighborId", + inet_ntoa(rt->nexthop)); + json_object_string_add(json_lib_entry, "localLabel", + log_label(rt->local_label)); + json_object_string_add(json_lib_entry, "remoteLabel", + log_label(rt->remote_label)); + json_object_int_add(json_lib_entry, "inUse", rt->in_use); + + json_object_array_add(json_array, json_lib_entry); + break; + case IMSG_CTL_END: + return (1); + default: + break; + } + + return (0); +} + +static int +show_lib_detail_msg_json(struct imsg *imsg, struct show_params *params, + json_object *json) +{ struct ctl_rt *rt; char dstnet[BUFSIZ]; - static json_object *json_binding; + static json_object *json_lib_entry; + static json_object *json_adv_labels; + json_object *json_adv_label; static json_object *json_remote_labels; json_object *json_remote_label; switch (imsg->hdr.type) { - case IMSG_CTL_SHOW_LIB: + case IMSG_CTL_SHOW_LIB_BEGIN: + case IMSG_CTL_SHOW_LIB_SENT: + case IMSG_CTL_SHOW_LIB_RCVD: + case IMSG_CTL_SHOW_LIB_END: rt = imsg->data; - if (params->family != AF_UNSPEC && params->family != rt->af) - break; + return (0); + break; + default: + break; + } + switch (imsg->hdr.type) { + case IMSG_CTL_SHOW_LIB_BEGIN: snprintf(dstnet, sizeof(dstnet), "%s/%d", log_addr(rt->af, &rt->prefix), rt->prefixlen); - if (rt->first) { - json_binding = json_object_new_object(); - json_object_string_add(json_binding, "localLabel", - log_label(rt->local_label)); + json_lib_entry = json_object_new_object(); + json_object_string_add(json_lib_entry, "localLabel", + log_label(rt->local_label)); - json_remote_labels = json_object_new_array(); - json_object_object_add(json_binding, "remoteLabels", - json_remote_labels); - json_object_object_add(json, dstnet, json_binding); - } + json_adv_labels = json_object_new_array(); + json_object_object_add(json_lib_entry, "advertisedTo", + json_adv_labels); - if (rt->remote_label != NO_LABEL) { - json_remote_label = json_object_new_object(); - json_object_string_add(json_remote_label, "nexthop", - inet_ntoa(rt->nexthop)); - json_object_string_add(json_remote_label, "label", - log_label(rt->remote_label)); - json_object_array_add(json_remote_labels, - json_remote_label); - } + json_remote_labels = json_object_new_array(); + json_object_object_add(json_lib_entry, "remoteLabels", + json_remote_labels); + + json_object_object_add(json, dstnet, json_lib_entry); + break; + case IMSG_CTL_SHOW_LIB_SENT: + json_adv_label = json_object_new_object(); + json_object_string_add(json_adv_label, "neighborId", + inet_ntoa(rt->nexthop)); + json_object_array_add(json_adv_labels, json_adv_label); + break; + case IMSG_CTL_SHOW_LIB_RCVD: + json_remote_label = json_object_new_object(); + json_object_string_add(json_remote_label, "neighborId", + inet_ntoa(rt->nexthop)); + json_object_string_add(json_remote_label, "label", + log_label(rt->remote_label)); + json_object_int_add(json_remote_label, "inUse", rt->in_use); + json_object_array_add(json_remote_labels, json_remote_label); break; case IMSG_CTL_END: return (1); @@ -825,34 +1431,83 @@ static int ldp_vty_dispatch_msg(struct vty *vty, struct imsg *imsg, enum show_command cmd, struct show_params *params, json_object *json) { + int ret; + switch (cmd) { case SHOW_IFACE: - if (json) - return (show_interface_msg_json(imsg, params, json)); - return (show_interface_msg(vty, imsg, params)); + if (params->json) + ret = show_interface_msg_json(imsg, params, json); + else + ret = show_interface_msg(vty, imsg, params); + break; case SHOW_DISC: - if (json) - return (show_discovery_msg_json(imsg, params, json)); - return (show_discovery_msg(vty, imsg, params)); + if (params->detail) { + if (params->json) + ret = show_discovery_detail_msg_json(imsg, + params, json); + else + ret = show_discovery_detail_msg(vty, imsg, + params); + } else { + if (params->json) + ret = show_discovery_msg_json(imsg, params, + json); + else + ret = show_discovery_msg(vty, imsg, params); + } + break; case SHOW_NBR: - if (json) - return (show_nbr_msg_json(imsg, params, json)); - return (show_nbr_msg(vty, imsg, params)); + if (params->capabilities) { + if (params->json) + ret = show_nbr_capabilities_msg_json(imsg, + params, json); + else + ret = show_nbr_capabilities_msg(vty, imsg, + params); + } else if (params->detail) { + if (params->json) + ret = show_nbr_detail_msg_json(imsg, params, + json); + else + ret = show_nbr_detail_msg(vty, imsg, params); + } else { + if (params->json) + ret = show_nbr_msg_json(imsg, params, json); + else + ret = show_nbr_msg(vty, imsg, params); + } + break; case SHOW_LIB: - if (json) - return (show_lib_msg_json(imsg, params, json)); - return (show_lib_msg(vty, imsg, params)); + if (params->detail) { + if (params->json) + ret = show_lib_detail_msg_json(imsg, params, + json); + else + ret = show_lib_detail_msg(vty, imsg, params); + } else { + if (params->json) + ret = show_lib_msg_json(imsg, params, json); + else + ret = show_lib_msg(vty, imsg, params); + } + break; case SHOW_L2VPN_PW: - if (json) - return (show_l2vpn_pw_msg_json(imsg, params, json)); - return (show_l2vpn_pw_msg(vty, imsg, params)); + if (params->json) + ret = show_l2vpn_pw_msg_json(imsg, params, json); + else + ret = show_l2vpn_pw_msg(vty, imsg, params); + break; case SHOW_L2VPN_BINDING: - if (json) - return (show_l2vpn_binding_msg_json(imsg, params, json)); - return (show_l2vpn_binding_msg(vty, imsg, params)); + if (params->json) + ret = show_l2vpn_binding_msg_json(imsg, params, json); + else + ret = show_l2vpn_binding_msg(vty, imsg, params); + break; default: return (0); } + + return (ret); } static int @@ -944,8 +1599,14 @@ ldp_vty_show_binding(struct vty *vty, struct vty_arg *args[]) memset(¶ms, 0, sizeof(params)); params.family = af; + params.detail = vty_get_arg_value(args, "detail") ? 1 : 0; params.json = vty_get_arg_value(args, "json") ? 1 : 0; + if (!params.detail && !params.json) + vty_out(vty, "%-4s %-20s %-15s %-11s %-13s %6s\n", "AF", + "Destination", "Nexthop", "Local Label", "Remote Label", + "In Use"); + imsg_compose(&ibuf, IMSG_CTL_SHOW_LIB, 0, 0, -1, NULL, 0); return (ldp_vty_dispatch(vty, &ibuf, SHOW_LIB, ¶ms)); } @@ -967,9 +1628,18 @@ ldp_vty_show_discovery(struct vty *vty, struct vty_arg *args[]) memset(¶ms, 0, sizeof(params)); params.family = af; + params.detail = vty_get_arg_value(args, "detail") ? 1 : 0; params.json = vty_get_arg_value(args, "json") ? 1 : 0; - imsg_compose(&ibuf, IMSG_CTL_SHOW_DISCOVERY, 0, 0, -1, NULL, 0); + if (!params.detail && !params.json) + vty_out(vty, "%-4s %-15s %-8s %-15s %9s\n", + "AF", "ID", "Type", "Source", "Holdtime"); + + if (params.detail) + imsg_compose(&ibuf, IMSG_CTL_SHOW_DISCOVERY_DTL, 0, 0, -1, + NULL, 0); + else + imsg_compose(&ibuf, IMSG_CTL_SHOW_DISCOVERY, 0, 0, -1, NULL, 0); return (ldp_vty_dispatch(vty, &ibuf, SHOW_DISC, ¶ms)); } @@ -1006,6 +1676,58 @@ ldp_vty_show_interface(struct vty *vty, struct vty_arg *args[]) } int +ldp_vty_show_capabilities(struct vty *vty, struct vty_arg *args[]) +{ + if (vty_get_arg_value(args, "json")) { + json_object *json; + json_object *json_array; + json_object *json_cap; + + json = json_object_new_object(); + json_array = json_object_new_array(); + json_object_object_add(json, "capabilities", json_array); + + /* Dynamic Announcement (0x0506) */ + json_cap = json_object_new_object(); + json_object_string_add(json_cap, "description", + "Dynamic Announcement"); + json_object_string_add(json_cap, "tlvType", + "0x0506"); + json_object_array_add(json_array, json_cap); + + /* Typed Wildcard (0x050B) */ + json_cap = json_object_new_object(); + json_object_string_add(json_cap, "description", + "Typed Wildcard"); + json_object_string_add(json_cap, "tlvType", + "0x050B"); + json_object_array_add(json_array, json_cap); + + /* Unrecognized Notification (0x0603) */ + json_cap = json_object_new_object(); + json_object_string_add(json_cap, "description", + "Unrecognized Notification"); + json_object_string_add(json_cap, "tlvType", + "0x0603"); + json_object_array_add(json_array, json_cap); + + vty_out(vty, "%s%s", json_object_to_json_string_ext(json, + JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); + json_object_free(json); + return (0); + } + + vty_out(vty, + "Supported LDP Capabilities%s" + " * Dynamic Announcement (0x0506)%s" + " * Typed Wildcard (0x050B)%s" + " * Unrecognized Notification (0x0603)%s%s", VTY_NEWLINE, + VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); + + return (0); +} + +int ldp_vty_show_neighbor(struct vty *vty, struct vty_arg *args[]) { struct imsgbuf ibuf; @@ -1015,8 +1737,17 @@ ldp_vty_show_neighbor(struct vty *vty, struct vty_arg *args[]) return (CMD_WARNING); memset(¶ms, 0, sizeof(params)); + params.capabilities = vty_get_arg_value(args, "capabilities") ? 1 : 0; + params.detail = vty_get_arg_value(args, "detail") ? 1 : 0; params.json = vty_get_arg_value(args, "json") ? 1 : 0; + if (params.capabilities) + params.detail = 1; + + if (!params.detail && !params.json) + vty_out(vty, "%-4s %-15s %-11s %-15s %8s\n", + "AF", "ID", "State", "Remote Address", "Uptime"); + imsg_compose(&ibuf, IMSG_CTL_SHOW_NBR, 0, 0, -1, NULL, 0); return (ldp_vty_dispatch(vty, &ibuf, SHOW_NBR, ¶ms)); } diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c index f070ae34c9..559a2474b3 100644 --- a/ldpd/ldpd.c +++ b/ldpd/ldpd.c @@ -1467,6 +1467,7 @@ merge_nbrps(struct ldpd_conf *conf, struct ldpd_conf *xconf, void **ref) nbr->af))->ldp_session_socket, nbr->af, &nbr->raddr, NULL); #endif + nbr->auth.method = AUTH_NONE; if (nbr_session_active_role(nbr)) nbr_establish_connection(nbr); } @@ -1492,6 +1493,7 @@ merge_nbrps(struct ldpd_conf *conf, struct ldpd_conf *xconf, void **ref) nbr = nbr_find_ldpid(xn->lsr_id.s_addr); if (nbr) { session_shutdown(nbr, S_SHUTDOWN, 0, 0); + nbr->auth.method = xn->auth.method; #ifdef __OpenBSD__ if (pfkey_establish(nbr, xn) == -1) fatalx("pfkey setup failed"); @@ -1539,9 +1541,11 @@ merge_nbrps(struct ldpd_conf *conf, struct ldpd_conf *xconf, void **ref) session_shutdown(nbr, S_SHUTDOWN, 0, 0); #ifdef __OpenBSD__ pfkey_remove(nbr); + nbr->auth.method = nbrp->auth.method; if (pfkey_establish(nbr, nbrp) == -1) fatalx("pfkey setup failed"); #else + nbr->auth.method = nbrp->auth.method; sock_set_md5sig((ldp_af_global_get(&global, nbr->af))->ldp_session_socket, nbr->af, &nbr->raddr, nbrp->auth.md5key); diff --git a/ldpd/ldpd.h b/ldpd/ldpd.h index c665656aa6..a8279ebf66 100644 --- a/ldpd/ldpd.h +++ b/ldpd/ldpd.h @@ -77,6 +77,7 @@ enum imsg_type { IMSG_CTL_RELOAD, IMSG_CTL_SHOW_INTERFACE, IMSG_CTL_SHOW_DISCOVERY, + IMSG_CTL_SHOW_DISCOVERY_DTL, IMSG_CTL_SHOW_DISC_IFACE, IMSG_CTL_SHOW_DISC_TNBR, IMSG_CTL_SHOW_DISC_ADJ, @@ -84,6 +85,10 @@ enum imsg_type { IMSG_CTL_SHOW_NBR_DISC, IMSG_CTL_SHOW_NBR_END, IMSG_CTL_SHOW_LIB, + IMSG_CTL_SHOW_LIB_BEGIN, + IMSG_CTL_SHOW_LIB_SENT, + IMSG_CTL_SHOW_LIB_RCVD, + IMSG_CTL_SHOW_LIB_END, IMSG_CTL_SHOW_L2VPN_PW, IMSG_CTL_SHOW_L2VPN_BINDING, IMSG_CTL_CLEAR_NBR, @@ -347,6 +352,29 @@ DECLARE_QOBJ_TYPE(nbr_params) #define F_NBRP_GTSM 0x02 #define F_NBRP_GTSM_HOPS 0x04 +struct ldp_stats { + uint32_t kalive_sent; + uint32_t kalive_rcvd; + uint32_t addr_sent; + uint32_t addr_rcvd; + uint32_t addrwdraw_sent; + uint32_t addrwdraw_rcvd; + uint32_t notif_sent; + uint32_t notif_rcvd; + uint32_t capability_sent; + uint32_t capability_rcvd; + uint32_t labelmap_sent; + uint32_t labelmap_rcvd; + uint32_t labelreq_sent; + uint32_t labelreq_rcvd; + uint32_t labelwdraw_sent; + uint32_t labelwdraw_rcvd; + uint32_t labelrel_sent; + uint32_t labelrel_rcvd; + uint32_t labelabreq_sent; + uint32_t labelabreq_rcvd; +}; + struct l2vpn_if { RB_ENTRY(l2vpn_if) entry; struct l2vpn *l2vpn; @@ -568,7 +596,9 @@ struct ctl_adj { char ifname[IF_NAMESIZE]; union ldpd_addr src_addr; uint16_t holdtime; + uint16_t holdtime_remaining; union ldpd_addr trans_addr; + int ds_tlv; }; struct ctl_nbr { @@ -578,9 +608,12 @@ struct ctl_nbr { in_port_t lport; union ldpd_addr raddr; in_port_t rport; + enum auth_method auth_method; uint16_t holdtime; time_t uptime; int nbr_state; + struct ldp_stats stats; + int flags; }; struct ctl_rt { @@ -592,7 +625,7 @@ struct ctl_rt { uint32_t remote_label; uint8_t flags; uint8_t in_use; - int first; + int no_downstream; }; struct ctl_pw { diff --git a/ldpd/ldpe.c b/ldpd/ldpe.c index c9f0e19076..6c542c5e34 100644 --- a/ldpd/ldpe.c +++ b/ldpd/ldpe.c @@ -354,6 +354,7 @@ ldpe_dispatch_main(struct thread *thread) #ifdef __OpenBSD__ pfkey_remove(nbr); #endif + nbr->auth.method = AUTH_NONE; } ldpe_close_sockets(af); if_update_all(af); @@ -409,8 +410,11 @@ ldpe_dispatch_main(struct thread *thread) af))->trans_addr; #ifdef __OpenBSD__ nbrp = nbr_params_find(leconf, nbr->id); - if (nbrp && pfkey_establish(nbr, nbrp) == -1) - fatalx("pfkey setup failed"); + if (nbrp) { + nbr->auth.method = nbrp->auth.method; + if (pfkey_establish(nbr, nbrp) == -1) + fatalx("pfkey setup failed"); + } #endif if (nbr_session_active_role(nbr)) nbr_establish_connection(nbr); @@ -642,7 +646,10 @@ ldpe_dispatch_lde(struct thread *thread) send_notification_full(nbr->tcp, nm); break; case IMSG_CTL_END: - case IMSG_CTL_SHOW_LIB: + case IMSG_CTL_SHOW_LIB_BEGIN: + case IMSG_CTL_SHOW_LIB_RCVD: + case IMSG_CTL_SHOW_LIB_SENT: + case IMSG_CTL_SHOW_LIB_END: case IMSG_CTL_SHOW_L2VPN_PW: case IMSG_CTL_SHOW_L2VPN_BINDING: control_imsg_relay(&imsg); @@ -820,6 +827,21 @@ ldpe_iface_ctl(struct ctl_conn *c, unsigned int idx) void ldpe_adj_ctl(struct ctl_conn *c) { + struct adj *adj; + struct ctl_adj *actl; + + RB_FOREACH(adj, global_adj_head, &global.adj_tree) { + actl = adj_to_ctl(adj); + imsg_compose_event(&c->iev, IMSG_CTL_SHOW_DISCOVERY, 0, 0, + -1, actl, sizeof(struct ctl_adj)); + } + + imsg_compose_event(&c->iev, IMSG_CTL_END, 0, 0, -1, NULL, 0); +} + +void +ldpe_adj_detail_ctl(struct ctl_conn *c) +{ struct iface *iface; struct tnbr *tnbr; struct adj *adj; diff --git a/ldpd/ldpe.h b/ldpd/ldpe.h index 992fbd38d5..8215d08407 100644 --- a/ldpd/ldpe.h +++ b/ldpd/ldpe.h @@ -100,6 +100,7 @@ struct nbr { int idtimer_cnt; uint16_t keepalive; uint16_t max_pdu_len; + struct ldp_stats stats; struct { uint8_t established; @@ -207,6 +208,7 @@ void ldpe_stop_init_backoff(int); struct ctl_conn; void ldpe_iface_ctl(struct ctl_conn *, unsigned int); void ldpe_adj_ctl(struct ctl_conn *); +void ldpe_adj_detail_ctl(struct ctl_conn *); void ldpe_nbr_ctl(struct ctl_conn *); void mapping_list_add(struct mapping_head *, struct map *); void mapping_list_clr(struct mapping_head *); @@ -231,7 +233,7 @@ in_addr_t if_get_ipv4_addr(struct iface *); struct adj *adj_new(struct in_addr, struct hello_source *, union ldpd_addr *); void adj_del(struct adj *, uint32_t); -struct adj *adj_find(struct hello_source *); +struct adj *adj_find(struct in_addr, struct hello_source *); int adj_get_af(struct adj *adj); void adj_start_itimer(struct adj *); void adj_stop_itimer(struct adj *); diff --git a/ldpd/neighbor.c b/ldpd/neighbor.c index 077d472850..9a92a00d32 100644 --- a/ldpd/neighbor.c +++ b/ldpd/neighbor.c @@ -264,6 +264,7 @@ nbr_new(struct in_addr id, int af, int ds_tlv, union ldpd_addr *addr, nbrp = nbr_params_find(leconf, nbr->id); if (nbrp) { + nbr->auth.method = nbrp->auth.method; #ifdef __OpenBSD__ if (pfkey_establish(nbr, nbrp) == -1) fatalx("pfkey setup failed"); @@ -296,6 +297,7 @@ nbr_del(struct nbr *nbr) (ldp_af_global_get(&global, nbr->af))->ldp_session_socket, nbr->af, &nbr->raddr, NULL); #endif + nbr->auth.method = AUTH_NONE; if (nbr_pending_connect(nbr)) THREAD_WRITE_OFF(nbr->ev_connect); @@ -808,8 +810,11 @@ nbr_to_ctl(struct nbr *nbr) nctl.lport = nbr->tcp->lport; nctl.raddr = nbr->raddr; nctl.rport = nbr->tcp->rport; + nctl.auth_method = nbr->auth.method; nctl.holdtime = nbr->keepalive; nctl.nbr_state = nbr->state; + nctl.stats = nbr->stats; + nctl.flags = nbr->flags; gettimeofday(&now, NULL); if (nbr->state == NBR_STA_OPER) { diff --git a/ldpd/notification.c b/ldpd/notification.c index 393994ed5f..f10faa4a54 100644 --- a/ldpd/notification.c +++ b/ldpd/notification.c @@ -66,6 +66,7 @@ send_notification_full(struct tcp_conn *tcp, struct notify_msg *nm) if (tcp->nbr) { log_msg_notification(1, tcp->nbr, nm); nbr_fsm(tcp->nbr, NBR_EVT_PDU_SENT); + tcp->nbr->stats.notif_sent++; } evbuf_enqueue(&tcp->wbuf, buf); diff --git a/ldpd/packet.c b/ldpd/packet.c index a7be0f6b42..46893b992b 100644 --- a/ldpd/packet.c +++ b/ldpd/packet.c @@ -572,6 +572,42 @@ session_read(struct thread *thread) return (0); } + /* no errors - update per neighbor message counters */ + switch (type) { + case MSG_TYPE_NOTIFICATION: + nbr->stats.notif_rcvd++; + break; + case MSG_TYPE_KEEPALIVE: + nbr->stats.kalive_rcvd++; + break; + case MSG_TYPE_CAPABILITY: + nbr->stats.capability_rcvd++; + break; + case MSG_TYPE_ADDR: + nbr->stats.addr_rcvd++; + break; + case MSG_TYPE_ADDRWITHDRAW: + nbr->stats.addrwdraw_rcvd++; + break; + case MSG_TYPE_LABELMAPPING: + nbr->stats.labelmap_rcvd++; + break; + case MSG_TYPE_LABELREQUEST: + nbr->stats.labelreq_rcvd++; + break; + case MSG_TYPE_LABELWITHDRAW: + nbr->stats.labelwdraw_rcvd++; + break; + case MSG_TYPE_LABELRELEASE: + nbr->stats.labelrel_rcvd++; + break; + case MSG_TYPE_LABELABORTREQ: + nbr->stats.labelabreq_rcvd++; + break; + default: + break; + } + /* Analyse the next message */ pdu += msg_size; len -= msg_size; diff --git a/ldpd/pfkey.c b/ldpd/pfkey.c index 88a778cccc..a1a79dabfd 100644 --- a/ldpd/pfkey.c +++ b/ldpd/pfkey.c @@ -418,12 +418,6 @@ pfkey_establish(struct nbr *nbr, struct nbr_params *nbrp) if (nbrp->auth.method == AUTH_NONE) return (0); - /* - * make sure we keep copies of everything we need to - * remove SAs and flows later again. - */ - nbr->auth.method = nbrp->auth.method; - switch (nbr->auth.method) { case AUTH_MD5SIG: strlcpy(nbr->auth.md5key, nbrp->auth.md5key, |
