ppp: add a few patches to reduce the package size
[openwrt/openwrt.git] / 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 @@ -1414,11 +1414,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 @@ -1440,6 +1441,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 @@ -2098,11 +2100,13 @@ int ppp_available(void)
46 "ppp.o exists in /lib/modules/`uname -r`/net.\n"
47 "See README.linux file in the ppp distribution for more details.\n";
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 0
59 @@ -2121,7 +2125,9 @@ int ppp_available(void)
60 }
61 #endif /* 0 */
62 if (fd >= 0) {
63 +#if 0
64 new_style_driver = 1;
65 +#endif
66
67 /* XXX should get from driver */
68 driver_version = 2;
69 @@ -2168,6 +2174,7 @@ int ppp_available(void)
70
71 if (ok && ((ifr.ifr_hwaddr.sa_family & ~0xFF) != ARPHRD_PPP))
72 ok = 0;
73 + return ok;
74
75 /*
76 * This is the PPP device. Validate the version of the driver at this
77 @@ -2659,6 +2666,7 @@ get_pty(master_fdp, slave_fdp, slave_nam
78 }
79 #endif /* TIOCGPTN */
80
81 +#if 0
82 if (sfd < 0) {
83 /* the old way - scan through the pty name space */
84 for (i = 0; i < 64; ++i) {
85 @@ -2677,6 +2685,7 @@ get_pty(master_fdp, slave_fdp, slave_nam
86 }
87 }
88 }
89 +#endif
90
91 if (sfd < 0)
92 return 0;