bgpd: Fix mistakes in applying 'allow inbound connections to non-default view'

* bgpd.c: (peer_lookup_with_open) Bodged application of previous patch
  meant the second loop around bgp->peer wasn't included in the loop
  around bm->bgp as it was supposed to be. Fix..
This commit is contained in:
Paul Jakma 2009-08-05 16:25:16 +01:00
parent 5372510d10
commit 9d878775ff

View File

@ -2169,15 +2169,16 @@ peer_lookup_with_open (union sockunion *su, as_t remote_as,
struct in_addr *remote_id, int *as) struct in_addr *remote_id, int *as)
{ {
struct peer *peer; struct peer *peer;
struct listnode *node, *nnode; struct listnode *node;
struct listnode *bgpnode, *nbgpnode; struct listnode *bgpnode;
struct bgp *bgp; struct bgp *bgp;
if (! bm->bgp) if (! bm->bgp)
return NULL; return NULL;
for (ALL_LIST_ELEMENTS (bm->bgp, bgpnode, nbgpnode, bgp)) for (ALL_LIST_ELEMENTS_RO (bm->bgp, bgpnode, bgp))
for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) {
for (ALL_LIST_ELEMENTS_RO (bgp->peer, node, peer))
{ {
if (sockunion_same (&peer->su, su) if (sockunion_same (&peer->su, su)
&& ! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER)) && ! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
@ -2190,7 +2191,7 @@ peer_lookup_with_open (union sockunion *su, as_t remote_as,
} }
} }
for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) for (ALL_LIST_ELEMENTS_RO (bgp->peer, node, peer))
{ {
if (sockunion_same (&peer->su, su) if (sockunion_same (&peer->su, su)
&& ! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER)) && ! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
@ -2202,6 +2203,7 @@ peer_lookup_with_open (union sockunion *su, as_t remote_as,
*as = 1; *as = 1;
} }
} }
}
return NULL; return NULL;
} }