summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/session.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2006-06-12 12:45:15 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2006-06-12 12:45:15 +0000
commit75721851a0028571fce205d7a9dfd2feb7e01805 (patch)
tree253bae55ec0a017608cc66fda861f7b5a569950f /usr.sbin/bgpd/session.c
parent6fd857cc505ab813edd337f7effa013bb91b23fd (diff)
in session_setup_socket(), to take address family dependent action
(set v4 TTL/v6 hoplimit, v4 TOS), do not look at remote sockaddr's af, since that is not set at the first connection attempt yet. instead, use the configured remote address' af. problem spotted & my fix tested by Leen Besselink <leen@consolejunkie.net>
Diffstat (limited to 'usr.sbin/bgpd/session.c')
-rw-r--r--usr.sbin/bgpd/session.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index d66cc498389..e322bd19a22 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.250 2006/06/10 16:32:38 henning Exp $ */
+/* $OpenBSD: session.c,v 1.251 2006/06/12 12:45:14 henning Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@@ -1072,7 +1072,7 @@ session_setup_socket(struct peer *p)
int nodelay = 1;
int bsize;
- if (p->conf.ebgp && p->sa_remote.ss_family == AF_INET)
+ if (p->conf.ebgp && p->conf.remote_addr.af == AF_INET)
/* set TTL to foreign router's distance - 1=direct n=multihop */
if (setsockopt(p->fd, IPPROTO_IP, IP_TTL, &ttl,
sizeof(ttl)) == -1) {
@@ -1081,7 +1081,7 @@ session_setup_socket(struct peer *p)
return (-1);
}
- if (p->conf.ebgp && p->sa_remote.ss_family == AF_INET6)
+ if (p->conf.ebgp && p->conf.remote_addr.af == AF_INET6)
/* set hoplimit to foreign router's distance */
if (setsockopt(p->fd, IPPROTO_IPV6, IPV6_HOPLIMIT, &ttl,
sizeof(ttl)) == -1) {
@@ -1099,7 +1099,7 @@ session_setup_socket(struct peer *p)
}
/* set precedence, see rfc1771 appendix 5 */
- if (p->sa_remote.ss_family == AF_INET &&
+ if (p->conf.remote_addr.af == AF_INET &&
setsockopt(p->fd, IPPROTO_IP, IP_TOS, &pre, sizeof(pre)) == -1) {
log_peer_warn(&p->conf,
"session_setup_socket setsockopt TOS");