mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-08-15 12:27:50 +00:00
Merge pull request #889 from adamdunkels/pr/ip64-fix
IP64: randomize source ports for all outgoing connections
This commit is contained in:
@@ -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 *
|
||||||
|
Reference in New Issue
Block a user