static const char rcsid[] = RCSID;
/* interface vars */
-char ifname[32]; /* Interface name */
+char ifname[MAXIFNAMELEN]; /* Interface name */
int ifunit; /* Interface unit number */
struct channel *the_channel;
static void handle_events __P((void));
void print_link_stats __P((void));
-extern char *ttyname __P((int));
extern char *getlogin __P((void));
int main __P((int, char *[]));
NULL
};
-/*
- * If PPP_DRV_NAME is not defined, use the default "ppp" as the device name.
- */
-#if !defined(PPP_DRV_NAME)
-#define PPP_DRV_NAME "ppp"
-#endif /* !defined(PPP_DRV_NAME) */
-
int
main(argc, argv)
int argc;
set_ifunit(iskey)
int iskey;
{
- info("Using interface %s%d", PPP_DRV_NAME, ifunit);
- slprintf(ifname, sizeof(ifname), "%s%d", PPP_DRV_NAME, ifunit);
+ if (req_ifname[0] != '\0')
+ slprintf(ifname, sizeof(ifname), "%s", req_ifname);
+ else
+ slprintf(ifname, sizeof(ifname), "%s%d", PPP_DRV_NAME, ifunit);
+ info("Using interface %s", ifname);
script_setenv("IFNAME", ifname, iskey);
if (iskey) {
create_pidfile(getpid()); /* write pid to file */
update_system_environment();
execl("/bin/sh", "sh", "-c", program, (char *)0);
perror("pppd: could not exec /bin/sh");
- exit(99);
+ _exit(99);
/* NOTREACHED */
}
syslog(LOG_ERR, "Can't execute %s: %m", prog);
closelog();
}
- _exit(-1);
+ _exit(99);
}
free(p-1);
script_env[i] = newstring;
#ifdef USE_TDB
- if (iskey && pppdb != NULL)
- add_db_key(newstring);
- update_db_entry();
+ if (pppdb != NULL) {
+ if (iskey)
+ add_db_key(newstring);
+ update_db_entry();
+ }
#endif
return;
}