Commit 935128b7 authored by Geoff Simmons's avatar Geoff Simmons

Add in & out stats for encryption VFPs, and bugfix in for decryption.

parent dbd9d1bb
......@@ -132,8 +132,6 @@ client c1 {
logexpect l1 -wait
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 3
varnish v1 -expect ECE.vfp.ece_decrypt.in == 147
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
## Errors
......@@ -178,8 +176,6 @@ client c1 {
logexpect l1 -wait
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 4
varnish v1 -expect ECE.vfp.ece_decrypt.in == 150
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
server s1 -wait
server s1 {
......@@ -197,8 +193,6 @@ client c1 {
} -run
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 5
varnish v1 -expect ECE.vfp.ece_decrypt.in == 150
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
server s1 -wait
server s1 {
......@@ -226,8 +220,6 @@ client c1 {
logexpect l1 -wait
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 6
varnish v1 -expect ECE.vfp.ece_decrypt.in == 172
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
server s1 -wait
server s1 {
......@@ -247,8 +239,6 @@ client c1 {
} -run
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 7
varnish v1 -expect ECE.vfp.ece_decrypt.in == 193
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
server s1 -wait
server s1 {
......@@ -276,8 +266,6 @@ client c1 {
logexpect l1 -wait
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 8
varnish v1 -expect ECE.vfp.ece_decrypt.in == 214
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
server s1 -wait
server s1 {
......@@ -305,8 +293,6 @@ client c1 {
logexpect l1 -wait
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 9
varnish v1 -expect ECE.vfp.ece_decrypt.in == 235
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
server s1 -wait
server s1 {
......@@ -334,8 +320,6 @@ client c1 {
logexpect l1 -wait
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 10
varnish v1 -expect ECE.vfp.ece_decrypt.in == 258
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
server s1 -wait
server s1 {
......@@ -365,8 +349,6 @@ client c1 {
logexpect l1 -wait
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 11
varnish v1 -expect ECE.vfp.ece_decrypt.in == 279
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
server s1 -wait
server s1 -start
......@@ -403,5 +385,3 @@ client c1 {
logexpect l1 -wait
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 12
varnish v1 -expect ECE.vfp.ece_decrypt.in == 300
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
......@@ -61,6 +61,8 @@ logexpect l1 -v v1 -d 1 -g vxid -q "VfpAcct" {
} -run
varnish v1 -expect ECE.vfp.ece_encrypt.ops == 1
varnish v1 -expect ECE.vfp.ece_encrypt.in == 15
varnish v1 -expect ECE.vfp.ece_encrypt.out == 53
# set-salt error
varnish v1 -vcl+backend {
......
......@@ -149,7 +149,11 @@ logexpect l1 -v v1 -d 1 -g vxid -q "VfpAcct" {
expect * = End
} -run
# encrypt.out == decrypt.in, confirm in the log
varnish v1 -expect ECE.vfp.ece_encrypt.ops == 6
varnish v1 -expect ECE.vfp.ece_encrypt.in == 199975
varnish v1 -expect ECE.vfp.ece_encrypt.out > 199975
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 6
varnish v1 -expect ECE.vfp.ece_decrypt.in > 199975
varnish v1 -expect ECE.vfp.ece_decrypt.out == 199975
......
......@@ -333,8 +333,6 @@ vfp_decrypt_pull(struct vfp_ctx *ctx, struct vfp_entry *ent, void *ptr,
setOutputBuf(stream, ptr, *lenp);
inb4 = recBufIn(stream);
flushRecBuf(stream);
if (stats != NULL)
stats->in += recBufIn(stream) - inb4;
if (isOutputBufFull(stream)) {
*lenp = outputLen(stream, p);
if (stats != NULL)
......@@ -346,15 +344,14 @@ vfp_decrypt_pull(struct vfp_ctx *ctx, struct vfp_entry *ent, void *ptr,
size_t len = ece->chunksz;
vp = suck_bytes(ctx, ece->buf, &len);
assert(len <= ece->chunksz);
if (stats != NULL)
stats->in += len;
if (vp == VFP_ERROR)
return (vp);
setInputBuf(stream, ece->buf, len);
}
if (!isInputBufEmpty(stream)) {
inb4 = streamIn(stream);
vp = decrypt(ctx, ece, vp);
if (stats != NULL)
stats->in += streamIn(stream) - inb4;
if (vp == VFP_ERROR)
return (vp);
}
......
......@@ -208,7 +208,9 @@ vfp_encrypt_pull(struct vfp_ctx *ctx, struct vfp_entry *ent, void *ptr,
struct ece *ece;
struct ece_stream *stream;
struct ece_hdrbuf *hdrbuf;
unsigned char *p = ptr;
const struct vfp_cfg *cfg;
struct VSC_ece *stats;
unsigned char *p = ptr, *inb4;
enum vfp_status vp = VFP_OK;
CHECK_OBJ_NOTNULL(ctx, VFP_CTX_MAGIC);
......@@ -216,18 +218,23 @@ vfp_encrypt_pull(struct vfp_ctx *ctx, struct vfp_entry *ent, void *ptr,
CAST_OBJ_NOTNULL(ece, ent->priv1, ECE_MAGIC);
CHECK_OBJ_NOTNULL(ece->stream, ECE_STREAM_MAGIC);
CHECK_OBJ_NOTNULL(ece->hdr, ECE_HDRBUF_MAGIC);
AN(ent->vfp);
CAST_OBJ_NOTNULL(cfg, ent->vfp->priv1, VFP_CFG_MAGIC);
AN(ptr);
AN(lenp);
assert(ece->rs > TAG_LEN + 1);
stream = ece->stream;
hdrbuf = ece->hdr;
stats = cfg->stats;
setOutputBuf(stream, ptr, *lenp);
if (!isHdrBufEmpty(hdrbuf)) {
flushHdrBuf(stream, hdrbuf);
if (isOutputBufFull(stream)) {
*lenp = outputLen(stream, p);
if (stats != NULL)
stats->out += *lenp;
return (VFP_OK);
}
}
......@@ -239,12 +246,17 @@ vfp_encrypt_pull(struct vfp_ctx *ctx, struct vfp_entry *ent, void *ptr,
memset(ece->buf, 0, len);
vp = suck_bytes(ctx, ece->buf, &len);
assert(len <= ece->chunksz);
if (stats != NULL)
stats->in += len;
if (vp == VFP_ERROR)
return (vp);
setInputBuf(stream, ece->buf, len);
}
else {
inb4 = streamIn(stream);
vp = fillInputBuf(ctx, stream, ece->chunksz, vp);
if (stats != NULL)
stats->in += streamIn(stream) - inb4;
if (vp == VFP_ERROR)
return (vp);
}
......@@ -255,6 +267,8 @@ vfp_encrypt_pull(struct vfp_ctx *ctx, struct vfp_entry *ent, void *ptr,
if (encrypt_status == VFP_NULL) {
/* Output record was buffered */
*lenp = outputLen(stream, p);
if (stats != NULL)
stats->out += *lenp;
return (VFP_OK);
}
}
......@@ -263,6 +277,8 @@ vfp_encrypt_pull(struct vfp_ctx *ctx, struct vfp_entry *ent, void *ptr,
}
*lenp = outputLen(stream, p);
if (stats != NULL)
stats->out += *lenp;
return (vp);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment