From 75721851a0028571fce205d7a9dfd2feb7e01805 Mon Sep 17 00:00:00 2001 From: Henning Brauer Date: Mon, 12 Jun 2006 12:45:15 +0000 Subject: 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 --- usr.sbin/bgpd/session.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'usr.sbin/bgpd') 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 @@ -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"); -- cgit v1.2.3