Source-Changes-HG archive

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

[src/trunk]: src For modular configurations, always build with PPPOE_TERM_UNK...



details:   https://anonhg.NetBSD.org/src/rev/326b91fdc9f6
branches:  trunk
changeset: 817068:326b91fdc9f6
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Aug 07 01:59:43 2016 +0000

description:
For modular configurations, always build with PPPOE_TERM_UNKNOWN_SESSIONS
defined, and provide a sysctl variable for enabling/disabling the option.

Update man page accordingly.

diffstat:

 share/man/man4/pppoe.4        |   8 ++++-
 sys/modules/if_pppoe/Makefile |   5 +--
 sys/net/if_pppoe.c            |  54 +++++++++++++++++++++++++++++++++++++++---
 3 files changed, 57 insertions(+), 10 deletions(-)

diffs (155 lines):

diff -r 3f345bd41f90 -r 326b91fdc9f6 share/man/man4/pppoe.4
--- a/share/man/man4/pppoe.4    Sun Aug 07 01:47:11 2016 +0000
+++ b/share/man/man4/pppoe.4    Sun Aug 07 01:59:43 2016 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: pppoe.4,v 1.36 2012/03/01 09:08:19 wiz Exp $
+.\"    $NetBSD: pppoe.4,v 1.37 2016/08/07 01:59:43 pgoyette Exp $
 .\"
 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 24, 2012
+.Dd August 7, 2016
 .Dt PPPOE 4
 .Os
 .Sh NAME
@@ -263,6 +263,10 @@
 .Pp
 .Dl options PPPOE_TERM_UNKNOWN_SESSIONS
 .Pp
+and set the value of
+.Xr sysctl 7
+variable net.pppoe.term_unknown to true.
+.Pp
 Note that this will break all userland
 .Nm PPPoE
 implementations using the same Ethernet interface!
diff -r 3f345bd41f90 -r 326b91fdc9f6 sys/modules/if_pppoe/Makefile
--- a/sys/modules/if_pppoe/Makefile     Sun Aug 07 01:47:11 2016 +0000
+++ b/sys/modules/if_pppoe/Makefile     Sun Aug 07 01:59:43 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2016/08/06 23:46:30 pgoyette Exp $
+# $NetBSD: Makefile,v 1.2 2016/08/07 01:59:43 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -9,7 +9,6 @@
 SRCS=          if_pppoe.c
 
 CPPFLAGS+=     -DPPPOE_SERVER
-#CPPFLAGS+=    -DPPPOE_TERM_UNKNOWN_SESSIONS   # This should not be
-                                               # enabled by default
+CPPFLAGS+=     -DPPPOE_TERM_UNKNOWN_SESSIONS
 
 .include <bsd.kmodule.mk>
diff -r 3f345bd41f90 -r 326b91fdc9f6 sys/net/if_pppoe.c
--- a/sys/net/if_pppoe.c        Sun Aug 07 01:47:11 2016 +0000
+++ b/sys/net/if_pppoe.c        Sun Aug 07 01:59:43 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.112 2016/08/06 23:46:30 pgoyette Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.113 2016/08/07 01:59:43 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.112 2016/08/06 23:46:30 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.113 2016/08/07 01:59:43 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -51,6 +51,7 @@
 #include <sys/socketvar.h>
 #include <sys/device.h>
 #include <sys/module.h>
+#include <sys/sysctl.h>
 
 #include <net/if.h>
 #include <net/if_types.h>
@@ -204,6 +205,16 @@
 static int     pppoe_clone_create(struct if_clone *, int);
 static int     pppoe_clone_destroy(struct ifnet *);
 
+#ifdef PPPOE_TERM_UNKNOWN_SESSIONS
+static bool    pppoe_term_unknown = false;
+#endif
+
+#ifdef _MODULE
+static struct sysctllog        *pppoe_sysctl_clog;
+#endif
+
+SYSCTL_SETUP_PROTO(sysctl_net_pppoe_setup);
+
 static struct if_clone pppoe_cloner =
     IF_CLONE_INITIALIZER("pppoe", pppoe_clone_create, pppoe_clone_destroy);
 
@@ -831,9 +842,11 @@
        sc = pppoe_find_softc_by_session(session, rcvif);
        if (sc == NULL) {
 #ifdef PPPOE_TERM_UNKNOWN_SESSIONS
-               printf("pppoe: input for unknown session 0x%x, sending PADT\n",
-                   session);
-               pppoe_send_padt(rcvif, session, shost);
+               if (pppoe_term_unknown) {
+                       printf("pppoe: input for unknown session 0x%x, "
+                           "sending PADT\n", session);
+                       pppoe_send_padt(rcvif, session, shost);
+               }
 #endif
                m_put_rcvif_psref(rcvif, &psref);
                goto drop;
@@ -1672,6 +1685,11 @@
 #endif  
                /* Init the cloner etc. */
                pppoeinit();
+
+#ifdef _MODULE
+               /* Create our sysctl subtree */
+               sysctl_net_pppoe_setup(&pppoe_sysctl_clog);
+#endif
                break;
 
         case MODULE_CMD_FINI:
@@ -1692,7 +1710,10 @@
                            "%d\n", __func__, pppoe_cd.cd_name, error);
                        break;
                }
+               /* Remove our sysctl sub-tree */
+               sysctl_teardown(&pppoe_sysctl_clog);
 #endif
+
                break;
        case MODULE_CMD_STAT:
        case MODULE_CMD_AUTOUNLOAD:
@@ -1702,3 +1723,26 @@
        return error;
 }
 
+SYSCTL_SETUP(sysctl_net_pppoe_setup, "sysctl net.pppoe subtree setup")
+{
+       const struct sysctlnode *node = NULL;
+
+       sysctl_createv(clog, 0, NULL, &node,
+           CTLFLAG_PERMANENT,
+           CTLTYPE_NODE, "pppoe",
+           SYSCTL_DESCR("PPPOE protocol"),
+           NULL, 0, NULL, 0,
+           CTL_NET, CTL_CREATE, CTL_EOL);
+
+       if (node == NULL)
+               return;
+
+#ifdef PPPOE_TERM_UNKNOWN_SESSIONS
+       sysctl_createv(clog, 0, &node, NULL,
+           CTLFLAG_PERMANENT | CTLFLAG_READONLY,
+           CTLTYPE_BOOL, "term_unknown",
+           SYSCTL_DESCR("Terminate unknown sessions"),
+           NULL, 0, &pppoe_term_unknown, sizeof(pppoe_term_unknown),
+           CTL_CREATE, CTL_EOL);
+#endif
+}



Home | Main Index | Thread Index | Old Index