Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled

This commit is contained in:
domenico
2025-06-24 14:35:53 +02:00
commit c06fb25d1f
9263 changed files with 1750214 additions and 0 deletions

View File

@@ -0,0 +1,160 @@
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 <jo@mein.io>
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
@@ -224,14 +224,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 */
@@ -249,9 +245,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
@@ -1970,11 +1965,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;
@@ -1996,6 +1992,7 @@ static char *path_to_procfs(const char *
fclose (fp);
}
}
+#endif
strlcpy(proc_path + proc_path_len, tail,
sizeof(proc_path) - proc_path_len);
@@ -2889,6 +2886,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;
@@ -3016,6 +3015,7 @@ int ppp_check_kernel_support(void)
}
close(s);
return ok;
+#endif
}
#ifndef HAVE_LOGWTMP
@@ -3577,6 +3577,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) {
@@ -3601,6 +3602,7 @@ get_pty(int *master_fdp, int *slave_fdp,
}
}
}
+#endif
if (sfd < 0)
return 0;
@@ -3716,6 +3718,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,
@@ -3726,6 +3729,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
@@ -57,9 +57,6 @@ static char const RCSID[] =
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;
@@ -421,10 +418,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