better printing of headers when listing flows
This commit is contained in:
parent
611daf7e62
commit
f40be7f6f9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=210118
@ -146,10 +146,6 @@ print_mask(struct ipfw_flow_id *id)
|
|||||||
id->proto,
|
id->proto,
|
||||||
id->src_ip, id->src_port,
|
id->src_ip, id->src_port,
|
||||||
id->dst_ip, id->dst_port);
|
id->dst_ip, id->dst_port);
|
||||||
|
|
||||||
printf("BKT Prot ___Source IP/port____ "
|
|
||||||
"____Dest. IP/port____ "
|
|
||||||
"Tot_pkt/bytes Pkt/Byte Drp\n");
|
|
||||||
} else {
|
} else {
|
||||||
char buf[255];
|
char buf[255];
|
||||||
printf("\n mask: %sproto: 0x%02x, flow_id: 0x%08x, ",
|
printf("\n mask: %sproto: 0x%02x, flow_id: 0x%08x, ",
|
||||||
@ -159,22 +155,35 @@ print_mask(struct ipfw_flow_id *id)
|
|||||||
printf("%s/0x%04x -> ", buf, id->src_port);
|
printf("%s/0x%04x -> ", buf, id->src_port);
|
||||||
inet_ntop(AF_INET6, &(id->dst_ip6), buf, sizeof(buf));
|
inet_ntop(AF_INET6, &(id->dst_ip6), buf, sizeof(buf));
|
||||||
printf("%s/0x%04x\n", buf, id->dst_port);
|
printf("%s/0x%04x\n", buf, id->dst_port);
|
||||||
|
|
||||||
printf("BKT ___Prot___ _flow-id_ "
|
|
||||||
"______________Source IPv6/port_______________ "
|
|
||||||
"_______________Dest. IPv6/port_______________ "
|
|
||||||
"Tot_pkt/bytes Pkt/Byte Drp\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
list_flow(struct dn_flow *ni)
|
print_header(struct ipfw_flow_id *id)
|
||||||
|
{
|
||||||
|
if (!IS_IP6_FLOW_ID(id))
|
||||||
|
printf("BKT Prot ___Source IP/port____ "
|
||||||
|
"____Dest. IP/port____ "
|
||||||
|
"Tot_pkt/bytes Pkt/Byte Drp\n");
|
||||||
|
else
|
||||||
|
printf("BKT ___Prot___ _flow-id_ "
|
||||||
|
"______________Source IPv6/port_______________ "
|
||||||
|
"_______________Dest. IPv6/port_______________ "
|
||||||
|
"Tot_pkt/bytes Pkt/Byte Drp\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
list_flow(struct dn_flow *ni, int *print)
|
||||||
{
|
{
|
||||||
char buff[255];
|
char buff[255];
|
||||||
struct protoent *pe;
|
struct protoent *pe = NULL;
|
||||||
struct in_addr ina;
|
struct in_addr ina;
|
||||||
struct ipfw_flow_id *id = &ni->fid;
|
struct ipfw_flow_id *id = &ni->fid;
|
||||||
|
|
||||||
|
if (*print) {
|
||||||
|
print_header(&ni->fid);
|
||||||
|
*print = 0;
|
||||||
|
}
|
||||||
pe = getprotobynumber(id->proto);
|
pe = getprotobynumber(id->proto);
|
||||||
/* XXX: Should check for IPv4 flows */
|
/* XXX: Should check for IPv4 flows */
|
||||||
printf("%3u%c", (ni->oid.id) & 0xff,
|
printf("%3u%c", (ni->oid.id) & 0xff,
|
||||||
@ -290,6 +299,7 @@ static void
|
|||||||
list_pipes(struct dn_id *oid, struct dn_id *end)
|
list_pipes(struct dn_id *oid, struct dn_id *end)
|
||||||
{
|
{
|
||||||
char buf[160]; /* pending buffer */
|
char buf[160]; /* pending buffer */
|
||||||
|
int toPrint = 1; /* print header */
|
||||||
|
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
for (; oid != end; oid = O_NEXT(oid, oid->len)) {
|
for (; oid != end; oid = O_NEXT(oid, oid->len)) {
|
||||||
@ -333,7 +343,7 @@ list_pipes(struct dn_id *oid, struct dn_id *end)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DN_FLOW:
|
case DN_FLOW:
|
||||||
list_flow((struct dn_flow *)oid);
|
list_flow((struct dn_flow *)oid, &toPrint);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DN_LINK: {
|
case DN_LINK: {
|
||||||
|
Loading…
Reference in New Issue
Block a user