]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
netfilter: xt_LED: fix too short led-always-blink
authorJiri Prchal <jiri.prchal@aksignal.cz>
Fri, 25 Jul 2014 13:58:33 +0000 (15:58 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 25 Jul 2014 14:09:28 +0000 (16:09 +0200)
If led-always-blink is set, then between switch led OFF and ON
is almost zero time. So blink is invisible. This use oneshot led trigger
with fixed time 50ms witch is enough to see blink.

Signed-off-by: Jiri Prchal <jiri.prchal@aksignal.cz>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/xt_LED.c

index 993de2ba89d33bb3fa532ded0952bfb83de63836..92c71cdc473905a804651e46a46247ea7e42728f 100644 (file)
@@ -50,11 +50,14 @@ struct xt_led_info_internal {
        struct timer_list timer;
 };
 
+#define XT_LED_BLINK_DELAY 50 /* ms */
+
 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 led_delay = XT_LED_BLINK_DELAY;
 
        /*
         * If "always blink" is enabled, and there's still some time until the
@@ -62,9 +65,10 @@ led_tg(struct sk_buff *skb, const struct xt_action_param *par)
         */
        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_blink_oneshot(&ledinternal->netfilter_led_trigger,
+                                         &led_delay, &led_delay, 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) {