bfd: fix buffer leak when cannot send periodic packets 97/39997/2
authorAlexander Chernavin <achernavin@netgate.com>
Thu, 23 Nov 2023 11:36:09 +0000 (11:36 +0000)
committerMatthew Smith <mgsmith@netgate.com>
Mon, 27 Nov 2023 18:53:43 +0000 (18:53 +0000)
When a periodic BFD packet cannot be sent because the interface is
disabled, the allocated buffer needs to be freed. This currently will
occur for IPv4 sessions. However, buffers will leak for IPv6 sessions as
in this case, bfd_transport_control_frame() and bfd_transport_udp6()
will not indicate failure.

With this fix, stop always returning success in bfd_transport_udp6() and
start returning the actual return value.

Type: fix
Change-Id: I5fa4d9206e32cccae3053ef24966d80e2022fc81
Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
src/vnet/bfd/bfd_udp.c

index 2ba43a3..bf403df 100644 (file)
@@ -483,7 +483,7 @@ bfd_transport_udp6 (vlib_main_t *vm, vlib_node_runtime_t *rt, u32 bi,
                                     is_echo ? &bm->tx_echo_counter :
                                                     &bm->tx_counter);
     }
-  return 1;
+  return rv;
 }
 
 static bfd_session_t *