Add configuration option "set pppoe [standard|3Com]" which allows
to configure mode for ng_pppoe(4) node under control. Reviewed by: brian Approved by: julian (mentor)
This commit is contained in:
parent
e9346e012d
commit
b5bc6d4db0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132818
@ -143,6 +143,7 @@
|
||||
#define VAR_MPPE 36
|
||||
#define VAR_IPV6CPRETRY 37
|
||||
#define VAR_RAD_ALIVE 38
|
||||
#define VAR_PPPOE 39
|
||||
|
||||
/* ``accept|deny|disable|enable'' masks */
|
||||
#define NEG_HISMASK (1)
|
||||
@ -2294,6 +2295,18 @@ SetVariable(struct cmdargs const *arg)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case VAR_PPPOE:
|
||||
if (strcasecmp(argp, "3Com") == 0)
|
||||
physical_SetPPPoEnonstandard(arg->cx->physical, 1);
|
||||
else if (strcasecmp(argp, "standard") == 0)
|
||||
physical_SetPPPoEnonstandard(arg->cx->physical, 0);
|
||||
else {
|
||||
log_Printf(LogWARN, "PPPoE standard value must be \"standard\" or \"3Com\"\n");
|
||||
res = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -2422,6 +2435,9 @@ static struct cmdtab const SetCommands[] = {
|
||||
"vj values", "set vj slots|slotcomp [value]"},
|
||||
{"help", "?", HelpCommand, LOCAL_AUTH | LOCAL_NO_AUTH,
|
||||
"Display this message", "set help|? [command]", SetCommands},
|
||||
{"pppoe", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
|
||||
"Connect using standard/3Com mode", "set pppoe [standard|3Com]",
|
||||
(const char *)VAR_PPPOE},
|
||||
{NULL, NULL, NULL},
|
||||
};
|
||||
|
||||
|
@ -443,7 +443,7 @@ ether_Create(struct physical *p)
|
||||
struct ng_mesg *resp;
|
||||
const struct hooklist *hlist;
|
||||
const struct nodeinfo *ninfo;
|
||||
char *path, *sessionid;
|
||||
char *path, *sessionid, *mode;
|
||||
int ifacelen, f;
|
||||
|
||||
dev = NULL;
|
||||
@ -621,6 +621,19 @@ ether_Create(struct physical *p)
|
||||
log_Printf(LogWARN, "%s: Failed to set the IFF_UP flag on %s\n",
|
||||
p->link.name, path);
|
||||
|
||||
snprintf(connectpath, sizeof connectpath, ".:%s", dev->hook);
|
||||
|
||||
/* Configure node to 3Com mode if needed */
|
||||
if (p->cfg.pppoe_configured) {
|
||||
mode = p->cfg.nonstandard_pppoe ? NG_PPPOE_NONSTANDARD : NG_PPPOE_STANDARD;
|
||||
if (NgSendMsg(dev->cs, connectpath, NGM_PPPOE_COOKIE,
|
||||
NGM_PPPOE_SETMODE, mode, strlen(mode) + 1) == -1) {
|
||||
log_Printf(LogWARN, "``%s'': Cannot configure netgraph node: %s\n",
|
||||
connectpath, strerror(errno));
|
||||
return ether_Abandon(dev, p);
|
||||
}
|
||||
}
|
||||
|
||||
/* And finally, request a connection to the given provider */
|
||||
|
||||
data = (struct ngpppoe_init_data *)alloca(sizeof *data + providerlen);
|
||||
@ -628,7 +641,6 @@ ether_Create(struct physical *p)
|
||||
memcpy(data->data, provider, providerlen);
|
||||
data->data_len = providerlen;
|
||||
|
||||
snprintf(connectpath, sizeof connectpath, ".:%s", dev->hook);
|
||||
log_Printf(LogDEBUG, "Sending PPPOE_CONNECT to %s\n", connectpath);
|
||||
if (NgSendMsg(dev->cs, connectpath, NGM_PPPOE_COOKIE,
|
||||
NGM_PPPOE_CONNECT, data, sizeof *data + providerlen) == -1) {
|
||||
|
@ -1129,3 +1129,11 @@ physical_Slot(struct physical *p)
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
physical_SetPPPoEnonstandard(struct physical *p, int enable)
|
||||
{
|
||||
p->cfg.nonstandard_pppoe = enable ? 1 : 0;
|
||||
p->cfg.pppoe_configured = 1;
|
||||
return 1;
|
||||
}
|
||||
|
@ -104,6 +104,8 @@ struct physical {
|
||||
|
||||
struct {
|
||||
unsigned rts_cts : 1; /* Is rts/cts enabled ? */
|
||||
unsigned nonstandard_pppoe : 1; /* Is PPPoE mode nonstandard */
|
||||
unsigned pppoe_configured : 1; /* temporary hack */
|
||||
unsigned parity; /* What parity is enabled? (tty flags) */
|
||||
unsigned speed; /* tty speed */
|
||||
|
||||
@ -171,3 +173,4 @@ extern int physical_AwaitCarrier(struct physical *);
|
||||
extern void physical_SetDescriptor(struct physical *);
|
||||
extern void physical_SetAsyncParams(struct physical *, u_int32_t, u_int32_t);
|
||||
extern int physical_Slot(struct physical *);
|
||||
extern int physical_SetPPPoEnonstandatd(struct physical *, int);
|
||||
|
@ -27,7 +27,7 @@ changecom(,)dnl
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 20, 1995
|
||||
.Dd July 20, 2004
|
||||
.Dt PPP 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -5256,6 +5256,11 @@ below.
|
||||
In
|
||||
.Fl background
|
||||
mode, each number is attempted at most once.
|
||||
.It set pppoe Op standard|3Com
|
||||
This option configures the underlying
|
||||
.Xr ng_pppoe 4
|
||||
node to either standard RFC2516 PPPoE or proprietary 3Com mode.
|
||||
If not set the system default will be used.
|
||||
.It set Op proc Ns Xo
|
||||
.No title Op Ar value
|
||||
.Xc
|
||||
|
Loading…
Reference in New Issue
Block a user