zebra: use prefix_ipv4 in IPv4-only functions

There is no gain in zebra_static_ipv4(), a pure IPv4 function, using
protocol-agnostic "struct prefix", str2prefix() and apply_mask(). This
commit makes it work with "struct prefix_ipv4", str2prefix_ipv4() and
apply_mask_ipv4() respectively. The change enables helper functions
static_add_ipv4(), static_delete_ipv4(), static_install_ipv4() and
static_uninstall_ipv4() also switch to "struct prefix_ipv4" and cast to
"struct prefix" only where it is actually needed.
zebra: use prefix_ipv6 in IPv6-only functions

This change is very much like commit fdc3eaa, but built around
static_ipv6_func() and its helper functions.
use PRIx64 to print 64-bit interface flags
ripngd: ignore setsockopt_ipv6_tclass() failure
ospfd: refine Router-LSA "# TOS" length check

ospf_router_lsa_links_examin() was checking structural integrity of a
Router-LSA link descriptors list without checking, that "# TOS" field of
the current descriptor actually belongs to the space of the received
packet. Although, considering buffer size, this could not cause any
issues, this commit makes the check consistent in this regard.
ospfd: use router_lsa_link in router_lsa

struct router_lsa used to have an anonymous equivalent of Router-LSA
link descriptor structure despite existing router_lsa_link structure.
This commit makes use of struct router_lsa_link and updates assorted
functions, which use struct router_lsa:

* ospf_lsa.h (struct router_lsa)
* ospf_dump.c (ospf_router_lsa_dump)
* ospf_interface.c (ospf_vl_set_params)
* ospf_packet.c (ospf_lsa_netmasks_examin, ospf_lsa_examin)
* ospf_spf.c (ospf_lsa_has_link)
* ospf_vty.c (show_ip_ospf_database_router_links)
ospfd: use LOOKUP for Router-LSA link decoding
bgpd: add "show ipv6 bgp neighbors" ALIASes
zebra: feed MRIB with connected routes

Connected routes should be installed in the MRIB so that the nexthop
lookup does not fail.

Currently all connected routes are looked up in the Unicast RIB but for
MBGP the MRIB should be looked up and without applying this patch the
MRIB will not contain these routes and hence the lookup would fail so to
avoid this, we basically add the connected routes too in the MRIB.
zebra: simplify rtadv_make_socket()
zebra: fix rtadv_setsockopt()
Fix format for some metric outputs
bgpd: Fix crash when disabling dampening (BZ#687)

    Vladimir Podobaev reported that the following commands crashed the
daemon.

router bgp 123
 bgp dampening
 no bgp dampening 1 2 3 4
 no bgp dampening

    The problem was that bgp_damp_info_clean() tried to dereference the
already freed reuse_list array in the second call to "no bgp dampening".

    Fixed by checking in bgp_damp_disable() that the dampening it's
enabled before doing the cleanup.
ospfd: make sndbuflen unsigned, resolve warning
lib: fix endianness bug in prefix.c

Use preprocessor macros to avoid the somewhat expensive
htonl/ntohl macros.
lib: fix map64kto17 for big-endian case

This commit is based on the patch by Renato Westphal. The change in
64K/17 mapping array makes it work correctly for a big-endian
architecture as well.
tests: Extend aspath_test.c with cases for invalid segments & attributes

* aspath_test.c: Add more test cases. In particular ones to cover the
  last invalid-segment problem. Also add ability to specify aspath attribute
  headers and test them somewhat.

  NB: It's obvious this test has not been run for a year by anyone, despite
  2 non-trivial commits to bgpd aspath code.
bgpd: New show commands for improved view and address family support

Many show commands do not have support for multiple views and do not
treat different address families uniformly.  The following changes add
a number of commands with support for views and rationalized treatment
of IPv4 v IPv6 and unicast v multicast (such as in JUNOS, IOS XR and
more recent versions of IOS).

* bgp_route.c: (bgp_show_community) Inserted a new second argument (the
  name of the view) and the code to look up that name in the BGP structure.
  The NULL argument in the call to bgp_show (indicating the default view)
  was replaced by the specified view.  The existing calls to
  bgp_show_community had a NULL second argument inserted to make clear
  that they refer to the default view.

  (top level) Added new functions via the DEFUN and/or ALIAS macros (and
  the associated command table entries) to add the commands

    show bgp ipv4 (unicast|multicast)
    show bgp ipv4 (unicast|multicast) A.B.C.D
    show bgp ipv4 (unicast|multicast) A.B.C.D/M
    show bgp ipv6 (unicast|multicast)
    show bgp ipv6 (unicast|multicast) X:X::X:X
    show bgp ipv6 (unicast|multicast) X:X::X:X/M

      These show either the full BGP table or the specified route or
      prefix for the given address family.

    show bgp view WORD (ipv4|ipv6) (unicast|multicast) community
    show bgp view WORD (ipv4|ipv6) (unicast|multicast) community \
            (AA:NN|local-AS|no-advertise|no-export){1,4}

      For the specified view and address family, these show entries
      matching any community or the specified communit(y)(ies).

    show bgp view WORD (ipv4|ipv6) (unicast|multicast) neighbors \
            (A.B.C.D|X:X::X:X) (advertised-routes|received-routes)

      For the specified view and address family, show the routes
      advertised to or received from the given BGP neighbor.

    show bgp [view WORD] ipv4 (unicast|multicast) \
            rsclient (A.B.C.D|X:X::X:X)
    show bgp [view WORD] ipv4 (unicast|multicast) \
            rsclient (A.B.C.D|X:X::X:X) A.B.C.D
    show bgp [view WORD] ipv4 (unicast|multicast) \
            rsclient (A.B.C.D|X:X::X:X) A.B.C.D/M
    show bgp [view WORD] ipv6 (unicast|multicast) \
            rsclient (A.B.C.D|X:X::X:X)
    show bgp [view WORD] ipv6 (unicast|multicast) \
            rsclient (A.B.C.D|X:X::X:X) X:X::X:X
    show bgp [view WORD] ipv6 (unicast|multicast) \
            rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M

      For the specifed (optional) view and address family, show either
      the full BGP table or the specified route or prefix for the given
      route server client peer.

* bgp_vty.c: (top level) Added new functions via the DEFUN and/or ALIAS
  macros (and the associated command table entries) to add the commands

    show bgp [view WORD] (ipv4|ipv6) (unicast|multicast) summary
    show bgp [view WORD] (ipv4|ipv6) (unicast|multicast) rsclient summary

      For the specified (optional) view and address family, display
      either the normal summary table for BGP peers, or the route server
      client table showing the import and export policies.
bgpd: leave peer socket in non-blocking mode (mostly)

* bgpd: Rather than toggling socket in/out of non-block mode, just leave it
  in nonblocking mode.

  One exception is in bgp_notify which only happens just before close.
lib: add TCP_CORK wrapper

* sockunion.{c,h}: (sockopt_cork) wrapper for TCP_CORK socket option for
  those platforms that provide it.  For other platforms, it is just a nop.

Conflicts:

	lib/sockunion.c