diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2017-03-03 17:50:22 -0300 |
|---|---|---|
| committer | Renato Westphal <renato@opensourcerouting.org> | 2017-03-03 17:50:22 -0300 |
| commit | faf757937f8a38f96cfd732068588830e0a998b5 (patch) | |
| tree | aff5843f22d2071449a69a6d6ed030d969184cc3 /ldpd/labelmapping.c | |
| parent | 8afbd8942ae56af31c0bcbf741b4ef11f2b8f229 (diff) | |
ldpd: create helper functions to log sent/received messages
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ldpd/labelmapping.c')
| -rw-r--r-- | ldpd/labelmapping.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/ldpd/labelmapping.c b/ldpd/labelmapping.c index 34cc1f83a2..d9f71fdf6b 100644 --- a/ldpd/labelmapping.c +++ b/ldpd/labelmapping.c @@ -31,6 +31,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) @@ -124,9 +125,7 @@ send_labelmessage(struct nbr *nbr, uint16_t type, struct mapping_head *mh) return; } - debug_msg_send("%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); @@ -396,9 +395,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; - debug_msg_recv("%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: @@ -759,3 +756,10 @@ 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) +{ + debug_msg(out, "%s: lsr-id %s, fec %s, label %s", msg_name(msg_type), + inet_ntoa(nbr->id), log_map(map), log_label(map->label)); +} |
