diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-02-09 16:14:24 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-02-09 16:14:24 +0000 |
commit | adc97eaf1842b0b5c521b062e3030153795a2cce (patch) | |
tree | e41dbd8aed6f4f3b10abb9c833e417acc1462679 | |
parent | bceb1c08c9749985cb5bd283953b4ab5d52d5b21 (diff) |
Print the interface state from the view of the neighbor in ospfctl sh nei.
The idea is to print DR, BDR or DROther dependent on the type of the
neighbor. This is only done for multicast capable networks.
-rw-r--r-- | usr.sbin/ospfd/neighbor.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/usr.sbin/ospfd/neighbor.c b/usr.sbin/ospfd/neighbor.c index aa15490b327..68872cd5142 100644 --- a/usr.sbin/ospfd/neighbor.c +++ b/usr.sbin/ospfd/neighbor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: neighbor.c,v 1.7 2005/02/09 16:08:06 claudio Exp $ */ +/* $OpenBSD: neighbor.c,v 1.8 2005/02/09 16:14:23 claudio Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -654,7 +654,20 @@ nbr_to_ctl(struct nbr *nbr) nctl.ls_retrans_lst_cnt++; nctl.nbr_state = nbr->state; - nctl.iface_state = nbr->iface->state; + + /* + * We need to trick a bit to show the remote iface state. + * The idea is to print DR, BDR or DROther dependent on + * the type of the neighbor. + */ + if (nbr->iface->dr == nbr) + nctl.iface_state = IF_STA_DR; + else if (nbr->iface->bdr == nbr) + nctl.iface_state = IF_STA_BACKUP; + else if (nbr->iface->state & IF_STA_MULTI) + nctl.iface_state = IF_STA_DROTHER; + else + nctl.iface_state = nbr->iface->state; nctl.state_chng_cnt = nbr->stats.sta_chng; |