Commit Graph

57 Commits

Author SHA1 Message Date
Paul Jakma
6d58272b4c [bgpd] cleanup, compact and consolidate capability parsing code
2007-07-26 Paul Jakma <paul.jakma@sun.com>

	* (general) Clean up and compact capability parsing slightly.
	  Consolidate validation of length and logging of generic TLV, and
	  memcpy of capability data, thus removing such from cap specifc
	  code (not always present or correct).
	* bgp_open.h: Add structures for the generic capability TLV header
	  and for the data formats of the various specific capabilities we
	  support.  Hence remove the badly named, or else misdefined, struct
	  capability.
	* bgp_open.c: (bgp_capability_vty_out) Use struct capability_mp_data.
	  Do the length checks *before* memcpy()'ing based on that length
	  (stored capability - should have been validated anyway on input,
	  but..).
	  (bgp_afi_safi_valid_indices) new function to validate (afi,safi)
	  which is about to be used as index into arrays, consolidates
	  several instances of same, at least one of which appeared to be
	  incomplete..
	  (bgp_capability_mp) Much condensed.
	  (bgp_capability_orf_entry) New, process one ORF entry
	  (bgp_capability_orf) Condensed. Fixed to process all ORF entries.
	  (bgp_capability_restart) Condensed, and fixed to use a
	  cap-specific type, rather than abusing capability_mp.
	  (struct message capcode_str) added to aid generic logging.
	  (size_t cap_minsizes[]) added to aid generic validation of
	  capability length field.
	  (bgp_capability_parse) Generic logging and validation of TLV
	  consolidated here. Code compacted as much as possible.
	* bgp_packet.c: (bgp_open_receive) Capability parsers now use
	  streams, so no more need here to manually fudge the input stream
	  getp.
	  (bgp_capability_msg_parse) use struct capability_mp_data. Validate
	  lengths /before/ memcpy. Use bgp_afi_safi_valid_indices.
	  (bgp_capability_receive) Exported for use by test harness.
	* bgp_vty.c: (bgp_show_summary) fix conversion warning
	  (bgp_show_peer) ditto
	* bgp_debug.h: Fix storage 'extern' after type 'const'.
        * lib/log.c: (mes_lookup) warning about code not being in
          same-number array slot should be debug, not warning. E.g. BGP
          has several discontigious number spaces, allocating from
          different parts of a space is not uncommon (e.g. IANA
          assigned versus vendor-assigned code points in some number
          space).
2007-08-06 15:21:45 +00:00
Andrew J. Schorr
a39275d76d [bgpd] Implement 'debug bgp zebra' to log all messages to and from zebra.
2006-11-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* bgp_debug.h: Declare new bgp_debug_zebra conf and term flags,
	  and define BGP_DEBUG_ZEBRA.
	* bgp_debug.c: Declare conf_bgp_debug_zebra and term_bgp_debug_zebra.
	  (debug_bgp_zebra, no_debug_bgp_zebra, undebug_bgp_zebra) New
	  functions to enable/disable bgp zebra debugging.
	  (no_debug_bgp_all) Turn off zebra debugging.
	  (show_debugging_bgp) Show whether zebra debugging is on.
	  (bgp_config_write_debug) Add 'debug bgp zebra' if configured.
	  (bgp_debug_init) Add new zebra debugging commands.
	* bgp_zebra.c: (bgp_router_id_update, bgp_interface_add,
	  bgp_interface_delete, bgp_interface_up, bgp_interface_down,
	  bgp_interface_address_add, bgp_interface_address_delete,
	  zebra_read_ipv4, zebra_read_ipv6, bgp_zebra_announce,
	  bgp_zebra_withdraw, bgp_redistribute_set, bgp_redistribute_unset)
	  If zebra debugging is enabled, log an appropriate debug message.
2006-11-30 16:36:57 +00:00
paul
94f2b3923e 2005-06-28 Paul Jakma <paul.jakma@sun.com>
* (global) The great bgpd extern and static'ification.
	* bgp_routemap.c: remove unused ROUTE_MATCH_ASPATH_OLD code
	  (route_set_metric_compile) fix u_int32_t to ULONG_MAX comparison
	  warnings.
	* bgp_route.h: (bgp_process, bgp_withdraw, bgp_update) export these
	  used by various files which had their own private declarations,
	  in the case of mplsvpn - incorrect.
2005-06-28 12:44:16 +00:00
paul
00d252cb5f 2005-05-23 Paul Jakma <paul@dishone.st>
* bgp_fsm.h: Add extern qualifier to exported functions
	* bgp_nexthop.c: add static to nexthop specific globals
	* *.h: Add guard defines
2005-05-23 14:19:54 +00:00
paul
fd79ac918b 2004-10-13 Paul Jakma <paul@dishone.st>
* (global) more const'ification and fixups of types to clean up code.
	* bgp_mplsvpn.{c,h}: (str2tag) fix abuse. Still not perfect,
          should use something like the VTY_GET_INTEGER macro, but without
          the vty_out bits..
        * bgp_routemap.c: (set_aggregator_as) use VTY_GET_INTEGER_RANGE
          (no_set_aggregator_as) ditto.
        * bgpd.c: (peer_uptime) fix unlikely bug, where no buffer is
          returned, add comments about troublesome return value.
2004-10-13 05:06:08 +00:00
paul
e01f9cbb87 2004-07-09 Paul Jakma <paul@dishone.st>
Merge of GNU Zebra cvs2svn changesets r799, r800 and r807.

        * bgp_dump.c: (bgp_dump_attr) cleanup. return status code. check
          attributes present before printing.
        * bgp_dump.c: update bgp_dump_attr prototype.
        * bgp_packet.c: (bgp_update_receive) init attrstr. check status
          of bgp_dump_attr. Log end-of-rib UPDATEs.
2004-07-09 17:48:53 +00:00
paul
718e374419 Initial revision 2002-12-13 20:15:29 +00:00