summaryrefslogtreecommitdiff
path: root/src/openvpn/packet_id.c
diff options
context:
space:
mode:
authorBernhard Schmidt <berni@debian.org>2018-10-14 22:51:08 +0200
committerBernhard Schmidt <berni@debian.org>2018-10-14 22:51:08 +0200
commit87c2fd4310e5b345102d7a4915dc5e3a65052305 (patch)
treeb7dc3d6d209bdb926c9e1ece7f9639aa1724b39e /src/openvpn/packet_id.c
parent3804bc2606a92e2f2f4b3a2b043af0d77d92b386 (diff)
Revert "Merge branch 'stretch' of ssh://git.debian.org/git/collab-maint/openvpn into stretch"
This reverts commit 3804bc2606a92e2f2f4b3a2b043af0d77d92b386, reversing changes made to 678cfd249add7ca758e4c41933c7b730132c99f4.
Diffstat (limited to 'src/openvpn/packet_id.c')
-rw-r--r--src/openvpn/packet_id.c34
1 files changed, 3 insertions, 31 deletions
diff --git a/src/openvpn/packet_id.c b/src/openvpn/packet_id.c
index 6f70c5d..fe13e1d 100644
--- a/src/openvpn/packet_id.c
+++ b/src/openvpn/packet_id.c
@@ -325,40 +325,12 @@ packet_id_read(struct packet_id_net *pin, struct buffer *buf, bool long_form)
return true;
}
-static bool
-packet_id_send_update(struct packet_id_send *p, bool long_form)
-{
- if (!p->time)
- {
- p->time = now;
- }
- if (p->id == PACKET_ID_MAX)
- {
- /* Packet ID only allowed to roll over if using long form and time has
- * moved forward since last roll over.
- */
- if (!long_form || now <= p->time)
- {
- return false;
- }
- p->time = now;
- p->id = 0;
- }
- p->id++;
- return true;
-}
-
bool
-packet_id_write(struct packet_id_send *p, struct buffer *buf, bool long_form,
- bool prepend)
+packet_id_write(const struct packet_id_net *pin, struct buffer *buf, bool long_form, bool prepend)
{
- if (!packet_id_send_update(p, long_form))
- {
- return false;
- }
+ packet_id_type net_id = htonpid(pin->id);
+ net_time_t net_time = htontime(pin->time);
- const packet_id_type net_id = htonpid(p->id);
- const net_time_t net_time = htontime(p->time);
if (prepend)
{
if (long_form)