summaryrefslogtreecommitdiffhomepage
path: root/src/dhcpv6.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2014-02-05 16:41:51 +0100
committerSteven Barth <steven@midlink.org>2014-02-05 16:41:51 +0100
commitb618ad5373ae619e3d01a49f2c672a8cc1dc59a6 (patch)
tree9cc63aac435c10799fcde7e459fb19f33b593087 /src/dhcpv6.c
parenteaa9fbea30a5c6de93b89b0acdb2ac856d4c9bcf (diff)
Fix homenet filter
Diffstat (limited to 'src/dhcpv6.c')
-rw-r--r--src/dhcpv6.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/dhcpv6.c b/src/dhcpv6.c
index 9b802c4..bf48d78 100644
--- a/src/dhcpv6.c
+++ b/src/dhcpv6.c
@@ -22,6 +22,8 @@
#include "odhcpd.h"
#include "dhcpv6.h"
+static const char *excluded_class = "HOMENET";
+
static void relay_client_request(struct sockaddr_in6 *source,
const void *data, size_t len, struct interface *iface);
@@ -275,6 +277,13 @@ static void handle_client_request(void *addr, void *data, size_t len,
if (olen != ntohs(dest.serverid_length) ||
memcmp(odata, &dest.duid_type, olen))
return; // Not for us
+ } else if (otype == DHCPV6_OPT_USER_CLASS) {
+ uint8_t *c = odata, *cend = &odata[olen];
+ for (; &c[2] <= cend && &c[2 + (c[0] << 8) + c[1]] <= cend; c = &c[2 + (c[0] << 8) + c[1]]) {
+ size_t elen = strlen(excluded_class);
+ if (((((size_t)c[0]) << 8) | c[1]) == elen && !memcmp(&c[2], excluded_class, elen))
+ return; // Ignore from homenet
+ }
}
}