Set HISMACADDR in the environment before envoking ppp.

MFC after:	1 week
This commit is contained in:
brian 2001-11-21 03:29:43 +00:00
parent 33425adab6
commit 2f112e8511

View File

@ -61,7 +61,8 @@
#include <unistd.h>
#define DEFAULT_EXEC_PREFIX "exec /usr/sbin/ppp -direct "
#define DEFAULT_EXEC_PREFIX "exec /usr/sbin/ppp -direct "
#define HISMACADDR "HISMACADDR"
static int ReceivedSignal;
@ -247,15 +248,15 @@ ConfigureNode(const char *prog, const char *iface, const char *provider,
static void
Spawn(const char *prog, const char *acname, const char *provider,
const char *exec,
struct ngm_connect ngc, int cs, int ds, void *request, int sz,
int debug)
const char *exec, struct ngm_connect ngc, int cs, int ds, void *request,
int sz, int debug)
{
char msgbuf[sizeof(struct ng_mesg) + sizeof(struct ngpppoe_sts)];
struct ng_mesg *rep = (struct ng_mesg *)msgbuf;
struct ngpppoe_sts *sts = (struct ngpppoe_sts *)(msgbuf + sizeof *rep);
struct ngpppoe_init_data *data;
char unknown[14], *path;
unsigned char *macaddr;
char env[sizeof(HISMACADDR)+18], unknown[14], *path;
const char *msg;
int ret, slen;
@ -345,6 +346,17 @@ 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=%2x:%2x:%2x:%2x:%2x:%2x", HISMACADDR,
macaddr[0], macaddr[1], macaddr[2], macaddr[3], macaddr[4],
macaddr[5]);
if (putenv(env) != 0)
syslog(LOG_INFO, "putenv: cannot set %s: %m", env);
}
/* And send our request data to the waiting node */
if (debug)
syslog(LOG_INFO, "Sending original request to %s (%d bytes)", path, sz);