From: Renato Westphal Date: Fri, 3 Mar 2017 20:50:22 +0000 (-0300) Subject: ldpd: minor tweaks X-Git-Tag: frr-3.0-branchpoint~12^2~16 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=05aac414e69068748a8e6d6f7e3b0bdb74677039;p=mirror_frr.git ldpd: minor tweaks Signed-off-by: Renato Westphal --- diff --git a/ldpd/labelmapping.c b/ldpd/labelmapping.c index 62f2a620d..15861cfd9 100644 --- a/ldpd/labelmapping.c +++ b/ldpd/labelmapping.c @@ -423,14 +423,14 @@ recv_labelmessage(struct nbr *nbr, char *buf, uint16_t len, uint16_t type) ldpe_imsg_compose_lde(imsg_type, nbr->peerid, 0, &me->map, sizeof(struct map)); -next: + next: TAILQ_REMOVE(&mh, me, entry); free(me); } return (0); -err: + err: mapping_list_clr(&mh); return (-1); @@ -562,7 +562,7 @@ gen_fec_tlv(struct ibuf *buf, struct map *map) break; case MAP_TYPE_PWID: if (map->flags & F_MAP_PW_ID) - pw_len += PW_STATUS_TLV_LEN; + pw_len += FEC_PWID_SIZE; if (map->flags & F_MAP_PW_IFMTU) pw_len += FEC_SUBTLV_IFMTU_SIZE; diff --git a/ldpd/lde.c b/ldpd/lde.c index 1323ba3d0..6ac0f07da 100644 --- a/ldpd/lde.c +++ b/ldpd/lde.c @@ -37,7 +37,7 @@ static void lde_shutdown(void); static int lde_dispatch_imsg(struct thread *); static int lde_dispatch_parent(struct thread *); -static __inline int lde_nbr_compare(struct lde_nbr *, +static __inline int lde_nbr_compare(struct lde_nbr *, struct lde_nbr *); static struct lde_nbr *lde_nbr_new(uint32_t, struct lde_nbr *); static void lde_nbr_del(struct lde_nbr *); @@ -1044,7 +1044,7 @@ lde_send_labelrelease(struct lde_nbr *ln, struct fec_node *fn, uint32_t label) } void -lde_send_notification(uint32_t peerid, uint32_t status_code, uint32_t msg_id, +lde_send_notification(struct lde_nbr *ln, uint32_t status_code, uint32_t msg_id, uint16_t msg_type) { struct notify_msg nm; @@ -1055,7 +1055,7 @@ lde_send_notification(uint32_t peerid, uint32_t status_code, uint32_t msg_id, nm.msg_id = msg_id; nm.msg_type = msg_type; - lde_imsg_compose_ldpe(IMSG_NOTIFICATION_SEND, peerid, 0, + lde_imsg_compose_ldpe(IMSG_NOTIFICATION_SEND, ln->peerid, 0, &nm, sizeof(nm)); } diff --git a/ldpd/lde.h b/ldpd/lde.h index e0e9873d5..b3fa2d469 100644 --- a/ldpd/lde.h +++ b/ldpd/lde.h @@ -147,7 +147,8 @@ void lde_send_labelwithdraw(struct lde_nbr *, struct fec_node *, void lde_send_labelwithdraw_all(struct fec_node *, uint32_t); void lde_send_labelrelease(struct lde_nbr *, struct fec_node *, uint32_t); -void lde_send_notification(uint32_t, uint32_t, uint32_t, uint16_t); +void lde_send_notification(struct lde_nbr *, uint32_t, uint32_t, + uint16_t); struct lde_nbr *lde_nbr_find_by_lsrid(struct in_addr); struct lde_nbr *lde_nbr_find_by_addr(int, union ldpd_addr *); struct lde_map *lde_map_add(struct lde_nbr *, struct fec_node *, int); diff --git a/ldpd/lde_lib.c b/ldpd/lde_lib.c index 234d373fb..6ec88a19b 100644 --- a/ldpd/lde_lib.c +++ b/ldpd/lde_lib.c @@ -561,7 +561,7 @@ lde_check_request(struct map *map, struct lde_nbr *ln) fn = (struct fec_node *)fec_find(&ft, &fec); if (fn == NULL || LIST_EMPTY(&fn->nexthops)) { /* LRq.5: send No Route notification */ - lde_send_notification(ln->peerid, S_NO_ROUTE, map->msg_id, + lde_send_notification(ln, S_NO_ROUTE, map->msg_id, htons(MSG_TYPE_LABELREQUEST)); return; } @@ -575,8 +575,8 @@ lde_check_request(struct map *map, struct lde_nbr *ln) continue; /* LRq.4: send Loop Detected notification */ - lde_send_notification(ln->peerid, S_LOOP_DETECTED, - map->msg_id, htons(MSG_TYPE_LABELREQUEST)); + lde_send_notification(ln, S_LOOP_DETECTED, map->msg_id, + htons(MSG_TYPE_LABELREQUEST)); return; default: break; diff --git a/ldpd/ldp.h b/ldpd/ldp.h index c421cddc3..c068e2291 100644 --- a/ldpd/ldp.h +++ b/ldpd/ldp.h @@ -242,6 +242,7 @@ struct address_list_tlv { #define FEC_ELM_WCARD_LEN 1 #define FEC_ELM_PREFIX_MIN_LEN 4 #define FEC_PWID_ELM_MIN_LEN 8 +#define FEC_PWID_SIZE 4 #define MAP_TYPE_WILDCARD 0x01 #define MAP_TYPE_PREFIX 0x02 diff --git a/ldpd/ldpe.c b/ldpd/ldpe.c index 7dcc8fbe1..bea26a661 100644 --- a/ldpd/ldpe.c +++ b/ldpd/ldpe.c @@ -791,8 +791,7 @@ ldpe_iface_af_ctl(struct ctl_conn *c, int af, unsigned int idx) continue; ictl = if_to_ctl(ia); - imsg_compose_event(&c->iev, - IMSG_CTL_SHOW_INTERFACE, + imsg_compose_event(&c->iev, IMSG_CTL_SHOW_INTERFACE, 0, 0, -1, ictl, sizeof(struct ctl_iface)); } }