]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: remove useless control checks about TCP connection
authorPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 5 Apr 2024 11:52:27 +0000 (13:52 +0200)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Mon, 11 Nov 2024 08:27:21 +0000 (08:27 +0000)
When attempting to get the src and destination addresses of a given
connection, the API may return the NULL pointer, but further code
in bgp_zebra_nexthop_set() already does a check about the given
pointer.

Relaxing the error code for all the returned adressing.

Fixes: 1ff9a340588a ("bgpd: bgpd-fsm-fix.patch")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit ba7130309954fbe8d58854339ca43259149e603a)

bgpd/bgp_network.c

index b874e7211f9fb2c857988012b612a515283dfd36..f08881512a4b9b56a554bdb10f6e502d068ef113 100644 (file)
@@ -876,11 +876,7 @@ int bgp_getsockname(struct peer *peer)
        }
 
        peer->su_local = sockunion_getsockname(peer->connection->fd);
-       if (!peer->su_local)
-               return -1;
        peer->su_remote = sockunion_getpeername(peer->connection->fd);
-       if (!peer->su_remote)
-               return -1;
 
        if (!bgp_zebra_nexthop_set(peer->su_local, peer->su_remote,
                                   &peer->nexthop, peer)) {