mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-11-20 10:35:34 +00:00
Randomize source ports for all outgoing connections. Fix for CERT VU#210620.
This commit is contained in:
parent
d3d33c5699
commit
ad744c6218
@ -35,6 +35,8 @@
|
|||||||
|
|
||||||
#include "ip64-conf.h"
|
#include "ip64-conf.h"
|
||||||
|
|
||||||
|
#include "lib/random.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef IP64_ADDRMAP_CONF_ENTRIES
|
#ifdef IP64_ADDRMAP_CONF_ENTRIES
|
||||||
@ -173,10 +175,8 @@ ip64_addrmap_lookup_port(uint16_t mapped_port, uint8_t protocol)
|
|||||||
static void
|
static void
|
||||||
increase_mapped_port(void)
|
increase_mapped_port(void)
|
||||||
{
|
{
|
||||||
mapped_port++;
|
mapped_port = (random_rand() % (LAST_MAPPED_PORT - FIRST_MAPPED_PORT)) +
|
||||||
if(mapped_port >= LAST_MAPPED_PORT) {
|
FIRST_MAPPED_PORT;
|
||||||
mapped_port = FIRST_MAPPED_PORT;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
struct ip64_addrmap_entry *
|
struct ip64_addrmap_entry *
|
||||||
|
Loading…
Reference in New Issue
Block a user