Deleted Added
full compact
inet.c (132671) inet.c (142215)
1/*
2 * Copyright (c) 1983, 1988, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 24 unchanged lines hidden (view full) ---

33
34#if 0
35#ifndef lint
36static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95";
37#endif /* not lint */
38#endif
39
40#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1983, 1988, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 24 unchanged lines hidden (view full) ---

33
34#if 0
35#ifndef lint
36static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95";
37#endif /* not lint */
38#endif
39
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/usr.bin/netstat/inet.c 132671 2004-07-26 20:18:11Z charnier $");
41__FBSDID("$FreeBSD: head/usr.bin/netstat/inet.c 142215 2005-02-22 13:04:05Z glebius $");
42
43#include <sys/param.h>
44#include <sys/queue.h>
45#include <sys/socket.h>
46#include <sys/socketvar.h>
47#include <sys/sysctl.h>
48#include <sys/protosw.h>
49
50#include <net/route.h>
51#include <netinet/in.h>
52#include <netinet/in_systm.h>
53#include <netinet/ip.h>
42
43#include <sys/param.h>
44#include <sys/queue.h>
45#include <sys/socket.h>
46#include <sys/socketvar.h>
47#include <sys/sysctl.h>
48#include <sys/protosw.h>
49
50#include <net/route.h>
51#include <netinet/in.h>
52#include <netinet/in_systm.h>
53#include <netinet/ip.h>
54#include <netinet/ip_carp.h>
54#ifdef INET6
55#include <netinet/ip6.h>
56#endif /* INET6 */
57#include <netinet/in_pcb.h>
58#include <netinet/ip_icmp.h>
59#include <netinet/icmp_var.h>
60#include <netinet/igmp_var.h>
61#include <netinet/ip_var.h>

--- 458 unchanged lines hidden (view full) ---

520 udpstat.udps_fullsock;
521 if (delivered || sflag <= 1)
522 printf("\t%lu delivered\n", delivered);
523 p(udps_opackets, "\t%lu datagram%s output\n");
524#undef p
525#undef p1a
526}
527
55#ifdef INET6
56#include <netinet/ip6.h>
57#endif /* INET6 */
58#include <netinet/in_pcb.h>
59#include <netinet/ip_icmp.h>
60#include <netinet/icmp_var.h>
61#include <netinet/igmp_var.h>
62#include <netinet/ip_var.h>

--- 458 unchanged lines hidden (view full) ---

521 udpstat.udps_fullsock;
522 if (delivered || sflag <= 1)
523 printf("\t%lu delivered\n", delivered);
524 p(udps_opackets, "\t%lu datagram%s output\n");
525#undef p
526#undef p1a
527}
528
529/*
530 * Dump CARP statistics structure.
531 */
532void
533carp_stats(u_long off, const char *name, int af1 __unused)
534{
535 struct carpstats carpstat, zerostat;
536 size_t len = sizeof(struct carpstats);
537
538 if (zflag)
539 memset(&zerostat, 0, len);
540 if (sysctlbyname("net.inet.carp.stats", &carpstat, &len,
541 zflag ? &zerostat : NULL, zflag ? len : 0) < 0) {
542 warn("sysctl: net.inet.carp.stats");
543 return;
544 }
545
546 printf("%s:\n", name);
547
548#define p(f, m) if (carpstat.f || sflag <= 1) \
549 printf(m, (unsigned long long)carpstat.f, plural((int)carpstat.f))
550#define p2(f, m) if (carpstat.f || sflag <= 1) \
551 printf(m, (unsigned long long)carpstat.f)
552
553 p(carps_ipackets, "\t%llu packet%s received (IPv4)\n");
554 p(carps_ipackets6, "\t%llu packet%s received (IPv6)\n");
555 p(carps_badttl, "\t\t%llu packet%s discarded for wrong TTL\n");
556 p(carps_hdrops, "\t\t%llu packet%s shorter than header\n");
557 p(carps_badsum, "\t\t%llu discarded for bad checksum%s\n");
558 p(carps_badver, "\t\t%llu discarded packet%s with a bad version\n");
559 p2(carps_badlen, "\t\t%llu discarded because packet too short\n");
560 p2(carps_badauth, "\t\t%llu discarded for bad authentication\n");
561 p2(carps_badvhid, "\t\t%llu discarded for bad vhid\n");
562 p2(carps_badaddrs, "\t\t%llu discarded because of a bad address list\n");
563 p(carps_opackets, "\t%llu packet%s sent (IPv4)\n");
564 p(carps_opackets6, "\t%llu packet%s sent (IPv6)\n");
565 p2(carps_onomem, "\t\t%llu send failed due to mbuf memory error\n");
566#if notyet
567 p(carps_ostates, "\t\t%s state update%s sent\n");
568#endif
569#undef p
570#undef p2
571}
572
528/*
529 * Dump IP statistics structure.
530 */
531void
532ip_stats(u_long off __unused, const char *name, int af1 __unused)
533{
534 struct ipstat ipstat, zerostat;
535 size_t len = sizeof ipstat;

--- 297 unchanged lines hidden ---
573/*
574 * Dump IP statistics structure.
575 */
576void
577ip_stats(u_long off __unused, const char *name, int af1 __unused)
578{
579 struct ipstat ipstat, zerostat;
580 size_t len = sizeof ipstat;

--- 297 unchanged lines hidden ---