mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-06 12:45:13 +02:00
xt_pknock: reduce indent in the two most-recently touched functions
This commit is contained in:
@@ -311,13 +311,12 @@ static void update_rule_gc_timer(struct xt_pknock_rule *rule)
|
|||||||
static inline bool
|
static inline bool
|
||||||
autoclose_time_passed(const struct peer *peer, unsigned int autoclose_time)
|
autoclose_time_passed(const struct peer *peer, unsigned int autoclose_time)
|
||||||
{
|
{
|
||||||
if (peer != NULL) {
|
unsigned long x, y;
|
||||||
unsigned long x = ktime_get_seconds();
|
if (peer == NULL || autoclose_time == 0)
|
||||||
unsigned long y = peer->login_sec + autoclose_time * 60;
|
return false;
|
||||||
return autoclose_time != 0 && time_after(x, y);
|
x = ktime_get_seconds();
|
||||||
} else {
|
y = peer->login_sec + autoclose_time * 60;
|
||||||
return 0;
|
return time_after(x, y);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -339,12 +338,12 @@ is_interknock_time_exceeded(const struct peer *peer, unsigned int max_time)
|
|||||||
static inline bool
|
static inline bool
|
||||||
has_logged_during_this_minute(const struct peer *peer)
|
has_logged_during_this_minute(const struct peer *peer)
|
||||||
{
|
{
|
||||||
if (peer != NULL) {
|
unsigned long x, y;
|
||||||
unsigned long x = ktime_get_seconds(), y = peer->login_sec;
|
if (peer == NULL)
|
||||||
return do_div(y, 60) == do_div(x, 60);
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
x = ktime_get_seconds();
|
||||||
|
y = peer->login_sec;
|
||||||
|
return do_div(y, 60) == do_div(x, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user