From 88b96862d497e603cc9954d92de4eed288850462 Mon Sep 17 00:00:00 2001 From: itojun Date: Fri, 27 Sep 2002 14:43:00 +0000 Subject: [PATCH] IPV6_V6ONLY setsockopt has to happen before bind(2). PR 18435 --- usr.sbin/route6d/route6d.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index 38c817012a61..71fb3d8987ed 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -1,4 +1,4 @@ -/* $NetBSD: route6d.c,v 1.42 2002/09/24 13:48:14 itojun Exp $ */ +/* $NetBSD: route6d.c,v 1.43 2002/09/27 14:43:00 itojun Exp $ */ /* $KAME: route6d.c,v 1.88 2002/08/21 16:24:25 itojun Exp $ */ /* @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: route6d.c,v 1.42 2002/09/24 13:48:14 itojun Exp $"); +__RCSID("$NetBSD: route6d.c,v 1.43 2002/09/27 14:43:00 itojun Exp $"); #endif #include @@ -591,15 +591,15 @@ init(void) fatal("rip socket"); /*NOTREACHED*/ } - if (bind(ripsock, res->ai_addr, res->ai_addrlen) < 0) { - fatal("rip bind"); - /*NOTREACHED*/ - } if (setsockopt(ripsock, IPPROTO_IPV6, IPV6_V6ONLY, &int1, sizeof(int1)) < 0) { fatal("rip IPV6_V6ONLY"); /*NOTREACHED*/ } + if (bind(ripsock, res->ai_addr, res->ai_addrlen) < 0) { + fatal("rip bind"); + /*NOTREACHED*/ + } if (setsockopt(ripsock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &int255, sizeof(int255)) < 0) { fatal("rip IPV6_MULTICAST_HOPS");