From: "cron2 (Code Review)" Date: Wed, 25 Dec 2024 15:31:45 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277... Message-ID: <90d28e37fdb3368c9bd64906ee0943970edd3ddb-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="7AAphAarvNI="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: Change internal id of packet id to uint64 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld , stipa Cc: openvpn-devel --7AAphAarvNI= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: stipa. cron2 has uploaded a new patch set (#9) to the change originally created by= plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/802?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+1 by stipa, Code-Review+2 by cron2 Change subject: Change internal id of packet id to uint64 ...................................................................... Change internal id of packet id to uint64 This allows to get rid of multiple casts and also prepares for the larger packet id used by epoch data format. Change-Id: If470af2eb456b2b10f9f2806933e026842188c42 Signed-off-by: Arne Schwabe Acked-by: Gert Doering Message-Id: <20241225142131.12543-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30= 199.html Signed-off-by: Gert Doering --- M src/openvpn/packet_id.c M src/openvpn/packet_id.h M tests/unit_tests/openvpn/test_packet_id.c 3 files changed, 55 insertions(+), 59 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/02/802/9 diff --git a/src/openvpn/packet_id.c b/src/openvpn/packet_id.c index fb962e4..117c95f 100644 --- a/src/openvpn/packet_id.c +++ b/src/openvpn/packet_id.c @@ -36,6 +36,8 @@ #include "syshead.h" +#include + #include "packet_id.h" #include "misc.h" #include "integer.h" @@ -56,7 +58,7 @@ const struct packet_id_rec *p, const struct packet_id_net *pin, const char *message, - int value); + packet_id_print_type value); #endif /* ENABLE_DEBUG */ @@ -65,7 +67,7 @@ const struct packet_id_rec *p, const struct packet_id_net *pin, const char *message, - int value) + uint64_t value) { #ifdef ENABLE_DEBUG if (unlikely(check_debug_level(msglevel))) @@ -115,22 +117,21 @@ const time_t local_now =3D now; if (p->seq_list) { - packet_id_type diff; + int64_t diff; /* - * If time value increases, start a new - * sequence number sequence. + * If time value increases, start a new sequence number sequence. */ if (!CIRC_LIST_SIZE(p->seq_list) || pin->time > p->time - || (pin->id >=3D (packet_id_type)p->seq_backtrack - && pin->id - (packet_id_type)p->seq_backtrack > p->id)) + || (pin->id >=3D p->seq_backtrack + && pin->id - p->seq_backtrack > p->id)) { p->time =3D pin->time; p->id =3D 0; - if (pin->id > (packet_id_type)p->seq_backtrack) + if (pin->id > p->seq_backtrack) { - p->id =3D pin->id - (packet_id_type)p->seq_backtrack; + p->id =3D pin->id - p->seq_backtrack; } CIRC_LIST_RESET(p->seq_list); } @@ -146,7 +147,7 @@ } diff =3D p->id - pin->id; - if (diff < (packet_id_type) CIRC_LIST_SIZE(p->seq_list) + if (diff < CIRC_LIST_SIZE(p->seq_list) && local_now > SEQ_EXPIRED) { CIRC_LIST_ITEM(p->seq_list, diff) =3D local_now; @@ -170,9 +171,8 @@ const time_t local_now =3D now; if (p->time_backtrack) { - int i; bool expire =3D false; - for (i =3D 0; i < CIRC_LIST_SIZE(p->seq_list); ++i) + for (int i =3D 0; i < CIRC_LIST_SIZE(p->seq_list); ++i) { const time_t t =3D CIRC_LIST_ITEM(p->seq_list, i); if (t =3D=3D SEQ_EXPIRED) @@ -200,7 +200,7 @@ packet_id_test(struct packet_id_rec *p, const struct packet_id_net *pin) { - packet_id_type diff; + uint64_t diff; packet_id_debug(D_PID_DEBUG, p, pin, "PID_TEST", 0); @@ -231,9 +231,9 @@ diff =3D p->id - pin->id; /* keep track of maximum backtrack seen for debugging purposes= */ - if ((int)diff > p->max_backtrack_stat) + if (diff > p->max_backtrack_stat) { - p->max_backtrack_stat =3D (int)diff; + p->max_backtrack_stat =3D diff; packet_id_debug(D_PID_DEBUG_LOW, p, pin, "PID_ERR replay-w= indow backtrack occurred", p->max_backtrack_stat); } @@ -557,7 +557,7 @@ const struct packet_id_rec *p, const struct packet_id_net *pin, const char *message, - int value) + packet_id_print_type value) { struct gc_arena gc =3D gc_new(); struct buffer out =3D alloc_buf_gc(256, &gc); @@ -569,7 +569,7 @@ CLEAR(tv); gettimeofday(&tv, NULL); - buf_printf(&out, "%s [%d]", message, value); + buf_printf(&out, "%s [" packet_id_format "]", message, value); buf_printf(&out, " [%s-%d] [", p->name, p->unit); for (i =3D 0; sl !=3D NULL && i < sl->x_size; ++i) { @@ -604,17 +604,17 @@ } buf_printf(&out, "%c", c); } - buf_printf(&out, "] %" PRIi64 ":" packet_id_format, (int64_t)p->time, = (packet_id_print_type)p->id); + buf_printf(&out, "] %" PRIi64 ":" packet_id_format, (int64_t)p->time, = p->id); if (pin) { - buf_printf(&out, " %" PRIi64 ":" packet_id_format, (int64_t)pin->t= ime, (packet_id_print_type)pin->id); + buf_printf(&out, " %" PRIi64 ":" packet_id_format, (int64_t)pin->t= ime, pin->id); } buf_printf(&out, " t=3D%" PRIi64 "[%d]", (int64_t)prev_now, (int)(prev_now - tv.tv_sec)); - buf_printf(&out, " r=3D[%d,%d,%d,%d,%d]", + buf_printf(&out, " r=3D[%d,%" PRIu64 ",%d,%" PRIu64 ",%d]", (int)(p->last_reap - tv.tv_sec), p->seq_backtrack, p->time_backtrack, diff --git a/src/openvpn/packet_id.h b/src/openvpn/packet_id.h index 3778d19..d8a3e1a 100644 --- a/src/openvpn/packet_id.h +++ b/src/openvpn/packet_id.h @@ -35,11 +35,13 @@ #include "error.h" #include "otime.h" -#if 1 /* - * These are the types that members of - * a struct packet_id_net are converted - * to for network transmission. + * These are the types that members of a struct packet_id_net are converted + * to for network transmission and for saving to a persistent file. + * + * Note: data epoch data uses a 64 bit packet ID + * compromised of 16 bit epoch and 48 bit per-epoch packet counter. + * These are ephemeral and are never saved to a file. */ typedef uint32_t packet_id_type; #define PACKET_ID_MAX UINT32_MAX @@ -64,31 +66,12 @@ /* convert a net_time_t in network order to a time_t in host order */ #define ntohtime(x) ((time_t)ntohl(x)) -#else /* if 1 */ - -/* - * DEBUGGING ONLY. - * Make packet_id_type and net_time_t small - * to test wraparound logic and corner cases. - */ - -typedef uint8_t packet_id_type; -typedef uint16_t net_time_t; - -#define PACKET_ID_WRAP_TRIGGER 0x80 - -#define htonpid(x) (x) -#define ntohpid(x) (x) -#define htontime(x) htons((net_time_t)x) -#define ntohtime(x) ((time_t)ntohs(x)) - -#endif /* if 1 */ /* * Printf formats for special types */ -#define packet_id_format "%u" -typedef unsigned int packet_id_print_type; +#define packet_id_format "%" PRIu64 +typedef uint64_t packet_id_print_type; =20 /* * Maximum allowed backtrack in @@ -128,10 +111,10 @@ { time_t last_reap; /* last call of packet_id_reap */ time_t time; /* highest time stamp received */ - packet_id_type id; /* highest sequence number received */ - int seq_backtrack; /* set from --replay-window */ + uint64_t id; /* highest sequence number received */ + uint64_t seq_backtrack; /* set from --replay-window */ int time_backtrack; /* set from --replay-window */ - int max_backtrack_stat; /* maximum backtrack seen so far */ + uint64_t max_backtrack_stat; /* maximum backtrack seen so far */ bool initialized; /* true if packet_id_init was called */ struct seq_list *seq_list; /* packet-id "memory" */ const char *name; @@ -164,7 +147,7 @@ */ struct packet_id_send { - packet_id_type id; + uint64_t id; time_t time; }; @@ -174,8 +157,12 @@ * sequence number. A long packet-id * includes a timestamp as well. * + * An epoch packet-id is a 16 bit epoch + * counter plus a 48 per-epoch packet-id + * * Long packet-ids are used as IVs for - * CFB/OFB ciphers. + * CFB/OFB ciphers and for control channel + * messages. * * This data structure is always sent * over the net in network byte order, @@ -191,9 +178,16 @@ * 64 bit platforms use a * 64 bit time_t. */ + +/** + * Data structure for describing the packet id that is received/send to the + * network. This struct does not match the on wire format. + */ struct packet_id_net { - packet_id_type id; + /* converted to packet_id_type on non-epoch data ids, does not contain + * the epoch but is a flat id */ + uint64_t id; time_t time; /* converted to net_time_t before transmission */ }; diff --git a/tests/unit_tests/openvpn/test_packet_id.c b/tests/unit_tests/o= penvpn/test_packet_id.c index a3567bc..d918985 100644 --- a/tests/unit_tests/openvpn/test_packet_id.c +++ b/tests/unit_tests/openvpn/test_packet_id.c @@ -90,8 +90,8 @@ now =3D 5010; assert_true(packet_id_write(&data->pis, &data->test_buf, true, false)); - assert(data->pis.id =3D=3D 1); - assert(data->pis.time =3D=3D now); + assert_int_equal(data->pis.id, 1); + assert_int_equal(data->pis.time, now); assert_true(data->test_buf_data.buf_id =3D=3D htonl(1)); assert_true(data->test_buf_data.buf_time =3D=3D htonl((uint32_t)now)); } @@ -117,8 +117,8 @@ data->test_buf.offset =3D sizeof(data->test_buf_data); now =3D 5010; assert_true(packet_id_write(&data->pis, &data->test_buf, true, true)); - assert(data->pis.id =3D=3D 1); - assert(data->pis.time =3D=3D now); + assert_int_equal(data->pis.id, 1); + assert_int_equal(data->pis.time, now); assert_true(data->test_buf_data.buf_id =3D=3D htonl(1)); assert_true(data->test_buf_data.buf_time =3D=3D htonl((uint32_t)now)); } @@ -128,7 +128,8 @@ { struct test_packet_id_write_data *data =3D *state; - data->pis.id =3D ~0; + /* maximum 32-bit packet id */ + data->pis.id =3D (packet_id_type)(~0); assert_false(packet_id_write(&data->pis, &data->test_buf, false, false= )); } @@ -137,7 +138,8 @@ { struct test_packet_id_write_data *data =3D *state; - data->pis.id =3D ~0; + /* maximum 32-bit packet id */ + data->pis.id =3D (packet_id_type)(~0); data->pis.time =3D 5006; /* Write fails if time did not change */ @@ -148,8 +150,8 @@ now =3D 5010; assert_true(packet_id_write(&data->pis, &data->test_buf, true, false)); - assert(data->pis.id =3D=3D 1); - assert(data->pis.time =3D=3D now); + assert_int_equal(data->pis.id, 1); + assert_int_equal(data->pis.time, now); assert_true(data->test_buf_data.buf_id =3D=3D htonl(1)); assert_true(data->test_buf_data.buf_time =3D=3D htonl((uint32_t)now)); } -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/802?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: If470af2eb456b2b10f9f2806933e026842188c42 Gerrit-Change-Number: 802 Gerrit-PatchSet: 9 Gerrit-Owner: plaisthos Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: stipa Gerrit-CC: openvpn-devel Gerrit-Attention: stipa Gerrit-MessageType: newpatchset --7AAphAarvNI= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: stipa.

cron2 uploaded patch set #9 to the change originally cr= eated by plaisthos.

View Change

The following approvals got outdated= and were removed: Code-Review+1 by stipa, Code-Review+2 by cron2

Change internal id of packet=
 id to uint64

This allows to get rid of multiple casts and also prep= ares for the
larger packet id used by epoch data format.

Change-I= d: If470af2eb456b2b10f9f2806933e026842188c42
Signed-off-by: Arne Schwabe= <arne@...1227...>
Acked-by: Gert Doering <gert@...1296...><= br>Message-Id: <20241225142131.12543-1-gert@...1296...>
URL: https= ://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30199.htmlSigned-off-by: Gert Doering <gert@...1296...>
---
M src/openv= pn/packet_id.c
M src/openvpn/packet_id.h
M tests/unit_tests/openvpn/t= est_packet_id.c
3 files changed, 55 insertions(+), 59 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/02/802/9<=
/pre>
+#include <stddef.h>
+
#include "packet_id.h"
<= span> #include "misc.h"
#include "integer.h= "
@@ -56,7 +58,7 @@
= const struct packet_id_rec *p,
= const struct packet_id_net *pin,
= const char *message,
- int value= );
+ = packet_id_print_type value);

