| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- pppd: Remove runtime kernel checks
- On embedded system distributions the required kernel features for pppd are
- more or less guaranteed to be present, so there is not much point in
- performing runtime checks, it just increases the binary size.
- This patch removes the runtime kernel feature checks.
- Signed-off-by: Jo-Philipp Wich <[email protected]>
- --- a/pppd/sys-linux.c
- +++ b/pppd/sys-linux.c
- @@ -220,14 +220,10 @@ static fd_set in_fds; /* set of fds tha
- static int max_in_fd; /* highest fd set in in_fds */
-
- static int has_proxy_arp = 0;
- -static int driver_version = 0;
- -static int driver_modification = 0;
- -static int driver_patch = 0;
- -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 */
- @@ -245,9 +241,8 @@ static int dynaddr_set; /* 1 if ip_dyna
- 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(4,9,0);
-
- #define MAX_IFS 100
-
- @@ -1966,11 +1961,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;
-
- @@ -1992,6 +1988,7 @@ static char *path_to_procfs(const char *
- fclose (fp);
- }
- }
- +#endif
-
- strlcpy(proc_path + proc_path_len, tail,
- sizeof(proc_path) - proc_path_len);
- @@ -2883,6 +2880,8 @@ ppp_registered(void)
-
- int ppp_check_kernel_support(void)
- {
- + return 1; /* OpenWrt support ppp device "/dev/ppp" by default */
- +#if 0
- int s, ok, fd;
- struct ifreq ifr;
- int size;
- @@ -3010,6 +3009,7 @@ int ppp_check_kernel_support(void)
- }
- close(s);
- return ok;
- +#endif
- }
-
- #ifndef HAVE_LOGWTMP
- @@ -3571,6 +3571,7 @@ get_pty(int *master_fdp, int *slave_fdp,
- }
- #endif /* TIOCGPTN */
-
- +#if 0
- if (sfd < 0) {
- /* the old way - scan through the pty name space */
- for (i = 0; i < 64; ++i) {
- @@ -3595,6 +3596,7 @@ get_pty(int *master_fdp, int *slave_fdp,
- }
- }
- }
- +#endif
-
- if (sfd < 0)
- return 0;
- @@ -3710,6 +3712,7 @@ get_host_seed(void)
- int
- sys_check_options(void)
- {
- +#if 0
- if (demand && driver_is_old) {
- ppp_option_error("demand dialling is not supported by kernel driver "
- "version %d.%d.%d", driver_version, driver_modification,
- @@ -3720,6 +3723,7 @@ sys_check_options(void)
- warn("Warning: multilink is not supported by the kernel driver");
- multilink = 0;
- }
- +#endif
- return 1;
- }
-
- --- a/pppd/plugins/pppoatm/pppoatm.c
- +++ b/pppd/plugins/pppoatm/pppoatm.c
- @@ -180,10 +180,6 @@ static void disconnect_pppoatm(void)
- void plugin_init(void)
- {
- #ifdef linux
- - extern int new_style_driver; /* From sys-linux.c */
- - if (!ppp_check_kernel_support() && !new_style_driver)
- - fatal("Kernel doesn't support ppp_generic - "
- - "needed for PPPoATM");
- #else
- fatal("No PPPoATM support on this OS");
- #endif
- --- a/pppd/plugins/pppoe/plugin.c
- +++ b/pppd/plugins/pppoe/plugin.c
- @@ -54,9 +54,6 @@
-
- char pppd_version[] = PPPD_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;
- @@ -418,10 +415,6 @@ PPPoEDevnameHook(char *cmd, char **argv,
- void
- plugin_init(void)
- {
- - if (!ppp_check_kernel_support() && !new_style_driver) {
- - fatal("Linux kernel does not support PPPoE -- are you running 2.4.x?");
- - }
- -
- ppp_add_options(Options);
-
- info("PPPoE plugin from pppd %s", PPPD_VERSION);
- --- a/pppd/plugins/pppol2tp/pppol2tp.c
- +++ b/pppd/plugins/pppol2tp/pppol2tp.c
- @@ -501,10 +501,6 @@ static void pppol2tp_cleanup(void)
- void plugin_init(void)
- {
- #if defined(__linux__)
- - extern int new_style_driver; /* From sys-linux.c */
- - if (!ppp_check_kernel_support() && !new_style_driver)
- - fatal("Kernel doesn't support ppp_generic - "
- - "needed for PPPoL2TP");
- #else
- fatal("No PPPoL2TP support on this OS");
- #endif
|