pppoed.c (ba174a5e38b1ab764c4a36ef4dd83e80c4add148) | pppoed.c (2966d28c322dcfa4b9db2558da0b91839e7798b9) |
---|---|
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 --- 244 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; | 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 --- 244 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[sizeof(HISMACADDR)+18], unknown[14], sessionid[5], *path; | 261 char env[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), "%s=%x:%x:%x:%x:%x:%x", HISMACADDR, | 355 snprintf(env, sizeof(env), "%x:%x:%x:%x:%x:%x", |
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 (putenv(env) != 0) 359 syslog(LOG_INFO, "putenv: cannot set %s: %m", env); | 358 if (setenv(HISMACADDR, env, 1) != 0) 359 syslog(LOG_INFO, "setenv: cannot set %s: %m", HISMACADDR); |
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 --- |