<= span> #endif /* ENABLE_DEBUG */

@@ -65,7 = +67,7 @@
const struct packet_id_rec *p,
const struct packet_id_net *pin,
<= span> const char *message,

- int value)
+ uint64_t value)
{
#ifdef ENABLE_DEBUG
if (unlikely(= check_debug_level(msglevel)))
@@ -115,22 +117,21 @@<= br> const time_t local_now =3D now;
if (p-&g= t;seq_list)
{
- packet_id_type diff;
+ int64_t diff;

/*
- = * If time value increases, start a new
- * sequence number sequence.
+ * If time value increases, sta= rt a new sequence number sequence.
*/
<= span> if (!CIRC_LIST_SIZE(p->seq_list)
= || pin->time > p->time
- || (pin->id >=3D (packet_id_type)p->seq_= backtrack
- = && pin->id - (packet_id_type)p->seq_backtrack > p->= id))
+ || = (pin->id >=3D p->seq_backtrack
+ && pin->id - p->seq_backt= rack > p->id))
{
= p->time =3D pin->time;
p->id =3D 0;=
- if (pin-&= gt;id > (packet_id_type)p->seq_backtrack)
+ if (pin->id > p->seq_backt= rack)
{
- p->id =3D pin->id - (packet_id_type)p-= >seq_backtrack;
+ = p->id =3D pin->id - p->seq_backtrack;
}
CIRC_LIST_RESET(p->seq_li= st);
}
@@ -146,7 +147,7 @@<= br> }

