Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f539c41 authored by Devi Sandeep Endluri V V's avatar Devi Sandeep Endluri V V Committed by Gerrit - the friendly Code Review server
Browse files

xt_hardidletiemr: Check for remaining expiry time



-xt_hardidletimers are getting reset with addition/
deletion of any iptable rule in any chain of raw/mangle
table.
-Check and restart the timer with remaining expiry time.

Change-Id: I55c6fb211b929dfe500edda8e7c01530f944b067
CRs-Fixed: 2367114
Acked-by: default avatarManoj Basapathi <manojbm@qti.qualcomm.com>
Signed-off-by: default avatarDevi Sandeep Endluri V V <dendluri@codeaurora.org>
parent aea06a3b
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -236,6 +236,9 @@ static int hardidletimer_tg_checkentry(const struct xt_tgchk_param *par)
	struct hardidletimer_tg_info *info = par->targinfo;
	int ret;
	ktime_t tout;
	struct timespec ktimespec;

	memset(&ktimespec, 0, sizeof(struct timespec));

	pr_debug("checkentry targinfo %s\n", info->label);

@@ -256,14 +259,15 @@ static int hardidletimer_tg_checkentry(const struct xt_tgchk_param *par)
	info->timer = __hardidletimer_tg_find_by_label(info->label);
	if (info->timer) {
		info->timer->refcnt++;
		if (!info->timer->active) {
			schedule_work(&info->timer->work);
			pr_debug("Starting Checkentry timer\n");
		}
		/* calculate remaining expiry time */
		tout = alarm_expires_remaining(&info->timer->alarm);
		ktimespec = ktime_to_timespec(tout);

		info->timer->active = true;
		tout = ktime_set(info->timeout, 0);
		if (ktimespec.tv_sec > 0) {
			pr_debug("time_expiry_remaining %ld\n",
				 ktimespec.tv_sec);
			alarm_start_relative(&info->timer->alarm, tout);
		}

		pr_debug("increased refcnt of timer %s to %u\n",
			 info->label, info->timer->refcnt);