Some sample fetches return contents which may be written in multiple
equivalent forms that are interpreted the same way by the next hop, for
example the path with its %-encoding, its case, or its "/./" and "../"
segments. Matching such contents against a pattern to deny requests is
unreliable, and we'll want to be able to detect such constructs at boot.
This adds SMP_USE__MAY_ALIAS, which is not a source but a property of the
fetched contents. It is placed in the ->use field so that it doesn't
require a new field in all fetch keywords, and since this field is
already or'ed into the ACLs and conditions, it will be possible to
quickly check if a condition involves such a fetch.
The double underscore marks the values which are properties of the
contents and not sources. They're not mapped to any SMP_SRC_* value, so
they're ignored when computing the validity domain. They are allocated
from the topmost bit downwards, leaving all the room to the sources
below, and a build time check verifies that the sources never reach
bit 31.
/* This composite one is useful to detect if an http_txn needs to be allocated */
SMP_USE_HTTP_ANY = SMP_USE_HRQHV | SMP_USE_HRQHP | SMP_USE_HRQBO |
SMP_USE_HRSHV | SMP_USE_HRSHP | SMP_USE_HRSBO,
+
+ /* The values below are not sources but properties of the fetched
+ * contents. Their names start with "SMP_USE__" to distinguish them from
+ * the sources. They are not mapped to any SMP_SRC_* value and are thus
+ * ignored when computing the validity domain. They are allocated from
+ * the topmost bit downwards, and the sources must never reach them. They
+ * are or'ed into the ACLs' and conditions' ->use like sources, which
+ * allows to quickly check whether a condition depends on such contents.
+ */
+ SMP_USE__MAY_ALIAS = 1U << 31, /* contents may be aliased: multiple equivalent forms (eg: %-encoding, case, "/./") */
};
/* Sample validity is computed from the fetch sources above when keywords
.list = LIST_HEAD_INIT(sample_convs.list)
};
+/* the sources must never reach the content properties (SMP_USE__*) */
+BUG_ON_STATIC(SMP_SRC_ENTRIES > 31);
+
const unsigned int fetch_cap[SMP_SRC_ENTRIES] = {
[SMP_SRC_CONST] = (SMP_VAL_FE_CON_ACC | SMP_VAL_FE_SES_ACC | SMP_VAL_FE_REQ_CNT |
SMP_VAL_FE_HRQ_HDR | SMP_VAL_FE_HRQ_BDY | SMP_VAL_FE_SET_BCK |