]> git.puffer.fish Git - mirror/frr.git/commit
zebra: don't created connected if duplicate depend
authorStephen Worley <sworley@cumulusnetworks.com>
Mon, 6 Jan 2020 17:58:41 +0000 (12:58 -0500)
committerStephen Worley <sworley@cumulusnetworks.com>
Fri, 3 Apr 2020 19:24:10 +0000 (15:24 -0400)
commit0764f43afef37c6a228038de9a7550f53b0bc27d
treee8afd097d4dadb31c3a2519618b670c32bd49bd0
parentb4deb56ddd15681b7bf1cd859d5f6ad817ad4899
zebra: don't created connected if duplicate depend

Since we are using a UNIQUE RB tree, we need to handle the
case of adding in a duplicate entry into it.

The list API code returns NULL when a successfull add
occurs, so lets pull that handling further up into
the connected handlers. Then, free the allocated
connected struct if it is a duplicate.

This is a pretty unlikely situation to happen.

Also, pull up the RB handling of _del RB API as well.

This was found with the zapi fuzzing code.

```
==1052840==
==1052840== 200 bytes in 5 blocks are definitely lost in loss record 545 of 663
==1052840==    at 0x483BB1A: calloc (vg_replace_malloc.c:762)
==1052840==    by 0x48E1008: qcalloc (memory.c:110)
==1052840==    by 0x44D357: nhg_connected_new (zebra_nhg.c:73)
==1052840==    by 0x44D300: nhg_connected_tree_add_nhe (zebra_nhg.c:123)
==1052840==    by 0x44FBDC: depends_add (zebra_nhg.c:1077)
==1052840==    by 0x44FD62: depends_find_add (zebra_nhg.c:1090)
==1052840==    by 0x44E46D: zebra_nhg_find (zebra_nhg.c:567)
==1052840==    by 0x44E1FE: zebra_nhg_rib_find (zebra_nhg.c:1126)
==1052840==    by 0x45AD3D: rib_add_multipath (zebra_rib.c:2616)
==1052840==    by 0x4977DC: zread_route_add (zapi_msg.c:1596)
==1052840==    by 0x49ABB9: zserv_handle_commands (zapi_msg.c:2636)
==1052840==    by 0x428B11: main (main.c:309)
```

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
(cherry picked from commit 5bf15faa19288144c214ca48ef26e01512037ef6)
zebra/zebra_nhg.c
zebra/zebra_nhg_private.h