diff =3D p-&= gt;id - pin->id;
- = if (diff < (packet_id_type) CIRC_LIST_SIZE(p->seq_list)<= br>+ if (diff < CIRC_= LIST_SIZE(p->seq_list)
&& local_now= > SEQ_EXPIRED)
{
= CIRC_LIST_ITEM(p->seq_list, diff) =3D local_now;
@@ -170= ,9 +171,8 @@
const time_t local_now =3D now; if (p->time_backtrack)
{
- int i;
= bool expire =3D false;
- for (i =3D 0; i < CIRC_LIST_SIZE(p->seq_list); ++i)

+ for (int i =3D 0= ; i < CIRC_LIST_SIZE(p->seq_list); ++i)
{
const time_t t =3D CIRC_LIST_ITEM(p->seq_list= , i);
if (t =3D=3D SEQ_EXPIRED)
@@ -200,7 +200,7 @@

packet_id_test(struct packet_id_rec = *p,
const struct packet_id_net *pin)=
{
- packe= t_id_type diff;
+ = uint64_t diff;

packet_id_debug(D_PID= _DEBUG, p, pin, "PID_TEST", 0);

@@ -231,9 +231,9 @@
diff =3D p->id - pin-&= gt;id;

/* keep track of maxi= mum backtrack seen for debugging purposes */
- if ((int)diff > p->max_backtrack_s= tat)
+ if = (diff > p->max_backtrack_stat)
{<= br>- p->max_bac= ktrack_stat =3D (int)diff;
+ p->max_backtrack_stat =3D diff;
= packet_id_debug(D_PID_DEBUG_LOW, p, pin, "PID_ERR repl= ay-window backtrack occurred", p->max_backtrack_stat);
}

@@ -557,7 +557,7 @@

const struct packet_id_rec *p,<= br> const struct packet_id_net *pin,
= const char *message,
- int value)
+ packet_id_pr= int_type value)
{
struct gc_arena gc = =3D gc_new();
struct buffer out =3D alloc_buf_gc(256, = &gc);
@@ -569,7 +569,7 @@
CLEAR(tv= );
gettimeofday(&tv, NULL);

- buf_printf(&out, &= quot;%s [%d]", message, value);
+ buf_printf(&out, "%s [" packet_id_format= "]", message, value);
buf_printf(&out, = " [%s-%d] [", p->name, p->unit);
for (= i =3D 0; sl !=3D NULL && i < sl->x_size; ++i)
{
@@ -604,17 +604,17 @@
}
buf_printf(&out, "%c", c);
<= span> }

- buf_pr= intf(&out, "] %" PRIi64 ":" packet_id_format, (int6= 4_t)p->time, (packet_id_print_type)p->id);
+ buf_printf(&out, "] %" PRIi6= 4 ":" packet_id_format, (int64_t)p->time, p->id); if (pin)
{
- buf_printf(&out, " %" PRIi64 &q= uot;:" packet_id_format, (int64_t)pin->time, (packet_id_print_type)= pin->id);
+ = buf_printf(&out, " %" PRIi64 ":" packet_id_format,= (int64_t)pin->time, pin->id);
}

buf_printf(&out, " t=3D%" PRIi64 &quo= t;[%d]",
(int64_t)prev_now,
= (int)(prev_now - tv.tv_sec));

- buf_printf(&out, &q= uot; r=3D[%d,%d,%d,%d,%d]",
+ buf_printf(&out, " r=3D[%d,%" PRIu64 ",= %d,%" PRIu64 ",%d]",
(int)(p= ->last_reap - tv.tv_sec),
p->seq_back= track,
p->time_backtrack,
diff --git a/src/openvpn/packet_id.h b/src/openvpn/packet_id.h
= index 3778d19..d8a3e1a 100644
--- a/src/openvpn/packe= t_id.h
+++ b/src/openvpn/packet_id.h
@@ -35= ,11 +35,13 @@
#include "error.h"
#include "otime.h"

-#if 1
/*
- * These are the types that members of

- * a struct packet_id_net = are converted
- * to fo= r network transmission.
+ * These are the types that members of a struct packet_id_net are conve= rted
+ * to for netwo= rk transmission and for saving to a persistent file.
+ *
+ * Note: data epoch data uses a 64 bit packet ID+ * compromised of 16 bit epoc= h and 48 bit per-epoch packet counter.
+ * These are ephemeral and are never saved to a file.
*/
typedef uint32_t packet_id_type;=
#define PACKET_ID_MAX UINT32_MAX
@@ -64,31 +66,1= 2 @@
/* convert a net_time_t in network order to a time_t = in host order */
#define ntohtime(x) ((time_t)ntohl(x))

-#else = /* if 1 */
--/*
- * DEBUGGING ONLY.
- * Make packet_id_type and net_time_t small- * to test wraparound logic and= corner cases.
- */

-
-typedef uint8_t packet_id_type;
-typedef uint16_t net_time_t;<= br>-
-#define PACKET_ID_WRAP_TRIGGER 0x80
-
-#define htonpid(x) (x)
-#define ntohpid(x) (x)
-#define htontime(x) htons((net_time_t)x)
-#define ntohtime(x) ((time_t)ntohs(x= ))
-
-#endif /* if 1 */

/*
* Printf formats for special types=
*/
-#define= packet_id_format "%u"
-typedef unsigned int packet_id_print_type;
+#define packet_id_format "%" PR= Iu64
+typedef uint64_= t packet_id_print_type;

/*
* Maximum allowed backtrack in
@@ -128,10 +111,10 @@
{
time_t last_reap; /* last ca= ll of packet_id_reap */
time_t time; /* h= ighest time stamp received */
- packet_id_type id; /* highest sequence number received *= /
- int seq_backtrac= k; /* set from --replay-window */
+ uint64_t id; /* highest sequence numb= er received */
+ u= int64_t seq_backtrack; /* set from --replay-window */
= int time_backtrack; /* set from --replay-window */
- int max_backtrack_stat; /* maxim= um backtrack seen so far */
+ uint64_t max_backtrack_stat; /* maximum backtrack seen so far= */
bool initialized; /* true if packet_id_ini= t was called */
struct seq_list *seq_list; /* packet-i= d "memory" */
const char *name;
@@ -164,7 +147,7 @@

*/
struct packet= _id_send
{
- packet_id_type id;
+ uint64_t id;
time_t time;
};

@@ -174,8 +157,12 @@
* sequence number. A long packet-id
* includes a time= stamp as well.
*
+ * An epoch packet-id is a 16 bit epoch
+ * counter plus a 48 per-epoch packet-id=
+ *
= * Long packet-ids are used as IVs for
- * CFB/OFB ciphers.
+ * CFB/OFB ciphers and for control channel
+ * messages.
*
* This data structure is always sent
* o= ver the net in network byte order,
@@ -191,9 +178,16 @@

* 64 bit platforms use a
* 64 bit time_t.<= /span>
*/
= +
+/**
+ * Data structure for describing t= he packet id that is received/send to the

+ * network. This struct does not match the on wire fo= rmat.
+ */
= struct packet_id_net
{
- packet_id_type id;
+ /* converted to packet_id_type on non-epoch= data ids, does not contain
+ * the epoch but is a flat id */
+ uint64_t id;
time_t time;= /* converted to net_time_t before transmission */
};


diff --git a/tests/unit_tests/openvpn/test_pa= cket_id.c b/tests/unit_tests/openvpn/test_packet_id.c
index= a3567bc..d918985 100644
--- a/tests/unit_tests/openvpn/tes= t_packet_id.c
+++ b/tests/unit_tests/openvpn/test_packet_id= .c
@@ -90,8 +90,8 @@

= now =3D 5010;
assert_true(packet_id_write(&data-&= gt;pis, &data->test_buf, true, false));
- assert(data->pis.id =3D=3D 1);
- assert(data->pis.time =3D= =3D now);
+ assert= _int_equal(data->pis.id, 1);
+ assert_int_equal(data->pis.time, now);
= assert_true(data->test_buf_data.buf_id =3D=3D htonl(1));
<= span> assert_true(data->test_buf_data.buf_time =3D=3D htonl((uint32_= t)now));
}
@@ -117,8 +117,8 @@
<= span> data->test_buf.offset =3D sizeof(data->test_buf_data);

now =3D 5010;
assert_true(packet_id_w= rite(&data->pis, &data->test_buf, true, true));
- assert(data->pis.id =3D=3D 1= );
- assert(data->= ;pis.time =3D=3D now);
+ assert_int_equal(data->pis.time, now);
assert_true(data->test_buf_data.buf_id =3D=3D htonl(1))= ;
assert_true(data->test_buf_data.buf_time =3D=3D h= tonl((uint32_t)now));
}
@@ -128,7 +128,8 @= @
{
struct test_packet_id_write_data = *data =3D *state;

- data->pis.id =3D ~0;
+ /* maximum 32-bit packet id */
+ data->pis.id =3D (packet_id_typ= e)(~0);
assert_false(packet_id_write(&data->pis= , &data->test_buf, false, false));
}

@@ -137,7 +138,8 @@
{
= struct test_packet_id_write_data *data =3D *state;

- data->pis.id =3D= ~0;
+ /* maximum = 32-bit packet id */
+= data->pis.id =3D (packet_id_type)(~0);
data->= ;pis.time =3D 5006;

/* Write fails i= f time did not change */
@@ -148,8 +150,8 @@
now =3D 5010;

assert_true(packet_id_write(&= data->pis, &data->test_buf, true, false));

- assert(data->pis.id= =3D=3D 1);
- assert= (data->pis.time =3D=3D now);
+ assert_int_equal(data->pis.id, 1);
+ assert_int_equal(data->pis.time, n= ow);
assert_true(data->test_buf_data.buf_id =3D=3D = htonl(1));
assert_true(data->test_buf_data.buf_time= =3D=3D htonl((uint32_t)now));
}

To view, visit change 802. To unsubscribe, or for help writing mail f= ilters, visit settings.<= /p>

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If470af2eb456b2b10f9f2806933= e026842188c42
Gerrit-Change-Number: 802
Gerrit-PatchSet: 9
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: stipa <lstipakov@...277...= >
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: stipa <lstipakov@...1663...= .>
Gerrit-MessageType: newpatchset
--7AAphAarvNI=--