summaryrefslogtreecommitdiffstats
path: root/libexec/pppoed
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2001-11-21 03:29:43 +0000
committerbrian <brian@FreeBSD.org>2001-11-21 03:29:43 +0000
commit2f112e8511b81d32e494e76237bf6b5b7ec33755 (patch)
tree6488db2bdcc4b948570bd0aadb7705f1515fbc6c /libexec/pppoed
parent33425adab60f16afec99080a04f626aaa5c2344c (diff)
downloadFreeBSD-src-2f112e8511b81d32e494e76237bf6b5b7ec33755.zip
FreeBSD-src-2f112e8511b81d32e494e76237bf6b5b7ec33755.tar.gz
Set HISMACADDR in the environment before envoking ppp.
MFC after: 1 week
Diffstat (limited to 'libexec/pppoed')
-rw-r--r--libexec/pppoed/pppoed.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/libexec/pppoed/pppoed.c b/libexec/pppoed/pppoed.c
index 424bd15..9d9eb8a 100644
--- a/libexec/pppoed/pppoed.c
+++ b/libexec/pppoed/pppoed.c
@@ -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);
OpenPOWER on IntegriCloud