summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ldpd/address.c12
-rw-r--r--ldpd/adjacency.c4
-rw-r--r--ldpd/hello.c1
-rw-r--r--ldpd/init.c1
-rw-r--r--ldpd/keepalive.c1
-rw-r--r--ldpd/labelmapping.c29
-rw-r--r--ldpd/lde_lib.c29
-rw-r--r--ldpd/ldp_vty_exec.c501
-rw-r--r--ldpd/ldpd.c4
-rw-r--r--ldpd/ldpd.h33
-rw-r--r--ldpd/ldpe.c13
-rw-r--r--ldpd/ldpe.h1
-rw-r--r--ldpd/neighbor.c4
-rw-r--r--ldpd/notification.c1
-rw-r--r--ldpd/packet.c36
-rw-r--r--ldpd/pfkey.c6
16 files changed, 507 insertions, 169 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 244d0f55a2..8659202ee4 100644
--- a/ldpd/adjacency.c
+++ b/ldpd/adjacency.c
@@ -375,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/hello.c b/ldpd/hello.c
index 19e3013bb8..dd67f68f70 100644
--- a/ldpd/hello.c
+++ b/ldpd/hello.c
@@ -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_exec.c b/ldpd/ldp_vty_exec.c
index 32b36675a7..616847b363 100644
--- a/ldpd/ldp_vty_exec.c
+++ b/ldpd/ldp_vty_exec.c
@@ -82,8 +82,11 @@ 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 *,
@@ -231,12 +234,23 @@ 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
@@ -268,7 +282,7 @@ show_discovery_detail_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;
@@ -281,8 +295,8 @@ show_discovery_detail_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;
@@ -301,8 +315,17 @@ show_discovery_detail_msg(struct vty *vty, struct imsg *imsg,
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);
@@ -381,10 +404,16 @@ show_discovery_detail_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);
}
@@ -406,7 +435,13 @@ show_discovery_detail_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();
@@ -422,10 +457,6 @@ show_discovery_detail_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;
@@ -441,10 +472,6 @@ show_discovery_detail_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;
@@ -521,9 +548,11 @@ show_nbr_detail_adj(struct vty *vty, char *buffer, struct ctl_adj *adj)
}
static int
-show_nbr_detail_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];
@@ -540,12 +569,41 @@ show_nbr_detail_msg(struct vty *vty, struct imsg *imsg, struct show_params *para
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;
@@ -648,8 +706,11 @@ 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;
@@ -659,6 +720,8 @@ show_nbr_detail_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));
@@ -668,13 +731,109 @@ show_nbr_detail_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);
@@ -716,6 +875,25 @@ show_nbr_detail_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)
{
@@ -730,21 +908,7 @@ show_nbr_capabilities_msg(struct vty *vty, struct imsg *imsg, struct show_params
vty_out(vty, "Peer LDP Identifier: %s:0%s", inet_ntoa(nbr->id),
VTY_NEWLINE);
- 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);
+ show_nbr_capabilities(vty, nbr);
break;
case IMSG_CTL_END:
vty_out(vty, "%s", VTY_NEWLINE);
@@ -756,87 +920,84 @@ show_nbr_capabilities_msg(struct vty *vty, struct imsg *imsg, struct show_params
return (0);
}
-static int
-show_nbr_capabilities_msg_json(struct imsg *imsg, struct show_params *params,
- json_object *json)
+static void
+show_nbr_capabilities_json(struct ctl_nbr *nbr, json_object *json_nbr)
{
- struct ctl_nbr *nbr;
- json_object *json_nbr;
json_object *json_array;
json_object *json_cap;
- 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_string_add(json_nbr, "peerId", inet_ntoa(nbr->id));
- json_object_object_add(json, inet_ntoa(nbr->id), json_nbr);
-
- /* sent capabilities */
- json_array = json_object_new_array();
- json_object_object_add(json_nbr, "sentCapabilities", json_array);
-
- /* Dynamic Announcement (0x0506) */
+ /* 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_string_add(json_cap, "tlvType", "0x0506");
json_object_array_add(json_array, json_cap);
+ }
- /* Typed Wildcard (0x050B) */
+ /* 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_string_add(json_cap, "tlvType", "0x050B");
json_object_array_add(json_array, json_cap);
+ }
- /* Unrecognized Notification (0x0603) */
+ /* 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_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);
+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;
- /* 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);
- }
+ switch (imsg->hdr.type) {
+ case IMSG_CTL_SHOW_NBR:
+ nbr = imsg->data;
- /* 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);
- }
+ if (nbr->nbr_state != NBR_STA_OPER)
+ break;
- /* 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);
- }
+ 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);
@@ -854,9 +1015,14 @@ 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;
@@ -885,36 +1051,63 @@ show_lib_detail_msg(struct vty *vty, struct imsg *imsg, struct show_params *para
{
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:
+ 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:
+ 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);
- 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, "%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);
@@ -936,10 +1129,12 @@ show_lib_msg_json(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 (params->family != AF_UNSPEC && params->family != rt->af)
+ if (imsg->hdr.type == IMSG_CTL_SHOW_LIB_BEGIN &&
+ !rt->no_downstream)
break;
json_object_object_get_ex(json, "bindings", &json_array);
@@ -979,40 +1174,58 @@ show_lib_detail_msg_json(struct imsg *imsg, struct show_params *params,
{
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);
diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c
index 98ea5ca53e..aae7333729 100644
--- a/ldpd/ldpd.c
+++ b/ldpd/ldpd.c
@@ -1448,6 +1448,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);
}
@@ -1473,6 +1474,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");
@@ -1520,9 +1522,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 81850dd497..8f96b78375 100644
--- a/ldpd/ldpd.h
+++ b/ldpd/ldpd.h
@@ -85,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,
@@ -346,6 +350,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;
@@ -567,7 +594,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 {
@@ -577,9 +606,11 @@ 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;
};
@@ -592,7 +623,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 de93d7a2d0..20774137e6 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);
diff --git a/ldpd/ldpe.h b/ldpd/ldpe.h
index 4cac18f0b9..e50879ae95 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;
diff --git a/ldpd/neighbor.c b/ldpd/neighbor.c
index 172468256a..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,10 @@ 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);
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,