- kvm_read(off, (char *)&ipstat, sizeof (ipstat));
-#if BSD>=43
- printf("%s:\n\t%u total packets received\n", name,
- ipstat.ips_total);
-#endif
- printf("\t%u bad header checksum%s\n",
- ipstat.ips_badsum, plural(ipstat.ips_badsum));
- printf("\t%u with size smaller than minimum\n", ipstat.ips_tooshort);
- printf("\t%u with data size < data length\n", ipstat.ips_toosmall);
- printf("\t%u with header length < data size\n", ipstat.ips_badhlen);
- printf("\t%u with data length < header length\n", ipstat.ips_badlen);
-#if BSD>=43
- printf("\t%u fragment%s received\n",
- ipstat.ips_fragments, plural(ipstat.ips_fragments));
- printf("\t%u fragment%s dropped (dup or out of space)\n",
- ipstat.ips_fragdropped, plural(ipstat.ips_fragdropped));
- printf("\t%u fragment%s dropped after timeout\n",
- ipstat.ips_fragtimeout, plural(ipstat.ips_fragtimeout));
- printf("\t%u packet%s forwarded\n",
- ipstat.ips_forward, plural(ipstat.ips_forward));
- printf("\t%u packet%s not forwardable\n",
- ipstat.ips_cantforward, plural(ipstat.ips_cantforward));
- printf("\t%u redirect%s sent\n",
- ipstat.ips_redirectsent, plural(ipstat.ips_redirectsent));
+ kread(off, (char *)&ipstat, sizeof (ipstat));
+ printf("%s:\n", name);
+
+#define p(f, m) if (ipstat.f || sflag <= 1) \
+ printf(m, ipstat.f, plural(ipstat.f))
+
+ p(ips_total, "\t%u total packet%s received\n");
+ p(ips_badsum, "\t%u bad header checksum%s\n");
+ p(ips_tooshort, "\t%u with size smaller than minimum\n");
+ p(ips_toosmall, "\t%u with data size < data length\n");
+ p(ips_badhlen, "\t%u with header length < data size\n");
+ p(ips_badlen, "\t%u with data length < header length\n");
+ p(ips_fragments, "\t%u fragment%s received\n");
+ p(ips_fragdropped, "\t%u fragment%s dropped (dup or out of space)\n");
+ p(ips_fragtimeout, "\t%u fragment%s dropped after timeout\n");
+ p(ips_forward, "\t%u packet%s forwarded\n");
+ p(ips_cantforward, "\t%u packet%s not forwardable\n");
+ p(ips_redirectsent, "\t%u redirect%s sent\n");
+#undef p