Root/package/ppp/patches/400-simplify_kernel_checks.patch

1--- a/pppd/sys-linux.c
2+++ b/pppd/sys-linux.c
3@@ -203,7 +203,7 @@ static int driver_is_old = 0;
4 static int restore_term = 0; /* 1 => we've munged the terminal */
5 static struct termios inittermios; /* Initial TTY termios */
6 
7-int new_style_driver = 0;
8+static const int new_style_driver = 1;
9 
10 static char loop_name[20];
11 static unsigned char inbuf[512]; /* buffer for chars read from loopback */
12@@ -220,8 +220,8 @@ static int looped; /* 1 if using loop
13 static int link_mtu; /* mtu for the link (not bundle) */
14 
15 static struct utsname utsname; /* for the kernel version */
16-static int kernel_version;
17 #define KVERSION(j,n,p) ((j)*1000000 + (n)*1000 + (p))
18+static const int kernel_version = KVERSION(2,6,37);
19 
20 #define MAX_IFS 100
21 
22@@ -1438,11 +1438,12 @@ int ccp_fatal_error (int unit)
23  *
24  * path_to_procfs - find the path to the proc file system mount point
25  */
26-static char proc_path[MAXPATHLEN];
27-static int proc_path_len;
28+static char proc_path[MAXPATHLEN] = "/proc";
29+static int proc_path_len = 5;
30 
31 static char *path_to_procfs(const char *tail)
32 {
33+#if 0
34     struct mntent *mntent;
35     FILE *fp;
36 
37@@ -1464,6 +1465,7 @@ static char *path_to_procfs(const char *
38         fclose (fp);
39     }
40     }
41+#endif
42 
43     strlcpy(proc_path + proc_path_len, tail,
44         sizeof(proc_path) - proc_path_len);
45@@ -2116,15 +2118,19 @@ int ppp_available(void)
46     int my_version, my_modification, my_patch;
47     int osmaj, osmin, ospatch;
48 
49+#if 0
50     /* get the kernel version now, since we are called before sys_init */
51     uname(&utsname);
52     osmaj = osmin = ospatch = 0;
53     sscanf(utsname.release, "%d.%d.%d", &osmaj, &osmin, &ospatch);
54     kernel_version = KVERSION(osmaj, osmin, ospatch);
55+#endif
56 
57     fd = open("/dev/ppp", O_RDWR);
58     if (fd >= 0) {
59+#if 0
60     new_style_driver = 1;
61+#endif
62 
63     /* XXX should get from driver */
64     driver_version = 2;
65@@ -2185,6 +2191,7 @@ int ppp_available(void)
66 
67     if (ok && ((ifr.ifr_hwaddr.sa_family & ~0xFF) != ARPHRD_PPP))
68     ok = 0;
69+ return ok;
70 
71 /*
72  * This is the PPP device. Validate the version of the driver at this
73@@ -2678,6 +2685,7 @@ get_pty(master_fdp, slave_fdp, slave_nam
74     }
75 #endif /* TIOCGPTN */
76 
77+#if 0
78     if (sfd < 0) {
79     /* the old way - scan through the pty name space */
80     for (i = 0; i < 64; ++i) {
81@@ -2696,6 +2704,7 @@ get_pty(master_fdp, slave_fdp, slave_nam
82         }
83     }
84     }
85+#endif
86 
87     if (sfd < 0)
88     return 0;
89--- a/pppd/plugins/pppoatm/pppoatm.c
90+++ b/pppd/plugins/pppoatm/pppoatm.c
91@@ -171,14 +171,6 @@ static void disconnect_pppoatm(void)
92 
93 void plugin_init(void)
94 {
95-#ifdef linux
96- extern int new_style_driver; /* From sys-linux.c */
97- if (!ppp_available() && !new_style_driver)
98- fatal("Kernel doesn't support ppp_generic - "
99- "needed for PPPoATM");
100-#else
101- fatal("No PPPoATM support on this OS");
102-#endif
103     info("PPPoATM plugin_init");
104     add_options(pppoa_options);
105 }
106--- a/pppd/plugins/rp-pppoe/plugin.c
107+++ b/pppd/plugins/rp-pppoe/plugin.c
108@@ -60,9 +60,6 @@ static char const RCSID[] =
109 
110 char pppd_version[] = VERSION;
111 
112-/* From sys-linux.c in pppd -- MUST FIX THIS! */
113-extern int new_style_driver;
114-
115 char *pppd_pppoe_service = NULL;
116 static char *acName = NULL;
117 static char *existingSession = NULL;
118@@ -340,10 +337,6 @@ PPPoEDevnameHook(char *cmd, char **argv,
119 void
120 plugin_init(void)
121 {
122- if (!ppp_available() && !new_style_driver) {
123- fatal("Linux kernel does not support PPPoE -- are you running 2.4.x?");
124- }
125-
126     add_options(Options);
127 
128     info("RP-PPPoE plugin version %s compiled against pppd %s",
129

Archive Download this file



interactive