]> git.puffer.fish Git - mirror/frr.git/commit
bgpd: Fix the order of NULL check and ZAPI decode 15921/head
authorCarmine Scarpitta <cscarpit@cisco.com>
Sun, 5 May 2024 05:25:57 +0000 (07:25 +0200)
committerCarmine Scarpitta <cscarpit@cisco.com>
Sun, 5 May 2024 05:25:57 +0000 (07:25 +0200)
commitbdc2c7bc5473b5582419702211c22e5d29bf0631
tree55294898b5c6f78541baa2a42644f23f8f84e93c
parentae3241b96d7be08d627f142030a41031492ffaf5
bgpd: Fix the order of NULL check and ZAPI decode

When BGP receives an SRV6_LOCATOR_ADD message from zebra, it calls the
`bgp_zebra_process_srv6_locator_add()` function to process the message.
`bgp_zebra_process_srv6_locator_add()` decodes the message first, and
then if the pointer to the default BGP instance is NULL (i.e. the
default BGP instance is not configured yet), it returns early without
doing anything and without using the decoded message information.

This commit fixes the order of the operations executed by
`bgp_zebra_process_srv6_locator_add()`. We first ensure that the default
BGP instance is ready and we return early if it is not. Then, we decode
the message and do something with the information contained in it.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
bgpd/bgp_zebra.c