6 Commits

Author SHA1 Message Date
Andrea Barberio
4861d2ce08 Added license headers
Signed-off-by: Andrea Barberio <insomniac@slackware.it>
2019-09-18 13:59:16 +01:00
Anatole Denis
b566efa666 plugins: Decapsulate DHCPv6 relayed requests
The `request` argument to handlers passes the full DHCPv6 message as
received by the server. Notably, relayed messages will stay encapsulated
in each other. These two plugins (server_id and file) are accessing the
options of the outermost message, causing incorrect behavior when
handling relayed messages.

Signed-off-by: Anatole Denis <anatole@unverle.fr>
2019-09-12 23:00:48 +02:00
Anatole Denis
79b3d047cc plugins/server_id: Extend ServerID rejection tests
The RFC is a bit more verbose than "reject when DUIDs mismatch".
This patch adds these conditions as expressed in the various
subsections of RFC8416 section 16

Signed-off-by: Anatole Denis <anatole@unverle.fr>
2019-09-12 23:00:48 +02:00
Anatole Denis
5cd963f1a3 plugins/server_id: Add a happy-path test
Signed-off-by: Anatole Denis <anatole@unverle.fr>
2019-09-12 23:00:48 +02:00
Anatole Denis
4a73abd6b6 plugins/server_id: Abort when ServerID is nil
For V6ServerID to be nil, either:
 * The handler is running before setupServer6 ran (should be impossible)
 * Some other code modified V6ServerID outside of this plugin
   which is probably worth aborting as well.
   Unexport V6ServerID (and v4ServerID) to prevent this second one

Signed-off-by: Anatole Denis <anatole@unverle.fr>
2019-09-12 23:00:48 +02:00
Anatole Denis
e23dd4d1f9 plugins/server_id: Reject non-matching ServerIDs
From [RFC8415](https://tools.ietf.org/html/rfc8415#section-16.4):
```
Servers MUST discard any received Request message that meets any of
   the following conditions:
[...]
   -  the contents of the Server Identifier option do not match the
      server's DUID.
```

Closes #36

Signed-off-by: Anatole Denis <anatole@unverle.fr>
2019-09-12 23:00:48 +02:00