| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: t_misc.sh,v 1.4 2020/08/29 07:22:49 tih Exp $ | | 1 | # $NetBSD: t_misc.sh,v 1.5 2020/08/31 20:32:58 riastradh Exp $ |
2 | # | | 2 | # |
3 | # Copyright (c) 2018 Ryota Ozaki <ozaki.ryota@gmail.com> | | 3 | # Copyright (c) 2018 Ryota Ozaki <ozaki.ryota@gmail.com> |
4 | # All rights reserved. | | 4 | # All rights reserved. |
5 | # | | 5 | # |
6 | # Redistribution and use in source and binary forms, with or without | | 6 | # Redistribution and use in source and binary forms, with or without |
7 | # modification, are permitted provided that the following conditions | | 7 | # modification, are permitted provided that the following conditions |
8 | # are met: | | 8 | # are met: |
9 | # 1. Redistributions of source code must retain the above copyright | | 9 | # 1. Redistributions of source code must retain the above copyright |
10 | # notice, this list of conditions and the following disclaimer. | | 10 | # notice, this list of conditions and the following disclaimer. |
11 | # 2. Redistributions in binary form must reproduce the above copyright | | 11 | # 2. Redistributions in binary form must reproduce the above copyright |
12 | # notice, this list of conditions and the following disclaimer in the | | 12 | # notice, this list of conditions and the following disclaimer in the |
13 | # documentation and/or other materials provided with the distribution. | | 13 | # documentation and/or other materials provided with the distribution. |
14 | # | | 14 | # |
| @@ -96,27 +96,27 @@ wg_rekey_body() | | | @@ -96,27 +96,27 @@ wg_rekey_body() |
96 | sleep $rekey_after_time | | 96 | sleep $rekey_after_time |
97 | | | 97 | |
98 | $ping $ip_wg_peer | | 98 | $ping $ip_wg_peer |
99 | | | 99 | |
100 | # A reinitiation should be performed | | 100 | # A reinitiation should be performed |
101 | atf_check -s exit:0 -o not-match:"$latest_handshake" \ | | 101 | atf_check -s exit:0 -o not-match:"$latest_handshake" \ |
102 | $HIJACKING wgconfig wg0 show peer peer0 | | 102 | $HIJACKING wgconfig wg0 show peer peer0 |
103 | | | 103 | |
104 | latest_handshake=$($HIJACKING wgconfig wg0 show peer peer0 \ | | 104 | latest_handshake=$($HIJACKING wgconfig wg0 show peer peer0 \ |
105 | | awk -F ': ' '/latest-handshake/ {print $2;}') | | 105 | | awk -F ': ' '/latest-handshake/ {print $2;}') |
106 | $DEBUG && echo $latest_handshake | | 106 | $DEBUG && echo $latest_handshake |
107 | | | 107 | |
108 | # Wait for a reinitiation to be performed again | | 108 | # Wait for a reinitiation to be performed again |
109 | sleep $rekey_after_time | | 109 | sleep $((rekey_after_time+1)) |
110 | | | 110 | |
111 | $ping $ip_wg_peer | | 111 | $ping $ip_wg_peer |
112 | | | 112 | |
113 | # A reinitiation should be performed | | 113 | # A reinitiation should be performed |
114 | atf_check -s exit:0 -o not-match:"$latest_handshake" \ | | 114 | atf_check -s exit:0 -o not-match:"$latest_handshake" \ |
115 | $HIJACKING wgconfig wg0 show peer peer0 | | 115 | $HIJACKING wgconfig wg0 show peer peer0 |
116 | | | 116 | |
117 | destroy_wg_interfaces | | 117 | destroy_wg_interfaces |
118 | } | | 118 | } |
119 | | | 119 | |
120 | wg_rekey_cleanup() | | 120 | wg_rekey_cleanup() |
121 | { | | 121 | { |
122 | | | 122 | |