diff options
author | julian <julian@FreeBSD.org> | 2000-12-13 00:27:33 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2000-12-13 00:27:33 +0000 |
commit | 2f9510483656cbc312350e507024771791fe3d12 (patch) | |
tree | 5493dfecfcf4de1ea88694a14017116d2810c02d | |
parent | a4ad237eaa665b78919b8ff019591629b59df5e9 (diff) | |
download | FreeBSD-src-2f9510483656cbc312350e507024771791fe3d12.zip FreeBSD-src-2f9510483656cbc312350e507024771791fe3d12.tar.gz |
Add support for advertising the service we support if the
PADI packet contains a NULL service. This is apparently the desired
behaviour in this case, though we only allow advertising one
service. You could run multiple pppoeds to advertise multiple services.
-rw-r--r-- | libexec/pppoed/pppoed.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/libexec/pppoed/pppoed.c b/libexec/pppoed/pppoed.c index 1e4d24b..fa55252 100644 --- a/libexec/pppoed/pppoed.c +++ b/libexec/pppoed/pppoed.c @@ -247,7 +247,8 @@ ConfigureNode(const char *prog, const char *iface, const char *provider, } static void -Spawn(const char *prog, const char *acname, const char *exec, +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) { @@ -328,6 +329,22 @@ Spawn(const char *prog, const char *acname, const char *exec, syslog(LOG_INFO, "%s: Cannot OFFER on netgraph node: %m", path); _exit(EX_OSERR); } + /* If we have a provider code, set it */ + if (provider ) { + slen = strlen(provider); + data = (struct ngpppoe_init_data *)alloca(sizeof *data + slen); + snprintf(data->hook, sizeof data->hook, "%s", ngc.ourhook); + memcpy(data->data, provider, slen); + data->data_len = slen; + + syslog(LOG_INFO, "adding to %s as offered service %s", + path, acname); + if (NgSendMsg(cs, path, NGM_PPPOE_COOKIE, NGM_PPPOE_SERVICE, + data, sizeof *data + slen) == -1) { + syslog(LOG_INFO, "%s: Cannot add service on netgraph node: %m", path); + _exit(EX_OSERR); + } + } /* And send our request data to the waiting node */ if (debug) @@ -607,7 +624,7 @@ main(int argc, char **argv) ret = EX_UNAVAILABLE; break; } - Spawn(prog, acname, exec, ngc, cs, ds, response, sz, optd); + Spawn(prog, acname, provider, exec, ngc, cs, ds, response, sz, optd); } if (pidfile) |