Shuffle sysctls a bit (thankyou whoever made them dynamic for modules)
and add a sysctl to pppoe to activate non standard ethertypes so that idiot ISPs (apparently in France) who use equipment from idiot suppliers (rumour says 3com) who use nonstandard ethertypes can still connect. "yep, sure we do pppoe, we use a different identifier to that dictated in the standard, but sure it's pppoe!" sysctl -w net.graph.stupid_isp=1 enables the changeover.
This commit is contained in:
parent
7c1d4b3ae9
commit
bfa7e882d1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=72946
@ -164,6 +164,21 @@ This node shuts down upon receipt of a
|
||||
control message, when all session have been disconnected or when the
|
||||
.Dv ethernet
|
||||
hook is disconnected.
|
||||
.Sh SYSCTLs
|
||||
If you are one of the unfortunate people who have an ISP that
|
||||
uses some "pppoe" equipment from (I believe) 3com, and who have to
|
||||
use a different ethertype on pppoe packets
|
||||
(hey why not change it from the standard for
|
||||
no reason?) then after you have kldloaded or compiled in your pppoe node,
|
||||
you may have to do the following sysctl:
|
||||
.Bd -literal
|
||||
(kldload netgraph)
|
||||
(kldload ng_pppoe)
|
||||
sysctl -w net.graph.stupid_isp=1
|
||||
.Ed
|
||||
.Pp
|
||||
to enable the alternate ethertypes. Then phone your ISP and ask them
|
||||
why you need to set option "stupid_isp" for you to be able to connect.
|
||||
.Sh EXAMPLES
|
||||
The following code uses
|
||||
.Dv libnetgraph
|
||||
|
@ -1124,7 +1124,11 @@ MALLOC_DECLARE(M_NETGRAPH);
|
||||
MALLOC_DECLARE(M_NETGRAPH_MSG);
|
||||
MALLOC_DECLARE(M_NETGRAPH_META);
|
||||
|
||||
|
||||
/* declare the base of the netgraph sysclt hierarchy */
|
||||
/* but only if this file cares about sysctls */
|
||||
#ifdef SYSCTL_DECL
|
||||
SYSCTL_DECL(_net_graph);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Methods that the nodes can use.
|
||||
|
@ -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>
|
||||
@ -2948,6 +2949,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, "");
|
||||
|
||||
/************************************************************************
|
||||
Queue element get/free routines
|
||||
|
@ -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>
|
||||
@ -71,7 +72,7 @@ MALLOC_DEFINE(M_NETGRAPH_PPPOE, "netgraph_pppoe", "netgraph pppoe node");
|
||||
|
||||
/*
|
||||
* 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;
|
||||
@ -238,11 +239,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};
|
||||
|
||||
int stupid_isp;
|
||||
static int
|
||||
ngpppoe_set_ethertype(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
int error;
|
||||
int val;
|
||||
|
||||
val = stupid_isp;
|
||||
error = sysctl_handle_int(oidp, &val, sizeof(int), req);
|
||||
if (error != 0 || req->newptr == NULL)
|
||||
return (error);
|
||||
if (val == 1) {
|
||||
stupid_isp = 1;
|
||||
eh_prototype.ether_type = ETHERTYPE_PPPOE_STUPID_DISC;
|
||||
} else {
|
||||
stupid_isp = 0;
|
||||
eh_prototype.ether_type = ETHERTYPE_PPPOE_DISC;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_net_graph, OID_AUTO, stupid_isp, CTLTYPE_INT | CTLFLAG_RW,
|
||||
0, sizeof(int), ngpppoe_set_ethertype, "I", "select normal or stupid ISP");
|
||||
|
||||
union uniq {
|
||||
char bytes[sizeof(void *)];
|
||||
void * pointer;
|
||||
@ -902,6 +927,10 @@ AAA
|
||||
wh = mtod(m, struct pppoe_full_hdr *);
|
||||
length = ntohs(wh->ph.length);
|
||||
switch(wh->eh.ether_type) {
|
||||
case ETHERTYPE_PPPOE_STUPID_DISC:
|
||||
stupid_isp = 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
|
||||
@ -1099,7 +1128,11 @@ AAA
|
||||
* from NEWCONNECTED to CONNECTED
|
||||
*/
|
||||
sp->pkt_hdr = neg->pkt->pkt_header;
|
||||
sp->pkt_hdr.eh.ether_type
|
||||
if (stupid_isp)
|
||||
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);
|
||||
@ -1146,7 +1179,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 (stupid_isp)
|
||||
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);
|
||||
@ -1176,6 +1213,7 @@ AAA
|
||||
LEAVE(EPFNOSUPPORT);
|
||||
}
|
||||
break;
|
||||
case ETHERTYPE_PPPOE_STUPID_SESS:
|
||||
case ETHERTYPE_PPPOE_SESS:
|
||||
/*
|
||||
* find matching peer/session combination.
|
||||
@ -1423,7 +1461,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 (stupid_isp)
|
||||
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);
|
||||
|
@ -177,6 +177,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)
|
||||
@ -191,6 +193,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 {
|
||||
|
@ -1084,7 +1084,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, "");
|
||||
|
Loading…
Reference in New Issue
Block a user