mirror of
https://github.com/coredns/coredns.git
synced 2025-11-12 15:02:17 -05:00
Add EDNS0_SUBNET rewrite (#1022)
* Add EDNS0_SUBNET rewrite * Fix review comments * Update comment * Fix according to review comments * Add ResponseWriter6 instead of parameterized the existing ResponseWriter
This commit is contained in:
@@ -37,7 +37,7 @@ Using FIELD edns0, you can set, append, or replace specific EDNS0 options on the
|
||||
* `append` will add the option regardless of what options already exist
|
||||
* `set` will modify a matching option or add one if none is found
|
||||
|
||||
Currently supported are `EDNS0_LOCAL` and `EDNS0_NSID`.
|
||||
Currently supported are `EDNS0_LOCAL`, `EDNS0_NSID` and `EDNS0_SUBNET`.
|
||||
|
||||
### `EDNS0_LOCAL`
|
||||
|
||||
@@ -74,3 +74,18 @@ rewrite edns0 local set 0xffee {client_ip}
|
||||
|
||||
This has no fields; it will add an NSID option with an empty string for the NSID. If the option already exists
|
||||
and the action is `replace` or `set`, then the NSID in the option will be set to the empty string.
|
||||
|
||||
### `EDNS0_SUBNET`
|
||||
|
||||
This has two fields, IPv4 bitmask length and IPv6 bitmask length. The bitmask
|
||||
length is used to extract the client subnet from the source IP address in the query.
|
||||
|
||||
Example:
|
||||
|
||||
~~~
|
||||
rewrite edns0 subnet set 24 56
|
||||
~~~
|
||||
|
||||
* If the query has source IP as IPv4, the first 24 bits in the IP will be the network subnet.
|
||||
* If the query has source IP as IPv6, the first 56 bits in the IP will be the network subnet.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user