summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>2001-09-03 06:38:16 +0000
committerJulian Elischer <julian@FreeBSD.org>2001-09-03 06:38:16 +0000
commit5c420e23fd7fb9f96ba60e33b437e415f48205a0 (patch)
treee80c05c97ee004146b33c7b2accc4a61cc28371b /sys
parent81396b1ed8294b6a1a83a474ceed24e0166ed433 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/netgraph/netgraph.h6
-rw-r--r--sys/netgraph/ng_base.c6
-rw-r--r--sys/netgraph/ng_pppoe.c51
-rw-r--r--sys/netgraph/ng_pppoe.h4
-rw-r--r--sys/netgraph/ng_socket.c1
5 files changed, 61 insertions, 7 deletions
diff --git a/sys/netgraph/netgraph.h b/sys/netgraph/netgraph.h
index adf1e801e570..fb29a8faccb5 100644
--- a/sys/netgraph/netgraph.h
+++ b/sys/netgraph/netgraph.h
@@ -297,6 +297,12 @@ DECLARE_MODULE(ng_##typename, ng_##typename##_mod, sub, order)
/* Special malloc() type for netgraph structs and ctrl messages */
MALLOC_DECLARE(M_NETGRAPH);
+/* declare the base of the netgraph sysctl hierarchy */
+/* but only if this file cares about sysctls */
+#ifdef SYSCTL_DECL
+SYSCTL_DECL(_net_graph);
+#endif
+
int ng_bypass(hook_p hook1, hook_p hook2);
void ng_cutlinks(node_p node);
int ng_con_nodes(node_p node,
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c
index 0d16ffdfaa89..c39d20c9373a 100644
--- a/sys/netgraph/ng_base.c
+++ b/sys/netgraph/ng_base.c
@@ -55,6 +55,7 @@
#include <sys/queue.h>
#include <sys/mbuf.h>
#include <sys/ctype.h>
+#include <sys/sysctl.h>
#include <machine/limits.h>
#include <net/netisr.h>
@@ -653,7 +654,7 @@ ng_unname(node_p node)
/*
* Remove a hook reference
*/
-static void
+void
ng_unref_hook(hook_p hook)
{
int s;
@@ -1801,6 +1802,9 @@ static moduledata_t netgraph_mod = {
(NULL)
};
DECLARE_MODULE(netgraph, netgraph_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
+SYSCTL_NODE(_net, OID_AUTO, graph, CTLFLAG_RW, 0, "netgraph Family");
+SYSCTL_INT(_net_graph, OID_AUTO, abi_version, CTLFLAG_RD, 0, NG_ABI_VERSION,"");
+SYSCTL_INT(_net_graph, OID_AUTO, msg_version, CTLFLAG_RD, 0, NG_VERSION, "");
/************************************************************************
Queueing routines
diff --git a/sys/netgraph/ng_pppoe.c b/sys/netgraph/ng_pppoe.c
index a07b269e480e..32b04c0ee92b 100644
--- a/sys/netgraph/ng_pppoe.c
+++ b/sys/netgraph/ng_pppoe.c
@@ -53,6 +53,7 @@
#include <sys/mbuf.h>
#include <sys/malloc.h>
#include <sys/errno.h>
+#include <sys/sysctl.h>
#include <net/ethernet.h>
#include <netgraph/ng_message.h>
@@ -63,7 +64,7 @@
/*
* This section contains the netgraph method declarations for the
- * sample node. These methods define the netgraph 'type'.
+ * pppoe node. These methods define the netgraph pppoe 'type'.
*/
static ng_constructor_t ng_pppoe_constructor;
@@ -159,11 +160,35 @@ struct PPPOE {
};
typedef struct PPPOE *priv_p;
-const struct ether_header eh_prototype =
+struct ether_header eh_prototype =
{{0xff,0xff,0xff,0xff,0xff,0xff},
{0x00,0x00,0x00,0x00,0x00,0x00},
ETHERTYPE_PPPOE_DISC};
+static int nonstandard;
+static int
+ngpppoe_set_ethertype(SYSCTL_HANDLER_ARGS)
+{
+ int error;
+ int val;
+
+ val = nonstandard;
+ error = sysctl_handle_int(oidp, &val, sizeof(int), req);
+ if (error != 0 || req->newptr == NULL)
+ return (error);
+ if (val == 1) {
+ nonstandard = 1;
+ eh_prototype.ether_type = ETHERTYPE_PPPOE_STUPID_DISC;
+ } else {
+ nonstandard = 0;
+ eh_prototype.ether_type = ETHERTYPE_PPPOE_DISC;
+ }
+ return (0);
+}
+
+SYSCTL_PROC(_net_graph, OID_AUTO, nonstandard, CTLTYPE_INT | CTLFLAG_RW,
+ 0, sizeof(int), ngpppoe_set_ethertype, "I", "nonstandard ethertype");
+
union uniq {
char bytes[sizeof(void *)];
void * pointer;
@@ -847,6 +872,10 @@ AAA
length = ntohs(wh->ph.length);
code = wh->ph.code;
switch(wh->eh.ether_type) {
+ case ETHERTYPE_PPPOE_STUPID_DISC:
+ nonstandard = 1;
+ eh_prototype.ether_type = ETHERTYPE_PPPOE_STUPID_DISC;
+ /* fall through */
case ETHERTYPE_PPPOE_DISC:
/*
* We need to try to make sure that the tag area
@@ -1026,7 +1055,11 @@ AAA
* from NEWCONNECTED to CONNECTED
*/
sp->pkt_hdr = neg->pkt->pkt_header;
- sp->pkt_hdr.eh.ether_type
+ if (nonstandard)
+ sp->pkt_hdr.eh.ether_type
+ = ETHERTYPE_PPPOE_STUPID_SESS;
+ else
+ sp->pkt_hdr.eh.ether_type
= ETHERTYPE_PPPOE_SESS;
sp->pkt_hdr.ph.code = 0;
pppoe_send_event(sp, NGM_PPPOE_SUCCESS);
@@ -1073,7 +1106,11 @@ AAA
* Keep a copy of the header we will be using.
*/
sp->pkt_hdr = neg->pkt->pkt_header;
- sp->pkt_hdr.eh.ether_type
+ if (nonstandard)
+ sp->pkt_hdr.eh.ether_type
+ = ETHERTYPE_PPPOE_STUPID_SESS;
+ else
+ sp->pkt_hdr.eh.ether_type
= ETHERTYPE_PPPOE_SESS;
sp->pkt_hdr.ph.code = 0;
m_freem(neg->m);
@@ -1104,6 +1141,7 @@ AAA
LEAVE(EPFNOSUPPORT);
}
break;
+ case ETHERTYPE_PPPOE_STUPID_SESS:
case ETHERTYPE_PPPOE_SESS:
/*
* find matching peer/session combination.
@@ -1352,7 +1390,10 @@ AAA
/* revert the stored header to DISC/PADT mode */
wh = &sp->pkt_hdr;
wh->ph.code = PADT_CODE;
- wh->eh.ether_type = ETHERTYPE_PPPOE_DISC;
+ if (nonstandard)
+ wh->eh.ether_type = ETHERTYPE_PPPOE_STUPID_DISC;
+ else
+ wh->eh.ether_type = ETHERTYPE_PPPOE_DISC;
/* generate a packet of that type */
MGETHDR(m, M_DONTWAIT, MT_DATA);
diff --git a/sys/netgraph/ng_pppoe.h b/sys/netgraph/ng_pppoe.h
index 7d2c47039ece..bb156debdbbf 100644
--- a/sys/netgraph/ng_pppoe.h
+++ b/sys/netgraph/ng_pppoe.h
@@ -151,6 +151,8 @@ struct ngpppoe_sts {
#define ETHERTYPE_PPPOE_DISC 0x8863 /* pppoe discovery packets */
#define ETHERTYPE_PPPOE_SESS 0x8864 /* pppoe session packets */
+#define ETHERTYPE_PPPOE_STUPID_DISC 0x3c12 /* pppoe discovery packets 3com? */
+#define ETHERTYPE_PPPOE_STUPID_SESS 0x3c13 /* pppoe session packets 3com? */
#else
#define PTT_EOL (0x0000)
#define PTT_SRV_NAME (0x0101)
@@ -165,6 +167,8 @@ struct ngpppoe_sts {
#define ETHERTYPE_PPPOE_DISC 0x6388 /* pppoe discovery packets */
#define ETHERTYPE_PPPOE_SESS 0x6488 /* pppoe session packets */
+#define ETHERTYPE_PPPOE_STUPID_DISC 0x123c /* pppoe discovery packets 3com? */
+#define ETHERTYPE_PPPOE_STUPID_SESS 0x133c /* pppoe session packets 3com? */
#endif
struct pppoe_tag {
diff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c
index f367e7100af5..b1a8e1116b89 100644
--- a/sys/netgraph/ng_socket.c
+++ b/sys/netgraph/ng_socket.c
@@ -1012,7 +1012,6 @@ ngs_mod_event(module_t mod, int event, void *data)
return (error);
}
-SYSCTL_NODE(_net, AF_NETGRAPH, graph, CTLFLAG_RW, 0, "netgraph Family");
SYSCTL_INT(_net_graph, OID_AUTO, family, CTLFLAG_RD, 0, AF_NETGRAPH, "");
SYSCTL_NODE(_net_graph, OID_AUTO, data, CTLFLAG_RW, 0, "DATA");
SYSCTL_INT(_net_graph_data, OID_AUTO, proto, CTLFLAG_RD, 0, NG_DATA, "");