Skip to content

Commit

Permalink
Merge pull request #562 from pi-hole/tweak/regex_reply
Browse files Browse the repository at this point in the history
Add ;reply= regex extension documentation
  • Loading branch information
DL6ER authored Sep 12, 2021
2 parents a0169c0 + 4afd7ca commit 1218b1b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/ftldns/configfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

#### `REPLY_WHEN_BUSY=DROP|ALLOW|BLOCK|REFUSE` (PR [#1156](https://github.com/pi-hole/FTL/pull/1156)) {#reply_when_busy data-toc-label='Database busy reply'}

Expand Down
38 changes: 38 additions & 0 deletions docs/regex/pi-hole.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1218b1b

Please sign in to comment.