Insmod silently rejected being run on any non 2.x kernel. Make its version
check allow newer kernels (and reject 2.4- when not enabling the 2.4
feature).
Signed-off-by: Jonas Gorski <jonas.gorski+openwrt@gmail.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@27189
3c298f89-4303-0410-b956-
a3cf2f4a3e73
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
#include "libbb.h"
#include "modutils.h"
#include "libbb.h"
#include "modutils.h"
+ char *module_dir, real_module_dir[FILENAME_MAX];
+ int len, slen, ret = ENOENT, k_version;
+ struct utsname myuname;
+ char *module_dir, real_module_dir[FILENAME_MAX];
+ int len, slen, ret = ENOENT, k_version;
+ struct utsname myuname;
++ const char *suffix = ".ko";
+ struct stat st;
+
+ /* check the kernel version */
+ struct stat st;
+
+ /* check the kernel version */
-+ if ((uname(&myuname) != 0) || (myuname.release[0] != '2'))
++ if (uname(&myuname) != 0)
-+ k_version = myuname.release[2] - '0';
++ k_version = myuname.release[0] - '0';
++
++ if (k_version < 2 || k_version > 9)
++ return EINVAL;
++
++ if (k_version == 2) {
++ int k_patchlevel = myuname.release[2] - '0';
++ if (k_patchlevel <= 4)
+#if ENABLE_FEATURE_2_4_MODULES
+#if ENABLE_FEATURE_2_4_MODULES
-+ if (k_version <= 4)
-+ suffix = ".o";
-+ else
++ suffix = ".o";
++#else
++ return EINVAL;
+
+ len = strlen(filename);
+ slen = strlen(suffix);
+
+ len = strlen(filename);
+ slen = strlen(suffix);
/* 2.6 style insmod has no options and required filename
* (not module name - .ko can't be omitted) */
/* 2.6 style insmod has no options and required filename
* (not module name - .ko can't be omitted) */
-@@ -59,9 +152,15 @@ int insmod_main(int argc UNUSED_PARAM, c
+@@ -59,9 +159,15 @@ int insmod_main(int argc UNUSED_PARAM, c
if (!filename)
bb_show_usage();
if (!filename)
bb_show_usage();