--- ppp/pppd/sys-linux.c.orig 2004-10-02 18:36:40.864795256 +1000 +++ ppp/pppd/sys-linux.c 2004-10-02 18:36:46.356960320 +1000 @@ -97,6 +97,7 @@ #include #include #include +#include /* This is in netdevice.h. However, this compile will fail miserably if you attempt to include netdevice.h because it has so many references @@ -2112,6 +2113,47 @@ return 1; } if (kernel_version >= KVERSION(2,3,13)) { + char modprobePath[PATH_MAX] = ""; + int status, p, count; + pid_t pid; + + fd = open("/proc/sys/kernel/modprobe", O_RDONLY); + if (fd >= 0) { + int count = read(fd, modprobePath, PATH_MAX - 1); + if (count < 1) + modprobePath[0] = 0; + else if (modprobePath[count - 1] == '\n') + modprobePath[count - 1] = 0; + close(fd); + } + + if (modprobePath[0] == 0) + strcpy(modprobePath, "/sbin/modprobe"); + + switch (pid = fork()) { + case 0: /* child */ + setenv("PATH", "/sbin", 1); + status = execl(modprobePath, "modprobe", "ppp_generic", NULL); + case -1: /* couldn't fork */ + errno = ENOENT; + default: /* parent */ + do + p = waitpid(pid, &status, 0); + while (p == -1 && count++ < 4); + + sleep (5); + + } + + if ((fd = open("/dev/ppp", O_RDWR)) >= 0) { + new_style_driver = 1; + driver_version = 2; + driver_modification = 4; + driver_patch = 0; + close(fd); + return 1; + } + if (errno == ENOENT) no_ppp_msg = "pppd is unable to open the /dev/ppp device.\n"