summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-08-25 10:18:15 -0700
committerPaul Jakma <paul@quagga.net>2009-08-28 14:53:42 +0100
commitd1c21cabdbeeb4d12049f39579c602686eb94927 (patch)
treeaaaee477b15999c34175c80f6b3b1e99d2887150 /bgpd
parentc4cf095e95ae66c1a7b87bca95e61e50fec746ee (diff)
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 *).
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_network.c19
1 files changed, 10 insertions, 9 deletions
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. */