aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJiri Prchal <jiri.prchal@aksignal.cz>2014-07-25 09:58:33 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2014-07-25 10:09:28 -0400
commit8452e6ff3efce76335eba9d29d2a5b3b524b9f1f (patch)
treec860ec8abe9b7a3dc061a701bcf913afafe805c6 /net
parent76f084bc10004b3050b2cff9cfac29148f1f6088 (diff)
netfilter: xt_LED: fix too short led-always-blink
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>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/xt_LED.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/net/netfilter/xt_LED.c b/net/netfilter/xt_LED.c
index 993de2ba89d3..92c71cdc4739 100644
--- a/net/netfilter/xt_LED.c
+++ b/net/netfilter/xt_LED.c
@@ -50,11 +50,14 @@ struct xt_led_info_internal {
50 struct timer_list timer; 50 struct timer_list timer;
51}; 51};
52 52
53#define XT_LED_BLINK_DELAY 50 /* ms */
54
53static unsigned int 55static unsigned int
54led_tg(struct sk_buff *skb, const struct xt_action_param *par) 56led_tg(struct sk_buff *skb, const struct xt_action_param *par)
55{ 57{
56 const struct xt_led_info *ledinfo = par->targinfo; 58 const struct xt_led_info *ledinfo = par->targinfo;
57 struct xt_led_info_internal *ledinternal = ledinfo->internal_data; 59 struct xt_led_info_internal *ledinternal = ledinfo->internal_data;
60 unsigned long led_delay = XT_LED_BLINK_DELAY;
58 61
59 /* 62 /*
60 * If "always blink" is enabled, and there's still some time until the 63 * 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)
62 */ 65 */
63 if ((ledinfo->delay > 0) && ledinfo->always_blink && 66 if ((ledinfo->delay > 0) && ledinfo->always_blink &&
64 timer_pending(&ledinternal->timer)) 67 timer_pending(&ledinternal->timer))
65 led_trigger_event(&ledinternal->netfilter_led_trigger, LED_OFF); 68 led_trigger_blink_oneshot(&ledinternal->netfilter_led_trigger,
66 69 &led_delay, &led_delay, 1);
67 led_trigger_event(&ledinternal->netfilter_led_trigger, LED_FULL); 70 else
71 led_trigger_event(&ledinternal->netfilter_led_trigger, LED_FULL);
68 72
69 /* If there's a positive delay, start/update the timer */ 73 /* If there's a positive delay, start/update the timer */
70 if (ledinfo->delay > 0) { 74 if (ledinfo->delay > 0) {