From 1a3146826abca80a95262cd632a6e3cfb5a90777 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 11 Sep 2021 21:34:02 +0200 Subject: [PATCH] Add ;reply= regex extension documentation Signed-off-by: DL6ER --- docs/ftldns/configfile.md | 4 ++-- docs/regex/pi-hole.md | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/docs/ftldns/configfile.md b/docs/ftldns/configfile.md index 96ca7cd..c3ae39c 100755 --- a/docs/ftldns/configfile.md +++ b/docs/ftldns/configfile.md @@ -42,11 +42,11 @@ Rate-limiting may be disabled altogether by setting `RATE_LIMIT=0/0` (this resul #### `REPLY_ADDR4` (no default, PR [#965](https://github.com/pi-hole/FTL/pull/965)) {#reply_addr4 data-toc-label='Force A reply'} -When using `IP` blocking mode, `FTL` determines the address of the interface a query arrived on. We then use this IP address in the blocked reply. This setting can be used to overwrite the replied IPv4 (`A`) address. +When using `IP` blocking mode, `FTL` determines the address of the interface a query arrived on. We then use this IP address in the blocked reply. This setting can be used to overwrite the replied IPv4 (`A`) address. It also overwrites the `A` record generated by the [`;reply=IP` regex extension](../regex/pi-hole.md#specify-reply-type) #### `REPLY_ADDR6` (no default, PR [#965](https://github.com/pi-hole/FTL/pull/965)) {#reply_addr6 data-toc-label='Force AAAA reply'} -When using `IP` blocking mode, `FTL` determines the address of the interface a query arrived on. We then use this IP address in the blocked reply. This setting can be used to overwrite the replied IPv6 (`AAAA`) address. +When using `IP` blocking mode, `FTL` determines the address of the interface a query arrived on. We then use this IP address in the blocked reply. This setting can be used to overwrite the replied IPv6 (`AAAA`) address. It also overwrites the `A` record generated by the [`;reply=IP` regex extension](../regex/pi-hole.md#specify-reply-type). --- diff --git a/docs/regex/pi-hole.md b/docs/regex/pi-hole.md index d0e90ac..8fd4349 100644 --- a/docs/regex/pi-hole.md +++ b/docs/regex/pi-hole.md @@ -56,6 +56,44 @@ will not block `abc` with type `AAAA` (but everything else) for the clients assi will block **not** block `abc` but **everything else**. +## Specify reply type + +Pi-hole allows you to configure the reply it serves when a regular expression matches a query. This can be controlled via the `;reply` keyword. + +Valid options are: + +- `;reply=nodata` (an empty answer will be provided) +- `;reply=nxdomain` ("no such domain" will be provided, can cause unintended side-effects) +- `;reply=refused` (the query will be refused) +- `;reply=none` (the query will be silently dropped) +- `;reply=ip` (the Pi-hole's IP address if not overwritten by [`REPLY_ADDR4`](../ftldns/configfile.md#reply_addr4) and/or [`REPLY_ADDR6`](../ftldns/configfile.md#reply_addr6)) +- `;reply=1.2.3.4` (any valid IPv4 address) +- `;reply=fe80::1234` (any valid IPv6 address) + +Only one option should be specified. An exception to this rule are the last two options which may be specified at the same time to configure both an IPv4 and an IPv6 address: + +- IPv4 only: + + ``` plain + myregex;reply=1.2.3.4 + ``` + + will result in `A 1.2.3.4` and `AAAA ::` +- IPv6 only: + + ``` plain + myregex;reply=fe80::1234 + ``` + + will result in `A 0.0.0.0` and `AAAA fe80:1234` +- IPv4 and IPv6: + + ``` plain + myregex;reply=1.2.3.4;reply=fe80::1234 + ``` + + will result in `A 1.2.3.4` and `AAAA fe80:1234` + ## Comments You can specify comments withing your regex using the syntax