Feng Lu [Thu, 16 Oct 2014 01:52:36 +0000 (09:52 +0800)]
*: add VRF ID in the API message header
The API messages are used by zebra to exchange the interfaces, addresses,
routes and router-id information with its clients. To distinguish which
VRF the information belongs to, a new field "VRF ID" is added in the
message header. And hence the message version is increased to 3.
* The new field "VRF ID" in the message header:
Length (2 bytes)
Marker (1 byte)
Version (1 byte)
VRF ID (2 bytes, newly added)
Command (2 bytes)
- Client side:
- zclient_create_header() adds the VRF ID in the message header.
- zclient_read() extracts and validates the VRF ID from the header,
and passes the VRF ID to the callback functions registered to
the API messages.
- All relative functions are appended with a new parameter "vrf_id",
including all the callback functions.
- "vrf_id" is also added to "struct zapi_ipv4" and "struct zapi_ipv6".
Clients need to correctly set the VRF ID when using the API
functions zapi_ipv4_route() and zapi_ipv6_route().
- Till now all messages sent from a client have the default VRF ID
"0" in the header.
- The HELLO message is special, which is used as the heart-beat of
a client, and has no relation with VRF. The VRF ID in the HELLO
message header will always be 0 and ignored by zebra.
- Zebra side:
- zserv_create_header() adds the VRF ID in the message header.
- zebra_client_read() extracts and validates the VRF ID from the
header, and passes the VRF ID to the functions which process
the received messages.
- All relative functions are appended with a new parameter "vrf_id".
* Suppress the messages in a VRF which a client does not care:
Some clients may not care about the information in the VRF X, and
zebra should not send the messages in the VRF X to those clients.
Extra flags are used to indicate which VRF is registered by a client,
and a new message ZEBRA_VRF_UNREGISTER is introduced to let a client
can unregister a VRF when it does not need any information in that
VRF.
A client sends any message other than ZEBRA_VRF_UNREGISTER in a VRF
will automatically register to that VRF.
- lib/vrf:
A new utility "VRF bit-map" is provided to manage the flags for
VRFs, one bit per VRF ID.
- Use vrf_bitmap_init()/vrf_bitmap_free() to initialize/free a
bit-map;
- Use vrf_bitmap_set()/vrf_bitmap_unset() to set/unset a flag
in the given bit-map, corresponding to the given VRF ID;
- Use vrf_bitmap_check() to test whether the flag, in the given
bit-map and for the given VRF ID, is set.
- Client side:
- In "struct zclient", the following flags are changed from
"u_char" to "vrf_bitmap_t":
redist[ZEBRA_ROUTE_MAX]
default_information
These flags are extended for each VRF, and controlled by the
clients themselves (or with the help of zclient_redistribute()
and zclient_redistribute_default()).
- Zebra side:
- In "struct zserv", the following flags are changed from
"u_char" to "vrf_bitmap_t":
redist[ZEBRA_ROUTE_MAX]
redist_default
ifinfo
ridinfo
These flags are extended for each VRF, as the VRF registration
flags. They are maintained on receiving a ZEBRA_XXX_ADD or
ZEBRA_XXX_DELETE message.
When sending an interface/address/route/router-id message in
a VRF to a client, if the corresponding VRF registration flag
is not set, this message will not be dropped by zebra.
- A new function zread_vrf_unregister() is introduced to process
the new command ZEBRA_VRF_UNREGISTER. All the VRF registration
flags are cleared for the requested VRF.
Those clients, who support only the default VRF, will never receive
a message in a non-default VRF, thanks to the filter in zebra.
* New callback for the event of successful connection to zebra:
- zclient_start() is splitted, keeping only the code of connecting
to zebra.
- Now zclient_init()=>zclient_connect()=>zclient_start() operations
are purely dealing with the connection to zbera.
- Once zebra is successfully connected, at the end of zclient_start(),
a new callback is used to inform the client about connection.
- Till now, in the callback of connect-to-zebra event, all clients
send messages to zebra to request the router-id/interface/routes
information in the default VRF.
Of corse in future the client can do anything it wants in this
callback. For example, it may send requests for both default VRF
and some non-default VRFs.
Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
Conflicts:
lib/zclient.h
lib/zebra.h
zebra/zserv.c
zebra/zserv.h
David Lamparter [Mon, 13 Apr 2015 08:21:37 +0000 (10:21 +0200)]
lib: optimise prefix list setup
- duplicate prefix check can use the trie structure
- appending with a seq# beyond the end of the list can shortcut
Configuration load is now bottlenecked by cmd_element_match() and
strcmp(). For a real-world routeserver prefix list configuration
(38668 lines of config for multiple prefix lists):
before: 4.73s
after: 1.92s x 2.46
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Mon, 13 Apr 2015 08:21:36 +0000 (10:21 +0200)]
lib: use trie structure for prefix list matching
Prefix lists were implemented with a simple linear list that is scanned
sequentially. This is, of course, extremely inefficient as it scales by
O(n). This patch adds a trie-ish data structure that allows quickly
descending based on the prefix.
Note that the trie structure used here is designed for real-world use,
hence it uses a relatively crude fixed-size bytewise table instead of
some fancy balancing scheme. It is quite cacheline efficient.
Using real-world routeserver prefix lists, matching against a fulltable
dump:
David Lamparter [Mon, 13 Apr 2015 08:21:35 +0000 (10:21 +0200)]
lib: straighten out ORF prefix list support
BGP ORF prefix lists are in a separate namespace; this was previously
hooked up with a special-purpose AFI value. This is a little kludgy for
extension, hence this splits it off.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Feng Lu [Thu, 3 Jul 2014 10:23:09 +0000 (18:23 +0800)]
zebra, lib/memtypes.c: the netlink sockets work per VRF
This patch lets the netlink sockets work per VRF.
* The definition of "struct nlsock" is moved into zebra/rib.h.
* The previous global variables "netlink" and "netlink_cmd" now
become the members of "struct zebra_vrf", and are initialized
in zebra_vrf_alloc().
* All relative functions now work for a specific VRF, by adding
a new parameter which specifies the working VRF, except those
functions in which the VRF ID can be obtained from the interface.
* kernel_init(), interface_list() and route_read() are now also
working per VRF, and moved from main() to zebra_vrf_enable().
* A new function kernel_terminate() is added to release the
netlink sockets. It is called from zebra_vrf_disable().
* Correct VRF ID, instead of the previous VRF_DEFAULT, are now
passed to the functions of processing interfaces or route
entries.
Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
Conflicts:
lib/memtypes.c
zebra/rib.h
zebra/rt_netlink.c
Feng Lu [Fri, 22 May 2015 09:40:10 +0000 (11:40 +0200)]
zebra: maintain RTADV per VRF
This moves the global variable "rtadv" into the "struct zebra_vrf",
so that RTADV feature can work per VRF.
* rtadv.c/rtadv.h:
Add a proper parameter to the functions so that the entity of the
"struct zebra_vrf" and interfaces can be obtained from the specified
VRF.
The old rtadv_init() is splitted into:
- rtadv_cmd_init(): it installs the RTADV commands; is called from
main();
- new rtadv_init(): it creates the socket; is called from
zebra_vrf_enable().
rtadv_terminate() is added to stop the threads, close the socket and
clear the counters. It is called from zebra_vrf_disable().
rtadv_make_socket() now calls vrf_socket() to create a socket in
the VRF.
* interface.h and rib.h: define the macro RTADV.
* main.c: according changes, refer to rtadv.c.
Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
zebra/interface.h
zebra/rib.h
zebra/rtadv.c
zebra/rtadv.h
Feng Lu [Fri, 22 May 2015 09:40:09 +0000 (11:40 +0200)]
zebra: add hooks upon enabling / disabling a VRF
zebra_vrf_enable() is the callback for VRF_ENABLE_HOOK.
It presently needs do nothing.
zebra_vrf_disable() is the callback for VRF_DISABLE_HOOK.
It presently withdraws routes, shuts down interfaces, and
clears the router-id candidates in that VRF.
Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Feng Lu [Fri, 22 May 2015 09:40:08 +0000 (11:40 +0200)]
lib/vrf: enable / disable a VRF
A new API vrf_is_enabled() is defined to check whether a VRF is ready
to use, that is, to allocate resources in that VRF. Currently there's
only one type of resource: socket.
Two new hooks VRF_ENABLE_HOOK/VRF_DISABLE_HOOK are introduced to tell
the user when a VRF gets ready or to be unavailable.
The VRF_ENABLE_HOOK callback is called in the new function vrf_enable(),
which is used to let the VRF be ready to use. Till now, only the default
VRF can be enabled, and we need do nothing to enable the default, except
calling the hook.
The VRF_DISABLE_HOOK callback is called in the new function
vrf_disable(), which is used to let the VRF be unusable. Till now,
it is called only when the VRF is to be deleted.
A new utility vrf_socket() is defined to provide a socket in a given
VRF to the user.
Till now before introducing a way of VRF realization, only the default
VRF is enabled since its birth, and vrf_socket() creates socket for
only the default VRF.
This patch defines the framework of the VRF APIs. The way they serve
the users is:
- vrf_is_enabled() is used to tell the user whether a VRF is usable;
- users are informed by the VRF_ENABLE_HOOK that a VRF gets usable;
they can allocate resources after that;
- users are informed by the VRF_DISABLE_HOOK that a VRF is to be
unavailable, and they must release the resources instantly;
- vrf_socket() is used to provide a socket in a given VRF.
Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Feng Lu [Fri, 22 May 2015 09:40:07 +0000 (11:40 +0200)]
zebra: maintain the router-id per VRF
A router may need different identifier among the VRFs. So move the
maintenance of router-id per VRF.
* rib.h:
Move the previous global variables in router-id.c into the
"struct zebra_vrf":
- struct list _rid_all_sorted_list/*rid_all_sorted_list
- struct list _rid_lo_sorted_list/*rid_lo_sorted_list
- struct prefix rid_user_assigned
* router-id.c/router-id.h:
A new parameter "vrf_id" is added to all the router-id APIs.
Their operations are done only within the specified VRF.
A new command "router-id A.B.C.D vrf N" is added to allow
manual router-id for any VRF.
The old router_id_init() function is splitted into two:
- router_id_cmd_init(): it only installs the commands
- router_id_init(): this new one initializes the variables for
a specified VRF
* zebra_rib.c: Add new functions zebra_vrf_get/lookup() called
from router-id.c.
* main.c: Replace router_id_init() with router_id_cmd_init() and
call the new router_id_init() in zebra_vrf_new().
Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
zebra/rib.h
Feng Lu [Fri, 22 May 2015 09:40:02 +0000 (11:40 +0200)]
zebra: let FIB stand for its respective VRF
A new member "vrf_id" is added to "struct rib", reflecting the VRF
which it belongs to.
A new parameter "vrf_id" is added to the relative functions where
need, except those:
- which already have the parameter "vrf_id"; or
- which have a parameter in type of "struct rib"; or
- which have a parameter in type of "struct interface".
All incoming routes are set to default VRF.
In fact, all routes in FIB are kept in default VRF. And the logic
is not changed.
Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
[DL: conflicts fixed + compile warning fix] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
zebra/connected.c
zebra/kernel_socket.c
zebra/rib.h
zebra/rt_netlink.c
zebra/zebra_rib.c
zebra/zserv.c
Feng Lu [Fri, 22 May 2015 09:40:01 +0000 (11:40 +0200)]
zebra: show interfaces in a specified VRF or all VRFs
The following commands only show interfaces in the default VRF:
show interface
show interface IFNAME
show interface description
New options are introduced to show interfaces in a specified VRF:
show interface vrf N
show interface IFNAME vrf N
show interface description vrf N
or all VRFs:
show interface vrf all
show interface IFNAME vrf all
show interface description vrf all
Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Feng Lu [Fri, 22 May 2015 09:39:59 +0000 (11:39 +0200)]
lib: move the interface list into "struct vrf"
An interface belongs to a specific VRF. So move the interface list
into the "struct vrf".
* vrf.c/vrf.h:
- add a new member "struct list *iflist" to the the "struct vrf";
- call if_init() in vrf_new();
- call if_terminate() in vrf_delete();
- add utilities to access the interface list and VRF ID in the
specified VRF.
* if.c/if.h:
- the global "iflist" now only exists for the default VRF;
- the global "if_master" is initialized on the definition;
- in if_create(), the interface is added into the list in the
specified VRF; if the VRF does not exist, create one;
- add parameters to if_init()/if_terminate() so that the
interface list in the VRF can be initialized/destroyed;
- in if_dump_all() scan the interfaces in all the VRFs;
- add a command "show address vrf N" to show addresses in a
specified VRF;
- add a command "show address vrf all" to show addresses in all
VRFs;
- new APIs ifxxx_vrf() are added to access an interface in a
specified VRF.
The old interface APIs (the global variable "iflist" and the API
functions) are not changed to keep the backward compatibility.
The new APIs are used in the daemons which support multiple VRFs
(till now only zebra).
Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
lib/if.c
Feng Lu [Fri, 22 May 2015 09:39:58 +0000 (11:39 +0200)]
*: call if_init()/if_terminate() from vrf_init()/vrf_terminate()
Later, an interface will belong to a specific VRF, and the interface
initialization will be a part of the VRF initialization. So now call
if_init() from vrf_init(), and if_terminate() from vrf_terminate().
Daemons have the according changes:
- if if_init() was called or "iflist" was initialized, now call
vrf_init() instead;
- if if_terminate() was called or "iflist" was destroyed, now call
vrf_terminate() instead.
Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
bgpd/bgp_main.c
pimd/pim_iface.c
pimd/pim_iface.h
pimd/pim_main.c
pimd/pimd.c
Feng Lu [Fri, 22 May 2015 09:39:56 +0000 (11:39 +0200)]
lib, zebra: move "struct vrf" to be a lib module
Previously "struct vrf" is defined locally in zebra. Now it is moved
to be a lib module.
This is the first step to support multi-VRF in quagga. The
implementation is splitted into small patches for the purpose of
easy review.
* lib:
"struct vrf" with basic members is defined in vrf.c. The member
"void *info" is for user data.
Some basic functions are defined in vrf.c for adding/deleting/
looking up a VRF, scanning the VRF table and initializing the
VRF module.
The type "vrf_id_t" is defined specificly for VRF ID.
* zebra:
The previous "struct vrf" is re-defined as "struct zebra_vrf";
and previous "vrf" variables are renamed to "zvrf".
The previous "struct vrf" related functions are removed from
zbera_rib.c. New functions are defined to maintain the new
"struct zebra_vrf".
The names vrf_xxx are reserved for the functions in VRF module.
So:
- the previous vrf_table() are renamed to zebra_vrf_table();
- the previous vrf_static_table() are renamed to
zebra_vrf_static_table().
The main logic is not changed.
BTW: Add a statement to zebra_snmp.c telling that the SNMP is
running only for the MIBs in the default VRF.
Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
lib/Makefile.am
zebra/zebra_rib.c
zebra/zebra_vty.c
vivek [Thu, 29 Oct 2015 17:30:45 +0000 (10:30 -0700)]
BGP: Do appropriate cleanup on receipt of redistribute update
When there is a change to a redistributed route, either an attribute
such as the metric or the route type itself has changed, protocol clients
receive an update of the route instead of a delete and add as a result
of an earlier optimization. The update needs to be handled as an implicit
delete for any existing redistributed route, especially to handle change
in route type.
vivek [Thu, 29 Oct 2015 16:41:23 +0000 (09:41 -0700)]
BGP: Check for duplicate and overlapping listen ranges
When configuring listen ranges for allowing dynamic BGP neighbors,
ensure that there are no duplicate or overlapping ones. This is
necessary because at the time of handling an incoming connection,
the first range that matches the source of the connection (and hence,
its peer-group parameters) will be used.
Donald Sharp [Wed, 28 Oct 2015 23:59:30 +0000 (19:59 -0400)]
lib: Memory reporting fails over 2GB
Ticket: CM-8015
Reviewed by: CCR-3717
Testing: See bug
The old style mallinfo() function uses an 'int' to
report memory usage data to the program. Unfortunately
modern architectures can chew through 2gb of memory like a
buzz saw hitting some warm butter, especially in the case
of a memory leak or memory fragmentation.
When a daemon uses more than 2gb of memory, just indicate it's
gotten large and we don't know anymore.
Pre-change behavior:
Robot-1# show memory
System allocator statistics:
Total heap allocated: 16777216 TiB
Holding block headers: 1288 KiB
Used small blocks: 0 bytes
Used ordinary blocks: 535 MiB
Free small blocks: 768 bytes
Free ordinary blocks: 16777216 TiB
Ordinary blocks: 266107
Small blocks: 24
Holding blocks: 2
Post-change behavior:
Robot-1# show memory
System allocator statistics:
Total heap allocated: 1572 KiB
Holding block headers: > 2GB
Used small blocks: 0 bytes
Used ordinary blocks: 1443 KiB
Free small blocks: 32 bytes
Free ordinary blocks: 129 KiB
Ordinary blocks: 2
Small blocks: 1
Holding blocks: 2
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
host-111# show ipv6 route
Codes: K - kernel route, C - connected, S - static, R - RIPng,
O - OSPFv6, I - IS-IS, B - BGP, A - Babel, T - Table,
> - selected route, * - FIB route
S 2002:44:44:44::44/128 [99/0] is directly connected, swp1
S>* 2002:44:44:44::44/128 [4/0] is directly connected, swp1
This problem is fixed in the ipv4 code path. Copying the same
code from the ipv4 into the ipv6 code path fixes the issue.
With the fix:
host-111(config)# ipv6 route 2002:44:44:44::44/128 swp1 4
host-111(config)# do show ipv6 route
Codes: K - kernel route, C - connected, S - static, R - RIPng,
O - OSPFv6, I - IS-IS, B - BGP, A - Babel, T - Table,
> - selected route, * - FIB route
S>* 2002:44:44:44::44/128 [4/0] is directly connected, swp1
C * fe80::/64 is directly connected, swp1
C>* fe80::/64 is directly connected, eth0
host-111(config)# ipv6 route 2002:44:44:44::44/128 swp1 99
host-111(config)# do show ipv6 route
Codes: K - kernel route, C - connected, S - static, R - RIPng,
O - OSPFv6, I - IS-IS, B - BGP, A - Babel, T - Table,
> - selected route, * - FIB route
S>* 2002:44:44:44::44/128 [99/0] is directly connected, swp1
C * fe80::/64 is directly connected, swp1
C>* fe80::/64 is directly connected, eth0
host-111(config)#
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Daniel Walton [Fri, 23 Oct 2015 17:36:55 +0000 (17:36 +0000)]
Quagga needs better debugs in lib/sockunion.c
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Ticket: CM-7233
radhika [Thu, 22 Oct 2015 17:14:00 +0000 (10:14 -0700)]
Addition of missing zebra command descriptions
Ticket: CM-7456
Reviewed By: CCR-3528
Testing Done: Unit
Porting of the patch zebra-fix-cmd-type-desc-log.patch from 2.5 branch
Last few Zebra message command types defined were not added to the command type description table used for getting logging strings. This was causing the logs to display "unknown command type" instead of the actual command type. So, added all the missing zebra commands to the command type description table. Also, changed the order of the description table to match with the actual command type definition order.
When saving an integrated config file, certain commands such as
"ipv6 protocol", "ip nht route-map" etc. ended up with a very
different group of commands making it hard to look for them. This
fixes the command grouping so that related commands are located
together.
Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Vipin Kumar <vipin@cumulusnetworks.com>
vivek [Wed, 21 Oct 2015 05:09:58 +0000 (22:09 -0700)]
Quagga: Display useful info when doing service quagga status
Ticket: CM-7132
Reviewed By: CCR-3461
Testing Done: the usual
Today, 'service quagga status' merely sets the return code and nothing
more. Like other services, it'd be good to print some useful output as
well.
Example output:
cumulus@top1$ sudo service quagga status ospfd
[ ok ] ospfd-1 is running.
[ ok ] ospfd-2 is running.
cumulus@top1$ sudo service quagga status
[ ok ] zebra is running.
[ ok ] ospfd-1 is running.
[ ok ] ospfd-2 is running.
[ ok ] ospf6d is running.
cumulus@top1$ sudo service quagga status
[ ok ] zebra is running.
[ ok ] ospfd-1 is running.
[FAIL] ospfd-2 is not running ... failed!
[ ok ] ospf6d is running.
cumulus@top1$ echo $?
1
cumulus@top1$
Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
BGP Unnumbered and Interface based peering can interact in some strange
ways. One of them is when there's an IPv4 address on a link on which
BGP Unnumbered session is beng attempted, but the IPv4 address is not
a /30 or /31. As per the bug report, we end up attempting to start the
BGP FSM on receiving a notification that an IPv4 address is present on
an interface. To avoid attempting to go past BGP's start state in the
absence of a valid peer address is the right thing to do. And this
simple patch does just that.
Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Vipin Kumar <vipin@cumulusnetworks.com>
vivek [Wed, 21 Oct 2015 04:52:52 +0000 (21:52 -0700)]
Zebra: Redistribute replace handling corner cases
Ticket: CM-7309
Reviewed By: CCR-3448
Testing Done: passing route_ospf_route_thrash, the new redist test
When zebra was modified to have redistributed routes follow a replace
logic instead of the del-add, one case was missed. When a route is
replaced with a change only to the source protocol (say from static
to bgp), its possible that the new source protocol is not selected
for redistribution by a client. Since we did not delete the route
initially, if the add is not allowed for the new source protocol
for a client, we need to send a delete of that redistributed route.
This is what the patch fixes.
Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Redistributing routes goes through a del/add cycle whenever a redistributed
is updated. This del/add cycle causes disruption by causing traffic loss
for brief/long periods of time(6-8 s in case of OSPF). The modifications in
this patch remove the del/add cycle to ensure that this disruption doesn't
happen.
Also fixed sending no forwarding address when announcing IPv4 routes with IPv6
nexthops, and sending nexthop only when there is a single path.
Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
vivek [Tue, 20 Oct 2015 21:32:12 +0000 (14:32 -0700)]
Zebra: Fix setting source for 5549-learnt routes via ip protocol
Ticket: CM-6854
Reviewed By: CCR-3297
Testing Done: bgpsmoke, bgpclos to verify setting source (in 2.5-br)
Two pieces prevented the user from specifying a route-map with set src on
IPv4 routes learnt via BGP's RFC 5549 model (v4 prefix with v6 nexthop):
- There was code missing in the section specific to 5549 in setting
the src in the netlink message
- During RIB processing, route-map processing was ignored when the NH
was v6 and the route itself was v4.
As per the code, all route-map processing that uses nexthop validates the
NH type before applying the route-map and so there should be no errors
as a consequence of relaxing bullet 2 above.
Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Tue, 13 Oct 2015 18:37:15 +0000 (11:37 -0700)]
lib: fix vty.c and smux.c static variable clash
Both vty.c and smux.c declare:
static struct thread_master *master
This is not a good thing because they are both linked into
the same library. If you want to pass different struct thread_master
pointers into smux.c and vty.c you will probably not get the result
you were looking for
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
radhika [Fri, 9 Oct 2015 20:44:32 +0000 (13:44 -0700)]
Fix for IPv6 OSPF BFD session staying down when ifdown/ifup on logical interfaces
Ticket: CM-7649
Reviewed By: Donald
Testing Done:
This is porting of the patch, ospf6d-bfd-fix-dereg-miss.patch from br2.5.
Issue: The IPv6 OSPF BFD sessions stay down after ifdown/ifup on logical interfaces. This problem doesn’t exist for BFD sessions created by BGP and IPv4 OSPF.
Root cause: When the interface is brought down the IPv6 neighbors discovered on that interface are deleted. This deletion happens without first bringing down the neighbor and the BFD deregistration happens only when the neighbor state changes. This leaves an orphaned BFD session in PTM. Also, the BFD session socket that is bound to the interface that was brought down loses connection. The socket has to be rebound to the interface when it comes up. This problem will not happen if the client deleted the sessions and re-adds it when interface goes down and come up. IPv4 OSPF and BGP work exactly like that.
Fix: Added the BFD deregistration code to IPv6 OSPF neighbor delete.
In Quagga, the ptm status is shown as pass for all the interfaces that PTM is not tracking. When ptm is enabled in Quagga all the interfaces are initialized as pass and changed to fail/pass when ptm cable check updates are received. For all the interfaces for which no status was received from PTM remain at pass status. Interface show in quagga indicates wrong status and it should be n/a for all the untracked interfaces. To fix the problem introduced a third state “unknown” and this is default ptm status for all the interfaces. The ptm status is updated accordingly to pass/fail when the updates are received from PTM. Also, reset all interface ptm status to unknown when the connection with ptm is lost and the status gets updated when the connection with PTM is re-established.
Donald Sharp [Wed, 7 Oct 2015 16:27:09 +0000 (09:27 -0700)]
Quagga: Fix some more compile warnings
The debian build process under Jessie has a 'newer' gcc
compiler that is more stringent on warnings returned.
This commit cleans up some more warnings returned.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Daniel Walton [Thu, 1 Oct 2015 18:23:00 +0000 (11:23 -0700)]
'service quagga reload' breaks with four top level keywords
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Vivek Venkataraman <vivek@cumulusnetworks.com>
Ticket: CM-7757
Reviewed By: Donald and Vivek
Donald Sharp [Wed, 30 Sep 2015 22:05:19 +0000 (15:05 -0700)]
bgpd: Fix neighbor command with internal or external keyword and interface
Ticket: CM-7737 Reviewed-by: CCR-3611
Testing: See bug
When configuring a bgp peer that already has some config hung off of it,
such as 'interface v6only' and then configuring remote-as internal/external
will not cause the config to be taken.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Tue, 29 Sep 2015 13:19:30 +0000 (09:19 -0400)]
quagga: Additional centos 6 -enable-werror fixes
This commit fixes these warnings:
1) bgpd/bgp_nexthop.c - dereferencing pointer 'X' does break strict-aliasing rules
3) ripd/ripd.c - 'ifaddr.prefixlen' may be used uninitialized in this function
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Mon, 28 Sep 2015 20:17:36 +0000 (13:17 -0700)]
vtysh: Fix Quagga.conf file read in.
There exists a sequence of cli commands that are successfully read in by bgpd.conf, but
not by a consolidated Quagga.conf.
This issue stems from the fact that the consolidated config file attempts to match the
current node + 1 node up the tree, while the individual config file searches for matches
all the way up the tree.
Quagga.conf read-in relies on vtysh_cmd.c command parsing which puts all nodes
at CONFIG_NODE and if a match is found CMD_SUCCESS_DAEMON is returned. This signals to
the parser to call the appropriate daemon with the comamnd.
bgp as an example has three levels of config node's. If you are reading in a config node
at the 3rd level(say address-family ipv6) then transition to another node under bgp it will
not work in Quagga.conf because the code only looked up one node and was at CONFIG_BGP when it failed
to find a match.
Ticket: CM-7625
Reviewed by: CCR-3591
Testing: See Bug
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>