Renato Westphal [Wed, 24 Aug 2016 15:11:00 +0000 (12:11 -0300)]
bgpd: fix build on Solaris
* Solaris doesn't have u_int64_t, so use uint64_t instead. C99-style
fixed-width integers should always be preferred to improve portability;
* 's_addr' is a macro on Solaris, so we can't use it as a variable name.
Rename the 's_addr' variable to 'addr' in the
bgp_peer_conf_if_to_su_update_v4() function.
Timo Teräs [Mon, 2 Nov 2015 14:50:07 +0000 (16:50 +0200)]
zebra: implement per-route mtu handling
This commits allow overriding MTU using netlink attributes on
per-route basis. This is useful for routing protocols that can
advertice prefix specific MTUs between routers (e.g. NHRP).
Timo Teräs [Mon, 2 Nov 2015 14:50:05 +0000 (16:50 +0200)]
zebra: make ZEBRA_FLAG_CHANGED internal status
This flag is used internally in zebra only. And it makes no sense
to expose it over the zclient API, as having it set from client
could corrupt the internal state.
Signed-off-by: Timo Teräs <timo.teras@iki.fi> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit 7eb6136b2732d4782360f9f376336c6d4f667ff0)
David Lamparter [Fri, 12 Aug 2016 23:20:20 +0000 (01:20 +0200)]
isisd: fix is_type_set
Code's "is_type" is "circuit-type" in CLI, "circuit_type" is "network"
(type) in CLI, and the function to change is_type is
isis_event_circuit_type_change()... *headdesk*
Reported-by: Martin Winter <mwinter@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Thu, 11 Aug 2016 15:02:50 +0000 (17:02 +0200)]
isisd: fix isis_circuit_af_set() on fresh circuit
A newly-created circuit will be in enabled state but have neither IPv4
nor IPv6 configured. The logic in isis_circuit_af_set assumed that
"enabled" is equivalent to "ip || ipv6".
This is the only place where this distinction is currently relevant, as
the CLI won't allow enabling an interface without enabling either IPv4
or IPv6; and it will also disable a circuit when both are deconfigured.
Reported-by: Martin Winter <mwinter@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Thu, 11 Aug 2016 14:59:08 +0000 (16:59 +0200)]
isisd: fix isis_circuit_create()
Between the awkwardly managed CSM and the tacked-on IPv6 support, the
simplified logic to setup a circuit wasn't quite right.
Note that the API essentially allows creating a circuit without enabling
either IPv4 or IPv6. This wasn't possible before and probably breaks
isisd in 'interesting' ways. The CLI won't do this, so it's only an
issue when adding on other configuration mechanisms.
Reported-by: Martin Winter <mwinter@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
vivek [Thu, 18 Aug 2016 22:02:49 +0000 (15:02 -0700)]
bgpd: Upon interface up (update) only kick-off non-Established peers
Any interface flags/parameter change (e.g., MTU, PROMISC flag change) is
notified by zebra to clients as an "up" event. BGP literally treats this
as the interface coming up and kicks all neighbors on that interface (i.e.,
directly connected peers). When doing so for IPv4 peers on the interface
(numbered or unnumbered /30-/31) or IPv6 numbered peers, peers that may
already be Established are also flapped; when doing so for IPv6 unnumbered
peers (classic 'neighbor swpX interface' scenario with no configured IP
address on interface), only peers not in Established state are processed.
This patch fixes the code to ensure that in all cases, only non-Established
peers are kicked.
Use with interface command:
interface ppp0
ip ospf area 0.0.0.0
This will enable OSPF on ppp0 with area 0.0.0.0
Remove with "no ip ospf area"
* ospf_vty.c: add "ip ospf area (A.B.C.D|<0-4294967295>)" interface command
* ospfd.c: (ospf_interface_{un,}set) new helper function to enable/disable
OSPF on a specific interface.
(ospf_if_update) 2 possible paths now to deal with interface updates.
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
[DL: this restores the tree to deccaf9...]
Donald Sharp [Wed, 16 Dec 2015 19:22:11 +0000 (14:22 -0500)]
ospfd: Remove HAVE_OSPF_TE
Remove from ospf the HAVE_OSPF_TE define and just always have
ospf traffic engineering.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Tested-by: NetDEF CI System <cisystem@netdef.org>
(cherry picked from commit 693da6096a28eef5eadeea699771265987b3ec0c)
Donald Sharp [Wed, 16 Dec 2015 19:22:10 +0000 (14:22 -0500)]
ospfd: Remove HAVE_OPAQUE_LSA
HAVE_OPAQUE_LSA is used by default and you have to actively turn it off
except that OPAQUE_LSA is an industry standard and used pretty much
everywhere. There is no need to have special #defines for this anymore.
David Lamparter [Thu, 11 Aug 2016 15:28:58 +0000 (17:28 +0200)]
bgpd: only try to identify VRF on Linux
Only Linux has SO_BINDTODEVICE, but that's not a problem since the whole
VRF use case in that instance is currently Linux-specific. Other OS's
VRF implementations will need different code.
Reported-by: Martin Winter <mwinter@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Fri, 12 Aug 2016 23:20:20 +0000 (01:20 +0200)]
isisd: fix is_type_set
Code's "is_type" is "circuit-type" in CLI, "circuit_type" is "network"
(type) in CLI, and the function to change is_type is
isis_event_circuit_type_change()... *headdesk*
Reported-by: Martin Winter <mwinter@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Thu, 11 Aug 2016 15:02:50 +0000 (17:02 +0200)]
isisd: fix isis_circuit_af_set() on fresh circuit
A newly-created circuit will be in enabled state but have neither IPv4
nor IPv6 configured. The logic in isis_circuit_af_set assumed that
"enabled" is equivalent to "ip || ipv6".
This is the only place where this distinction is currently relevant, as
the CLI won't allow enabling an interface without enabling either IPv4
or IPv6; and it will also disable a circuit when both are deconfigured.
Reported-by: Martin Winter <mwinter@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Thu, 11 Aug 2016 14:59:08 +0000 (16:59 +0200)]
isisd: fix isis_circuit_create()
Between the awkwardly managed CSM and the tacked-on IPv6 support, the
simplified logic to setup a circuit wasn't quite right.
Note that the API essentially allows creating a circuit without enabling
either IPv4 or IPv6. This wasn't possible before and probably breaks
isisd in 'interesting' ways. The CLI won't do this, so it's only an
issue when adding on other configuration mechanisms.
Reported-by: Martin Winter <mwinter@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Christian Franke [Tue, 10 Nov 2015 17:04:42 +0000 (18:04 +0100)]
lib: don't have log functions change errno
Signed-off-by: Christian Franke <chris@opensourcerouting.org> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit abfd40d68202882696260617729518a6d2c99302)
Donald Sharp [Mon, 15 Aug 2016 16:04:30 +0000 (12:04 -0400)]
zebra: Fix usage of accidental NULL pointer
NS_DEFAULT is #defined to 0, We are passing it
in to a function that is taking 'struct zebra_ns *'
which is translating into a NULL pointer. Which
in some situations will cause a crash.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Daniel Walton <dwalton@cumulusnetworks.com>
Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Donald Sharp [Mon, 15 Aug 2016 16:04:30 +0000 (12:04 -0400)]
zebra: Fix usage of accidental NULL pointer
NS_DEFAULT is #defined to 0, We are passing it
in to a function that is taking 'struct zebra_ns *'
which is translating into a NULL pointer. Which
in some situations will cause a crash.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Daniel Walton <dwalton@cumulusnetworks.com>
Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
The recommended, and in many ways the only supported, model for
the configuration file of quagga is to use a single Quagga.conf
configuration file. However, we weren't shipping with this model,
which led to some confusion amongst users. This patch fixes this
by removing all individual daemon configuration files and replacing
it with the single Quagga.conf file.
Sid Khot [Sat, 13 Aug 2016 00:09:27 +0000 (17:09 -0700)]
bgpd: Reverting fix for CM-5040: BGP and OSPF should accept "router-id use-loopback"
ospfd: Reverting fix for CM-5040: BGP and OSPF should accept "router-id use-loopback"
Renato Westphal [Thu, 4 Aug 2016 13:07:32 +0000 (10:07 -0300)]
zebra: create an abstraction layer for netlink_neigh_update()
We shouldn't have platform-agnostic code (e.g. zebra/interface.c)
calling platform-specific functions (e.g. netlink_neigh_update).
This commit introduces the kernel_neigh_update() function, which then
has to be implemented by all supported platforms. Currently only Linux
implements this function, which is only used by the RTADV code.
Renato Westphal [Thu, 4 Aug 2016 13:07:30 +0000 (10:07 -0300)]
pimd: add a workaround for *BSD
VIFF_USE_IFINDEX is not available on BSDs and other UNIX systems. In
order to build pimd on these platforms, use 'vifc_lcl_addr' instead of
'vifc_lcl_ifindex' to specify the interfaces we want to enable forwarding
of multicast traffic. In the case of unnumbered interfaces, print an
error and return.
Renato Westphal [Thu, 4 Aug 2016 13:07:26 +0000 (10:07 -0300)]
lib: fix setting of IPv4 multicast sockopts on OpenBSD
OpenBSD doesn't support the "ifindex hack" derived from RFC 1724 which
allows an ifindex to be encoded in the imr_interface field (in_addr)
of the ip_mreq structure. OpenBSD also doesn't support the RFC3678
Protocol-Independent socket API extensions, which allows an interface
to be specified by its ifindex. With that said, in OpenBSD we still need
to specify an interface by its IP address. This patch adds an exception
in the multicast sockopt functions to handle this case.
Renato Westphal [Thu, 4 Aug 2016 13:07:25 +0000 (10:07 -0300)]
ospf6d: fix sendmsg on OpenBSD
When sending ancillary data on OpenBSD, we need to tell the compiler
that the ancillary data buffer should be aligned on the stack to the
minimum alignment of the first ancillary data object that will be sent.
Additionally, HAVE_SIN6_SCOPE_ID is not defined anywhere, check for
HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID instead.
Donald Sharp [Wed, 3 Aug 2016 14:26:31 +0000 (10:26 -0400)]
lib: Arm build breakage with MAX_INT macro issues
The VTY_GET_INTEGER_RANGE macro is failing on arm
with a warning->error issue where we are passing in
a unsigned MAXINT to this macro and it is complaining
that the comparison of (TMPL) > MAXINT is always going
to be false because of data structure size.
I've changed the tmp variable to a unsigned long long
which alleviates this issue.
Ticket: CM-12187 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Don Slice [Wed, 3 Aug 2016 13:49:09 +0000 (06:49 -0700)]
bgpd: Add command to prefer global ipv6 address
There are cases where customers desire the ability to override the
default behavior of installing ipv6 prefixes with a link-local next-hop
if both a link-local and global ipv6 next-op is present in the bgp table.
This fix provides this ability and will allow the global to be used as the
next-hop. This also retains the ability to manually set the ipv6 next-hop
global value as before, and if so, this manual entry will be used for the
next-hop.
Ticket: CM-11480 Signed-off-by: Don Slice
Reviewed By: CCR-4983
Testing Done: Manual testing results attached to the ticket. bgp-min and
bgp-smoke will be completed before committing.
David Lamparter [Thu, 28 Jul 2016 15:23:32 +0000 (17:23 +0200)]
isisd: drop unused per-type metric values
Expense, Error and Delay metrics never quite made it into the real
world. Either way isisd does nothing useful with them, so let's drop
them from the code. If someone wants to implement them, this patch can
still be reverted.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Thu, 28 Jul 2016 15:23:49 +0000 (17:23 +0200)]
*: get rid of "MTYPE 0"
A few places are using 0 in place of the MTYPE_* argument. The
following rewrite of the alloc tracking won't deal with that, so let's
use MTYPE_TMP instead.
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
[DL: v2: fix XFREE(0, foo) calls too] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Thu, 28 Jul 2016 15:23:48 +0000 (17:23 +0200)]
pimd: relegate pim_igmp_join.c into a header file
pim_igmp_join.c only exists to make some portability hacks available to
test_igmpv3_join. The function only has 1 call site in each pimd and
the test tool, so it's nicely served as a simple static function in a
header file.
This removes a MTYPE related compiler/linker issue from referencing
lib/if.h in a binary that doesn't link libzebra, as test_igmpv3_join is
now fully independent of lib/.
(Fix by Christian Franke: remove stray leftover ifindex_t)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Thu, 28 Jul 2016 15:23:43 +0000 (17:23 +0200)]
lib: AgentX: use threads instead of eventloop hack
AgentX fd/timeout handling is rather hackishly monkeyed into thread.c.
Replace with code that uses plain thread_* functions.
NB: Net-SNMP's API rivals Quagga's in terms of age and absence of
documentation. netsnmp_check_outstanding_agent_requests() in particular
seems to be unused and is therefore untested.
The most useful documentation on this is actually the blog post Vincent
Bernat wrote when he originally integrated this into lldpd and Quagga:
https://vincent.bernat.im/en/blog/2012-snmp-event-loop.html
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Thu, 28 Jul 2016 15:23:42 +0000 (17:23 +0200)]
lib: add thread_add_timer_tv (struct timeval)
Another zoo extension, this adds a timer scheduling function that takes
a struct timeval argument (which is actually what the wrappers boil down
to, yet it's not exposed...)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Thu, 28 Jul 2016 15:23:41 +0000 (17:23 +0200)]
lib: linklist: add listnode_add_before()
This utility function, to join the zoo that the Quagga linked-list
implementation has accumulated, does an insert-before while returning
the newly allocated node.
It is similar to:
- listnode_add_after(), but
- complementary direction
- returns allocated node
- list_add_node_prev(), but
- supports before == NULL
- returns allocated node
In general, the entire linked-list implementation is in bad shape, and
while it needs a cleanup / rewrite / replacement, this would both cause
significant conflicts and block other cleanups...
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Thu, 28 Jul 2016 15:23:40 +0000 (17:23 +0200)]
lib: remove a whole bunch of unused time stuff
QUAGGA_CLK_REALTIME and QUAGGA_CLK_REALTIME_STABILISED aren't used
anywhere in the code. Remove. The enum is kept to avoid having to
change the calls everywhere.
Same applies to the workaround code for systems that don't have a
monotonic clock. None of the systems Quagga works on fall into that
category; Linux, BSD and Solaris all do clock_gettime, for OSX we have
mach_absolute_time() - that covers everything.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Thu, 28 Jul 2016 15:23:38 +0000 (17:23 +0200)]
ospfd: use random() to pick initial DD seq#
While the idea for this came the other way around - removing
quagga_time() - using random() is actually a better idea here. It's
seeded by time to begin with, but if ospfd restarts several times in a
short timespan it won't run straight into the same sequence number.
(Should also update the random seed to include microseconds so restarts
within a second use a different seq#)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Thu, 28 Jul 2016 15:23:34 +0000 (17:23 +0200)]
bgpd: divorce router-id logic from CLI & zebra
Logic for determining the router-id was spread out over bgp_zebra.c and
bgp_vty.c. Move to bgpd/bgpd.c and have these two call more properly
encapsulated functions.
Significant work by Christian Franke <chris@opensourcerouting.org>.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Thu, 28 Jul 2016 15:23:33 +0000 (17:23 +0200)]
bgpd: minor header/API clean up
Adds "const" on:
- peer_update_source_addr_set()
- peer_description_set()
Adds parameter names on:
- bgp_timers_set()
(really confusing, this one, with 2 unexplained args of same type)
Adds new setter:
- peer_afc_set(), calling peer_activate/peer_deactivate.
(intended for API consumers, matches peer->afc)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Don Slice [Thu, 28 Jul 2016 21:35:48 +0000 (14:35 -0700)]
bgpd: Pass correct bgp-name for clear command
Found that original fix for CM-10113 had a significant flaw, that
by deriving the bgp instance from the vty->index, if a clear ip bgp
command was entered from a vty index other then bgp, a crash occurred.
This fix passes the bgp->name to the clear functions so the correct
instance can be derived. Tested manually in both the CM-10113 case
as well as the problem discovered while testing CM-11480.
Ticket: CM-10113 Signed-off-by: Don Slice
Reviewed-by: