Merge pull request #889 from adamdunkels/pr/ip64-fix
IP64: randomize source ports for all outgoing connections
This commit is contained in:
commit
f82393b983
@ -35,6 +35,8 @@
|
||||
|
||||
#include "ip64-conf.h"
|
||||
|
||||
#include "lib/random.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef IP64_ADDRMAP_CONF_ENTRIES
|
||||
@ -173,10 +175,8 @@ ip64_addrmap_lookup_port(uint16_t mapped_port, uint8_t protocol)
|
||||
static void
|
||||
increase_mapped_port(void)
|
||||
{
|
||||
mapped_port++;
|
||||
if(mapped_port >= LAST_MAPPED_PORT) {
|
||||
mapped_port = FIRST_MAPPED_PORT;
|
||||
}
|
||||
mapped_port = (random_rand() % (LAST_MAPPED_PORT - FIRST_MAPPED_PORT)) +
|
||||
FIRST_MAPPED_PORT;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
struct ip64_addrmap_entry *
|
||||
|
Loading…
Reference in New Issue
Block a user