diff options
author | brian <brian@FreeBSD.org> | 2002-05-14 12:33:40 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2002-05-14 12:33:40 +0000 |
commit | 15e2de7839ff141411705eb5c5939ff5bfe8f522 (patch) | |
tree | 40a303781f6f55cb413b10e1cd9805c4ae0c5e70 | |
parent | ff317ae810db8b39af7cb0f9e032e7e692a46044 (diff) | |
download | FreeBSD-src-15e2de7839ff141411705eb5c5939ff5bfe8f522.zip FreeBSD-src-15e2de7839ff141411705eb5c5939ff5bfe8f522.tar.gz |
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)
-rw-r--r-- | libexec/pppoed/pppoed.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libexec/pppoed/pppoed.c b/libexec/pppoed/pppoed.c index 55616f1..7d78324 100644 --- a/libexec/pppoed/pppoed.c +++ b/libexec/pppoed/pppoed.c @@ -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; |