]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/main.c
pppd: allow use of arbitrary interface names
[ppp.git] / pppd / main.c
index 6d50d1bac1d998e7ad359a1ec4e35852e3739e1d..f1986ed68d0b7e4d00f81b956e2abbb263b79d7a 100644 (file)
 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;
@@ -298,13 +298,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;
@@ -737,8 +730,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 */