diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-03-04 01:25:50 +0100 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2020-10-29 22:09:01 +0100 |
commit | aff290bfee0b35a53bafb906aed107cc0b63a922 (patch) | |
tree | e8663d748614fbbd9d25f5214df6fc1ac69cd47e | |
parent | 2677fa10dc2eb455e9135ab40022ae586c651c0f (diff) |
dhcpv6: check message type
Signed-off-by: Mikael Magnusson <mikma@users.sourceforge.net>
-rw-r--r-- | src/dhcpv6.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/dhcpv6.c b/src/dhcpv6.c index 21b95fa..7c6c7ab 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -360,9 +360,24 @@ static void handle_client_request(void *addr, void *data, size_t len, if (hdr->msg_type == DHCPV6_MSG_RELAY_FORW) handle_nested_message(data, len, &hdr, &opts, &opts_end, iov); - if (hdr->msg_type == DHCPV6_MSG_ADVERTISE || hdr->msg_type == DHCPV6_MSG_REPLY || - hdr->msg_type == DHCPV6_MSG_RELAY_REPL) - return; + switch (hdr->msg_type) { + case DHCPV6_MSG_SOLICIT: + case DHCPV6_MSG_REQUEST: + case DHCPV6_MSG_CONFIRM: + case DHCPV6_MSG_RENEW: + case DHCPV6_MSG_REBIND: + case DHCPV6_MSG_RELEASE: + case DHCPV6_MSG_DECLINE: + case DHCPV6_MSG_INFORMATION_REQUEST: + case DHCPV6_MSG_RELAY_FORW: + break; /* Valid message types for clients */ + case DHCPV6_MSG_ADVERTISE: + case DHCPV6_MSG_REPLY: + case DHCPV6_MSG_RECONFIGURE: + case DHCPV6_MSG_RELAY_REPL: + default: + return; /* Invalid message types for clients */ + } if (!IN6_IS_ADDR_MULTICAST((struct in6_addr *)dest_addr) && iov[IOV_NESTED].iov_len == 0 && (hdr->msg_type == DHCPV6_MSG_SOLICIT || hdr->msg_type == DHCPV6_MSG_CONFIRM || |