Skip to content

Instantly share code, notes, and snippets.

@kwilczynski
Created September 1, 2011 00:12
Show Gist options
  • Save kwilczynski/1185100 to your computer and use it in GitHub Desktop.
Save kwilczynski/1185100 to your computer and use it in GitHub Desktop.
Add support for module parameters under /sys ...
--- ip_vs_ftp.c.orig 2011-08-30 21:34:43.769232489 +0100
+++ ip_vs_ftp.c 2011-08-30 22:12:31.193230337 +0100
@@ -52,8 +52,10 @@
* List of ports (up to IP_VS_APP_MAX_PORTS) to be handled by helper
* First port is set to the default port.
*/
+static unsigned int ports_count = 0;
static unsigned short ports[IP_VS_APP_MAX_PORTS] = {21, 0};
-module_param_array(ports, ushort, NULL, 0);
+
+module_param_array(ports, ushort, &ports_count, 0444);
MODULE_PARM_DESC(ports, "Ports to monitor for FTP control commands");
@@ -411,7 +413,10 @@
if (ret)
return ret;
- for (i=0; i<IP_VS_APP_MAX_PORTS; i++) {
+ if (!ports_count)
+ ports_count = 1;
+
+ for (i=0; i<ports_count; i++) {
if (!ports[i])
continue;
ret = register_ip_vs_app_inc(app, app->protocol, ports[i]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment