diff options
author | 2017-03-03 23:50:45 +0000 | |
---|---|---|
committer | 2017-03-03 23:50:45 +0000 | |
commit | 297a8bbeae691f7411c9fc625f2c76e48dbff8c5 (patch) | |
tree | 5ba9e210fddd1aaf0ce5323c5701f9ee55f3b976 /usr.sbin/ldpd/labelmapping.c | |
parent | Provide more detailed output when logging notification messages. (diff) | |
download | wireguard-openbsd-297a8bbeae691f7411c9fc625f2c76e48dbff8c5.tar.xz wireguard-openbsd-297a8bbeae691f7411c9fc625f2c76e48dbff8c5.zip |
Create helper functions to log sent/received messages.
Diffstat (limited to 'usr.sbin/ldpd/labelmapping.c')
-rw-r--r-- | usr.sbin/ldpd/labelmapping.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/usr.sbin/ldpd/labelmapping.c b/usr.sbin/ldpd/labelmapping.c index 61a6a8ae75f..964cc44286e 100644 --- a/usr.sbin/ldpd/labelmapping.c +++ b/usr.sbin/ldpd/labelmapping.c @@ -1,4 +1,4 @@ -/* $OpenBSD: labelmapping.c,v 1.63 2017/03/03 23:44:35 renato Exp $ */ +/* $OpenBSD: labelmapping.c,v 1.64 2017/03/03 23:50:45 renato Exp $ */ /* * Copyright (c) 2014, 2015 Renato Westphal <renato@openbsd.org> @@ -34,6 +34,7 @@ static int gen_label_tlv(struct ibuf *, uint32_t); static int tlv_decode_label(struct nbr *, struct ldp_msg *, char *, uint16_t, 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) @@ -127,9 +128,7 @@ 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)); + log_msg_mapping(1, type, nbr, &me->map); TAILQ_REMOVE(mh, me, entry); free(me); @@ -399,9 +398,7 @@ 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: %s: lsr-id %s, fec %s, label %s", - msg_name(type), inet_ntoa(nbr->id), log_map(&me->map), - log_label(me->map.label)); + log_msg_mapping(0, type, nbr, &me->map); switch (type) { case MSG_TYPE_LABELMAPPING: @@ -762,3 +759,11 @@ tlv_decode_fec_elm(struct nbr *nbr, struct ldp_msg *msg, char *buf, return (-1); } + +static void +log_msg_mapping(int out, uint16_t msg_type, struct nbr *nbr, struct map *map) +{ + log_debug("msg-%s: %s: lsr-id %s, fec %s, label %s", + (out) ? "out" : "in", msg_name(msg_type), inet_ntoa(nbr->id), + log_map(map), log_label(map->label)); +} |