Package: ifplugd
Version: 0.28-18
Severity: wishlist
Tags: patch

Right now minimal delay  interface poll (-t option) is 1 second. This is fine 
in case of 'notebook' usage. We deploing ifplugd as monitorig tool for 
heartbeat network and we expected to have smaller polling delay. I've added new 
option -T which fill tv.useconds field and allow to use ifplugd with fractional 
values. Typical usage is ifplugd -d 0 -t 0 -T 1000 -r /opt/monitor.

This option does not break in any way existing functionality (incuding trimming 
all incorrect values for -t to zero) and allow new usage of same code.


-- Package-specific info:
 /sys/class/net/ interfaces:
/sys/class/net/eth0/
/sys/class/net/eth1/
/sys/class/net/eth2/
/sys/class/net/eth3/
/sys/class/net/lo/

-- System Information:
Debian Release: wheezy/sid
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.0.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages ifplugd depends on:
ii  debconf [debconf-2.0]         1.5.41     Debian configuration management sy
ii  libc6                         2.13-11    Embedded GNU C Library: Shared lib
ii  libdaemon0                    0.14-2     lightweight C library for daemons 
ii  lsb-base                      3.2-27     Linux Standard Base 3.2 init scrip

Versions of packages ifplugd recommends:
ii  ifupdown         0.7~alpha5+really0.6.10 high level tools to configure netw

Versions of packages ifplugd suggests:
pn  wpasupplicant                 <none>     (no description available)

-- debconf information excluded
#! /bin/sh /usr/share/dpatch/dpatch-run
## 07_add_fractional_delays.dpatch by  <root@cvt-xs6>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' ifplugd-0.28~/man/ifplugd.8 ifplugd-0.28/man/ifplugd.8
--- ifplugd-0.28~/man/ifplugd.8	2011-08-22 17:20:53.000000000 +0400
+++ ifplugd-0.28/man/ifplugd.8	2011-08-22 17:22:09.000000000 +0400
@@ -48,6 +48,9 @@
 \fB\-t | \-\-poll-time=\f1 \fISECS\f1
 Specify poll time in seconds (default: 1) 
 .TP
+\fB\-T | \-\-poll-utime=\f1 \fIUSECS\f1
+Specify poll time in microseconds, added to -t (default: 0) 
+.TP
 \fB\-u | \-\-delay-up=\f1 \fISECS\f1
 Specify delay for configuring interface (default: 0) 
 .TP
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' ifplugd-0.28~/man/ifplugd.8.xml.in ifplugd-0.28/man/ifplugd.8.xml.in
--- ifplugd-0.28~/man/ifplugd.8.xml.in	2011-08-22 17:20:53.000000000 +0400
+++ ifplugd-0.28/man/ifplugd.8.xml.in	2011-08-22 17:20:53.000000000 +0400
@@ -132,6 +132,13 @@
 			Specify poll time in seconds (default: 1)
 		  </p></optdesc>
 	  </option>
+
+	  <option>
+		<p><opt>-T | --poll-utime=</opt> <arg>USECS</arg></p>
+		<optdesc><p>
+			Specify poll time in useconds, summing with -t (default: 1)
+		  </p></optdesc>
+	  </option>
 	  
 	  <option>
 		<p><opt>-u | --delay-up=</opt> <arg>SECS</arg></p>
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' ifplugd-0.28~/src/ifplugd.c ifplugd-0.28/src/ifplugd.c
--- ifplugd-0.28~/src/ifplugd.c	2011-08-22 17:20:53.000000000 +0400
+++ ifplugd-0.28/src/ifplugd.c	2011-08-22 17:20:53.000000000 +0400
@@ -68,6 +68,7 @@
 char *extra_arg = NULL;
 
 int polltime = 1,
+    pollutime = 0,
     delay_up = 0,
     delay_down = 5;
 
@@ -483,7 +484,7 @@
         struct timeval tv;
 
         tv.tv_sec = polltime;
-        tv.tv_usec = 0;
+        tv.tv_usec = pollutime;
         
         if (t) {
             int delay = t - time(NULL);
@@ -664,6 +665,7 @@
            "   -r --run=EXEC             Specify program to execute (%s)\n"
            "   -I --ignore-retval        Don't exit on nonzero return value of program executed (%s)\n"
            "   -t --poll-time=SECS       Specify poll time in seconds (%i)\n"
+           "   -T --poll-utime=USECS     Specify poll time in microseconds, add to -t (%i)\n"
            "   -u --delay-up=SECS        Specify delay for configuring interface (%i)\n"
            "   -d --delay-down=SECS      Specify delay for deconfiguring interface (%i)\n"
            "   -m --api-mode=MODE        Force API mode (mii, priv, ethtool, wlan, auto) (%s)\n"
@@ -694,6 +696,7 @@
            run,
            ignore_retval ? "on" : "off",
            polltime,
+           pollutime,
            delay_up,
            delay_down,
            m,
@@ -719,6 +722,7 @@
         {"iface",                required_argument, 0, 'i'},
         {"run",                  required_argument, 0, 'r'},
         {"poll-time",            required_argument, 0, 't'},
+        {"poll-utime",           required_argument, 0, 'T'},
         {"delay-up",             required_argument, 0, 'u'},
         {"delay-down",           required_argument, 0, 'd'},
         {"api-mode",             required_argument, 0, 'm'},
@@ -744,7 +748,7 @@
     for (;;) {
         int c;
         
-        if ((c = getopt_long(argc, argv, "asni:r:t:u:d:hkbUDfFvm:pqwx:cISRzlMW", long_options, &option_index)) < 0)
+        if ((c = getopt_long(argc, argv, "asni:r:t:T:u:d:hkbUDfFvm:pqwx:cISRzlMW", long_options, &option_index)) < 0)
             break;
 
         switch (c) {
@@ -772,6 +776,10 @@
                 polltime = atoi(optarg);
                 if (polltime < 0) polltime = 0;
                 break;
+            case 'T':
+                pollutime = atoi(optarg);
+                if (pollutime < 0) pollutime = 0;
+                break;
             case 'u':
                 delay_up = atoi(optarg);
                 break;

Reply via email to