Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net kill unknown sessions ifdef, link set for sysctl.
details: https://anonhg.NetBSD.org/src/rev/cb3dde335582
branches: trunk
changeset: 347051:cb3dde335582
user: christos <christos%NetBSD.org@localhost>
date: Thu Aug 11 15:16:07 2016 +0000
description:
kill unknown sessions ifdef, link set for sysctl.
diffstat:
sys/net/if_pppoe.c | 35 +++++++++--------------------------
1 files changed, 9 insertions(+), 26 deletions(-)
diffs (124 lines):
diff -r 13e49a70cf84 -r cb3dde335582 sys/net/if_pppoe.c
--- a/sys/net/if_pppoe.c Thu Aug 11 15:03:23 2016 +0000
+++ b/sys/net/if_pppoe.c Thu Aug 11 15:16:07 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.116 2016/08/08 07:23:27 roy Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.117 2016/08/11 15:16:07 christos 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.116 2016/08/08 07:23:27 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.117 2016/08/11 15:16:07 christos Exp $");
#ifdef _KERNEL_OPT
#include "pppoe.h"
@@ -64,9 +64,6 @@
#include "ioconf.h"
-#undef PPPOE_DEBUG /* XXX - remove this or make it an option */
-/* #define PPPOE_DEBUG 1 */
-
struct pppoehdr {
uint8_t vertype;
uint8_t code;
@@ -205,15 +202,10 @@
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 void sysctl_net_pppoe_setup(struct sysctllog **);
static struct if_clone pppoe_cloner =
IF_CLONE_INITIALIZER("pppoe", pppoe_clone_create, pppoe_clone_destroy);
@@ -238,9 +230,7 @@
pppoe_softintr = softint_establish(SOFTINT_NET, pppoe_softintr_handler,
NULL);
-#ifdef _MODULE
sysctl_net_pppoe_setup(&pppoe_sysctl_clog);
-#endif
}
static int
@@ -255,9 +245,7 @@
if_clone_detach(&pppoe_cloner);
softint_disestablish(pppoe_softintr);
/* Remove our sysctl sub-tree */
-#ifdef _MODULE
sysctl_teardown(&pppoe_sysctl_clog);
-#endif
}
return error;
@@ -815,15 +803,13 @@
struct pppoehdr *ph;
struct ifnet *rcvif;
struct psref psref;
-#ifdef PPPOE_TERM_UNKNOWN_SESSIONS
uint8_t shost[ETHER_ADDR_LEN];
-#endif
KASSERT(m->m_flags & M_PKTHDR);
-#ifdef PPPOE_TERM_UNKNOWN_SESSIONS
- memcpy(shost, mtod(m, struct ether_header*)->ether_shost, ETHER_ADDR_LEN);
-#endif
+ if (pppoe_term_unknown)
+ memcpy(shost, mtod(m, struct ether_header*)->ether_shost,
+ ETHER_ADDR_LEN);
m_adj(m, sizeof(struct ether_header));
if (m->m_pkthdr.len <= PPPOE_HEADERLEN) {
printf("pppoe (data): dropping too short packet: %d bytes\n",
@@ -854,13 +840,11 @@
goto drop;
sc = pppoe_find_softc_by_session(session, rcvif);
if (sc == NULL) {
-#ifdef PPPOE_TERM_UNKNOWN_SESSIONS
if (pppoe_term_unknown) {
- printf("pppoe: input for unknown session 0x%x, "
+ printf("pppoe: input for unknown session %#x, "
"sending PADT\n", session);
pppoe_send_padt(rcvif, session, shost);
}
-#endif
m_put_rcvif_psref(rcvif, &psref);
goto drop;
}
@@ -1671,7 +1655,8 @@
return;
}
-SYSCTL_SETUP(sysctl_net_pppoe_setup, "sysctl net.pppoe subtree setup")
+static void
+sysctl_net_pppoe_setup(struct sysctllog **clog)
{
const struct sysctlnode *node = NULL;
@@ -1685,14 +1670,12 @@
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