Skip to content

Commit

Permalink
reresolve-dns: use $EPOCHSECONDS instead of $(date +%s)
Browse files Browse the repository at this point in the history
Signed-off-by: Jason A. Donenfeld <[email protected]>
  • Loading branch information
zx2c4 committed Jan 4, 2022
1 parent b906ecb commit 1fd9570
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contrib/reresolve-dns/reresolve-dns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ INTERFACE="${BASH_REMATCH[1]}"
process_peer() {
[[ $PEER_SECTION -ne 1 || -z $PUBLIC_KEY || -z $ENDPOINT ]] && return 0
[[ $(wg show "$INTERFACE" latest-handshakes) =~ ${PUBLIC_KEY//+/\\+}\ ([0-9]+) ]] || return 0
(( ($(date +%s) - ${BASH_REMATCH[1]}) > 135 )) || return 0
(( ($EPOCHSECONDS - ${BASH_REMATCH[1]}) > 135 )) || return 0
wg set "$INTERFACE" peer "$PUBLIC_KEY" endpoint "$ENDPOINT"
reset_peer_section
}
Expand Down

0 comments on commit 1fd9570

Please sign in to comment.