--- ./pppd/plugins/rp-pppoe/if.c.orig Sun Dec 7 23:04:12 2003 +++ ./pppd/plugins/rp-pppoe/if.c Sun Dec 7 23:07:31 2003 @@ -715,8 +715,10 @@ char base_dev[PATH_MAX]; int ppa; - if(strlen(ifname) > PATH_MAX) { - rp_fatal("socket: string to long"); + if (strlen(ifname) > PATH_MAX) { + rp_fatal("socket: Interface name too long"); + } else if (strlen(ifname) < 2) { + rp_fatal("socket: Interface name too short"); } ppa = atoi(&ifname[strlen(ifname)-1]); @@ -726,11 +728,23 @@ /* rearranged order of DLPI code - delphys 20010803 */ dlp = (union DL_primitives*) buf; - if (( fd = open(base_dev, O_RDWR)) < 0) { + if ((fd = open(base_dev, O_RDWR)) < 0) { /* Give a more helpful message for the common error case */ if (errno == EPERM) { rp_fatal("Cannot create raw socket -- pppoe must be run as root."); } + /* Common error is to omit /dev/ */ + if (errno == ENOENT) { + char ifname[512]; + snprintf(ifname, sizeof(ifname), "/dev/%s", base_dev); + if ((fd = open(ifname, O_RDWR)) < 0) { + if (errno == EPERM) { + rp_fatal("Cannot create raw socket -- pppoe must be run as root."); + } + } + } + } + if (fd < 0) { fatalSys("socket"); }