]> git.puffer.fish Git - mirror/frr.git/commitdiff
ldpd: process pw-status in received order 6729/head
authorKaren Schoener <karen@volta.io>
Mon, 13 Jul 2020 16:22:15 +0000 (12:22 -0400)
committerKaren Schoener <karen@volta.io>
Mon, 20 Jul 2020 13:08:15 +0000 (09:08 -0400)
Update LDP to process received pw-status in received order.
Update LDP to save pw-status regardless of whether the PW is configured.
When the PW is configured, LDP checks for any saved PW pw-status.

Signed-off-by: Karen Schoener <karen@voltanet.io>
ldpd/l2vpn.c
ldpd/lde.c
ldpd/lde.h
ldpd/lde_lib.c

index 0d479e77ba4d44a9f0b7510c966d765dd79565af..2c68f3edbd1c2b0bef43864a4443fef4ae555d76 100644 (file)
@@ -294,6 +294,16 @@ l2vpn_pw_reset(struct l2vpn_pw *pw)
                pw->flags |= F_PW_STATUSTLV;
        else
                pw->flags &= ~F_PW_STATUSTLV;
+
+       if (pw->flags & F_PW_STATUSTLV_CONF) {
+               struct fec_node         *fn;
+               struct fec fec;
+               l2vpn_pw_fec(pw, &fec);
+               fn = (struct fec_node *)fec_find(&ft, &fec);
+               if (fn)
+                       pw->remote_status = fn->pw_remote_status;
+       }
+
 }
 
 int
@@ -433,6 +443,8 @@ l2vpn_recv_pw_status(struct lde_nbr *ln, struct notify_msg *nm)
                /* unknown fec */
                return;
 
+       fn->pw_remote_status = nm->pw_status;
+
        pw = (struct l2vpn_pw *) fn->data;
        if (pw == NULL)
                return;
index 4fca4b096285542ef90c713cac44f092f88a23a9..734c1ea230ea85161abb60471fa076474ad91c03 100644 (file)
@@ -296,7 +296,7 @@ lde_dispatch_imsg(struct thread *thread)
 
                        switch (imsg.hdr.type) {
                        case IMSG_LABEL_MAPPING:
-                               lde_check_mapping(map, ln);
+                               lde_check_mapping(map, ln, 1);
                                break;
                        case IMSG_LABEL_REQUEST:
                                lde_check_request(map, ln);
index 2895e00ae55f33eccd73ed778da6958e15b0a7a0..9e6db3a90b1259917a651c7d62b2034ed30eb010 100644 (file)
@@ -125,6 +125,9 @@ struct fec_node {
        struct lde_map_head      upstream;      /* sent mappings */
 
        uint32_t                 local_label;
+
+       uint32_t                 pw_remote_status;
+
        void                    *data;          /* fec specific data */
 };
 
@@ -209,7 +212,7 @@ void                 lde_kernel_insert(struct fec *, int, union ldpd_addr *,
 void            lde_kernel_remove(struct fec *, int, union ldpd_addr *,
                    ifindex_t, uint8_t, unsigned short);
 void            lde_kernel_update(struct fec *);
-void            lde_check_mapping(struct map *, struct lde_nbr *);
+void            lde_check_mapping(struct map *, struct lde_nbr *, int);
 void            lde_check_request(struct map *, struct lde_nbr *);
 void            lde_check_request_wcard(struct map *, struct lde_nbr *);
 void            lde_check_release(struct map *, struct lde_nbr *);
index 8f524e0aa97a6a1f21a406ccd1c48d6cec7b4bcb..71fb0c7bf285350482bdde8f3d833c2223f4733d 100644 (file)
@@ -267,6 +267,9 @@ fec_add(struct fec *fec)
        RB_INIT(lde_map_head, &fn->downstream);
        LIST_INIT(&fn->nexthops);
 
+       if (fec->type == FEC_TYPE_PWID)
+               fn->pw_remote_status = PW_FORWARDING;
+
        if (fec_insert(&ft, &fn->fec))
                log_warnx("failed to add %s to ft tree",
                    log_fec(&fn->fec));
@@ -455,13 +458,13 @@ lde_kernel_update(struct fec *fec)
                        me = (struct lde_map *)fec_find(&ln->recv_map, &fn->fec);
                        if (me)
                                /* FEC.5 */
-                               lde_check_mapping(&me->map, ln);
+                               lde_check_mapping(&me->map, ln, 0);
                }
        }
 }
 
 void
-lde_check_mapping(struct map *map, struct lde_nbr *ln)
+lde_check_mapping(struct map *map, struct lde_nbr *ln, int rcvd_label_mapping)
 {
        struct fec               fec;
        struct fec_node         *fn;
@@ -507,8 +510,12 @@ lde_check_mapping(struct map *map, struct lde_nbr *ln)
                lde_req_del(ln, lre, 1);
 
        /* RFC 4447 control word and status tlv negotiation */
-       if (map->type == MAP_TYPE_PWID && l2vpn_pw_negotiate(ln, fn, map))
+       if (map->type == MAP_TYPE_PWID && l2vpn_pw_negotiate(ln, fn, map)) {
+               if (rcvd_label_mapping && map->flags & F_MAP_PW_STATUS)
+                       fn->pw_remote_status = map->pw_status;
+
                return;
+       }
 
        /*
         * LMp.3 - LMp.8: loop detection - unnecessary for frame-mode
@@ -570,8 +577,10 @@ lde_check_mapping(struct map *map, struct lde_nbr *ln)
                        pw->remote_group = map->fec.pwid.group_id;
                        if (map->flags & F_MAP_PW_IFMTU)
                                pw->remote_mtu = map->fec.pwid.ifmtu;
-                       if (map->flags & F_MAP_PW_STATUS)
+                       if (rcvd_label_mapping && map->flags & F_MAP_PW_STATUS) {
                                pw->remote_status = map->pw_status;
+                               fn->pw_remote_status = map->pw_status;
+                       }
                        else
                                pw->remote_status = PW_FORWARDING;
                        fnh->remote_label = map->label;