bgpd: Add new configuration cli for eBGP and iBGP multipath.
There is support to configure this for each (AFI,SAFI), but
currently this configuration is only present for IPv4 unicast:

 maximum-paths [ibgp] <1-255>
 no maximum-paths [ibgp] [<1-255>]

* bgpd/Makefile.am
  * Add bgp_mpath.h and bgp_mpath.c to build
* bgpd/bgp_mpath.h
  * New file for bgp multipath declarations
  * define BGP_DEFAULT_MAXPATHS
* bgpd/bgp_mpath.c
  * bgp_maximum_paths_set(): Configure maximum paths for the given
    afi, safi and bgp instance
  * bgp_maximum_paths_unset(): Return maximum paths configuration to
    the default setting for the given afi, safi and bgp instance
* bgpd/bgp_vty.c
  * Define command strings for above CLI
  * bgp_config_write_maxpaths(): Outputs configuration for the given
    afi, safi and bgp instance
  * Install command elements for IPv4 unicast
* bgpd/bgp_zebra.h
  * bgp_config_write_maxpaths(): External declaration
* bgpd/bgpd.c
  * bgp_create(): Initialize bgp instance to default maximum paths setting
  * bgp_config_write_family(): Output maximum paths configuration
    for the given address family
  * bgp_config_write(): Output maximum paths configuration for
    IPv4 unicast address family
* bgpd/bgpd.h
  * struct bgp: Add storage for maximum paths configuration for
    each afi, safi
bgpd: add bgp_mpath_test.c

* tests/bgp_mpath_test.c
  * New file with test framework for testing BGP multipath
  * Add test for CLI support functions
* tests/Makefile.am
  * Add new testbgpmpath target
bgpd: Adds equal-paths check to path comparison. Paths that are
equal to the best path are accumulated onto an ordered list (mp_list)
if maximum-paths is configured. A future commit will add the
multipath markup to the BGP rib table based on the mp_list. Add
unit test for the added mp_list functions.

Deterministic MED is not supported in this commit, it will be
added later.

* bgpd/bgp_aspath.c
  * Make aspath_cmp() an external symbol so it can be used in
    equivalent paths check
* bgpd/bgp_aspath.h
  * Add extern declaration of aspath_cmp()
* bgpd/bgp_mpath.c
  * bgp_info_nexthop_cmp(): Compares nexthops of two paths
  * bgp_info_mpath_cmp(): Compare function to order multipaths by
    nexthop and then by peer address
  * bgp_mp_list_init(): Initialize a list with the multipath order function
  * bgp_mp_list_clear(): Clear out the mp_list
  * bgp_mp_list_add(): Add a multipath to mp_list
* bgpd/bgp_mpath.h
  * External declarations for above added functions in bgp_mpath.c
* bgpd/bgp_route.c
  * bgp_info_cmp(): Add equivalent paths result (paths_eq). If eBGP
    paths are equal down to IGP metric check, flag as equal if peer AS
    matches. Similarly for iBGP paths but compare full AS_PATH.
  * bgp_best_selection(): If multipath is enabled, accumulate equivalent paths
    in mp_list. Add debug bgp event output to see result (will be filtered
    later to display only when change occurs)
  * bgp_process_rsclient(): Pass multipath config to bgp_best_selection()
  * bgp_process_main(): Pass multipath config to bgp_best_selection()
* tests/bgp_mpath_test.c
  * Add unit test case for bgp_mp_list functions
bgpd: Adds support to mark up the BGP rib table entry with multipath
information based on the multipath list (mp_list) generated during
the best path calculation. Display "multipath" for paths that are
multipath and also on bestpath if the route is multipath. Flag a
best path with the BGP_INFO_MULTIPATH_CHG if the multipath
set has changed since the last update. This can be used to trigger
updates to zebra and peers.

The multipath markup is a lazily allocated bgp_info_mpath structure
that is added to the best path and any multipaths. The mpath structures
are linked together with the best path element at the head and the
other elements ordered by nexthop and then by peer address. This
markup scheme is updated by calling bgp_info_mpath_update() and passing
in a new mp_list the the current multipath set. There are additional
API's for walking the multipath set, querying the count of multipaths,
and for cleaning up the multipath markup information when freeing path
information.

* bgpd/bgp_mpath.c
  * bgp_info_mpath_new(): Allocation of new mpath element
  * bgp_info_mpath_free(): Release memory for mpath element
  * bgp_info_mpath_get(): Access mpath element of path. Allocate memory
    on-demand
  * bgp_info_mpath_enqueue(): Enqueue a path onto the multipath list
  * bgp_info_mpath_dequeue(): Remove a path from the multipath list
  * bgp_info_mpath_first(): Return first path on the multipath list
  * bgp_info_mpath_next(): Return next path on the multipath list
  * bgp_info_mpath_count(): Return the number of paths on the multipath list
  * bgp_info_mpath_count_set(): Set the number of paths on the multipath list
  * bgp_info_mpath_update(): Update multipath markup on bgp route table entry
    and flag any changes. Emit 'debug bgp event' output on any multipath
    change.
