summaryrefslogtreecommitdiffstats
path: root/bfdd
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2018-08-29 22:13:46 +0200
committerRafael Zalamena <rzalamena@opensourcerouting.org>2018-09-03 15:41:33 +0200
commit40675ea908eec9f3735219a44617371519f41d67 (patch)
tree5c22c59ee152e16f44572268469bad125ac771fb /bfdd
parentbfdd: make bfd_recv_* more generic (diff)
downloadfrr-40675ea908eec9f3735219a44617371519f41d67.tar.xz
frr-40675ea908eec9f3735219a44617371519f41d67.zip
bfdd: enumerate all diagnositic codes
Enumerate all codes, update the string representation and fix the misdiagnosed echo failure. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'bfdd')
-rw-r--r--bfdd/bfd.c4
-rw-r--r--bfdd/bfd.h24
-rw-r--r--bfdd/bfd_packet.c4
-rw-r--r--bfdd/bfdd.c19
4 files changed, 37 insertions, 14 deletions
diff --git a/bfdd/bfd.c b/bfdd/bfd.c
index 8919eeaa9..cf7c027db 100644
--- a/bfdd/bfd.c
+++ b/bfdd/bfd.c
@@ -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;
}
diff --git a/bfdd/bfd.h b/bfdd/bfd.h
index ef2b5b21f..f567bff74 100644
--- a/bfdd/bfd.h
+++ b/bfdd/bfd.h
@@ -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,
diff --git a/bfdd/bfd_packet.c b/bfdd/bfd_packet.c
index 76427c8f5..455ba07e6 100644
--- a/bfdd/bfd_packet.c
+++ b/bfdd/bfd_packet.c
@@ -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;
}
}
diff --git a/bfdd/bfdd.c b/bfdd/bfdd.c
index 44a29861b..9c75e103e 100644
--- a/bfdd/bfdd.c
+++ b/bfdd/bfdd.c
@@ -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},
};