mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
9e72f717e0
This adds a utility module which is used to write applications for fuzzing RIOT network modules. The module provides a dummy network interface which is configured with a static IPv6 addresses for modules which perform operations on the underlying network interface. Besides, it contains a utility function for transforming data received on standard input into a `gnrc_pktsnip_t`.
58 lines
1.3 KiB
C
58 lines
1.3 KiB
C
/*
|
|
* Copyright (C) 2019 Sören Tempel <tempel@uni-bremen.de>
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
* directory for more details.
|
|
*/
|
|
|
|
/**
|
|
* @defgroup sys_fuzzing FUZZING utilities
|
|
* @ingroup sys
|
|
*
|
|
* @brief Various utilities for fuzzing network applications.
|
|
*
|
|
* @{
|
|
* @file
|
|
*
|
|
* @author Sören Tempel <tempel@uni-bremen.de>
|
|
*/
|
|
|
|
#ifndef FUZZING_H
|
|
#define FUZZING_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "net/ipv6/addr.h"
|
|
#include "net/gnrc/pkt.h"
|
|
|
|
/**
|
|
* @brief Initialize dummy network interface with given address.
|
|
*
|
|
* @param addr IPv6 address to use for interface, can be NULL.
|
|
* @param pfx_len The prefix length of @p addr, ignored if @p addr is NULL.
|
|
*
|
|
* @return 0 on success, non-zero otherwise.
|
|
*/
|
|
int fuzzing_init(ipv6_addr_t *addr, unsigned pfx_len);
|
|
|
|
/**
|
|
* @brief Read a network packet from the given file descriptor.
|
|
*
|
|
* @param fd File descriptor to read packet from.
|
|
* @param pkt Allocated packet structure to write packet to,
|
|
* will be resized accordingly.
|
|
*
|
|
* @return 0 on success, non-zero otherwise.
|
|
*/
|
|
int fuzzing_read_packet(int fd, gnrc_pktsnip_t *pkt);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
/** @} */
|
|
#endif /* FUZZING_H */
|