* bgpd/bgp_mpath.h
  * struct bgp_info_mpath: Information added to a bgp_info path to record
    multipath information
  * External declarations for new functions in bgp_mpath.c
* bgpd/bgp_route.c
  * bgp_info_free(): Free mpath memory when freeing path information
  * bgp_info_reap(): Dequeue path from multipath queue before deleting it
  * bgp_best_selection(): Calls bgp_info_mpath_update() with latest
    mp_list to mark-up rib table entry
  * bgp_vty_out_detail(): Add display of multipath flag for a path. Also
    display 'multipath' for bestpath if it is a multipath route
* bgpd/bgp_route.h
  * struct bgp_info: Add pointer to bgp_info_mpath information
  * Add flags to mark a path as multipath (BGP_INFO_MULTIPATH) and
    to mark bestpath if multipath information has changed
    (BGP_INFO_MULTIPATH_CHG)
* lib/memtypes.c
  * Add MTYPE_BGP_MPATH_INFO for allocating memory for bgp_info_mpath
* tests/bgp_mpath_test.c
  * Add test case for bgp_info_mpath_update() and supporting functions
bgpd: Modify the BGP to zebra route announcement to support multipath
routes. Use a growable buffer (bgp_nexthop_buf) to collect nexthops
that are included in the announcement. Use the BGP_INFO_MULTIPATH_CHG
flag to trigger zebra announcement so zebra will be updated if the
multipath set changes. Display all multipath nexthops in
'debug bgp zebra' output.

* bgpd/bgp_main.c
  * bgp_exit(): Free bgp_nexthop_buf when exiting
* bgpd/bgp_route.c
  * bgp_process_rsclient(): Clear BGP_INFO_MULTIPATH_CHG after processing
  * bgp_process_main(): Check BGP_INFO_MULTIPATH_CHG to trigger zebra
    announcement and clear aftr processing
* bgpd/bgp_zebra.c
  * bgp_nexthop_buf: Growable buffer used to collect nexthops for zebra
    announcement
  * bgp_zebra_announce(): Grow bgp_nexthop_buf if needed. Include
    multipath count in zebra announcement and add all nexthops to
    bgp_nexthop_buf. Pass bgp_nexthop_buf data to zebra announcement.
    Added nexthops to debug output.
  * bgp_zebra_init(): Initialize bgp_nexthop_buf at startup
* bgpd/bgp_zebra.h
  * BGP_NEXTHOP_BUF_SIZE: Default initial bgp_nexthop_buf size has room
    for 8 nexthops
bgpd: For deterministic MED build a multipath set for each peer AS as the
first stage of the best path calculation. The second stage then
selects a winner from each peer AS's best path. In the second stage we
clear multipath set of the non-selected best paths via
bgp_mp_dmed_deselect(). Since the multipath set is already marked up
for the winning path, we don't call bgp_info_mpath_update() after the
second stage calculation.

* bgpd/bgp_mpath.c
  * bgp_mp_dmed_deselect(): New function to cleanup the multipath
    markup if a DMED selected path loses in stage 2 of the best path
    calculation
* bgpd/bgp_mpath.h
  * Add external declaration of bgp_mp_dmed_deselect()
* bgpd/bgp_route.c
  * bgp_best_selection(): If multipath is enabled, build up the mp_list
    for the current peer AS, and do the RIB markup the best path from
    that AS. In the second stage, clear the RIB markup for the DMED
    selected path if it is not selected as best. Only call
    bgp_info_mpath_update() in the second stage when not doing
    deterministic MED.
bgpd: When advertising a multipath route, the attribute set to be
advertised is based on the bestpath attribute set, but the
following attributes are aggregated from the attribute sets
of the multipath constituents:
- AS_PATH
- ORIGIN
- COMMUNITIES
- EXTENDED COMMUNITIES

In addition the route is advertised with the NEXT_HOP set
to the router's interface IP address, instead of the NEXT_HOP
of the best path. This is to ensure that traffic will go to this
router so it can be fanned out via the multipath route.

* bgpd/ecommunity.c
  * ecommunity_uniq_sort(): Make this function externally accessible
* bgpd/ecommunity.h
  * Add external declaration for ecommunity_uniq_sort()
* bgpd/bgp_mpath.c
  * bgp_info_nexthop_cmp(): Replace calls to bgp_attr_extra_get()
    to avoid unwanted memory allocation
  * bgp_info_mpath_free(): Free aggregate attribute for multipath
  * bgp_info_mpath_attr(): Lookup aggregate attribute of a multipath route
  * bgp_info_mpath_attr_set(): Set aggregate attribute of a multipath route
  * bgp_info_mpath_aggregate_update(): Update the aggregate attribute
    of a multipath route
* bgpd/bgp_mpath.h
  * bgp_info_mpath: Add pointer to hold aggregate attribute of a multipath
  * Add external declarations for new functions
* bgpd/bgp_route.c
  * bgp_announce_check(): Use aggregate attribute when announcing multipath
    route
  * bgp_announce_check_rsclient(): Use aggregate attribute when announcing
    multipath route
  * bgp_best_selection(): After updating multipath set, update the
    multipath aggregate attribute
