]> git.proxmox.com Git - mirror_frr.git/blobdiff - ldpd/l2vpn.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / ldpd / l2vpn.c
index 4a944fa01968095f774778eaa3145ec1f664e5c0..4664b1f894a81a7d0dc4c7443930b6a299ea573d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: ISC
 /*     $OpenBSD$ */
 
 /*
@@ -5,18 +6,6 @@
  * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
  * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
  * Copyright (c) 2004, 2005, 2008 Esben Norby <norby@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
 #include <zebra.h>
@@ -294,6 +283,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 +432,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;
@@ -521,11 +522,11 @@ l2vpn_pw_status_update(struct zapi_pw_status *zpw)
                return (1);
        }
 
-       if (zpw->status == PW_STATUS_UP) {
+       if (zpw->status == PW_FORWARDING) {
                local_status = PW_FORWARDING;
                pw->reason = F_PW_NO_ERR;
        } else {
-               local_status = PW_NOT_FORWARDING;
+               local_status = zpw->status;
                pw->reason = F_PW_LOCAL_NOT_FWD;
        }
 
@@ -571,10 +572,11 @@ l2vpn_pw_ctl(pid_t pid)
                            sizeof(pwctl.ifname));
                        pwctl.pwid = pw->pwid;
                        pwctl.lsr_id = pw->lsr_id;
+                       pwctl.status = PW_NOT_FORWARDING;
                        if (pw->enabled &&
                            pw->local_status == PW_FORWARDING &&
                            pw->remote_status == PW_FORWARDING)
-                               pwctl.status = 1;
+                               pwctl.status = PW_FORWARDING;
 
                        lde_imsg_compose_ldpe(IMSG_CTL_SHOW_L2VPN_PW, 0,
                            pid, &pwctl, sizeof(pwctl));