From 251813a6dd29410fca51e622994386eccdf60d4a Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Tue, 24 Mar 2015 10:51:51 +0100 Subject: [PATCH] Maintain stats about how many packets have been translated from IPv4 to IPv6 and vice versa --- core/net/ip64/ip64-addrmap.c | 4 ++++ core/net/ip64/ip64-addrmap.h | 1 + 2 files changed, 5 insertions(+) diff --git a/core/net/ip64/ip64-addrmap.c b/core/net/ip64/ip64-addrmap.c index 4f197e742..3a36b2344 100644 --- a/core/net/ip64/ip64-addrmap.c +++ b/core/net/ip64/ip64-addrmap.c @@ -149,6 +149,7 @@ ip64_addrmap_lookup(const uip_ip6addr_t *ip6addr, m->ip6port == ip6port && uip_ip4addr_cmp(&m->ip4addr, ip4addr) && uip_ip6addr_cmp(&m->ip6addr, ip6addr)) { + m->ip6to4++; return m; } } @@ -167,6 +168,7 @@ ip64_addrmap_lookup_port(uint16_t mapped_port, uint8_t protocol) m->protocol, protocol); if(m->mapped_port == mapped_port && m->protocol == protocol) { + m->ip4to6++; return m; } } @@ -205,6 +207,8 @@ ip64_addrmap_create(const uip_ip6addr_t *ip6addr, m->ip6port = ip6port; m->protocol = protocol; m->flags = FLAGS_NONE; + m->ip6to4 = 1; + m->ip4to6 = 0; timer_set(&m->timer, 0); /* Pick a new, unused local port. First make sure that the diff --git a/core/net/ip64/ip64-addrmap.h b/core/net/ip64/ip64-addrmap.h index 3ca56d2de..c4a31efcc 100644 --- a/core/net/ip64/ip64-addrmap.h +++ b/core/net/ip64/ip64-addrmap.h @@ -41,6 +41,7 @@ struct ip64_addrmap_entry { struct timer timer; uip_ip6addr_t ip6addr; uip_ip4addr_t ip4addr; + uint32_t ip6to4, ip4to6; uint16_t mapped_port; uint16_t ip6port; uint16_t ip4port;