Maintain stats about how many packets have been translated from IPv4 to IPv6 and vice versa

This commit is contained in:
Adam Dunkels 2015-03-24 10:51:51 +01:00
parent 191a57d06c
commit 251813a6dd
2 changed files with 5 additions and 0 deletions

View File

@ -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

View File

@ -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;