netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] nf: xt_LED: led-always-blink invisible
@ 2014-06-19  9:17 Jiří Prchal
  2014-06-30 10:54 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 7+ messages in thread
From: Jiří Prchal @ 2014-06-19  9:17 UTC (permalink / raw)
  To: coreteam, netfilter, netfilter-devel, kadlec, kaber, pablo

Hi all,
probably I found bug in kernel 3.14.0 in xt_LED module when set led-always-blink. If it is set, then between switch led 
OFF and ON is almost zero time. So blink is invisible. I did some fix, but I'm not sure if this way would be good. 
Please, help to direct me. This is not final patch so don't punish me for coding style.

diff --git a/net/netfilter/xt_LED.c b/net/netfilter/xt_LED.c
index 993de2b..430584b 100644
--- a/net/netfilter/xt_LED.c
+++ b/net/netfilter/xt_LED.c
@@ -54,30 +54,32 @@ static unsigned int
  led_tg(struct sk_buff *skb, const struct xt_action_param *par)
  {
  	const struct xt_led_info *ledinfo = par->targinfo;
  	struct xt_led_info_internal *ledinternal = ledinfo->internal_data;
+        unsigned long t=50;

  	/*
  	 * If "always blink" is enabled, and there's still some time until the
  	 * LED will switch off, briefly switch it off now.
  	 */
  	if ((ledinfo->delay > 0) && ledinfo->always_blink &&
  	    timer_pending(&ledinternal->timer))
-		led_trigger_event(&ledinternal->netfilter_led_trigger, LED_OFF);
-
-	led_trigger_event(&ledinternal->netfilter_led_trigger, LED_FULL);
+		//led_trigger_event(&ledinternal->netfilter_led_trigger, LED_OFF);
+          led_trigger_blink_oneshot(&ledinternal->netfilter_led_trigger, &t, &t, 1);
+        else
+                led_trigger_event(&ledinternal->netfilter_led_trigger, LED_FULL);

  	/* If there's a positive delay, start/update the timer */
  	if (ledinfo->delay > 0) {
  		mod_timer(&ledinternal->timer,
  			  jiffies + msecs_to_jiffies(ledinfo->delay));

  	/* Otherwise if there was no delay given, blink as fast as possible */
  	} else if (ledinfo->delay == 0) {
  		led_trigger_event(&ledinternal->netfilter_led_trigger, LED_OFF);
  	}

  	/* else the delay is negative, which means switch on and stay on */

  	return XT_CONTINUE;
  }


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-07-25 12:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-19  9:17 [BUG] nf: xt_LED: led-always-blink invisible Jiří Prchal
2014-06-30 10:54 ` Pablo Neira Ayuso
2014-06-30 23:36   ` Bryan Wu
2014-07-25  7:21     ` [PATCH] nf: xt_LED: fix too short led-always-blink Jiří Prchal
2014-07-25 12:22       ` Pablo Neira Ayuso
2014-07-25 12:40         ` [PATCH v2] " Jiří Prchal
2014-07-25 12:59           ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).