zephyr/subsys/net/lib/dns/dns_internal.h
Jukka Rissanen 6493af2714 tests: net: dns: Add tests for catching malformed packets
Add more tests to verify that we discard malformed packets.
In order to simplify the testing, separate message validation to
dns_validate_msg() function in resolve.c. Allow that function to
be called from unit test. This way we can construct invalid DNS
messages in unit test and verify that they are discarded when
needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-27 08:05:52 -04:00

19 lines
390 B
C

/*
* Copyright (c) 2020 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/types.h>
#include <net/buf.h>
#include <net/dns_resolve.h>
#include "dns_pack.h"
int dns_validate_msg(struct dns_resolve_context *ctx,
struct dns_msg_t *dns_msg,
uint16_t *dns_id,
int *query_idx,
struct net_buf *dns_cname,
uint16_t *query_hash);