]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: pattern/map: Maps can returns various types
authorThierry FOURNIER <tfournier@arpalert.org>
Wed, 19 Aug 2015 07:05:25 +0000 (09:05 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 20 Aug 2015 15:13:46 +0000 (17:13 +0200)
A map can store and return various types as output. The only one example is the
IPv4 and IPv6 types. The previous patch remove the type from the sample storage
struct and use the conoverter output type, expecting that all entries of the
map have the same type.

This will be wrong when the maps will support both IPv4 and IPv6 as output.

include/types/applet.h
src/dumpstats.c

index ff82ef3c50a6ad698ecf34572b3fd5782488ae7c..2e8a297fff2931093eca161d3716e901de919890 100644 (file)
@@ -95,7 +95,6 @@ struct appctx {
                        unsigned int display_flags;
                        struct pat_ref *ref;
                        struct pat_ref_elt *elt;
-                       struct map_descriptor *desc;
                        struct pattern_expr *expr;
                        struct chunk chunk;
                } map;
index d1c48859e4bc154e00976dcd99a6ce1addf74556..0621f1ff7a27d6be7cb440f9760affe41419d65e 100644 (file)
@@ -5619,11 +5619,6 @@ static int stats_map_lookup(struct stream_interface *si)
                appctx->ctx.map.expr = LIST_ELEM(&appctx->ctx.map.ref->pat, struct pattern_expr *, list);
                appctx->ctx.map.expr = pat_expr_get_next(appctx->ctx.map.expr, &appctx->ctx.map.ref->pat);
                appctx->st2 = STAT_ST_LIST;
-
-               /* retrieve one of the compatible map descriptor for learnig the type. */
-               if (appctx->ctx.map.display_flags == PAT_REF_MAP)
-                       appctx->ctx.map.desc = container_of(appctx->ctx.map.expr->pat_head,
-                                                           struct map_descriptor, pat);
                /* fall through */
 
        case STAT_ST_LIST:
@@ -5698,7 +5693,7 @@ static int stats_map_lookup(struct stream_interface *si)
                                if (appctx->ctx.map.display_flags == PAT_REF_MAP) {
                                        if (pat->data && pat->ref && pat->ref->sample)
                                                chunk_appendf(&trash, ", value=\"%s\", type=\"%s\"", pat->ref->sample,
-                                                             smp_to_type[appctx->ctx.map.desc->conv->out_type]);
+                                                             smp_to_type[pat->data->type]);
                                        else
                                                chunk_appendf(&trash, ", value=none");
                                }