Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jiri Prchal and committed by
Pablo Neira Ayuso
8452e6ff 76f084bc

+7 -3
+7 -3
net/netfilter/xt_LED.c
··· 50 50 struct timer_list timer; 51 51 }; 52 52 53 + #define XT_LED_BLINK_DELAY 50 /* ms */ 54 + 53 55 static unsigned int 54 56 led_tg(struct sk_buff *skb, const struct xt_action_param *par) 55 57 { 56 58 const struct xt_led_info *ledinfo = par->targinfo; 57 59 struct xt_led_info_internal *ledinternal = ledinfo->internal_data; 60 + unsigned long led_delay = XT_LED_BLINK_DELAY; 58 61 59 62 /* 60 63 * If "always blink" is enabled, and there's still some time until the ··· 65 62 */ 66 63 if ((ledinfo->delay > 0) && ledinfo->always_blink && 67 64 timer_pending(&ledinternal->timer)) 68 - led_trigger_event(&ledinternal->netfilter_led_trigger, LED_OFF); 69 - 70 - led_trigger_event(&ledinternal->netfilter_led_trigger, LED_FULL); 65 + led_trigger_blink_oneshot(&ledinternal->netfilter_led_trigger, 66 + &led_delay, &led_delay, 1); 67 + else 68 + led_trigger_event(&ledinternal->netfilter_led_trigger, LED_FULL); 71 69 72 70 /* If there's a positive delay, start/update the timer */ 73 71 if (ledinfo->delay > 0) {