zebra: unify the ipv4/ipv6 'show ip route' commands - part 1/2
Note: I had to remove one assert in clidef.py in order to fix a build
error when using a preprocessor string (FRR_IP_REDIST_STR_ZEBRA) inside
a DEFPY command. This should be revisited later.
Chirag Shah [Wed, 18 Oct 2017 04:54:29 +0000 (21:54 -0700)]
ospf6d: Divide LSupdate to keep size small
Within OSPFv3 area, Disect Router LSA and
Intra-prefix LSA in order to keep LSA size Small.
Each LSA has unique Link State ID assigned.
Intra-Area-Prefix LSA:
Spread prefixes across multiple intra-area-prefix-LSAs.
Ticket:CM-18069
Testing Done:
Tested 92 ospf6 enabled (point-to-point) interfaces
between two routers.
92 adajancy comes up with Full Neighborship.
Validated 'show ipv6 ospf6 database router detail' &
'show ipv6 ospf6 database intra-prefix detail', each adv-router
has two distinct LSA of such catgory.
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Commit 8c9cc7bbf657e3440d9bc758fe45aef5f43c989f changed the size
of the `struct bgp_attr_encap_subtlv` type to be a zero length
array at the end instead of having a 1 byte. All memory allocations
for this subsuquently were off by 1 byte since those were not
adjusted either.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Chirag Shah [Thu, 12 Oct 2017 22:10:50 +0000 (15:10 -0700)]
ospf6d: Handle lsupdate upto max ospf6 payload
While traversing LSUpdate list, if LSUpdate message
fills up (w/ LSAs) to the interface MTU size,
Send the existing filled LSUpdate message if max
payload exceeds max ospf6 payload,
reset sendbuf (buffer) to fill rest of
the remaining LSAs.
Add relevant fields to debugs.
Ticket:CM-18069
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Chirag Shah [Sat, 7 Oct 2017 20:26:13 +0000 (13:26 -0700)]
ospfd: fix ospf nssa command
-Fix ordering of nssa command with translate options
and no-summary option.
Just like ospf stub no-summary keep the order order
of nssa no-summary.
- Fix NSSA options.
- Avoid displaying translate-candiate (default) option
in running-config.
cumulus(config-router)# area 2.2.2.2 nssa
<cr>
no-summary Do not inject inter-area routes into nssa
translate-always Configure NSSA-ABR to always translate
translate-candidate Configure NSSA-ABR for translate election (default)
translate-never Configure NSSA-ABR to never translate
Running-config output:
router ospf
area 2.2.2.2 nssa translate-always
area 2.2.2.2 nssa no-summary
Ticket:CM-8312
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Donald Sharp [Tue, 10 Oct 2017 17:07:16 +0000 (13:07 -0400)]
ospf6d: Make ospf6_prefix have an empty v6 addr at end
The `struct ospf6_prefix` type expects to have space allocated
at the end of the structure for a v6 prefix. So let's tell
the compiler that there might be more there. This is to fix
a coverity scan warning.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Tue, 10 Oct 2017 16:29:54 +0000 (12:29 -0400)]
lib: Add some documentation about argv_find
We expect that the index value passed in for argv_find
should be initially set to 0. This way if the cli
ever changes there is no need to modify the initial
value.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Renato Westphal [Tue, 10 Oct 2017 12:22:41 +0000 (09:22 -0300)]
ldpd: fix heap-use-after-free at exit
This problems happens because, in this port, whenever the child
processes want to log something they send a message to the parent. But
in the shutdown functions the first thing we do is to close the pipes
to the parent process. With that said, add some protections to prevent
the child processes from trying to use a closed pipe and just ignore
their log messages during shutdown. In the future we need to share
the logging configuration with the child processes so they can send
log messages on their own.
While here, remove some unnecessary calls to msgbuf_write() in
ldpe_shutdown().
Renato Westphal [Wed, 4 Oct 2017 23:13:56 +0000 (20:13 -0300)]
lib: fix bug in if_cmp_name_func()
If the p1 and p2 arguments pointed to identical strings ending with
a non-numeric character (e.g. "lo"), this function would return -1
instead of 0 as one would expect. This inconsistency didn't matter
for sorted linked-lists but for red-black trees it's a major source
of problems.
Renato Westphal [Tue, 3 Oct 2017 01:06:04 +0000 (22:06 -0300)]
*: introduce new rb-tree to optimize interface lookup by ifindex
Performance tests showed that, when running on a system with a large
number of interfaces, some daemons would spend a considerable amount
of time in the if_lookup_by_index() function. Introduce a new rb-tree
to solve this problem.
With this change, we need to use the if_set_index() function whenever
we want to change the ifindex of an interface. This is necessary to
ensure that the 'ifaces_by_index' rb-tree is updated accordingly. The
return value of all insert/remove operations in the interface rb-trees
is checked to ensure that an error is logged if a corruption is
detected.
Renato Westphal [Tue, 3 Oct 2017 01:06:01 +0000 (22:06 -0300)]
*: use rb-trees to store interfaces instead of sorted linked-lists
This is an important optimization for users running FRR on systems with
a large number of interfaces (e.g. thousands of tunnels). Red-black
trees scale much better than sorted linked-lists and also store the
elements in an ordered way (contrary to hash tables).
This is a big patch but the interesting bits are all in lib/if.[ch].
Donald Sharp [Mon, 9 Oct 2017 20:36:52 +0000 (16:36 -0400)]
babeld: Do not copy beyond end of data
The function really_send_update takes a 'const unsigned char *id'.
and is called with myid(a 8 byte array) and route->src->id(an 8
byte array), but we copy these pointers into
babel_ifp->buffered_id which is a 16 byte array.
Adjust the size of buffered_id to be 8 bytes and fix the copy
to only copy the 8 bytes.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra: fix uninitialized prefixes in the handling of FEC messages
This was causing some weird prefixes to pop up in my log files. One
alternate solution would be to call apply_mask() on the prefix, but
memcpy() is faster and just enough in this case.
* use %u instead of %d, we don't want to print negative labels;
* increase the size of label_buf to accommodate the worst case scenarios;
* use strlcat() instead of strcat() as a security best practice.
Don Slice [Mon, 9 Oct 2017 15:22:52 +0000 (15:22 +0000)]
bgpd: check for bgp instance before processing interfaces
Problem reported with the log displaying error messages if bgpd was
enabled in /etc/frr/daemons but bgp wasn't actually configured. The
problem was due to operating on interfaces before if_create had been
called (which happens at "router bgp" not at frr starting. Moved the
checks for the bgp instance before operating on interfaces. Manual
testing successful and bgp-smoke completed with no new issues.
Ticket: CM-13504 Signed-off-by: Don Slice <dslice@cumulusnetworks.com> Reviewed-by: CCR-6738
Vincent JARDIN [Mon, 9 Oct 2017 10:42:11 +0000 (12:42 +0200)]
lib: fix NULL->field_len access
Currenlty, this function is used only by:
- unit test of csv.c (see its main() section)
- ptm_lib.c
In case of ptm, it is safe to return NULL because:
csv_encode_record() -> return NULL
_ptm_lib_encode_header() -> return NULL
the only consumer of the return value is: ptm_lib_init_msg()
that checks the NULL return.
Warning:
Access to field 'field_len' results in a dereference of a null
pointer (loaded from variable 'fld')
Signed-off-by: Vincent Jardin <vincent.jardin@6wind.com>