mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-12 07:26:08 +00:00
[ospfd] Apply some simplifications to ospf_nsm, from Andrew's suggestions
2006-07-04 Paul Jakma <paul.jakma@sun.com> * ospf_nsm.c: (general) Various small cleanups from Andrew's review of last set of patches. (nsm_timer_set) Loading, Full and default can share same code too. (nsm_should_adj) Can just be one big OR. (nsm_twoway_received) Collapse into return statement.
This commit is contained in:
parent
5db95bc2dd
commit
f7a76abf30
@ -1,3 +1,12 @@
|
||||
2006-07-04 Paul Jakma <paul.jakma@sun.com>
|
||||
|
||||
* ospf_nsm.c: (general) Various small cleanups from Andrew's
|
||||
review of last set of patches.
|
||||
(nsm_timer_set) Loading, Full and default can share
|
||||
same code too.
|
||||
(nsm_should_adj) Can just be one big OR.
|
||||
(nsm_twoway_received) Collapse into return statement.
|
||||
|
||||
2006-07-02 Paul Jakma <paul.jakma@sun.com>
|
||||
|
||||
* ospf_nsm.c: (nsm_should_adj) New function, just consolidate the
|
||||
|
@ -125,11 +125,7 @@ nsm_timer_set (struct ospf_neighbor *nbr)
|
||||
OSPF_NSM_TIMER_OFF (nbr->t_db_desc);
|
||||
break;
|
||||
case NSM_Loading:
|
||||
OSPF_NSM_TIMER_OFF (nbr->t_db_desc);
|
||||
break;
|
||||
case NSM_Full:
|
||||
OSPF_NSM_TIMER_OFF (nbr->t_db_desc);
|
||||
break;
|
||||
default:
|
||||
OSPF_NSM_TIMER_OFF (nbr->t_db_desc);
|
||||
break;
|
||||
@ -142,23 +138,17 @@ nsm_timer_set (struct ospf_neighbor *nbr)
|
||||
static int
|
||||
nsm_should_adj (struct ospf_neighbor *nbr)
|
||||
{
|
||||
struct ospf_interface *oi;
|
||||
struct ospf_interface *oi = nbr->oi;
|
||||
|
||||
oi = nbr->oi;
|
||||
|
||||
/* These network types must always form adjacencies. */
|
||||
/* These network types must always form adjacencies. */
|
||||
if (oi->type == OSPF_IFTYPE_POINTOPOINT
|
||||
|| oi->type == OSPF_IFTYPE_POINTOMULTIPOINT
|
||||
|| oi->type == OSPF_IFTYPE_VIRTUALLINK)
|
||||
return 1;
|
||||
|
||||
/* Router itself is the DRouter or the BDRouter. */
|
||||
if (IPV4_ADDR_SAME (&oi->address->u.prefix4, &DR (oi))
|
||||
|| IPV4_ADDR_SAME (&oi->address->u.prefix4, &BDR (oi)))
|
||||
return 1;
|
||||
|
||||
/* Neighboring Router is the DRouter or the BDRouter. */
|
||||
if (IPV4_ADDR_SAME (&nbr->address.u.prefix4, &DR (oi))
|
||||
|| oi->type == OSPF_IFTYPE_VIRTUALLINK
|
||||
/* Router itself is the DRouter or the BDRouter. */
|
||||
|| IPV4_ADDR_SAME (&oi->address->u.prefix4, &DR (oi))
|
||||
|| IPV4_ADDR_SAME (&oi->address->u.prefix4, &BDR (oi))
|
||||
/* Neighboring Router is the DRouter or the BDRouter. */
|
||||
|| IPV4_ADDR_SAME (&nbr->address.u.prefix4, &DR (oi))
|
||||
|| IPV4_ADDR_SAME (&nbr->address.u.prefix4, &BDR (oi)))
|
||||
return 1;
|
||||
|
||||
@ -211,12 +201,7 @@ nsm_start (struct ospf_neighbor *nbr)
|
||||
static int
|
||||
nsm_twoway_received (struct ospf_neighbor *nbr)
|
||||
{
|
||||
int next_state = NSM_TwoWay;
|
||||
|
||||
if (nsm_should_adj (nbr))
|
||||
next_state = NSM_ExStart;
|
||||
|
||||
return next_state;
|
||||
return (nsm_should_adj (nbr) ? NSM_ExStart : NSM_TwoWay);
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user