summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
authorPaul Jakma <paul.jakma@sun.com>2008-07-22 21:11:48 +0000
committerPaul Jakma <paul.jakma@sun.com>2008-07-22 21:11:48 +0000
commit750e814693050bc97391eec618aad9db798ee5e8 (patch)
tree03d3e27a68b0593002d8f73609235919c030e426 /bgpd
parent851a1a5c146b346d8b8f58fe3924baa5c208f865 (diff)
[bgpd] Fix triggerable crash when compiled with --disable-bgp-announce
2008-07-22 Paul Jakma <paul.jakma@sun.com> * HACKING: Document preference for compiler conditional code, over cpp conditional. * configure.ac: DISABLE_BGP_ANNOUNCE always should be defined. * bgp_{packet,route,advertise}.c: change to compiler testing of DISABLE_BGP_ANNOUNCE, rather than cpp. 2008-07-22 MIYAJIMA Mitsuharu <miyajima.mitsuharu@anchor.jp> * bgp_packet.c: (bgp_update_packet_eor) Fix crash triggerable if a bgpd was compiled with --disable-bgp-announce and if GR is advertised by peer.
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/ChangeLog11
-rw-r--r--bgpd/bgp_advertise.c10
-rw-r--r--bgpd/bgp_packet.c20
-rw-r--r--bgpd/bgp_route.c10
4 files changed, 27 insertions, 24 deletions
diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog
index 24244947..6fe2b0f5 100644
--- a/bgpd/ChangeLog
+++ b/bgpd/ChangeLog
@@ -1,5 +1,16 @@
2008-07-22 Paul Jakma <paul.jakma@sun.com>
+ * bgp_{packet,route,advertise}.c: change to compiler testing of
+ DISABLE_BGP_ANNOUNCE, rather than cpp.
+
+2008-07-22 MIYAJIMA Mitsuharu <miyajima.mitsuharu@anchor.jp>
+
+ * bgp_packet.c: (bgp_update_packet_eor) Fix crash triggerable
+ if a bgpd was compiled with --disable-bgp-announce and if GR is
+ advertised by peer.
+
+2008-07-22 Paul Jakma <paul.jakma@sun.com>
+
* bgp_community.c: (community_str2com) assigns defaults to local
vars
* bgp_attr.c: (bgp_attr_parse) match format specifier to arg
diff --git a/bgpd/bgp_advertise.c b/bgpd/bgp_advertise.c
index 73b868a8..870aab13 100644
--- a/bgpd/bgp_advertise.c
+++ b/bgpd/bgp_advertise.c
@@ -220,9 +220,8 @@ bgp_adj_out_set (struct bgp_node *rn, struct peer *peer, struct prefix *p,
struct bgp_adj_out *adj = NULL;
struct bgp_advertise *adv;
-#ifdef DISABLE_BGP_ANNOUNCE
- return;
-#endif /* DISABLE_BGP_ANNOUNCE */
+ if (DISABLE_BGP_ANNOUNCE)
+ return;
/* Look for adjacency information. */
if (rn)
@@ -274,9 +273,8 @@ bgp_adj_out_unset (struct bgp_node *rn, struct peer *peer, struct prefix *p,
struct bgp_adj_out *adj;
struct bgp_advertise *adv;
-#ifdef DISABLE_BGP_ANNOUNCE
- return;
-#endif /* DISABLE_BGP_ANNOUNCE */
+ if (DISABLE_BGP_ANNOUNCE)
+ return;
/* Lookup existing adjacency, if it is not there return immediately. */
for (adj = rn->adj_out; adj; adj = adj->next)
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 623fd9ec..4d7f32de 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -235,9 +235,8 @@ bgp_update_packet_eor (struct peer *peer, afi_t afi, safi_t safi)
struct stream *s;
struct stream *packet;
-#ifdef DISABLE_BGP_ANNOUNCE
- return;
-#endif /* DISABLE_BGP_ANNOUNCE */
+ if (DISABLE_BGP_ANNOUNCE)
+ return NULL;
if (BGP_DEBUG (normal, NORMAL))
zlog_debug ("send End-of-RIB for %s to %s", afi_safi_print (afi, safi), peer->host);
@@ -369,9 +368,8 @@ bgp_default_update_send (struct peer *peer, struct attr *attr,
char attrstr[BUFSIZ];
char buf[BUFSIZ];
-#ifdef DISABLE_BGP_ANNOUNCE
- return;
-#endif /* DISABLE_BGP_ANNOUNCE */
+ if (DISABLE_BGP_ANNOUNCE)
+ return;
if (afi == AFI_IP)
str2prefix ("0.0.0.0/0", &p);
@@ -438,9 +436,8 @@ bgp_default_withdraw_send (struct peer *peer, afi_t afi, safi_t safi)
bgp_size_t total_attr_len;
char buf[BUFSIZ];
-#ifdef DISABLE_BGP_ANNOUNCE
- return;
-#endif /* DISABLE_BGP_ANNOUNCE */
+ if (DISABLE_BGP_ANNOUNCE)
+ return;
if (afi == AFI_IP)
str2prefix ("0.0.0.0/0", &p);
@@ -958,9 +955,8 @@ bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi,
struct bgp_filter *filter;
int orf_refresh = 0;
-#ifdef DISABLE_BGP_ANNOUNCE
- return;
-#endif /* DISABLE_BGP_ANNOUNCE */
+ if (DISABLE_BGP_ANNOUNCE)
+ return;
filter = &peer->filter[afi][safi];
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 4fbc4bab..b639db05 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -742,9 +742,8 @@ bgp_announce_check (struct bgp_info *ri, struct peer *peer, struct prefix *p,
filter = &peer->filter[afi][safi];
bgp = peer->bgp;
-#ifdef DISABLE_BGP_ANNOUNCE
- return 0;
-#endif
+ if (DISABLE_BGP_ANNOUNCE)
+ return 0;
/* Do not send announces to RS-clients from the 'normal' bgp_table. */
if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
@@ -1095,9 +1094,8 @@ bgp_announce_check_rsclient (struct bgp_info *ri, struct peer *rsclient,
filter = &rsclient->filter[afi][safi];
bgp = rsclient->bgp;
-#ifdef DISABLE_BGP_ANNOUNCE
- return 0;
-#endif
+ if (DISABLE_BGP_ANNOUNCE)
+ return 0;
/* Do not send back route to sender. */
if (from == rsclient)