diff options
author | rgirada <rgirada@vmware.com> | 2021-10-08 09:15:48 +0200 |
---|---|---|
committer | rgirada <rgirada@vmware.com> | 2021-10-26 14:36:20 +0200 |
commit | 059fd3a48a8fca175125c4e1467c4471873b6659 (patch) | |
tree | 391993c50668d170b73578b394d766622e0b4dd3 /ospfd/ospf_dump.c | |
parent | ospfd: Few modifications in "show ip ospf neighbor" o/p. (diff) | |
download | frr-059fd3a48a8fca175125c4e1467c4471873b6659.tar.xz frr-059fd3a48a8fca175125c4e1467c4471873b6659.zip |
ospfd: Adding apropriate ism state in ptop neighbors.
Description:
In PointToPoint networks, There wont be DR and BDR.
But by default, All neighbours ism state is shown as
DR_OTHER.
Changed the nbr state format to <nbrsate>/- (ex : FULL/-)
to P2pnetworks.
Signed-off-by: Rajesh Girada <rgirada@vmware.com>
Diffstat (limited to 'ospfd/ospf_dump.c')
-rw-r--r-- | ospfd/ospf_dump.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index b1aeefcd4..fab5b7d3c 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -127,7 +127,9 @@ const char *ospf_area_desc_string(struct ospf_area *area) return buf; } -#define OSPF_IF_STRING_MAXLEN 40 +#define OSPF_IF_STRING_MAXLEN 40 + +/* Display both nbr and ism state of the ospf neighbor.*/ const char *ospf_if_name_string(struct ospf_interface *oi) { static char buf[OSPF_IF_STRING_MAXLEN] = ""; @@ -146,6 +148,13 @@ const char *ospf_if_name_string(struct ospf_interface *oi) return buf; } +/* Display only the nbr state.*/ +void ospf_nbr_state_message(struct ospf_neighbor *nbr, char *buf, size_t size) +{ + snprintf(buf, size, "%s", + lookup_msg(ospf_nsm_state_msg, nbr->state, NULL)); +} + int ospf_nbr_ism_state(struct ospf_neighbor *nbr) { int state; @@ -161,9 +170,23 @@ int ospf_nbr_ism_state(struct ospf_neighbor *nbr) return state; } -void ospf_nbr_state_message(struct ospf_neighbor *nbr, char *buf, size_t size) +void ospf_nbr_ism_state_message(struct ospf_neighbor *nbr, char *buf, + size_t size) { - int state = ospf_nbr_ism_state(nbr); + int state; + struct ospf_interface *oi = nbr->oi; + + if (!oi) + return; + + /* network type is point-to-point */ + if (oi->type == OSPF_IFTYPE_POINTOPOINT) { + snprintf(buf, size, "%s/-", + lookup_msg(ospf_nsm_state_msg, nbr->state, NULL)); + return; + } + + state = ospf_nbr_ism_state(nbr); snprintf(buf, size, "%s/%s", lookup_msg(ospf_nsm_state_msg, nbr->state, NULL), |