build: fix isisd topology out of tree build

isisd got the include directory wrong on building with a separate build
directory.

  * configure.ac: adjust ISIS_TOPOLOGY_INCLUDES

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib: make IPv6 prefix parser slightly more strict

This makes it possible to have both "show babel route A.B.C.D/M"
and "show babel route X:X::X:X/M" commands at the same time without
the parser complaining about ambiguity.

* lib/command.c: only accept STATE_DOT after : was seen.

Reported-by: Juliusz Chroboczek <jch@pps.jussieu.fr>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospfd: avoid exhausting memory with OSPF vertices (BZ#476)

This was found in scale testing at OSR;  ospfd is adding the same link
over and over again to the SPF tree.  This fix prevents the resulting
memory corruption from happening and adds a debug message to track
occurence of this issue and/or confirm a proper fix.

(This version was improved by Scott Feldman over the earlier RFC.)

* ospfd/ospf_spf.c: (ospf_spf_add_parent) loop over existing vertices
  and refuse to add duplicates.

Tested-by: Martin Winter <mwinter@opensourcerouting.org>
Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospfd: Optimize and improve SPF nexthop calculation

Maintain router LSA positions in OSPF interface.
Find the OSPF interface in nexthop_calculation using
the position in the router LSA. This is possible because
the only time nexthop_calculation needs to look up interfaces
is when dealing with its own Router LSA.

This has the following advantages:
 - Multiple PtP interfaces with the same IP address between two routers.
 - Use Unnumbered PtP on just one end of the link.
 - Faster OI lookup for the OSPF interface and only
   done once for PtoP links.

*ospf_interface.h: (struct ospf_interface) Add storage for
		   storing router LSA position.

*ospf_interface.c: (ospf_if_lookup_by_lsa_pos)
		   lookup OSPF I/F in an area using LSA position.

*ospf_lsa.c: (router_lsa_link_set) record Router LSA position.

*ospf_spf.c: (ospf_spf_next) Count and pass along lsa position.
	     (ospf_nexthop_calculation) Add lsa position argument.
	     call ospf_if_lookup_by_lsa_pos() for OSFP interface handle.
	     Clean up and remove all calls ospf_if_is_configured() the
	     rest. Adjust a few debug logs.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospf_spf_process_stubs: use LSA pos to find OSFP interface

This is better than a prefix lookup as prefixes may not be
unique, that is, the same prefix can exist on several interfaces.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra: Add support for ZEBRA_NEXTHOP_IPV4_IFINDEX

Actually implement the IPV4_IFINDEX nexthop type that has been drifting
around as a definition forever (without any warning about it being a
placeholder).

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospfd: use ZEBRA_NEXTHOP_IPV4_IFINDEX

OSPF really needs to specify interface in its routes. Otherwise
ospf may change the wrong route.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
[fixed up some whitespace errors, split patch in two]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospfd: Do not fall back to intervening router.

The patch in bug 330 did two things. It add a return value
whether ospf_nexthop_calculation() failed or not and also
moved the return stmt for 16.1.1 para 5 so now SPF
will fallback to the intervening router when no back links are found
by 16.1.1 para 5. This is wrong and can potentially create black holes
or routing loops according to Dave Katz and Acee Lindem at ospf@ietf.org

Even if the current code could be proved to be harmless in all cases,
it adds substantial extra processing and memory allocations.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>