BUG/MEDIUM: stick-tables: some sample-fetch doesn't work in the connection state.
The sc_* sample fetch can work without the struct strm, because the
tracked counters are also stored in the session. So, this patchs
removes the check for the strm existance.
This bug is recent and was introduced in 1.7-dev2 by commit 6204cd9
("BUG/MAJOR: vars: always retrieve the stream and session from the sample")
This bugfix must be backported in 1.6.
diff --git a/src/stream.c b/src/stream.c
index 4d87fc9..b5cfcfd 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -2754,7 +2754,8 @@
* ctr form the stream, then from the session if it was not there.
*/
- stkptr = &strm->stkctr[num];
+ if (strm)
+ stkptr = &strm->stkctr[num];
if (!strm || !stkctr_entry(stkptr)) {
stkptr = &sess->stkctr[num];
if (!stkctr_entry(stkptr))
@@ -2817,9 +2818,6 @@
static int
smp_fetch_sc_tracked(const struct arg *args, struct sample *smp, const char *kw, void *private)
{
- if (!smp->strm)
- return 0;
-
smp->flags = SMP_F_VOL_TEST;
smp->data.type = SMP_T_BOOL;
smp->data.u.sint = !!smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
@@ -2836,9 +2834,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -2866,9 +2861,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -2896,9 +2888,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -2925,9 +2914,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -2972,9 +2958,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -3007,9 +2990,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -3035,9 +3015,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -3106,9 +3083,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -3134,9 +3108,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -3161,9 +3132,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -3190,9 +3158,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -3218,9 +3183,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -3247,9 +3209,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -3275,9 +3234,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -3304,9 +3260,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -3332,9 +3285,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -3361,9 +3311,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -3389,9 +3336,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@@ -3417,9 +3361,6 @@
{
struct stkctr *stkctr;
- if (!smp->strm)
- return 0;
-
stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;