diff options
author | Ryan Thomas McBride <mcbride@cvs.openbsd.org> | 2003-10-17 21:05:00 +0000 |
---|---|---|
committer | Ryan Thomas McBride <mcbride@cvs.openbsd.org> | 2003-10-17 21:05:00 +0000 |
commit | faedf7a876de9ee825ed44b1f6f9dcdbe056bdcd (patch) | |
tree | fb322664c24a0866845294d2d89651bb52715ad7 /usr.bin/netstat | |
parent | 570077e03f36a1ce16a462a69f136900e3221923 (diff) |
Common Address Redundancy Protocol
Allows multiple hosts to share an IP address, providing high availability
and load balancing.
Based on code by mickey@, with additional help from markus@
and Marco_Pfatschbacher@genua.de
ok deraadt@
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r-- | usr.bin/netstat/inet.c | 38 | ||||
-rw-r--r-- | usr.bin/netstat/main.c | 8 | ||||
-rw-r--r-- | usr.bin/netstat/netstat.h | 3 |
3 files changed, 44 insertions, 5 deletions
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index ff36afb315d..569a2771d2d 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet.c,v 1.68 2003/09/04 20:05:19 tedu Exp $ */ +/* $OpenBSD: inet.c,v 1.69 2003/10/17 21:04:59 mcbride Exp $ */ /* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94"; #else -static char *rcsid = "$OpenBSD: inet.c,v 1.68 2003/09/04 20:05:19 tedu Exp $"; +static char *rcsid = "$OpenBSD: inet.c,v 1.69 2003/10/17 21:04:59 mcbride Exp $"; #endif #endif /* not lint */ @@ -70,6 +70,7 @@ static char *rcsid = "$OpenBSD: inet.c,v 1.68 2003/09/04 20:05:19 tedu Exp $"; #include <netinet/ip_ipip.h> #include <netinet/ip_ipcomp.h> #include <netinet/ip_ether.h> +#include <netinet/ip_carp.h> #include <arpa/inet.h> #include <limits.h> @@ -835,6 +836,39 @@ ipip_stats(u_long off, char *name) #undef p } +/* + * Dump CARP statistics structure. + */ +void +carp_stats(u_long off, char *name) +{ + struct carpstats carpstat; + + if (off == 0) + return; + kread(off, (char *)&carpstat, sizeof(carpstat)); + printf("%s:\n", name); + +#define p(f, m) if (carpstat.f || sflag <= 1) \ + printf(m, carpstat.f, plural(carpstat.f)) +#define p2(f, m) if (carpstat.f || sflag <= 1) \ + printf(m, carpstat.f) + + p(carps_ipackets, "\t%u packet%s received\n"); + p(carps_hdrops, "\t\t%u packet%s shorter than header\n"); + p(carps_badsum, "\t\t%u discarded for bad checksum%s\n"); + p(carps_badver, "\t\t%u discarded packet%s with a bad version\n"); + p2(carps_badlen, "\t\t%u discarded because packet too short\n"); + p2(carps_badauth, "\t\t%u discarded for bad authentication\n"); + p2(carps_badvhid, "\t\t%u discarded for bad vhid\n"); + p2(carps_badaddrs, "\t\t%u discarded because of a bad address list\n"); + p(carps_opackets, "\t%u packet%s sent\n"); +#if notyet + p(carps_ostates, "\t\t%s state update%s sent\n"); +#endif +#undef p +} + /* * Dump IPCOMP statistics structure. */ diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 7a0905f2d3b..abc6c05b32f 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.38 2003/06/26 21:59:11 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.39 2003/10/17 21:04:59 mcbride Exp $ */ /* $NetBSD: main.c,v 1.9 1996/05/07 02:55:02 thorpej Exp $ */ /* @@ -40,7 +40,7 @@ char copyright[] = #if 0 static char sccsid[] = "from: @(#)main.c 8.4 (Berkeley) 3/1/94"; #else -static char *rcsid = "$OpenBSD: main.c,v 1.38 2003/06/26 21:59:11 deraadt Exp $"; +static char *rcsid = "$OpenBSD: main.c,v 1.39 2003/10/17 21:04:59 mcbride Exp $"; #endif #endif /* not lint */ @@ -175,6 +175,8 @@ struct nlist nl[] = { { "_ipcompstat" }, #define N_RIP6STAT 54 { "_rip6stat" }, +#define N_CARPSTAT 55 + { "_carpstats" }, { ""}, }; @@ -206,6 +208,8 @@ struct protox { etherip_stats,"etherip" }, { -1, N_IPCOMPSTAT, 1, 0, ipcomp_stats, "ipcomp" }, + { -1, N_CARPSTAT, 1, 0, + carp_stats, "carp" }, { -1, -1, 0, 0, 0, 0 } }; diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h index d24e615c9c1..10bd073b5b5 100644 --- a/usr.bin/netstat/netstat.h +++ b/usr.bin/netstat/netstat.h @@ -1,4 +1,4 @@ -/* $OpenBSD: netstat.h,v 1.25 2003/06/26 21:59:11 deraadt Exp $ */ +/* $OpenBSD: netstat.h,v 1.26 2003/10/17 21:04:59 mcbride Exp $ */ /* $NetBSD: netstat.h,v 1.6 1996/05/07 02:55:05 thorpej Exp $ */ /* @@ -78,6 +78,7 @@ void igmp_stats(u_long, char *); void ah_stats(u_long, char *); void esp_stats(u_long, char *); void ipip_stats(u_long, char *); +void carp_stats (u_long, char *); void etherip_stats(u_long, char *); void protopr(u_long, char *); void ipcomp_stats(u_long, char *); |