Hello,
I made a small patch which does mostly cosmetic things. Attached is:
o added -DEXPORT_SYMTAB to Makefile to be able to compile the modules
o added support for MODULE_LICENSE in loadable kernel modules. Made it
backwards compatible in ip_vs.h for older 2.4.x kernels.
o added 'ipvsadm -h|--help' support even when ipvs modules are not
compiled or loaded. Reason: I had this workshop last week and I often
wanted to show people only the man-page so they can work on a patched
box. Before you always had to have a LVS-aware kernel to get the help
page which is IMHO not so nice. Please consider this little change.
o changed POPT_ARGFLAG_OPTIONAL back to POPT_ARG_STRING. This is because
on my machine I wasn't able to compile ipvsadm.c although I have
libpopt.a. It looks like if my popt.h is too old :). This is not a
fix nor should you apply it but I just want to make sure you know that
there are people out here that don't have the newest libpopt. Also
the conditional '#include "popt.h"' can be very misleading if you
haven't read the Makefile and try to find the popt.h in your
directory.
How about changing it to '#include <popt.h>'?
o fix copy'n'paste spello in ipvsadm.c comment for option 'f'.
Maybe we should also consider the EXPORT_MODULE_GPL(), because:
schtinkphish:/usr/src # diff -ur linux-2.4.10/include/linux/module.h
linux-2.4.12/include/linux/module.h
--- linux-2.4.10/include/linux/module.h Tue Sep 25 00:56:59 2001
+++ linux-2.4.12/include/linux/module.h Tue Oct 16 22:59:22 2001
@@ -346,12 +346,21 @@
#define __EXPORT_SYMBOL(sym,str) error
config_must_be_included_before_module
#define EXPORT_SYMBOL(var) error
config_must_be_included_before_module
#define EXPORT_SYMBOL_NOVERS(var) error
config_must_be_included_before_module
+#define EXPORT_SYMBOL_GPL(var) error
config_must_be_included_before_module
#elif !defined(CONFIG_MODULES)
#define __EXPORT_SYMBOL(sym,str)
#define EXPORT_SYMBOL(var)
#define EXPORT_SYMBOL_NOVERS(var)
+#define EXPORT_SYMBOL_GPL(var)
+
+#elif !defined(EXPORT_SYMTAB)
+
+#define __EXPORT_SYMBOL(sym,str) error
this_object_must_be_defined_as_export_objs_in_the_Makefile
+#define EXPORT_SYMBOL(var) error
this_object_must_be_defined_as_export_objs_in_the_Makefile
+#define EXPORT_SYMBOL_NOVERS(var) error
this_object_must_be_defined_as_export_objs_in_the_Makefile
+#define EXPORT_SYMBOL_GPL(var) error
this_object_must_be_defined_as_export_objs_in_the_Makefile
#else
@@ -362,10 +371,19 @@
__attribute__((section("__ksymtab"))) = \
{ (unsigned long)&sym, __kstrtab_##sym }
+#define __EXPORT_SYMBOL_GPL(sym, str) \
+const char __kstrtab_##sym[] \
+__attribute__((section(".kstrtab"))) = "GPLONLY_" str; \
+const struct module_symbol __ksymtab_##sym \
+__attribute__((section("__ksymtab"))) = \
+{ (unsigned long)&sym, __kstrtab_##sym }
+
#if defined(MODVERSIONS) || !defined(CONFIG_MODVERSIONS)
#define EXPORT_SYMBOL(var) __EXPORT_SYMBOL(var, __MODULE_STRING(var))
+#define EXPORT_SYMBOL_GPL(var) __EXPORT_SYMBOL_GPL(var,
__MODULE_STRING(var))
#else
#define EXPORT_SYMBOL(var) __EXPORT_SYMBOL(var,
__MODULE_STRING(__VERSIONED_SYMBOL(var)))
+#define EXPORT_SYMBOL_GPL(var) __EXPORT_SYMBOL(var,
__MODULE_STRING(__VERSIONED_SYMBOL(var)))
#endif
#define EXPORT_SYMBOL_NOVERS(var) __EXPORT_SYMBOL(var,
__MODULE_STRING(var))
schtinkphish:/usr/src #
YMMV but I would be happy, if the ipvsadm.c help thing could go in. I
would
really appreciate it.
Best regards,
Roberto Nibali, ratz
--
echo
'[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq' |
dc diff -ur ipvs-0.9.4/ipvs/Makefile ipvs-0.9.4-ratz/ipvs/Makefile
--- ipvs-0.9.4/ipvs/Makefile Tue Sep 18 17:42:53 2001
+++ ipvs-0.9.4-ratz/ipvs/Makefile Thu Oct 18 07:28:21 2001
@@ -10,7 +10,8 @@
CC=gcc
CFLAGS= -D__KERNEL__ -DMODULE $(SMPFLAGS) $(DEBUGFLAGS) -O2 -Wall \
-Wstrict-prototypes -I/usr/src/linux/include \
- -DMODVERSIONS -include /usr/src/linux/include/linux/modversions.h
+ -DMODVERSIONS -include /usr/src/linux/include/linux/modversions.h \
+ -DEXPORT_SYMTAB
all: ip_vs.o ip_vs_lc.o ip_vs_rr.o ip_vs_wlc.o ip_vs_wrr.o \
ip_vs_lblc.o ip_vs_lblcr.o ip_vs_dh.o ip_vs_sh.o ip_vs_ftp.o
diff -ur ipvs-0.9.4/ipvs/ip_vs.h ipvs-0.9.4-ratz/ipvs/ip_vs.h
--- ipvs-0.9.4/ipvs/ip_vs.h Tue Sep 18 17:42:53 2001
+++ ipvs-0.9.4-ratz/ipvs/ip_vs.h Wed Oct 17 09:04:41 2001
@@ -243,6 +243,9 @@
#include <net/tcp.h>
#include <net/udp.h>
+#ifndef MODULE_LICENSE
+#define MODULE_LICENSE(a)
+#endif
#ifdef CONFIG_IP_VS_DEBUG
extern int ip_vs_get_debug_level(void);
diff -ur ipvs-0.9.4/ipvs/ip_vs_core.c ipvs-0.9.4-ratz/ipvs/ip_vs_core.c
--- ipvs-0.9.4/ipvs/ip_vs_core.c Tue Sep 18 17:42:54 2001
+++ ipvs-0.9.4-ratz/ipvs/ip_vs_core.c Wed Oct 17 09:10:39 2001
@@ -45,6 +45,7 @@
#include "ip_vs.h"
//#include <net/ip_vs.h>
+MODULE_LICENSE("GPL");
EXPORT_SYMBOL(register_ip_vs_scheduler);
EXPORT_SYMBOL(unregister_ip_vs_scheduler);
diff -ur ipvs-0.9.4/ipvs/ip_vs_dh.c ipvs-0.9.4-ratz/ipvs/ip_vs_dh.c
--- ipvs-0.9.4/ipvs/ip_vs_dh.c Wed May 9 17:01:15 2001
+++ ipvs-0.9.4-ratz/ipvs/ip_vs_dh.c Thu Oct 18 07:34:11 2001
@@ -47,6 +47,7 @@
#include "ip_vs.h"
/* #include <net/ip_vs.h> */
+MODULE_LICENSE("GPL");
/*
* IPVS DH bucket
diff -ur ipvs-0.9.4/ipvs/ip_vs_ftp.c ipvs-0.9.4-ratz/ipvs/ip_vs_ftp.c
--- ipvs-0.9.4/ipvs/ip_vs_ftp.c Wed Jun 20 14:50:53 2001
+++ ipvs-0.9.4-ratz/ipvs/ip_vs_ftp.c Thu Oct 18 07:34:40 2001
@@ -42,6 +42,7 @@
#define SERVER_STRING "227 Entering Passive Mode ("
#define CLIENT_STRING "PORT "
+MODULE_LICENSE("GPL");
/*
* List of ports (up to IP_VS_APP_MAX_PORTS) to be handled by helper
diff -ur ipvs-0.9.4/ipvs/ip_vs_lblc.c ipvs-0.9.4-ratz/ipvs/ip_vs_lblc.c
--- ipvs-0.9.4/ipvs/ip_vs_lblc.c Mon Jun 4 15:51:03 2001
+++ ipvs-0.9.4-ratz/ipvs/ip_vs_lblc.c Thu Oct 18 07:34:57 2001
@@ -55,6 +55,7 @@
#include "ip_vs.h"
/* #include <net/ip_vs.h> */
+MODULE_LICENSE("GPL");
/*
* It is for garbage collection of stale IPVS lblc entries,
diff -ur ipvs-0.9.4/ipvs/ip_vs_lblcr.c ipvs-0.9.4-ratz/ipvs/ip_vs_lblcr.c
--- ipvs-0.9.4/ipvs/ip_vs_lblcr.c Mon Jun 4 15:51:03 2001
+++ ipvs-0.9.4-ratz/ipvs/ip_vs_lblcr.c Thu Oct 18 07:35:17 2001
@@ -55,6 +55,7 @@
#include "ip_vs.h"
/* #include <net/ip_vs.h> */
+MODULE_LICENSE("GPL");
/*
* It is for garbage collection of stale IPVS lblcr entries,
diff -ur ipvs-0.9.4/ipvs/ip_vs_lc.c ipvs-0.9.4-ratz/ipvs/ip_vs_lc.c
--- ipvs-0.9.4/ipvs/ip_vs_lc.c Mon Jun 4 15:51:03 2001
+++ ipvs-0.9.4-ratz/ipvs/ip_vs_lc.c Thu Oct 18 07:35:31 2001
@@ -26,6 +26,7 @@
#include "ip_vs.h"
//#include <net/ip_vs.h>
+MODULE_LICENSE("GPL");
static int ip_vs_lc_init_svc(struct ip_vs_service *svc)
{
diff -ur ipvs-0.9.4/ipvs/ip_vs_rr.c ipvs-0.9.4-ratz/ipvs/ip_vs_rr.c
--- ipvs-0.9.4/ipvs/ip_vs_rr.c Mon Jun 4 15:51:03 2001
+++ ipvs-0.9.4-ratz/ipvs/ip_vs_rr.c Thu Oct 18 07:35:46 2001
@@ -31,6 +31,7 @@
#include "ip_vs.h"
//#include <net/ip_vs.h>
+MODULE_LICENSE("GPL");
static int ip_vs_rr_init_svc(struct ip_vs_service *svc)
{
diff -ur ipvs-0.9.4/ipvs/ip_vs_sh.c ipvs-0.9.4-ratz/ipvs/ip_vs_sh.c
--- ipvs-0.9.4/ipvs/ip_vs_sh.c Wed May 9 17:01:15 2001
+++ ipvs-0.9.4-ratz/ipvs/ip_vs_sh.c Thu Oct 18 07:36:01 2001
@@ -44,6 +44,7 @@
#include "ip_vs.h"
/* #include <net/ip_vs.h> */
+MODULE_LICENSE("GPL");
/*
* IPVS SH bucket
diff -ur ipvs-0.9.4/ipvs/ip_vs_wlc.c ipvs-0.9.4-ratz/ipvs/ip_vs_wlc.c
--- ipvs-0.9.4/ipvs/ip_vs_wlc.c Mon Jun 4 15:51:03 2001
+++ ipvs-0.9.4-ratz/ipvs/ip_vs_wlc.c Thu Oct 18 07:36:19 2001
@@ -31,6 +31,7 @@
#include "ip_vs.h"
//#include <net/ip_vs.h>
+MODULE_LICENSE("GPL");
static int
ip_vs_wlc_init_svc(struct ip_vs_service *svc)
diff -ur ipvs-0.9.4/ipvs/ip_vs_wrr.c ipvs-0.9.4-ratz/ipvs/ip_vs_wrr.c
--- ipvs-0.9.4/ipvs/ip_vs_wrr.c Mon Jun 4 15:51:03 2001
+++ ipvs-0.9.4-ratz/ipvs/ip_vs_wrr.c Thu Oct 18 07:36:34 2001
@@ -30,6 +30,8 @@
#include "ip_vs.h"
//#include <net/ip_vs.h>
+MODULE_LICENSE("GPL");
+
/*
* current destination pointer for weighted round-robin scheduling
*/
diff -ur ipvs-0.9.4/ipvs/ipvsadm/ipvsadm.c
ipvs-0.9.4-ratz/ipvs/ipvsadm/ipvsadm.c
--- ipvs-0.9.4/ipvs/ipvsadm/ipvsadm.c Tue Sep 18 17:42:54 2001
+++ ipvs-0.9.4-ratz/ipvs/ipvsadm/ipvsadm.c Thu Oct 18 08:02:18 2001
@@ -281,6 +281,14 @@
{
int result;
+ /* allow print help even if ipvs modules are not compiled or loadable */
+ if (argc == 2) {
+ if ( strncmp(argv[1], "-h", strlen(argv[1])) == 0 || \
+ strncmp(argv[1], "--help", strlen(argv[1])) == 0 ){
+ usage_exit(argv[0], 0);
+ }
+ }
+
if (ipvs_init()) {
/* try to insmod the ip_vs module if ipvs_init failed */
if (modprobe_ipvs() || ipvs_init())
@@ -337,7 +345,7 @@
{"udp-service", 'u', POPT_ARG_STRING, &optarg, 'u'},
{"fwmark-service", 'f', POPT_ARG_STRING, &optarg, 'f'},
{"scheduler", 's', POPT_ARG_STRING, &optarg, 's'},
- {"persistent", 'p', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL,
+ {"persistent", 'p', POPT_ARG_STRING|POPT_ARG_STRING,
&optarg, 'p'},
{"netmask", 'M', POPT_ARG_STRING, &optarg, 'M'},
{"real-server", 'r', POPT_ARG_STRING, &optarg, 'r'},
@@ -434,7 +442,7 @@
case 'f':
set_option(options, OPT_SERVICE);
/*
- * Set prtocol to a sane values, even
+ * Set protocol to a sane values, even
* though it is not used
*/
ur->protocol = IPPROTO_TCP;
@@ -695,7 +703,7 @@
case 'f':
set_option(options, OPT_SERVICE);
/*
- * Set prtocol to a sane values, even
+ * Set protocol to a sane values, even
* though it is not used
*/
ur->protocol = IPPROTO_TCP;
|