Donald Sharp [Wed, 9 Mar 2016 12:25:02 +0000 (07:25 -0500)]
vtysh: Set an erroneous exit code if dry run fails because of syntax error
vtysh has a -C option to do a dry run of the quagga commands. However, the
program always returns 0 even when there's an error detected in the command.
Furthermore, it only parses vtysh.conf, not Quagga.conf.
This patch makes vtysh -C parse Quagga.conf also and return a non-zero
exit code so that network automation tools can catch this to flag errors in
syntax. This non-zero exit code along with printing the exact error with the
line number and offending line itself should help in fixing the error. But
this lack of proper error code requires the automation tools to go through
an additional hoop to validate the syntax.
Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Issue (related to CM-7615): 1. CM-7615: There is mismatch in the client name between ptm display of client BFD sessions and the zebra logs. For example, if bgpd added BFD session, zebra logs will show the client as “bgp” but the ptm display will show it as “quagga”
2. Bigger problem is when 2 clients (for example OSPF and BGP) from Quagga register for same BFD session and only one client de-registers the BFD session. This results in BFD session deletion from PTM even though other client still has the BFD registration.
Root Cause: Even though BGP, OSPF and OSPF6 are 3 different clients from Quagga that are trying to register/deregister BFD sessions with PTM, all 3 are represented as one client “quagga” from zebra. This makes it hard for PTM/BFD to distinguish between all three when BFD peer registration/deregistration happens from the clients.
Fix: Send the actual client name bgp, ospf or ospf6 from zebra with BFD reg/dereg messages instead of one unified client name “quagga”
CM-7773: BFD sessions are not getting cleaned from PTM even though no BGP peering exists in Quagga.
Root Cause: PTM cleans up stale BFD sessions from a client when it finds a change in seq id advertised by the client. But, if PTM never detects a change in the seq id then the stale BFD sessions never get cleaned up. The test restarts the quagga without saving the configuration, which results in no BGP peering. No BGP peers are registered with PTM after restart and PTM does not detect a client seq id change resulting in stale BFD sessions.
Fix: New client registration message was added in PTM. Every client that is interested in BFD monitoring will register with PTM with the client seq id. Client will register with a different seq id (typically pid) every time it restarts. This will help in detecting the change in seq id and cleanup of stale BFD sessions for a client.
Code Changes: To support the new client registration message following changes have been made
- Added support for client registration messaging in zebra for sending messages to PTM.
- Added support for client registration messaging between zebra and clients (BGP, OSPF and OSPF6) in BFD library.
- Expanded the reg/de reg peer messaging between zebra and clients to support client specific seq id to distinguish between multiple clients registering for BFD peer rather than one “quagga” client.
- Changes in bgpd, ospfd and ospf6d to send client registrations at the time of daemon initialization and on receiving BFD peer replay message.
vivek [Wed, 9 Mar 2016 03:39:38 +0000 (03:39 +0000)]
BGP: Update commands for VRF support
Ensure commands dealing with update-groups and peer-groups support VRFs.
Also implement a new command "show bgp vrfs" to show summary information of
all configured VRFs. Some additional code cleanup in this area.
radhika [Tue, 8 Mar 2016 13:10:56 +0000 (05:10 -0800)]
Zebra and bgpd: VRF support for BFD
Following changes have been done to support VRF for BFD in zebra and bgpd.
- Pass the correct VRF value from bgpd to zebra for reg and dereg of BFD destinations.
- Send the non-default vrf name in reg/dereg messages of multihop destination to BFD/PTM from zebra.
Donald Sharp [Fri, 4 Mar 2016 06:28:29 +0000 (06:28 +0000)]
lib: Add ability to use poll() instead of select
This patch originated w/ Hannes Hofer <hhofer@barracuda.com>.
I've taken the patch fixed some bugs and reworked the code
to allow both poll and select to be choosen at compile time.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Fri, 4 Mar 2016 03:52:12 +0000 (03:52 +0000)]
lib: Refactore thread_process_fd
thread_process_fd is looping over the read and write
fd's separately. There is no need to do this individually.
loop over both the read and write fdset's at the same time.
This will improve select processing performance, especially
for large data sets.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
vivek [Wed, 2 Mar 2016 07:40:14 +0000 (07:40 +0000)]
BGP: Handle unknown interface at delete
When BGP deals with interfaces at a VRF-level, it may get an interface delete
for a VRF which it has just de-registered, so it may not be able to locate
the interface. This is no longer an error, so handle this in the message
processing.
vivek [Mon, 29 Feb 2016 18:04:29 +0000 (18:04 +0000)]
BGP: Unnumbered peering in a VRF
Code changes to make unnumbered peering work in a VRF. The changes have
to do with locating the interface in the correct VRF (in order to look for
neighbor address) in the case of outgoing connections and when specifying
source address as well as fetching the correct instance for an incoming
connection based on reading the device the socket is bound to (the multi-vrf
socket option in the kernel).
Additionally, for IPv4 unnumbered peering in a VRF (based on /30 or /31
addresses), bind to the VRF rather than the interface.
Don Slice [Sun, 28 Feb 2016 22:03:27 +0000 (22:03 +0000)]
Zebra: Move VRF keyword in show ip route commands
To make the syntax of the "show ip route" vrf commands more closely align with the bgp variety,
moved the vrf forward in the command. In other words, show ip route 10.1.1.1/32 vrf green became
show ip route vrf green 10.0.0.1/32. Also added a couple of missing show vrf commands (ipv4 and
ipv6 tags).
Ticket: CM-9114 Signed-off-by: Don Slice Reviewed-by: Donald Sharp
vivek [Fri, 26 Feb 2016 19:13:34 +0000 (19:13 +0000)]
Zebra: Fix static NHT to work properly in a VRF
Implement VRF support for static nexthop resolution (NHT). This is
achieved by ensuring the correct VRF is passed as a parameter to
the NHT functions and is stored in the registered nexthop data
structure.
vivek [Thu, 25 Feb 2016 19:44:28 +0000 (19:44 +0000)]
Zebra: Fix neighbor address notification to clients
This problem was fixed as part of implementation of VRF change semantics
for an interface, though it is not directly related. The issue here
was that neighbor addresses learnt on an interface were being informed
to clients even though the clients may not have learnt of the interface.
Fixed by introducing the correct checks.
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Ticket: CM-9527
Reviewed By: CCR-4174
Testing Done: Manual tests of various scenarios
vivek [Thu, 25 Feb 2016 19:30:53 +0000 (19:30 +0000)]
Quagga: Implement VRF change semantics for an interface
Implement VRF change semantics for an interface to be invoked
when an interface is moved from one VRF (e.g., the Default) to
another. This includes the message definition as well as updating,
deleting or adding the interface from clients, depending on their
interest in the VRFs (old and new). Also handle replay of the
addresses on the interface upon VRF change, if required.
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Ticket: CM-9527
Reviewed By: CCR-4174
Testing Done: Manual tests of various scenarios
vivek [Tue, 23 Feb 2016 23:55:06 +0000 (23:55 +0000)]
BGP: Fix interface list upon instance creation/deletion
The BGP instance cleanup was deleting interfaces in that instance after
prior fixes, but this ended up deleting the interface list header which
was not being re-created. Added code to re-create this at the time an
instance is created.
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Ticket: CM-9466
Reviewed By: CCR-4164
Testing Done: Manual and verified failed test
Donald Sharp [Tue, 23 Feb 2016 20:06:59 +0000 (15:06 -0500)]
debian: Fixup removal of .pid and .vty files
The <daemon>.pid and <daemon>.vty files were not being
removed on shutdown. This was causing issues w/
logrotate becaue it depends on pid files being correct
about what is running in order to not error out.
Fixed some additional debugs accidently left in the quagga
script.
Ticket: CM-9293 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
sharpd [Mon, 22 Feb 2016 21:22:16 +0000 (13:22 -0800)]
debian: Revamp startup again
Remove quagga.service, it was a bad idea culminating in a
series of mistakes.
Replaced with /usr/lib/quagga/quagga script.
Use this script to start/stop quagga as a whole.
Ticket: CM-9445 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Dave Olson <olson@cumulusnetworks.com>
Donald Sharp [Sun, 21 Feb 2016 17:43:50 +0000 (12:43 -0500)]
debian, config, zebra: Ensure Cumulus Extensions are not auto turned on
There exist cases where Cumulus Code( in this case code surrounding
when we want to send Router Advertisements ) should only be
turned on for Cumulus Switches.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
vivek [Tue, 23 Feb 2016 03:42:19 +0000 (03:42 +0000)]
Zebra: Perform NHT evaluation for VRFs
NHT evaluation was not being triggered for any VRF after RIB processing. Fix
this and attempt to schedule only those VRFs for which RIB processing was
scheduled.
Don Slice [Mon, 22 Feb 2016 21:36:23 +0000 (21:36 +0000)]
Zebra: Enable VRF as an interface creation
Modified response to netlink message for VRF creation, allowing it to be
created as an interface and setting the right vrf_id and bringing in the ip address.
Ticket: CM-9277 Signed-off-by: Don Slice Reviewed-by: Vivek Venkatraman
vivek [Mon, 22 Feb 2016 06:36:37 +0000 (06:36 +0000)]
BGP: Cleanup interfaces properly on instance delete or exit
Perform interface cleanup as an instance is deleted. This takes care of the
scenario when BGP exits (or is stopped/restarted) too as instances undergo
deletion and the interface cleanup is done as the last step in that.
vivek [Mon, 22 Feb 2016 05:33:46 +0000 (05:33 +0000)]
Zebra: Fix ignoring status for VRF device
The earlier change to ignore status for VRF device was not quite perfect. As
defect CM-9437 illustrates, there are situations when Quagga may get a VRF
member interface (that refers to the VRF id of the VRF device) before it gets
the VRF device itself. The code has some logic to handle this, creating a
VRF structure which is partly initialized. The initialization is completed
with some additional incorrect status processing when the VRF is learnt. The
fix done earlier completely ignored the VRF message treating it as a status
change because the VRF is already present, but this left the VRF structure
not fully initialized in Quagga. The fix is to do some additional checks
to handle this scenario.
vivek [Sat, 20 Feb 2016 06:50:56 +0000 (22:50 -0800)]
Zebra: Ignore status change for VRF (temporary)
Temporary change to ignore status change for a VRF device as it is
incorrectly implemented now. When VRF is also supported as an
interface, the status change will be handled for the interface.
vivek [Sat, 20 Feb 2016 02:43:30 +0000 (18:43 -0800)]
BGP: Link BGP instance to corresponding VRF
Link BGP instance (Default or VRF) to the corresponding VRF structure and
modify lookup to use this. The logic is very similar to what is implemented
in zebra - the 'struct zebra_vrf' there is essentially 'struct bgp' in BGP.
vivek [Fri, 19 Feb 2016 22:28:25 +0000 (14:28 -0800)]
Zebra: Make RA socket operation on a per-NS basis
This patch reorganizes the RA handling to be per namespace rather than per
VRF. The VRF library by 6wind had done the original change to make the RA
data structures (socket information) per VRF, but this was correct only if
each VRF represented a NS. In our reorganization, we have created a NS
structure (struct zebra_ns) and VRFs don't correspond to namespaces (i.e.,
all VRFs exist in the default namespace). So, the RA handling should be
done under 'struct zebra_ns'.
With the changes, there is a single raw socket per NS (=> 1 for us) on which
we will receive and handle RAs for all interfaces. The interface information
is available through cmsg and the processing will then happen for that interface.
There is a problem with transmitting RAs over a VRF interface. This is
tracked by CM-9398.
Daniel Walton [Fri, 19 Feb 2016 13:36:06 +0000 (13:36 +0000)]
OSPFv2 has both "router-id x.x.x.x" and "ospf router-id x.x.x.x"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-9285
dslice [Wed, 17 Feb 2016 18:19:18 +0000 (10:19 -0800)]
zebra: fix creation of "other table" for rdnbrd
zebra: add the creation of the alternative table for rdnbrd in the context of vrfs
When rdnbrd pulls arp entries into table 10, which are then sent into quagga via netlink, the entries were incorrectly being added to the main table. This fix creates or uses the alternative table if the table-id is not default but the vrf-id is default. Tested manually and also run successfully in the /tests/l3/ospf_ebgp_redist_comprehensive_test.py:TestBasicEndToEndPing , which consistently failed bafore this fix was applied.
Signed-off-by: Don Slice Reviewed-by: Donald Sharp
vivek [Wed, 17 Feb 2016 16:41:33 +0000 (08:41 -0800)]
BGP: Ensure correct sequence of processing at exit
With VRF support, certain objects are now maintained per BGP instance. At
exit, the list of BGP instances has to be freed only after processing the
per-instance objects.
Don Slice [Mon, 15 Feb 2016 18:36:57 +0000 (18:36 +0000)]
zebra: set vrf-id on vrf slave interfaces
vrf: check netlink message for slave info and set the vrf-id accoringly
When a netlink newlink or link change comes into zebra, check the IFLA_INFO_SLAVE_KIND
to discover if the interface is a member of a vrf or not. Set the vrf-id to the correct
value if the interface is a slave member
vivek [Fri, 12 Feb 2016 20:18:28 +0000 (12:18 -0800)]
BGP: VRF registration and cleanup
Various changes and fixes related to VRF registration, deletion,
BGP exit etc.
- Define instance type
- Ensure proper handling upon instance create, delete and
VRF add/delete from zebra
- Cleanup upon bgp_exit()
- Ensure messages are not sent to zebra for unknown VRFs
vivek [Fri, 12 Feb 2016 19:37:33 +0000 (11:37 -0800)]
Quagga: Support VRF unregister for clients
Clients (BGP, OSPF etc.) register with Zebra for information about
a VRF such as Router ID, interfaces and redistribution. Add API to
support unregister also which is required for the non-default VRF.
vivek [Thu, 11 Feb 2016 22:45:58 +0000 (14:45 -0800)]
BGP: Perform cleanup upon instance delete
When a BGP instance is deleted through 'no router bgp', the required
cleanup was not being performed. This is after VRF-related changes.
Fix to ensure this is taken care of.
Note: Further changes needed in this area for VRFs.
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-9597
Reviewed By: CCR-4097
Testing Done: Verified failed test
Donald Sharp [Thu, 11 Feb 2016 16:29:36 +0000 (08:29 -0800)]
ripd: Fix crash when a default route is passed to rip
When rip is not configured and zebra decides to send
a default route to it, check to make sure that rip is
configured before accepting anything from zebra.
Ticket: CM-9270 Reviewed-by: Don Slice
Tested: OSPF test case that was erroring out no longer
happens
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Don Slice [Wed, 10 Feb 2016 17:53:21 +0000 (09:53 -0800)]
zebra: fix interface lookup for vrf configuration
Ticket:CM-9073
Reviewed By: sharpd
Testing Done:Manual, see ticket
Changed logic when "interface swpxx <vrf foo>" entered so that:
1. it matches when the command is entered without a vrf but the interface already exists in a vrf.
2. If the command is entered with a vrf name that is different than is defined by the kernel, the command is rejected.
3. If the call is made from other than the vty session, believe the new information and update the vrf accordingly.
Donald Sharp [Wed, 10 Feb 2016 12:30:56 +0000 (07:30 -0500)]
debian: Add Systemd integration to control files
Ticket:
Reviewed By: inprogress
Testing Done: minimal. Built, installed, started a few services.
This is in progress testing. quagga.service tries to start and stop
all the routing daemons. There is no check for whether they are enabled
via /etc/quagga/daemons (yet).
As installed, nothing is enabled (won't start on system boot or install).
The -A 127.0.0.1 is now in /etc/default/quagga, and picked up from there
by all routing daemons.
MAX_FDS is in all the service files for now as LimitNOFILE. Users who
need to modified the number of fd's will use e.g.
the file /etc/systemd/system/bgpd.service.d/maxfds.conf to override
bgpd.service contents
[Service]
LimitNOFILE=2048
MAX_INSTANCES isn't implemented yet.
reload isn't implemented yet (it should be possible via ExecReload
in the services, just not done yet).
The init.d file is removed.
All of the daemons are started without the -d/--daemonize option, and
use Type=simple rather than forking in the services file, to use the
systemd daemonizing.
All the daemons were set to have a 1m start time, and restart up to 3
times in 3 minutes, and for now, are only restart on-abnormal, not always
(we'll likely want the latter, but testing is easier with abnormal).
Also use tmpfiles.d to create /run/quagga
For now, we leave dh_installinit, even though it creates unneeded
update-rc.d calls, and causes lintian complaints about init.d files
that aren't present, so that it installs files like etc/default/quagga.
It also runs the tmpfiles.d commands for us, so we need to add those to
postinst if we dummy it out to fix the update-rc.d lines being added
(and lintian complaints).
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Wed, 10 Feb 2016 13:15:42 +0000 (08:15 -0500)]
*: Modify protocols to have systemd integration
Modify the daemons to integrate with systemd, if it is enabled via configure,
and to notify systemd that they are running/stopping and to send watch
notifications.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>