summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ldpd/labelmapping.c
diff options
context:
space:
mode:
authorrenato <renato@openbsd.org>2016-09-02 17:08:02 +0000
committerrenato <renato@openbsd.org>2016-09-02 17:08:02 +0000
commitc0cfacb43c99bff29b110ee70702f7e85660e0ef (patch)
treee0ccf1084a1639b6dcc2f28f1f339138bb59cca2 /usr.sbin/ldpd/labelmapping.c
parentconvert getpass to readpassphrase. from Dimitris Papastamos (diff)
downloadwireguard-openbsd-c0cfacb43c99bff29b110ee70702f7e85660e0ef.tar.xz
wireguard-openbsd-c0cfacb43c99bff29b110ee70702f7e85660e0ef.zip
Improve logging of sent and received messages.
* Standardize the logging format of sent and received messages: "msg-[in|out]: message type: lsr-id A.B.C.D [additional info]"; * Log sent label messages as well, not only the received ones; * Move the logging of sent notification messages from send_notification_nbr() to send_notification_full(), this way notification triggered by the lde process are logged as well; * Minor clean-up.
Diffstat (limited to 'usr.sbin/ldpd/labelmapping.c')
-rw-r--r--usr.sbin/ldpd/labelmapping.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/usr.sbin/ldpd/labelmapping.c b/usr.sbin/ldpd/labelmapping.c
index 5ed9800f2d8..4e70f8f3592 100644
--- a/usr.sbin/ldpd/labelmapping.c
+++ b/usr.sbin/ldpd/labelmapping.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: labelmapping.c,v 1.59 2016/08/08 16:45:51 renato Exp $ */
+/* $OpenBSD: labelmapping.c,v 1.60 2016/09/02 17:08:02 renato Exp $ */
/*
* Copyright (c) 2014, 2015 Renato Westphal <renato@openbsd.org>
@@ -126,6 +126,10 @@ send_labelmessage(struct nbr *nbr, uint16_t type, struct mapping_head *mh)
return;
}
+ log_debug("msg-out: %s: lsr-id %s, fec %s, label %s",
+ msg_name(type), inet_ntoa(nbr->id), log_map(&me->map),
+ log_label(me->map.label));
+
TAILQ_REMOVE(mh, me, entry);
free(me);
}
@@ -394,31 +398,24 @@ recv_labelmessage(struct nbr *nbr, char *buf, uint16_t len, uint16_t type)
if (me->map.flags & F_MAP_REQ_ID)
me->map.requestid = reqid;
+ log_debug("msg-in: label mapping: lsr-id %s, fec %s, label %s",
+ inet_ntoa(nbr->id), log_map(&me->map),
+ log_label(me->map.label));
+
switch (type) {
case MSG_TYPE_LABELMAPPING:
- log_debug("label mapping from lsr-id %s, FEC %s, "
- "label %s", inet_ntoa(nbr->id),
- log_map(&me->map), log_label(me->map.label));
imsg_type = IMSG_LABEL_MAPPING;
break;
case MSG_TYPE_LABELREQUEST:
- log_debug("label request from lsr-id %s, FEC %s",
- inet_ntoa(nbr->id), log_map(&me->map));
imsg_type = IMSG_LABEL_REQUEST;
break;
case MSG_TYPE_LABELWITHDRAW:
- log_debug("label withdraw from lsr-id %s, FEC %s",
- inet_ntoa(nbr->id), log_map(&me->map));
imsg_type = IMSG_LABEL_WITHDRAW;
break;
case MSG_TYPE_LABELRELEASE:
- log_debug("label release from lsr-id %s, FEC %s",
- inet_ntoa(nbr->id), log_map(&me->map));
imsg_type = IMSG_LABEL_RELEASE;
break;
case MSG_TYPE_LABELABORTREQ:
- log_debug("label abort from lsr-id %s, FEC %s",
- inet_ntoa(nbr->id), log_map(&me->map));
imsg_type = IMSG_LABEL_ABORT;
break;
default: