ppp command port does not listens on ipv4 unless no INET6 in kernel

Hajimu UMEMOTO ume at freebsd.org
Sun Sep 17 04:11:27 PDT 2006


Hi,

>>>>> On Thu, 14 Sep 2006 15:44:18 +0200 (CEST)
>>>>> "Julian Stacey" <jhs at berklix.org> 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,

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume at mahoroba.org  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/


More information about the freebsd-net mailing list