+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.
+
2008-06-10 Paul Jakma <paul@jakma.org>
* configure.ac: Bump version to 0.99.10
-*- mode: text; -*-
-$Id: HACKING,v 1.21 2005/11/10 10:21:19 paul Exp $
+$Id$
GUIDELINES FOR HACKING ON QUAGGA
See also below regarding SHARED LIBRARY VERSIONING.
+COMPILE-TIME CONDITIONAL CODE
+
+Please think very carefully before making code conditional at compile time,
+as it increases maintenance burdens and user confusion. In particular,
+please avoid gratuitious --enable-.... switches to the configure script -
+typically code should be good enough to be in Quagga, or it shouldn't be
+there at all.
+
+When code must be compile-time conditional, try have the compiler make it
+conditional rather than the C pre-processor. I.e. this:
+
+ if (SOME_SYMBOL)
+ frobnicate();
+
+rather than:
+
+ #ifdef SOME_SYMBOL
+ frobnicate ();
+ #endif /* SOME_SYMBOL */
+
+Note that the former approach requires ensuring that SOME_SYMBOL will be
+defined (watch your AC_DEFINEs).
CHANGELOG
+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
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)
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)
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);
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);
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);
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];
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))
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)
esac
if test "${enable_bgp_announce}" = "no";then
- AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
+ AC_DEFINE(DISABLE_BGP_ANNOUNCE,1,Disable BGP installation to zebra)
+else
+ AC_DEFINE(DISABLE_BGP_ANNOUNCE,0,Disable BGP installation to zebra)
fi
AC_SUBST(ZEBRA)