]> git.puffer.fish Git - mirror/frr.git/commitdiff
bfdd: enumerate all diagnositic codes
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Wed, 29 Aug 2018 20:13:46 +0000 (17:13 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Mon, 3 Sep 2018 13:41:33 +0000 (10:41 -0300)
Enumerate all codes, update the string representation and fix the
misdiagnosed echo failure.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
bfdd/bfd.c
bfdd/bfd.h
bfdd/bfd_packet.c
bfdd/bfdd.c

index 8919eeaa93471d80acc19a82b3823a3cd98a0edf..cf7c027db5d8f8022c1825a5473589cca5dae11a 100644 (file)
@@ -337,7 +337,7 @@ int bfd_recvtimer_cb(struct thread *t)
        switch (bs->ses_state) {
        case PTM_BFD_INIT:
        case PTM_BFD_UP:
-               ptm_bfd_ses_dn(bs, BFD_DIAGDETECTTIME);
+               ptm_bfd_ses_dn(bs, BD_CONTROL_EXPIRED);
                bfd_recvtimer_update(bs);
                break;
 
@@ -360,7 +360,7 @@ int bfd_echo_recvtimer_cb(struct thread *t)
        switch (bs->ses_state) {
        case PTM_BFD_INIT:
        case PTM_BFD_UP:
-               ptm_bfd_ses_dn(bs, BFD_DIAGDETECTTIME);
+               ptm_bfd_ses_dn(bs, BD_ECHO_FAILED);
                break;
        }
 
index ef2b5b21f92be270fe2b6897e3d690b0461f02e0..f567bff745b1b385c7301a10ac44daad38e7c1ea 100644 (file)
@@ -105,9 +105,6 @@ struct bfd_echo_pkt {
 #define BFD_CBIT 0x08
 #define BFD_ABIT 0x04
 #define BFD_DEMANDBIT 0x02
-#define BFD_DIAGNEIGHDOWN 3
-#define BFD_DIAGDETECTTIME 1
-#define BFD_DIAGADMINDOWN 7
 #define BFD_SETDEMANDBIT(flags, val)                                           \
        {                                                                      \
                if ((val))                                                     \
@@ -142,6 +139,27 @@ struct bfd_echo_pkt {
        ((int)(ETH_HDR_LEN + IP_HDR_LEN + UDP_HDR_LEN + BFD_ECHO_PKT_LEN))
 #define BFD_RX_BUF_LEN 160
 
+enum bfd_diagnosticis {
+       BD_OK = 0,
+       /* Control Detection Time Expired. */
+       BD_CONTROL_EXPIRED = 1,
+       /* Echo Function Failed. */
+       BD_ECHO_FAILED = 2,
+       /* Neighbor Signaled Session Down. */
+       BD_NEIGHBOR_DOWN = 3,
+       /* Forwarding Plane Reset. */
+       BD_FORWARDING_RESET = 4,
+       /* Path Down. */
+       BD_PATH_DOWN = 5,
+       /* Concatenated Path Down. */
+       BD_CONCATPATH_DOWN = 6,
+       /* Administratively Down. */
+       BD_ADMIN_DOWN = 7,
+       /* Reverse Concatenated Path Down. */
+       BD_REVCONCATPATH_DOWN = 8,
+       /* 9..31: reserved. */
+};
+
 /* BFD session flags */
 enum bfd_session_flags {
        BFD_SESS_FLAG_NONE = 0,
index 76427c8f54bd599bc9ac44c7c5680ef148db3b53..455ba07e6a16b3886330e04c2d7b131e765957a3 100644 (file)
@@ -886,7 +886,7 @@ int bfd_recv_cb(struct thread *t)
        /* State switch from section 6.8.6 */
        if (BFD_GETSTATE(cp->flags) == PTM_BFD_ADM_DOWN) {
                if (bfd->ses_state != PTM_BFD_DOWN)
-                       ptm_bfd_ses_dn(bfd, BFD_DIAGNEIGHDOWN);
+                       ptm_bfd_ses_dn(bfd, BD_NEIGHBOR_DOWN);
        } else {
                switch (bfd->ses_state) {
                case (PTM_BFD_DOWN):
@@ -902,7 +902,7 @@ int bfd_recv_cb(struct thread *t)
                        break;
                case (PTM_BFD_UP):
                        if (BFD_GETSTATE(cp->flags) == PTM_BFD_DOWN)
-                               ptm_bfd_ses_dn(bfd, BFD_DIAGNEIGHDOWN);
+                               ptm_bfd_ses_dn(bfd, BD_NEIGHBOR_DOWN);
                        break;
                }
        }
index 44a29861b709fd60d3a53ef68a8a7568743b8d2d..9c75e103e77c13a86c61f06a83150c14326f8b78 100644 (file)
@@ -130,17 +130,22 @@ static struct option longopts[] = {
 struct bfd_global bglobal;
 
 struct bfd_diag_str_list diag_list[] = {
-       {.str = "NeighDown", .type = BFD_DIAGNEIGHDOWN},
-       {.str = "DetectTime", .type = BFD_DIAGDETECTTIME},
-       {.str = "AdminDown", .type = BFD_DIAGADMINDOWN},
+       {.str = "control-expired", .type = BD_CONTROL_EXPIRED},
+       {.str = "echo-failed", .type = BD_ECHO_FAILED},
+       {.str = "neighbor-down", .type = BD_NEIGHBOR_DOWN},
+       {.str = "forwarding-reset", .type = BD_FORWARDING_RESET},
+       {.str = "path-down", .type = BD_PATH_DOWN},
+       {.str = "concatenated-path-down", .type = BD_CONCATPATH_DOWN},
+       {.str = "administratively-down", .type = BD_ADMIN_DOWN},
+       {.str = "reverse-concat-path-down", .type = BD_REVCONCATPATH_DOWN},
        {.str = NULL},
 };
 
 struct bfd_state_str_list state_list[] = {
-       {.str = "AdminDown", .type = PTM_BFD_ADM_DOWN},
-       {.str = "Down", .type = PTM_BFD_DOWN},
-       {.str = "Init", .type = PTM_BFD_INIT},
-       {.str = "Up", .type = PTM_BFD_UP},
+       {.str = "admin-down", .type = PTM_BFD_ADM_DOWN},
+       {.str = "down", .type = PTM_BFD_DOWN},
+       {.str = "init", .type = PTM_BFD_INIT},
+       {.str = "up", .type = PTM_BFD_UP},
        {.str = NULL},
 };