HACKING: remove an unneeded escape
lib: Improve error reporting from broken config files

* command.h: (config_from_file) Add variable to interface for line
      number reporting.
    * command.c: (config_from_file) Set & increment 'line_num' while parsing.
    * vty.c: (vty_read_file) Report parse errors in the correct order to
      stderr, with added line numbers.
Add missing GPL headers, and copyright claims that certainly apply.

* Fix (a subset of)? files with non-trivial code that are missing GPL headers.

* A few copyright claims added which I am certain apply, but which I had
  missed out on the original commits.

NB: Copyright claims are not exclusive and the addition of any copyright
claim should not be read as implying a lack of any further claims, or
denying the validity of any other claims.  All those with claims of
copyright over any portion of Quagga are welcome to submit them, ideally as
patches to update copyright strings in files.
Fix most compiler warnings in default GCC build.

Fix lots of warnings. Some const and type-pun breaks strict-aliasing
warnings left but much reduced.

* bgp_advertise.h: (struct bgp_advertise_fifo) is functionally identical to
  (struct fifo), so just use that.  Makes it clearer the beginning of
  (struct bgp_advertise) is compatible with with (struct fifo), which seems
  to be enough for gcc.
  Add a BGP_ADV_FIFO_HEAD macro to contain the right cast to try shut up
  type-punning breaks strict aliasing warnings.
* bgp_packet.c: Use BGP_ADV_FIFO_HEAD.
  (bgp_route_refresh_receive) fix an interesting logic error in
  (!ok || (ret != BLAH)) where ret is only well-defined if ok.
* bgp_vty.c: Peer commands should use bgp_vty_return to set their return.
* jhash.{c,h}: Can take const on * args without adding issues & fix warnings.
* libospf.h: LSA sequence numbers use the unsigned range of values, and
  constants need to be set to unsigned, or it causes warnings in ospf6d.
* md5.h: signedness of caddr_t is implementation specific, change to an
  explicit (uint_8 *), fix sign/unsigned comparison warnings.
* vty.c: (vty_log_fixed) const on level is well-intentioned, but not going
  to fly given iov_base.
* workqueue.c: ALL_LIST_ELEMENTS_RO tests for null pointer, which is always
  true for address of static variable.  Correct but pointless warning in
  this case, but use a 2nd pointer to shut it up.
* ospf6_route.h: Add a comment about the use of (struct prefix) to stuff 2
  different 32 bit IDs into in (struct ospf6_route), and the resulting
  type-pun strict-alias breakage warnings this causes.  Need to use 2
  different fields to fix that warning?

general:

* remove unused variables, other than a few cases where they serve a
  sufficiently useful documentary purpose (e.g.  for code that needs
  fixing), or they're required dummies.  In those cases, try mark them as
  unused.
* Remove dead code that can't be reached.
* Quite a few 'no ...' forms of vty commands take arguments, but do not
  check the argument matches the command being negated.  E.g., should
  'distance X <prefix>' succeed if previously 'distance Y <prefix>' was set?
  Or should it be required that the distance match the previously configured
  distance for the prefix?
  Ultimately, probably better to be strict about this.  However, changing
  from slack to strict might expose problems in command aliases and tools.
* Fix uninitialised use of variables.
* Fix sign/unsigned comparison warnings by making signedness of types consistent.
* Mark functions as static where their use is restricted to the same compilation
  unit.
* Add required headers
* Move constants defined in headers into code.
* remove dead, unused functions that have no debug purpose.
bgpd.c: Remove unused store to variable
ospf6_lsdb: trivial, make it clear that showfunc is set before deref.
ripng_nexthop: remove unused store to variable
lib/plist: Add some required parentheses, according to clang-analyzer
[lib] Add support for backtrace on more platforms

* lib/sigevent.c: (program_counter) extend to support more platforms. Joint
  effort with Paul Jakma.
bgpd: well-known attr check only run for v4/uni, which could cause a crash.

* ANVL testing by Martin Winter threw up a crash in bgpd in aspath_dup
  called from bgp_packet_attribute, if attr->aspath was NULL, on an IPv6
  UPDATE.

  This root cause is that the checks for well-known, mandatory attributes
  were being applied only if an UPDATE contained the IPv4 NLRI and the
  peer was configured for v4/unicast (i.e. not deconfigured). This is
  something inherited from GNU Zebra, and never noticed before.

* bgp_attr.c: (bgp_attr_parse) Move the well-known mandatory attribute
  check to here, so that it can be run immediately after all attributes
  are parsed, and before any further processing of attributes that might
  assume the existence of WK/M attributes (e.g. AS4-Path).
  (bgp_attr_munge_as4_attrs) Missing AS_PATH shouldn't happen here anymore,
  but retain a check anyway for robustness - it's definitely a hard error
  though.
* bgp_attr.h: (bgp_attr_check) No longer needs to be exported, make static.
* bgp_packet.c: (bgp_update_receive) Responsibility for well-known check
  now in bgp_attr_parse.
FreeBSD has changed its SOCK_RAW for being truly raw.
zebra: Build the test client, can be useful, and add IPv6 to testrib.conf
docs: defines.texi include seems to want to be after setfilename

* quagga.texi: I'm getting warnings about stuff in defines.texi not being
  defined when building quagga.info. Seems to be fixed by moving the include
  of defines.texi to the end of the header. Also, the Texinfo docs suggest
  setfilename must go first.
zebra: route_unlock_node is missing in "show ip[v6] route <prefix>" commands

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
ospfd: invalid MD5 auth_key?

This looks fishy in ospf_make_md5_digest()
if (list_isempty (OSPF_IF_PARAM (oi, auth_crypt)))
    auth_key = (const u_int8_t *) "";
...
MD5Update(&ctx, auth_key, OSPF_AUTH_MD5_SIZE);
auth_key points to a "" string of len 1 which is a lot
smaller that OSPF_AUTH_MD5_SIZE. Is this intentional to
get some random data or just a plain bug?

Anyone using MD5 should have a closer look and decide
what to do.
Acked-by: Feng Lu <lu.feng@6wind.com>
Bug in ospf6_lsa_compare()

This fix is probably correct on 32bit systems,
but i think it will not work on 64bit systems.
sizeof(signed long) would be 8 and therefore the
cast from u_int32_t will map all the values to
non-negative part of long int.

You would like to use int (like in ospfd) and
change the type of seqnuma, seqnumb to that.

The type int32_t would be even more proper, but
sizeof(int) is 4 on relevant platforms.

Signed-off: Ondrej Zajicek <santiago@crfreenet.org>
Acked-by: Feng Lu <lu.feng@6wind.com>
Acked-by: Yasuhiro Ohara <yasu@jaist.ac.jp>
stream: remove unused stream_read_unblock

The one place this was being used in BGP is now gone,
can remove deprecated interface.
Acked-by: Feng Lu <lu.feng@6wind.com>
ospfd: Don't leave stale RouterLSA's when changing areaID

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Acked-by: Feng Lu <lu.feng@6wind.com>
Handy guidelines to contribute

Explain how to be a nice contributor in a handy way.

Signed-off-by: Vincent JARDIN <vincent.jardin@6wind.com>
Acked-by: Paul Jakma <paul@jakma.org>
mrlg: Remove obsolete version.

* mrlg.cgi: The version we shipped was very much  out of date, remove it.
* mrlg.txt: Add file pointing to the official MRLG site.