The already implemented host table functions are put
to work also for IPv6 hosts. In addition, IPPROTO_AH,
IPPROTO_ESP, and IPPROTO_OSPF now prevent complaints
about these protocols being unknown.
A complete URI is augmented for hostreporting, since
the dubble colon can be confused for a protocol switch.
graph_acct((uint64_t)sm->len, GRAPH_IN);
}
graph_acct((uint64_t)sm->len, GRAPH_IN);
}
- if (sm->af == AF_INET6) return; /* Still no continuation for IPv6! */
-
if (hosts_max == 0) return; /* skip per-host accounting */
/* Hosts. */
if (hosts_max == 0) return; /* skip per-host accounting */
/* Hosts. */
- ipaddr.af = sm->af; /* TODO */
- ipaddr.addr.ip = sm->src_ip; /* TODO */
+ ipaddr.af = sm->af;
+ switch (ipaddr.af) {
+ case AF_INET6:
+ memcpy(&ipaddr.addr.ip6, &sm->src_ip6, sizeof(ipaddr.addr.ip6));
+ break;
+ case AF_INET:
+ default:
+ memcpy(&ipaddr.addr.ip, &sm->src_ip, sizeof(ipaddr.addr.ip));
+ break;
+ }
hs = host_get(&ipaddr);
hs->out += sm->len;
hs->total += sm->len;
memcpy(hs->u.host.mac_addr, sm->src_mac, sizeof(sm->src_mac));
hs->u.host.last_seen = now;
hs = host_get(&ipaddr);
hs->out += sm->len;
hs->total += sm->len;
memcpy(hs->u.host.mac_addr, sm->src_mac, sizeof(sm->src_mac));
hs->u.host.last_seen = now;
- ipaddr.addr.ip = sm->dest_ip; /* TODO */
+ switch (ipaddr.af) {
+ case AF_INET6:
+ memcpy(&ipaddr.addr.ip6, &sm->dest_ip6, sizeof(ipaddr.addr.ip6));
+ break;
+ case AF_INET:
+ default:
+ memcpy(&ipaddr.addr.ip, &sm->dest_ip, sizeof(ipaddr.addr.ip));
+ break;
+ }
hd = host_get(&ipaddr); /* this can invalidate hs! */
hd->in += sm->len;
hd->total += sm->len;
hd = host_get(&ipaddr); /* this can invalidate hs! */
hd->in += sm->len;
hd->total += sm->len;
hd->u.host.last_seen = now;
/* Protocols. */
hd->u.host.last_seen = now;
/* Protocols. */
- ipaddr.addr.ip = sm->src_ip; /* TODO */
+ switch (ipaddr.af) {
+ case AF_INET6:
+ memcpy(&ipaddr.addr.ip6, &sm->src_ip6, sizeof(ipaddr.addr.ip6));
+ break;
+ case AF_INET:
+ default:
+ memcpy(&ipaddr.addr.ip, &sm->src_ip, sizeof(ipaddr.addr.ip));
+ break;
+ }
hs = host_find(&ipaddr);
if (hs != NULL) {
ps = host_get_ip_proto(hs, sm->proto);
hs = host_find(&ipaddr);
if (hs != NULL) {
ps = host_get_ip_proto(hs, sm->proto);
case IPPROTO_ICMP:
case IPPROTO_ICMPV6:
case IPPROTO_ICMP:
case IPPROTO_ICMPV6:
+ case IPPROTO_AH:
+ case IPPROTO_ESP:
+ case IPPROTO_OSPF:
/* known protocol, don't complain about it */
break;
/* known protocol, don't complain about it */
break;
+ case IPPROTO_AH:
+ case IPPROTO_ESP:
+ case IPPROTO_OSPF:
/* known protocol, don't complain about it */
break;
/* known protocol, don't complain about it */
break;
+ case IPPROTO_AH:
+ case IPPROTO_ESP:
+ case IPPROTO_OSPF:
/* known protocol, don't complain about it */
break;
/* known protocol, don't complain about it */
break;
#define ETHER_ADDR_LEN 6
#endif
#define ETHER_ADDR_LEN 6
#endif
+#ifndef IPPROTO_OSPF
+# define IPPROTO_OSPF 89
+#endif
+
typedef struct {
int linktype;
unsigned int hdrlen;
typedef struct {
int linktype;
unsigned int hdrlen;
if (pid == -1)
return; /* no child was started - we're not doing any DNS */
if (pid == -1)
return; /* no child was started - we're not doing any DNS */
-#if 1
- if (ipaddr->af != AF_INET) {
+ if (ipaddr->af != AF_INET && ipaddr->af != AF_INET6) {
verbosef("dns_queue() for unknown family %d.\n", ipaddr->af);
verbosef("dns_queue() for unknown family %d.\n", ipaddr->af);
- /* Not yet IPv6 capable. */
rec = xmalloc(sizeof(*rec));
memcpy(&rec->ip, ipaddr, sizeof(rec->ip));
rec = xmalloc(sizeof(*rec));
memcpy(&rec->ip, ipaddr, sizeof(rec->ip));
str_appendf(buf,
"<tr class=\"%s\">\n"
str_appendf(buf,
"<tr class=\"%s\">\n"
- " <td><a href=\"%s/\">%s</a></td>\n"
+ " <td><a href=\"/hosts/%s/\">%s</a></td>\n"
" <td>%s</td>\n",
css_class,
ip, ip,
" <td>%s</td>\n",
css_class,
ip, ip,