X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fmain.c;h=e09b6ffcce32bd06389d91da6276f24c1e009007;hb=5c765a67fd25f9d84e71ed61ace37c8c97f6be15;hp=aef9e84775922a59cf6fb960d6f3aea53914ad7a;hpb=66ae569f1c6fb12df8a463c8beb9afc0c7e5f7f0;p=ppp.git diff --git a/pppd/main.c b/pppd/main.c index aef9e84..e09b6ff 100644 --- a/pppd/main.c +++ b/pppd/main.c @@ -124,7 +124,7 @@ 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; @@ -297,13 +297,6 @@ struct protent *protocols[] = { 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; @@ -736,8 +729,11 @@ void 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 */ @@ -1755,7 +1751,7 @@ update_script_environment() script_env[i] = newstring; else add_script_env(i, newstring); - } else { + } else if (p != NULL) { remove_script_env(i); } }