diff options
author | Jan Engelhardt <jengelh@medozas.de> | 2011-09-08 16:07:16 +0200 |
---|---|---|
committer | Jan Engelhardt <jengelh@medozas.de> | 2011-09-08 16:07:16 +0200 |
commit | 891d5790b3f4caeed80f1449d280617c54df8837 (patch) | |
tree | 6328d4a4a0d4bffb76fc5ecf297b4386a1257191 /iptables/xtables.c | |
parent | bf42cf92ea0c53e5470a20d62d00e5e83379f4d5 (diff) | |
parent | 153c23d9b14285b24aae3e96da0b547dcc7ee051 (diff) |
Merge branch 'stable'
Diffstat (limited to 'iptables/xtables.c')
-rw-r--r-- | iptables/xtables.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/iptables/xtables.c b/iptables/xtables.c index e72aa284..014e115b 100644 --- a/iptables/xtables.c +++ b/iptables/xtables.c @@ -31,6 +31,7 @@ #include <sys/stat.h> #include <sys/statfs.h> #include <sys/types.h> +#include <sys/utsname.h> #include <sys/wait.h> #include <arpa/inet.h> #if defined(HAVE_LINUX_MAGIC_H) @@ -1812,3 +1813,20 @@ xtables_parse_protocol(const char *s) "unknown protocol \"%s\" specified", s); return -1; } + +int kernel_version; + +void get_kernel_version(void) +{ + static struct utsname uts; + int x = 0, y = 0, z = 0; + + if (uname(&uts) == -1) { + fprintf(stderr, "Unable to retrieve kernel version.\n"); + xtables_free_opts(1); + exit(1); + } + + sscanf(uts.release, "%d.%d.%d", &x, &y, &z); + kernel_version = LINUX_VERSION(x, y, z); +} |