Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/lpr/lpd set IPV6_V6ONLY socket option for AF_INET6 ...



details:   https://anonhg.NetBSD.org/src/rev/e285c6a556f4
branches:  trunk
changeset: 536937:e285c6a556f4
user:      itojun <itojun%NetBSD.org@localhost>
date:      Tue Sep 24 13:31:33 2002 +0000

description:
set IPV6_V6ONLY socket option for AF_INET6 socket, to avoid
complicated access control issue due to IPv4 mapped address.

diffstat:

 usr.sbin/lpr/lpd/lpd.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 13eaaefa971d -r e285c6a556f4 usr.sbin/lpr/lpd/lpd.c
--- a/usr.sbin/lpr/lpd/lpd.c    Tue Sep 24 13:30:39 2002 +0000
+++ b/usr.sbin/lpr/lpd/lpd.c    Tue Sep 24 13:31:33 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lpd.c,v 1.42 2002/09/20 04:12:42 lukem Exp $   */
+/*     $NetBSD: lpd.c,v 1.43 2002/09/24 13:31:33 itojun Exp $  */
 
 /*
  * Copyright (c) 1983, 1993, 1994
@@ -45,7 +45,7 @@
 #if 0
 static char sccsid[] = "@(#)lpd.c      8.7 (Berkeley) 5/10/95";
 #else
-__RCSID("$NetBSD: lpd.c,v 1.42 2002/09/20 04:12:42 lukem Exp $");
+__RCSID("$NetBSD: lpd.c,v 1.43 2002/09/24 13:31:33 itojun Exp $");
 #endif
 #endif /* not lint */
 
@@ -788,6 +788,13 @@
                                close(s);
                                continue;
                        }
+                       if (r->ai_family == AF_INET6 && setsockopt(s,
+                           IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) {
+                               syslog(LOG_ERR,
+                                   "setsockopt (IPV6_V6ONLY): %m");
+                               close(s);
+                               continue;
+                       }
                        if (bind(s, r->ai_addr, r->ai_addrlen) < 0) {
                                syslog(LOG_DEBUG, "bind(): %m");
                                close(s);



Home | Main Index | Thread Index | Old Index