From d1c21cabdbeeb4d12049f39579c602686eb94927 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 25 Aug 2009 10:18:15 -0700 Subject: bgpd: fix md5 set on listen sockets * bgp_network.c: (bgp_md5_set) Missing piece from earlier listener change did not get ported from Vyatta code into upstream. The list listener_sockets changed from (int *) to (struct bgp_listener *). --- bgpd/bgp_network.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'bgpd') diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 4cb6f7d8..9e3427d2 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -97,8 +97,8 @@ int bgp_md5_set (struct peer *peer) { struct listnode *node; - int fret = 0, ret; - int *socket; + int ret = 0; + struct bgp_listener *listener; if ( bgpd_privs.change (ZPRIVS_RAISE) ) { @@ -109,16 +109,17 @@ bgp_md5_set (struct peer *peer) /* Just set the password on the listen socket(s). Outbound connections * are taken care of in bgp_connect() below. */ - for (ALL_LIST_ELEMENTS_RO(bm->listen_sockets, node, socket)) - { - ret = bgp_md5_set_socket ((int)(long)socket, &peer->su, peer->password); - if (ret < 0) - fret = ret; - } + for (ALL_LIST_ELEMENTS_RO(bm->listen_sockets, node, listener)) + if (listener->su.sa.sa_family == peer->su.sa.sa_family) + { + ret = bgp_md5_set_socket (listener->fd, &peer->su, peer->password); + break; + } + if (bgpd_privs.change (ZPRIVS_LOWER) ) zlog_err ("%s: could not lower privs", __func__); - return fret; + return ret; } /* Accept bgp connection. */ -- cgit v1.2.1