Matthieu Boutier [Fri, 27 Jan 2012 23:29:51 +0000 (00:29 +0100)]
babeld: fix interface bug, simplify code.
Perhaps could it be able to free already free memory (so free(NULL)),
in function interface_reset(). On other hand, it initiated untracked
interfaces, raising (at least) inappropriate messages. Finally, I
remove the BABEL_IF_IS_ENABLE flag, witch was not really usefull.
Note the test if_up isn't weaker, because (...IS_UP => ...IS_ENABLE).
Matthieu Boutier [Mon, 23 Jan 2012 22:46:32 +0000 (23:46 +0100)]
babeld: babelz merge.
Babelz is the last version of the stand-alone babel daemon. In
particular, it use multiple channels to diminuate
interferences. Please refer to this one for more details.
Denis Ovsienko [Sat, 21 Jan 2012 19:16:00 +0000 (23:16 +0400)]
babeld: add MP-specific zclient API fix
Add proper initialization of SAFI field, which is present in the
revisions of zapi_ipv4 and zapi_ipv6 structures specific to
MP-BGP patchset. Without this change no Babel routes could make
into zebra RIB.
Matthieu Boutier [Fri, 20 Jan 2012 14:32:16 +0000 (15:32 +0100)]
babeld: change the modify route system.
Zebra doesn't set errno to EEXIST if we add a route who was already in
the kernel, so we always returned after just doing "add; delete". This
patch fix the problem by doing "delete; add" always.
Denis Ovsienko [Tue, 17 Jan 2012 15:25:03 +0000 (19:25 +0400)]
babeld: implement "show babel interface" command
* babel_interface.c
* show_babel_interface_sub(): new function to process one ifp
* show_babel_interface(): new function, VTY wrapper
* babel_if_init(): update respectively
Denis Ovsienko [Sun, 8 Jan 2012 12:52:36 +0000 (16:52 +0400)]
babeld: address some compilation warnings
Including system headers is not necessary with zebra.h included and
sometimes results in "__ASSERT_FUNCTION redefined" compilation warning.
* babeld.c
* babel_distribute_update_interface(): make static
* babel_interface.c
* interface_config_write(): unused 'babel_ifp'
* don't include system headers
* message.c
* send_request(): unused 'babel_ifp'
* send_multihop_request(): idem
* don't include system headers
* route.c: don't include system headers
* xroute.c: idem
* source.h: newline at EOF
* message.h: idem
Paul Jakma [Sun, 25 Dec 2011 16:52:09 +0000 (17:52 +0100)]
babeld: Initial import, for Babel routing protocol.
* Initial import of the Babel routing protocol, ported to Quagga.
* LICENCE: Update the original LICENCE file to include all known potentially
applicable copyright claims. Ask that any future contributors to babeld/
grant MIT/X11 licence to their work.
* *.{c,h}: Add GPL headers, in according with the SFLC guidance on
dealing with potentially mixed GPL/other licensed work, at:
Renato Westphal [Fri, 23 Mar 2012 19:27:40 +0000 (16:27 -0300)]
lib: fix endianness bug in prefix.c
While defining two "maskbytes" arrays for the respective endiannesses,
the code was unconditionally using one that only worked on little endian
systems.
Use preprocessor macros to avoid the somewhat expensive
htonl/ntohl macros.
From: Renato Westphal <renatowestphal@gmail.com> Signed-off-by: David Lamparter <equinox@diac24.net>
Denis Ovsienko [Sun, 26 Feb 2012 13:59:43 +0000 (17:59 +0400)]
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
Denis Ovsienko [Mon, 20 Feb 2012 19:08:10 +0000 (23:08 +0400)]
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"
Denis Ovsienko [Fri, 17 Feb 2012 12:20:50 +0000 (16:20 +0400)]
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
Denis Ovsienko [Mon, 30 Jan 2012 12:07:18 +0000 (16:07 +0400)]
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.
Denis Ovsienko [Mon, 30 Jan 2012 11:41:39 +0000 (15:41 +0400)]
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
Paul Jakma [Thu, 8 Mar 2012 13:51:21 +0000 (13:51 +0000)]
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
Paul Jakma [Mon, 9 Jan 2012 20:59:26 +0000 (20:59 +0000)]
bgpd: Open option parse errors don't NOTIFY, resulting in abort & DoS
* bgp_packet.c: (bgp_open_receive) Errors from bgp_open_option_parse are
detected, and the code will stop processing the OPEN and return. However
it does so without calling bgp_notify_send to send a NOTIFY - which means
the peer FSM doesn't get stopped, and bgp_read will be called again later.
Because it returns, it doesn't go through the code near the end of the
function that removes the current message from the peer input streaam.
Thus the next call to bgp_read will try to parse a half-parsed stream as
if it were a new BGP message, leading to an assert later in the code when
it tries to read stuff that isn't there. Add the required call to
bgp_notify_send before returning.
* bgp_open.c: (bgp_capability_as4) Be a bit stricter, check the length field
corresponds to the only value it can be, which is the amount we're going to
read off the stream. And make sure the capability flag gets set, so
callers can know this capability was read, regardless.
(peek_for_as4_capability) Let bgp_capability_as4 do the length check.
Paul Jakma [Tue, 28 Feb 2012 18:32:56 +0000 (18:32 +0000)]
lib: fix incorrect thread list processing loops
* thread.c: (thread_timer_process,thread_process) thread_list_delete nulls
thread->next. Loops need to save next first, or will only process the head.
Problem noted by Lou Berger <lberger@labn.net>.
Paul Jakma [Wed, 18 Jan 2012 12:28:30 +0000 (12:28 +0000)]
bgpd: Move up flag-check calls, parcel up attr-parser args, and other cleanups
* bgp_attr.h: (struct bgp_attr_parser_args) Attribute parsing context,
containing common arguments.
* bgp_attr.c: (general) Move the bgp_attr_flag_invalid flag-check calls up,
out of each individual attr parser function, to be done once in attr_parse.
Similarly move the calculation of the 'total' attribute length field up
to attr_parse.
Bundle together common arguments to attr-parsing functions and helpers
into (struct bgp_attr_parser_args), so it can be passed by reference down
the stack & also de-clutter the argument lists & make it easier to
add/modify the context for attr-parsing - add local const aliases to avoid
modifying body of code too much. This also should help avoid cut & paste
errors, where calls to helpers with hard-coded attribute types are pasted
to other functions but the code isn't changed.
(bgp_attr_flags_diagnose) as above.
(bgp_attr_flag_invalid) as above.
(bgp_attr_{origin,aspath,as4_path,nexthop,med,local_pref,atomic}) as above.
(bgp_attr_{aggregator,as4_aggregator,community,originator_id}) as above
(bgp_attr_{cluster_list,ext_communities},bgp_mp_{un,}reach_parse) as above
(bgp_attr_unknown) as above.
(bgp_attr_malformed) as above. Also, startp and length have to be
special-cased, because whether or not to send attribute data depends
on the particular error - a separate length argument, distinct from
args->length, indicates whether or not the attribute data should be sent
in the NOTIFY.
(bgp_attr_aspath_check) Call to bgp_attr_malformed is wrong here, there is
no attribute parsing context - e.g. the 'flag' argument is unlikely to be
right, remove it. Explicitly handle the error instead.
(bgp_attr_munge_as4_attrs) Flag argument is pointless.
As the comment notes, the check here is pointless as AS_PATH presence
already checked elsewhere.
(bgp_attr_parse) Do bgp_attr_flag_invalid call here.
Use (struct bgp_attr_parser_args) for args to attr parser functions.
Remove out-of-context 'flag' argument to as4 checking functions.
Paul Jakma [Tue, 17 Jan 2012 13:31:33 +0000 (13:31 +0000)]
bgpd: consolidate attribute flag checks
* bgpd/bgp_attr.c: (attr_flags_values []) array of required flags for
attributes, EXTLEN & PARTIAL masked off as "dont care" as appropriate.
(bgp_attr_flag_invalid) check if flags may be invalid, according to
the above table & RFC rules.
(bgp_attr_*) Use bgp_attr_flag_invalid.
(bgp_attr_as4_aggregator) ditto, also take startp argument for the
NOTIFY data.
(bgp_attr_parse) pass startp to bgp_attr_as4_aggregator
Fritz Reichmann [Sat, 1 Oct 2011 13:43:12 +0000 (17:43 +0400)]
isisd: unexpected kernel routing table (BZ#544)
Fix bug 544: isisd produces an unexpected routing table for wide-metric.
* isis_spf.c: Accept VTYPE_PSEUDO_TE_IS and VTYPE_NONPSEUDO_TE_IS
vertex types for SPF calculation
* isis_pdu.c: Change order of TLVs to match Cisco to make bitwise
comparison easier for Wireshark
* isis_tlv.c: EXTREME_TLV_DEBUG for TLV debugging instead of
EXTREME_DEBUG
Peter Szilagyi [Sat, 1 Oct 2011 13:22:51 +0000 (17:22 +0400)]
isisd: fix wrong next-hops from SPF
The forwarding table was filled with wrong next-hops, and which is even
worse, it was done in a totally non-deterministic way.
The next-hop set for an IP prefix by isisd was the neighbor IS from
which the flooded LSP about the IP prefix was arrived. So, if an IS
received all the LSPs through its, say, eth0 interface, all entries
in the forwarding table contained the next IS reachable via eth0 as
the next-hop.
The solution is to propagate the correct next-hop further from node to
node as the SPF algorithm traverses the graph and selects the next
node to be added to the set of already covered nodes.
Also, the construction of the tentative node list (the nodes where the
shortest path is not known yet) was buggy: if a node was already a
member of this list with a certain path cost, and an alternative path
was found to it with a lower cost while processing a pseudo-node LSP,
it was not added to the list. This way, the path selected by isisd for
a certain prefix was the first one it encountered during the LSDB
processing.
Signed-off-by: Fritz Reichmann <fritz@reichmann.nl>
Peter Szilagyi [Sat, 1 Oct 2011 13:15:46 +0000 (17:15 +0400)]
isisd: send proper LSP after DIS election
After an IS has been elected as the Designated IS for a LAN, it did
not refresh the content of the pseudo-node after a new node has been
connected to the same LAN. Instead, the periodically reoriginated
pseudo-node LSP still contained only those IS neighbors that were
already present when the DIS election process was commenced.
The fix for the problem schedules an LSP regeneration rather than
just reoriginating the same LSP with the old content.
Signed-off-by: Fritz Reichmann <fritz@reichmann.nl>
Peter Szilagyi [Sat, 1 Oct 2011 13:11:45 +0000 (17:11 +0400)]
isisd: fix circuit state machine
isisd has a so-called circuit state machine that takes care about
the interface state changes, such as initializing, down, up. When
an interface was brought down by a link failure, the interface
information was deleted and set to NULL. When the link was restored
later, the interface was looked up by the old pointer, but since it
was cleared, it was never found again, resulting in an interface
never entering the up state again.
Also, the program regularly crashed because of a deleted pointer in
the same context which was later accessed without any further
checking.
Signed-off-by: Fritz Reichmann <fritz@reichmann.nl>
Calls to atoi() and atol() are replaced with VTY_GET_INTEGER_RANGE()
macro, command patterns are clarified and aliases of some commands
are added for consistency. Other changes are listed below.
* zebra/rtadv.c
* ipv6_nd_ra_interval_msec(): resolve -Wsign-compare
* ipv6_nd_ra_interval(): idem
* rtadv_init(): update to list new aliases
* doc/ipv6.texi: update to match current implementation
Denis Ovsienko [Sun, 8 Jan 2012 13:46:34 +0000 (17:46 +0400)]
zebra: clear host bits of ND RA prefix option
RFC4861 4.6.2. Prefix Information
Prefix An IP address or a prefix of an IP address. The
Prefix Length field contains the number of valid
leading bits in the prefix. The bits in the prefix
after the prefix length are reserved and MUST be
initialized to zero by the sender and ignored by
the receiver.
* rtadv.c
* ipv6_nd_prefix(): add missing call to apply_mask_ipv6()
* no_ipv6_nd_prefix(): idem
Denis Ovsienko [Fri, 30 Dec 2011 17:55:49 +0000 (21:55 +0400)]
zebra: justify some IPv6 ND RA timers wrt RFC
There was a regression introduced with the previous commit:
"ipv6 nd home-agent-lifetime 1800000" appeared by default in every
interface section of running-config, although this command is
invalid in this context. Troubleshooting and bugfixing of the issue
tracked out several bugs in router advertisement procedures, some of
which are fixed in this commit.
* zebra/interface.c
* if_zebra_new_hook(): update to treat -1 as "uninitialized"
* nd_dump_vty(): idem
* zebra/rtadv.c
* rtadv_send_packet(): update processing of "router lifetime" field,
"home agent" option and "home agent lifetime" field to conform to
RFC6275 better
* ipv6_nd_ra_interval_msec(): update MaxRtrAdvInterval range check,
make sure it never exceeds (initialized) AdvDefaultLifetime
* ipv6_nd_ra_interval(): idem
* ipv6_nd_ra_lifetime(): update AdvDefaultLifetime range check, make
sure it never falls below MaxRtrAdvInterval
* ipv6_nd_homeagent_lifetime(): update HomeAgentLifetime range check
* no_ipv6_nd_ra_lifetime(): update to treat -1 as "uninitialized"
* no_ipv6_nd_homeagent_lifetime(): idem
* rtadv_config_write(): idem
Denis Ovsienko [Mon, 5 Dec 2011 12:35:14 +0000 (16:35 +0400)]
fix zebra protocol after MP-BGP changes
The previous commits modified both zebra and bgpd for additional
SAFI field, but not any other routing daemon, which led to zebra
daemon crashing with failed assertion.
G.Balaji [Sat, 26 Nov 2011 18:10:39 +0000 (22:10 +0400)]
zebra: IPv6 MP-BGP Routes addition and deletion
This patch contains the following:
1. Addition of IPv6 SAFI_MULTICAST BGP routes into the RTM's RIB.
2. Deletion of IPv6 SAFI_MULTICAST BGP routes from the RTM's RIB.
G.Balaji [Sat, 26 Nov 2011 18:04:05 +0000 (22:04 +0400)]
bgpd: IPv6 MP-BGP Routes addition and deletion
This patch contains the following:
1. Addition of IPv6 SAFI_MULTICAST BGP routes into the BGP Multicast RIB.
2. Deletion of IPv6 SAFI_MULTICAST BGP routes from the BGP Multicast RIB.
G.Balaji [Sat, 26 Nov 2011 17:59:32 +0000 (21:59 +0400)]
zebra: IPv4 MP-BGP Routes addition and deletion
This patch contains the following:
1. Addition of IPv4 SAFI_MULTICAST BGP routes into the RTM's RIB.
2. Deletion of IPv4 SAFI_MULTICAST BGP routes from the RTM's RIB.
G.Balaji [Sat, 26 Nov 2011 17:58:42 +0000 (21:58 +0400)]
bgpd: IPv4 MP-BGP Routes addition and deletion
This patch contains the following:
1. Addition of IPv4 SAFI_MULTICAST BGP routes into the BGP Multicast RIB.
2. Deletion of IPv4 SAFI_MULTICAST BGP routes from the BGP Multicast RIB.
Paul Jakma [Mon, 9 Jan 2012 11:36:23 +0000 (11:36 +0000)]
bgpd: reinstate zlookup checks, required for BGP without zebra
* bgp_nexthop.c: The nexthop lookup cache has to return success for queried
nexthops if bgpd isn't connected to zebra, or else BGP without zebra doesn't
work.
Paul Jakma [Sun, 8 Jan 2012 14:47:06 +0000 (14:47 +0000)]
Marker merge for 'RE-0.99.17.6'
This marker merge (i.e. an 'ours' strategy merge) is a placeholder to show
that all commits in Quagga-RE stable, to its release RE-0.99.17.6 tag, have
been reviewed and merged into 'master'.
Denis Ovsienko [Mon, 8 Aug 2011 15:36:44 +0000 (19:36 +0400)]
bgpd: dismiss some zlookup checks
bgp_nexthop_onlink(): zlookup is not used here at all
bgp_nexthop_lookup_ipv6(): rely on the detection performed by "query"
function (this also changes the fallback value to 0), reorder if-block
bgp_nexthop_lookup(): idem