]> git.proxmox.com Git - mirror_frr.git/commitdiff
ldpd: minor tweaks
authorRenato Westphal <renato@opensourcerouting.org>
Fri, 3 Mar 2017 20:50:22 +0000 (17:50 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Fri, 3 Mar 2017 20:50:22 +0000 (17:50 -0300)
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
ldpd/labelmapping.c
ldpd/lde.c
ldpd/lde.h
ldpd/lde_lib.c
ldpd/ldp.h
ldpd/ldpe.c

index 62f2a620d22c0c59f376f4bc40b00b19abaf3765..15861cfd9ac2c37ff32a3fc3db653119810ed68e 100644 (file)
@@ -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;
 
index 1323ba3d0245344f740cf61bb82b5fbd66f95c15..6ac0f07dafc9a2e1873a9052ebadc81f27d4866f 100644 (file)
@@ -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));
 }
 
index e0e9873d5ca842bc83e4b260f4590e551724fd18..b3fa2d469b56fd59f760ec46185fb5b93aea9615 100644 (file)
@@ -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);
index 234d373fbb145998705022d2cd1ed6f4f484ed76..6ec88a19bd4821656faf79bfa874ea8280479ce4 100644 (file)
@@ -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;
index c421cddc386f8fb9bbcedf4bd91a907fa45c4b09..c068e22918c06f436da842f9614ce72c00a711ce 100644 (file)
@@ -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
index 7dcc8fbe16dcf5db03c7a6ec2474b0db8cc376ef..bea26a6610eba7174c1518b63b616c572e19d350 100644 (file)
@@ -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));
                }
        }