Deleted Added
full compact
pppoed.c (169121) pppoed.c (169177)
1/*-
2 * Copyright (c) 1999-2001 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1999-2001 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/libexec/pppoed/pppoed.c 169121 2007-04-30 12:27:58Z ache $
26 * $FreeBSD: head/libexec/pppoed/pppoed.c 169177 2007-05-01 16:02:44Z ache $
27 */
28
29#include <sys/param.h>
30#include <sys/socket.h>
31#include <sys/un.h>
32#include <netinet/in.h>
33#include <arpa/inet.h>
34#include <netdb.h>

--- 218 unchanged lines hidden (view full) ---

253Spawn(const char *prog, const char *acname, const char *provider,
254 const char *exec, struct ngm_connect ngc, int cs, int ds, void *request,
255 int sz, int debug)
256{
257 char msgbuf[sizeof(struct ng_mesg) + sizeof(struct ngpppoe_sts)];
258 struct ng_mesg *rep = (struct ng_mesg *)msgbuf;
259 struct ngpppoe_sts *sts = (struct ngpppoe_sts *)(msgbuf + sizeof *rep);
260 struct ngpppoe_init_data *data;
27 */
28
29#include <sys/param.h>
30#include <sys/socket.h>
31#include <sys/un.h>
32#include <netinet/in.h>
33#include <arpa/inet.h>
34#include <netdb.h>

--- 218 unchanged lines hidden (view full) ---

253Spawn(const char *prog, const char *acname, const char *provider,
254 const char *exec, struct ngm_connect ngc, int cs, int ds, void *request,
255 int sz, int debug)
256{
257 char msgbuf[sizeof(struct ng_mesg) + sizeof(struct ngpppoe_sts)];
258 struct ng_mesg *rep = (struct ng_mesg *)msgbuf;
259 struct ngpppoe_sts *sts = (struct ngpppoe_sts *)(msgbuf + sizeof *rep);
260 struct ngpppoe_init_data *data;
261 char env[18], unknown[14], sessionid[5], *path;
261 char env[sizeof(HISMACADDR)+18], unknown[14], sessionid[5], *path;
262 unsigned char *macaddr;
263 const char *msg;
264 int ret, slen;
265
266 switch ((ret = fork())) {
267 case -1:
268 syslog(LOG_ERR, "fork: %m");
269 break;

--- 77 unchanged lines hidden (view full) ---

347 syslog(LOG_INFO, "%s: Cannot add service on netgraph node: %m", path);
348 _exit(EX_OSERR);
349 }
350 }
351
352 /* Put the peer's MAC address in the environment */
353 if (sz >= sizeof(struct ether_header)) {
354 macaddr = ((struct ether_header *)request)->ether_shost;
262 unsigned char *macaddr;
263 const char *msg;
264 int ret, slen;
265
266 switch ((ret = fork())) {
267 case -1:
268 syslog(LOG_ERR, "fork: %m");
269 break;

--- 77 unchanged lines hidden (view full) ---

347 syslog(LOG_INFO, "%s: Cannot add service on netgraph node: %m", path);
348 _exit(EX_OSERR);
349 }
350 }
351
352 /* Put the peer's MAC address in the environment */
353 if (sz >= sizeof(struct ether_header)) {
354 macaddr = ((struct ether_header *)request)->ether_shost;
355 snprintf(env, sizeof(env), "%x:%x:%x:%x:%x:%x",
355 snprintf(env, sizeof(env), "%s=%x:%x:%x:%x:%x:%x", HISMACADDR,
356 macaddr[0], macaddr[1], macaddr[2], macaddr[3], macaddr[4],
357 macaddr[5]);
356 macaddr[0], macaddr[1], macaddr[2], macaddr[3], macaddr[4],
357 macaddr[5]);
358 if (setenv(HISMACADDR, env, 1) != 0)
359 syslog(LOG_INFO, "setenv: cannot set %s: %m", HISMACADDR);
358 if (putenv(env) != 0)
359 syslog(LOG_INFO, "putenv: cannot set %s: %m", env);
360 }
361
362 /* And send our request data to the waiting node */
363 if (debug)
364 syslog(LOG_INFO, "Sending original request to %s (%d bytes)", path, sz);
365 if (NgSendData(ds, ngc.ourhook, request, sz) == -1) {
366 syslog(LOG_ERR, "Cannot send original request to %s: %m", path);
367 _exit(EX_OSERR);

--- 325 unchanged lines hidden ---
360 }
361
362 /* And send our request data to the waiting node */
363 if (debug)
364 syslog(LOG_INFO, "Sending original request to %s (%d bytes)", path, sz);
365 if (NgSendData(ds, ngc.ourhook, request, sz) == -1) {
366 syslog(LOG_ERR, "Cannot send original request to %s: %m", path);
367 _exit(EX_OSERR);

--- 325 unchanged lines hidden ---