summaryrefslogtreecommitdiff
path: root/bgpd/bgpd.c
diff options
context:
space:
mode:
authorPaul Jakma <paul@quagga.net>2009-08-05 16:25:16 +0100
committerPaul Jakma <paul@quagga.net>2009-08-05 16:25:16 +0100
commit9d878775ff5c05afea522b60f014b88822d19e1b (patch)
treef1c7c45de602e2ac7ccd2c3c309e6568beff3af7 /bgpd/bgpd.c
parent5372510d109d87b94d6094d095dd4e0e02eaf32a (diff)
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..
Diffstat (limited to 'bgpd/bgpd.c')
-rw-r--r--bgpd/bgpd.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 274180b9..b34f996b 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -2169,38 +2169,40 @@ peer_lookup_with_open (union sockunion *su, as_t remote_as,
struct in_addr *remote_id, int *as)
{
struct peer *peer;
- struct listnode *node, *nnode;
- struct listnode *bgpnode, *nbgpnode;
+ struct listnode *node;
+ struct listnode *bgpnode;
struct bgp *bgp;
if (! bm->bgp)
return NULL;
- for (ALL_LIST_ELEMENTS (bm->bgp, bgpnode, nbgpnode, bgp))
- for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
- {
- if (sockunion_same (&peer->su, su)
- && ! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
- {
- if (peer->as == remote_as
- && peer->remote_id.s_addr == remote_id->s_addr)
- return peer;
- if (peer->as == remote_as)
- *as = 1;
- }
- }
-
- for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
+ for (ALL_LIST_ELEMENTS_RO (bm->bgp, bgpnode, bgp))
{
- if (sockunion_same (&peer->su, su)
- && ! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
- {
- if (peer->as == remote_as
- && peer->remote_id.s_addr == 0)
- return peer;
- if (peer->as == remote_as)
- *as = 1;
- }
+ for (ALL_LIST_ELEMENTS_RO (bgp->peer, node, peer))
+ {
+ if (sockunion_same (&peer->su, su)
+ && ! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
+ {
+ if (peer->as == remote_as
+ && peer->remote_id.s_addr == remote_id->s_addr)
+ return peer;
+ if (peer->as == remote_as)
+ *as = 1;
+ }
+ }
+
+ for (ALL_LIST_ELEMENTS_RO (bgp->peer, node, peer))
+ {
+ if (sockunion_same (&peer->su, su)
+ && ! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
+ {
+ if (peer->as == remote_as
+ && peer->remote_id.s_addr == 0)
+ return peer;
+ if (peer->as == remote_as)
+ *as = 1;
+ }
+ }
}
return NULL;
}