summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Dale <richard.dale@codethink.co.uk>2015-06-15 09:07:45 +0000
committerRichard Dale <richard.dale@codethink.co.uk>2015-06-15 09:07:45 +0000
commitef17aeca1fdfdd4da5d0d4556034f3cdfa471f73 (patch)
tree699ff4050e3ce9d00685272bf5164b9167af9e02
parent5be4fa3b222290018354785ea2f24dd6caae7cdc (diff)
downloadppp-ef17aeca1fdfdd4da5d0d4556034f3cdfa471f73.tar.gz
simplify kernel checks
-rw-r--r--pppd/plugins/pppoatm/pppoatm.c8
-rw-r--r--pppd/plugins/pppol2tp/pppol2tp.c7
-rw-r--r--pppd/plugins/rp-pppoe/plugin.c7
-rw-r--r--pppd/sys-linux.c17
4 files changed, 14 insertions, 25 deletions
diff --git a/pppd/plugins/pppoatm/pppoatm.c b/pppd/plugins/pppoatm/pppoatm.c
index cef5ff7..d60f39d 100644
--- a/pppd/plugins/pppoatm/pppoatm.c
+++ b/pppd/plugins/pppoatm/pppoatm.c
@@ -168,14 +168,6 @@ static void disconnect_pppoatm(void)
void plugin_init(void)
{
-#if defined(__linux__)
- extern int new_style_driver; /* From sys-linux.c */
- if (!ppp_available() && !new_style_driver)
- fatal("Kernel doesn't support ppp_generic - "
- "needed for PPPoATM");
-#else
- fatal("No PPPoATM support on this OS");
-#endif
info("PPPoATM plugin_init");
add_options(pppoa_options);
}
diff --git a/pppd/plugins/pppol2tp/pppol2tp.c b/pppd/plugins/pppol2tp/pppol2tp.c
index 0e28606..6fa0e38 100644
--- a/pppd/plugins/pppol2tp/pppol2tp.c
+++ b/pppd/plugins/pppol2tp/pppol2tp.c
@@ -486,12 +486,7 @@ static void pppol2tp_cleanup(void)
void plugin_init(void)
{
-#if defined(__linux__)
- extern int new_style_driver; /* From sys-linux.c */
- if (!ppp_available() && !new_style_driver)
- fatal("Kernel doesn't support ppp_generic - "
- "needed for PPPoL2TP");
-#else
+#if !defined(__linux__)
fatal("No PPPoL2TP support on this OS");
#endif
add_options(pppol2tp_options);
diff --git a/pppd/plugins/rp-pppoe/plugin.c b/pppd/plugins/rp-pppoe/plugin.c
index d460136..13ea569 100644
--- a/pppd/plugins/rp-pppoe/plugin.c
+++ b/pppd/plugins/rp-pppoe/plugin.c
@@ -59,9 +59,6 @@ static char const RCSID[] =
char pppd_version[] = VERSION;
-/* From sys-linux.c in pppd -- MUST FIX THIS! */
-extern int new_style_driver;
-
char *pppd_pppoe_service = NULL;
static char *acName = NULL;
static char *existingSession = NULL;
@@ -371,10 +368,6 @@ PPPoEDevnameHook(char *cmd, char **argv, int doit)
void
plugin_init(void)
{
- if (!ppp_available() && !new_style_driver) {
- fatal("Linux kernel does not support PPPoE -- are you running 2.4.x?");
- }
-
add_options(Options);
info("RP-PPPoE plugin version %s compiled against pppd %s",
diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c
index 250bdc8..846a8f6 100644
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
@@ -196,7 +196,7 @@ static int driver_is_old = 0;
static int restore_term = 0; /* 1 => we've munged the terminal */
static struct termios inittermios; /* Initial TTY termios */
-int new_style_driver = 0;
+static const int new_style_driver = 1;
static char loop_name[20];
static unsigned char inbuf[512]; /* buffer for chars read from loopback */
@@ -214,8 +214,8 @@ static int looped; /* 1 if using loop */
static int link_mtu; /* mtu for the link (not bundle) */
static struct utsname utsname; /* for the kernel version */
-static int kernel_version;
#define KVERSION(j,n,p) ((j)*1000000 + (n)*1000 + (p))
+static const int kernel_version = KVERSION(2,6,37);
#define MAX_IFS 100
@@ -1451,11 +1451,12 @@ int ccp_fatal_error (int unit)
*
* path_to_procfs - find the path to the proc file system mount point
*/
-static char proc_path[MAXPATHLEN];
-static int proc_path_len;
+static char proc_path[MAXPATHLEN] = "/proc";
+static int proc_path_len = 5;
static char *path_to_procfs(const char *tail)
{
+#if 0
struct mntent *mntent;
FILE *fp;
@@ -1477,6 +1478,7 @@ static char *path_to_procfs(const char *tail)
fclose (fp);
}
}
+#endif
strlcpy(proc_path + proc_path_len, tail,
sizeof(proc_path) - proc_path_len);
@@ -2129,15 +2131,19 @@ int ppp_available(void)
int my_version, my_modification, my_patch;
int osmaj, osmin, ospatch;
+#if 0
/* get the kernel version now, since we are called before sys_init */
uname(&utsname);
osmaj = osmin = ospatch = 0;
sscanf(utsname.release, "%d.%d.%d", &osmaj, &osmin, &ospatch);
kernel_version = KVERSION(osmaj, osmin, ospatch);
+#endif
fd = open("/dev/ppp", O_RDWR);
if (fd >= 0) {
+#if 0
new_style_driver = 1;
+#endif
/* XXX should get from driver */
driver_version = 2;
@@ -2197,6 +2203,7 @@ int ppp_available(void)
if (ok && ((ifr.ifr_hwaddr.sa_family & ~0xFF) != ARPHRD_PPP))
ok = 0;
+ return ok;
/*
* This is the PPP device. Validate the version of the driver at this
@@ -2730,6 +2737,7 @@ get_pty(master_fdp, slave_fdp, slave_name, uid)
}
#endif /* TIOCGPTN */
+#if 0
if (sfd < 0) {
/* the old way - scan through the pty name space */
for (i = 0; i < 64; ++i) {
@@ -2748,6 +2756,7 @@ get_pty(master_fdp, slave_fdp, slave_name, uid)
}
}
}
+#endif
if (sfd < 0)
return 0;