summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/session.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-01-29 20:38:23 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-01-29 20:38:23 +0000
commit409929b879393a4a28d09eee4797e91c33838b87 (patch)
tree9789ae3c809e5248dabba40b3e14da07ec71a47c /usr.sbin/bgpd/session.c
parent7eb0a4572bc0eb98c8745f8958a9bcae36186f1a (diff)
enable tcp md5sig om the connecting socket when md5sig is configured for that
peer. I just successfully established an md5sig'd session against a cisco 7200 with that.
Diffstat (limited to 'usr.sbin/bgpd/session.c')
-rw-r--r--usr.sbin/bgpd/session.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index 5de5b5dce5d..df64ee801ef 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.103 2004/01/28 23:14:21 henning Exp $ */
+/* $OpenBSD: session.c,v 1.104 2004/01/29 20:38:22 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -740,7 +740,7 @@ session_accept(int listenfd)
int
session_connect(struct peer *peer)
{
- int n;
+ int n, opt = 1;
struct sockaddr *sa;
/*
@@ -758,6 +758,14 @@ session_connect(struct peer *peer)
return (-1);
}
+ if (peer->conf.tcp_md5_key[0])
+ if (setsockopt(peer->sock, IPPROTO_TCP, TCP_SIGNATURE_ENABLE,
+ &opt, sizeof(opt)) == -1) {
+ log_peer_warn(&peer->conf, "setsockopt md5sig");
+ bgp_fsm(peer, EVNT_CON_OPENFAIL);
+ return (-1);
+ }
+
peer->wbuf.sock = peer->sock;
/* if update source is set we need to bind() */