From owner-freebsd-net@FreeBSD.ORG Sun Sep 17 21:36:12 2006 Return-Path: X-Original-To: net@freebsd.org Delivered-To: freebsd-net@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8459716A407; Sun, 17 Sep 2006 21:36:12 +0000 (UTC) (envelope-from jhs@flat.berklix.net) Received: from thin.berklix.org (thin.berklix.org [194.246.123.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5E71843D45; Sun, 17 Sep 2006 21:36:10 +0000 (GMT) (envelope-from jhs@flat.berklix.net) Received: from js.berklix.net (p549A6AEA.dip.t-dialin.net [84.154.106.234]) (authenticated bits=128) by thin.berklix.org (8.12.11/8.12.11) with ESMTP id k8HLa68E075464; Sun, 17 Sep 2006 23:36:06 +0200 (CEST) (envelope-from jhs@flat.berklix.net) Received: from fire.jhs.private (fire.jhs.private [192.168.91.41]) by js.berklix.net (8.13.6/8.13.6) with ESMTP id k8HLZvQq001129; Sun, 17 Sep 2006 23:36:02 +0200 (CEST) (envelope-from jhs@flat.berklix.net) Received: from fire.jhs.private (localhost [127.0.0.1]) by fire.jhs.private (8.13.6/8.13.6) with ESMTP id k8HLZvN5094226; Sun, 17 Sep 2006 23:35:57 +0200 (CEST) (envelope-from jhs@fire.jhs.private) Message-Id: <200609172135.k8HLZvN5094226@fire.jhs.private> To: Hajimu UMEMOTO In-reply-to: <20060917120701.4d8eb7ec@dev.lan.Awfulhak.org> References: <200609141344.k8EDiI42092840@flat.berklix.org> <20060917120701.4d8eb7ec@dev.lan.Awfulhak.org> Comments: In-reply-to Brian Somers message dated "Sun, 17 Sep 2006 12:07:01 -0700." Date: Sun, 17 Sep 2006 23:35:57 +0200 From: "Julian H. Stacey" Cc: Gary Jennejohn , Brian Somers , net@freebsd.org Subject: Re: ppp command port does not listens on ipv4 unless no INET6 in kernel X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Sep 2006 21:36:12 -0000 Brian Somers wrote: > On Sun, 17 Sep 2006 20:10:47 +0900 Hajimu UMEMOTO wrote: > > Hi, > > > > >>>>> On Thu, 14 Sep 2006 15:44:18 +0200 (CEST) > > >>>>> "Julian Stacey" said: > > > > jhs> I'm not clear if this is a bug or a config error: > > jhs> It seems though my /usr/sbin/ppp was moving traffic > > jhs> to & from internet, it was only listening for commands > > jhs> (not data) on ipv6, not ipv4, thus I could not type commands > > jhs> like dial & drop, unless instead of running ppp -auto > > jhs> instead I invoked ppp manually in foreground on localhost. > > > > As far as I read the source of ppp(8), it only listen on an IPv6, and > > expects to listen on an IPv4 through an IPv4-mapped IPv6 address. > > However, an IPv4-mapped IPv6 address feature is disabled by default. > > ppp(8) should be rewritten to listen on both an IPv4 and an IPv6. > > But, it is slightly complex. So, I made a patch to enable an > > IPv4-mapped IPv6 address only for the socket that ppp(8) is listening > > on. > > I have no environment for testing this. Could you try this patch? > > > > Index: usr.sbin/ppp/server.c > > diff -u -p usr.sbin/ppp/server.c.orig usr.sbin/ppp/server.c > > --- usr.sbin/ppp/server.c.orig Sun Sep 5 10:46:52 2004 > > +++ usr.sbin/ppp/server.c Sun Sep 17 19:54:43 2006 > > @@ -346,6 +346,13 @@ server_TcpOpen(struct bundle *bundle, u_ > > goto failed; > > } > > > > +#ifndef NOINET6 > > + if (probe.ipv6_available) { > > + int off = 0; > > + setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&off, sizeof(off)); > > + } > > +#endif > > + > > setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &s, sizeof s); > > if (bind(s, (struct sockaddr *)&ss, sz) < 0) { > > log_Printf(LogWARN, "Tcp: bind: %s\n", strerror(errno)); > > > > > > Sincerely, > > AFAIR I had trouble getting that code to work and was advised at > the time that I'd just get the mapped port for free. I haven't > been using IPv6 on production machines for some time, so I haven't > seen the problem :( > > It'd be great if you'd commit the patch if Julian says it works > ok for him. Tested. It Works. Thanks ! I tested the patch on PPP running under both kernels IPV4+6 & V4only just to be sure, it works on both, & allows me to type dial & down (all I tried or wanted.) Output With patch: ------------------------ strings /boot/kernel/kernel | grep ___ | grep INET ___options INET ___options INET6 sockstat -l USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS root ppp 939 9 tcp46 *:12345 *:* ------------------------ strings /boot/kernel/kernel | grep ___ | grep INET ___options INET ___# options INET6 sockstat -l USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS root ppp 931 9 tcp4 *:12345 *:* ------------------------ Old V4+6 Kernel pre patch: USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS root ppp 1020 9 tcp6 *:12345 *:* I hope it's commited. (Dont't know if a 2nd tester is needed to verify ?) Thanks Hajimu :-) Julian -- Julian Stacey. BSD Unix C Net Consultancy, Munich/Muenchen http://berklix.com Mail Ascii, not HTML. Ihr Rauch = mein allergischer Kopfschmerz. Don't buy it ! Get it free ! http://berklix.org/free-software