***********************************************************************/
static char const RCSID[] =
-"$Id: plugin.c,v 1.3 2002/02/12 04:36:00 mostrows Exp $";
+"$Id: plugin.c,v 1.5 2002/03/14 20:32:41 dfs Exp $";
#define _GNU_SOURCE 1
#include "pppoe.h"
/* From sys-linux.c in pppd -- MUST FIX THIS! */
extern int new_style_driver;
-static char *service = NULL;
+char *pppd_pppoe_service = NULL;
static char *acName = NULL;
static char *existingSession = NULL;
static int printACNames = 0;
-static int PPPoEDevnameHook(const char *name);
+static int PPPoEDevnameHook(const char **argv);
static option_t Options[] = {
{ "device name", o_wild, (void *) &PPPoEDevnameHook,
"PPPoE device name",
OPT_DEVNAM | OPT_PRIVFIX | OPT_NOARG | OPT_A2STRVAL | OPT_STATIC,
devnam},
- { "rp_pppoe_service", o_string, &service,
+ { "rp_pppoe_service", o_string, &pppd_pppoe_service,
"Desired PPPoE service name" },
{ "rp_pppoe_ac", o_string, &acName,
"Desired PPPoE access concentrator name" },
"Be verbose about discovered access concentrators"},
{ NULL }
};
-int (*OldDevnameHook)(const char *name) = NULL;
+int (*OldDevnameHook)(const char **argv) = NULL;
static PPPoEConnection *conn = NULL;
/**********************************************************************
if (acName) {
SET_STRING(conn->acName, acName);
}
- if (service) {
- SET_STRING(conn->serviceName, acName);
+ if (pppd_pppoe_service) {
+ SET_STRING(conn->serviceName, pppd_pppoe_service);
}
SET_STRING(conn->ifName, devnam);
conn->discoverySocket = -1;
/**********************************************************************
* %FUNCTION: PPPoEDevnameHook
* %ARGUMENTS:
- * name -- name of device
+ * argv -- argument vector for option
* %RETURNS:
* 1 if we will handle this device; 0 otherwise.
* %DESCRIPTION:
* sets up devnam (string representation of device).
***********************************************************************/
static int
-PPPoEDevnameHook(const char *name)
+PPPoEDevnameHook(const char **argv)
{
int r = 1;
int fd;
struct ifreq ifr;
+ char const *name = *argv;
+
+ /* Only do it if name is "ethXXX" */
+ /* Thanks to Russ Couturier for this fix */
+ if (strlen(name) < 4 || strncmp(name, "eth", 3)) {
+ return 0;
+ }
/* Open a socket */
if ((fd = socket(PF_PACKET, SOCK_RAW, 0)) < 0) {
return 1;
}
- if (OldDevnameHook) r = OldDevnameHook(name);
+ if (OldDevnameHook) r = OldDevnameHook(argv);
return r;
}