bgpd: Fix a crash caused by mistakenly dequeueing the bestpath on the
multipath list. This causes the multipath list to get truncated
but the multipath count still reflects what it was before truncation.
When we install the route to zebra we fail to fill the nexthop
array with the number of nexthop pointers indicated by the
multipath count and this leads to a NULL pointer crash in
stream_put_in_addr().

Changes:

* bgpd/bgp_mpath.c
  * bgp_info_mpath_update(): If new_mpath is the bestpath we should
    just move to the next mp_list node. Move dequeue of new_mpath and
    the code that updates next_mpath to inside the check that
    new_mpath is not the bestpath.
bgpd: We try to skip out of updating the multipath aggregate if there are no
changes in the multipath set or attributes, but failed to check for
just a bestpath change. The result is there is no attribute on the new
bestpath and we hit the assert. Added the bestpath check and
rearranged the code to only check attributes when there is no bestpath
or multipath change, so we only scan the for attribute changes when
necessary.

* bgpd/bgp_mpath.c
  * bgp_info_mpath_aggregate_update(): Added check for bestpath
    change before skipping the aggregate generation. Skip the attribute
    check if either the multipath set or bestpath has changed.
HACKING.tex: Change to a LaTeX version of HACKING

* configure.ac: Check for latexmk and pdflatex
* Makefile.am: Add a conditional target to build HACKING.pdf, as a convenience
* HACKING.tex: A slightly more structured HACKING, is readable on its own.
* HACKING: removed
doc: Fix an apparently no longer legal @itemize @asis

* basic.texi: @asis isn't legal with @itemize apparently, should be @w
  according to docs, but @w{} seems to be needed. Fixes doc build error.
ospfd: use LOOKUP() for ospf_packet_type_str

* ospf_packet.h: add proper str/max extern declarations
* ospf_packet.c
  * ospf_packet_type_str: rewrite in "struct message", add max value
  * ospf_packet_add(): use LOOKUP()
  * ospf_write(): ditto
  * ospf_hello(): ditto
  * ospf_read(): ditto
* ospf_dump.h: the declaration does not belong here
* ospf_dump.c
  * ospf_header_dump(): use LOOKUP()
  * show_debugging_ospf(): ditto
ospfd: fix ospf_packet_add_top() to use LOOKUP()
ospfd: introduce ospf_packet_minlen[] (BZ#705)

This commit ports some of the OSPFv3 packet reception checks
to OSPFv2.

* ospf_packet.c
  * ospf_packet_minlen[]: a direct equivalent of ospf6_packet_minlen[]
  * ospf_packet_examin(): new function designed after the first part
    of ospf6_packet_examin()
  * ospf_read(): verify received packet with ospf_packet_examin()
* ospf_packet.h: add convenience macros
ospfd: review ospf_check_auth()

1. The only purpose of "ibuf" argument was to get stream size, which
was always equal to OSPF_MAX_PACKET_SIZE + 1, exactly as initialized
in ospf_new().

2. Fix the packet size check condition, which was incorrect for very
large packets, at least in theory.
ospfd: review ospf_check_md5_digest()

Rewrite some pointer arithmetics without the additional variables and
move byte order conversion inside the function.
ospfd: introduce ospf_lsa_minlen[] (BZ#705)

This commit ports more packet checks to OSPFv2, in particular, LSA size
verification and Router-LSA link blocks verification.

* ospf_lsa.h: add LSA size macros
* ospf_packet.h: add struct ospf_ls_update
* ospf_packet.c
  * ospf_lsa_minlen[]: a direct equivalent of ospf6_lsa_minlen[]
  * ospf_router_lsa_links_examin(): new function, verifies trailing
    part of a Router-LSA
  * ospf_lsa_examin(): new function like ospf6_lsa_examin()
  * ospf_lsaseq_examin(): new function like ospf6_lsaseq_examin()
  * ospf_packet_examin(): add type-specific deeper level checks
ospfd: fix packet length check for auth/LLS cases

An OSPFv2 packet with trailing data blocks (authentication and/or
link-local signaling) failed the recently implemented packet length
check, because trailing data length isn't counted in the packet header
"length" field. This commit fixes respective check conditions.

* ospf_packet.c
  * ospf_packet_examin(): use "bytesdeclared" instead of "bytesonwire"
ospfd: introduce ospf_auth_type_str[]
ospfd: bring ospf_check_auth() into focus

The old ospf_check_auth() function did two different jobs depending on
AuType. For Null and Simple cases it actually authenticated the packet,
but for Cryptographic case it only checked declared packet size (not
taking the actual number of bytes on wire into account). The calling
function, ospf_verify_header(), had its own set of MD5/checksum checks
dispatched depending on AuType.

This commit makes the packet size check work against the real number of
bytes and moves it to ospf_packet_examine(). All MD5/checksum
verification is now performed in ospf_check_auth() function.

* ospf_packet.c
  * ospf_packet_examin(): check length with MD5 bytes in mind
  * ospf_verify_header(): remove all AuType-specific code
  * ospf_check_auth(): completely rewrite