mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-23 16:01:42 +00:00
Understand the new NGM_PPPOE_SESSIONID message and set SESSIONID
in the environment to it's value. Approved by: archie (after a very cursory glance)
This commit is contained in:
parent
348df1aa25
commit
629d0dd5e0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=96580
@ -63,6 +63,7 @@
|
||||
|
||||
#define DEFAULT_EXEC_PREFIX "exec /usr/sbin/ppp -direct "
|
||||
#define HISMACADDR "HISMACADDR"
|
||||
#define SESSION_ID "SESSION_ID"
|
||||
|
||||
static void nglogx(const char *, ...) __printflike(1, 2);
|
||||
|
||||
@ -257,8 +258,8 @@ Spawn(const char *prog, const char *acname, const char *provider,
|
||||
struct ng_mesg *rep = (struct ng_mesg *)msgbuf;
|
||||
struct ngpppoe_sts *sts = (struct ngpppoe_sts *)(msgbuf + sizeof *rep);
|
||||
struct ngpppoe_init_data *data;
|
||||
char env[sizeof(HISMACADDR)+18], unknown[14], sessionid[5], *path;
|
||||
unsigned char *macaddr;
|
||||
char env[sizeof(HISMACADDR)+18], unknown[14], *path;
|
||||
const char *msg;
|
||||
int ret, slen;
|
||||
|
||||
@ -350,7 +351,6 @@ Spawn(const char *prog, const char *acname, const char *provider,
|
||||
|
||||
/* Put the peer's MAC address in the environment */
|
||||
if (sz >= sizeof(struct ether_header)) {
|
||||
|
||||
macaddr = ((struct ether_header *)request)->ether_shost;
|
||||
snprintf(env, sizeof(env), "%s=%x:%x:%x:%x:%x:%x", HISMACADDR,
|
||||
macaddr[0], macaddr[1], macaddr[2], macaddr[3], macaddr[4],
|
||||
@ -411,6 +411,13 @@ Spawn(const char *prog, const char *acname, const char *provider,
|
||||
syslog(LOG_WARNING, "setenv: cannot set ACNAME=%s: %m",
|
||||
sts->hook);
|
||||
break;
|
||||
case NGM_PPPOE_SESSIONID:
|
||||
msg = "SESSIONID";
|
||||
snprintf(sessionid, sizeof sessionid, "%04x", *(u_int16_t *)sts);
|
||||
if (setenv("SESSIONID", sessionid, 1) != 0)
|
||||
syslog(LOG_WARNING, "setenv: cannot set SESSIONID=%s: %m",
|
||||
sessionid);
|
||||
break;
|
||||
default:
|
||||
snprintf(unknown, sizeof unknown, "<%d>", (int)rep->header.cmd);
|
||||
msg = unknown;
|
||||
|
Loading…
Reference in New Issue
Block a user