| 426 | } |
| 427 | |
| 428 | static void |
| 429 | list_flow(struct buf_pr *bp, struct dn_flow *ni) |
| 430 | { |
| 431 | char buff[255]; |
| 432 | struct protoent *pe = NULL; |
| 433 | struct in_addr ina; |
| 434 | struct ipfw_flow_id *id = &ni->fid; |
| 435 | |
| 436 | pe = getprotobynumber(id->proto); |
| 437 | /* XXX: Should check for IPv4 flows */ |
| 438 | bprintf(bp, "%3u%c", (ni->oid.id) & 0xff, |
| 439 | id->extra ? '*' : ' '); |
| 440 | if (!IS_IP6_FLOW_ID(id)) { |
| 441 | if (pe) |
| 442 | bprintf(bp, "%-4s ", pe->p_name); |
| 443 | else |
| 444 | bprintf(bp, "%4u ", id->proto); |
| 445 | ina.s_addr = htonl(id->src_ip); |
| 446 | bprintf(bp, "%15s/%-5d ", |
| 447 | inet_ntoa(ina), id->src_port); |
| 448 | ina.s_addr = htonl(id->dst_ip); |
| 449 | bprintf(bp, "%15s/%-5d ", |
| 450 | inet_ntoa(ina), id->dst_port); |
| 451 | } else { |
| 452 | /* Print IPv6 flows */ |
| 453 | if (pe != NULL) |
| 454 | bprintf(bp, "%9s ", pe->p_name); |
| 455 | else |
| 456 | bprintf(bp, "%9u ", id->proto); |
| 457 | bprintf(bp, "%7d %39s/%-5d ", id->flow_id6, |
| 458 | inet_ntop(AF_INET6_LINUX, &(id->src_ip6), buff, sizeof(buff)), |
| 459 | id->src_port); |
| 460 | bprintf(bp, " %39s/%-5d ", |
| 461 | inet_ntop(AF_INET6_LINUX, &(id->dst_ip6), buff, sizeof(buff)), |
| 462 | id->dst_port); |
| 463 | } |
| 464 | pr_u64(bp, &ni->tot_pkts, 4); |
| 465 | pr_u64(bp, &ni->tot_bytes, 8); |
| 466 | bprintf(bp, "%2u %4u %3u", |
| 467 | ni->length, ni->len_bytes, ni->drops); |
| 468 | } |
| 469 | |
| 470 | static void |
| 471 | print_flowset_parms(struct dn_fs *fs, char *prefix) |
no test coverage detected