summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_carp.c
diff options
context:
space:
mode:
authorRyan Thomas McBride <mcbride@cvs.openbsd.org>2004-11-17 06:07:40 +0000
committerRyan Thomas McBride <mcbride@cvs.openbsd.org>2004-11-17 06:07:40 +0000
commit2f86b966265210f55e237eb49ff2f0d073c8d726 (patch)
tree82b13baddb1706a290d4dc7a83aa59781fa296cd /sys/netinet/ip_carp.c
parent6ee3d837971ab0e7f49af6a0ad46f789327101ba (diff)
Improved logging for advertisement failures: Add some carpstats.carps_onomem++
when sending advertisements fail due to ENOBUGS, and some CARP_LOG for other failures. From camield@
Diffstat (limited to 'sys/netinet/ip_carp.c')
-rw-r--r--sys/netinet/ip_carp.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index ab34d1b2f8c..780a61fe0ed 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.69 2004/11/16 18:13:02 mcbride Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.70 2004/11/17 06:07:39 mcbride Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -339,7 +339,7 @@ carp_input(struct mbuf *m, ...)
/* verify that the IP TTL is 255. */
if (ip->ip_ttl != CARP_DFLTTL) {
carpstats.carps_badttl++;
- CARP_LOG(sc, ("received ttl %d != 255i on %s", ip->ip_ttl,
+ CARP_LOG(sc, ("received ttl %d != 255 on %s", ip->ip_ttl,
m->m_pkthdr.rcvif->if_xname));
m_freem(m);
return;
@@ -769,6 +769,7 @@ carp_prepare_ad(struct mbuf *m, struct carp_softc *sc, struct carp_header *ch)
if (mtag == NULL) {
m_freem(m);
sc->sc_ac.ac_if.if_oerrors++;
+ carpstats.carps_onomem++;
return (ENOMEM);
}
bcopy(&ifp, (caddr_t)(mtag + 1), sizeof(struct ifnet *));
@@ -806,7 +807,7 @@ carp_send_ad(void *v)
struct carp_softc *sc = v;
struct carp_header *ch_ptr;
struct mbuf *m;
- int len, advbase, advskew, s;
+ int error, len, advbase, advskew, s;
s = splsoftnet();
@@ -879,7 +880,13 @@ carp_send_ad(void *v)
sc->sc_ac.ac_if.if_obytes += len;
carpstats.carps_opackets++;
- if (ip_output(m, NULL, NULL, IP_RAWOUTPUT, &sc->sc_imo, NULL)) {
+ error = ip_output(m, NULL, NULL, IP_RAWOUTPUT, &sc->sc_imo,
+ NULL);
+ if (error) {
+ if (error == ENOBUFS)
+ carpstats.carps_onomem++;
+ else
+ CARP_LOG(sc, ("ip_output failed: %d", error));
sc->sc_ac.ac_if.if_oerrors++;
if (sc->sc_sendad_errors < INT_MAX)
sc->sc_sendad_errors++;
@@ -945,7 +952,12 @@ carp_send_ad(void *v)
sc->sc_ac.ac_if.if_obytes += len;
carpstats.carps_opackets6++;
- if (ip6_output(m, NULL, NULL, 0, &sc->sc_im6o, NULL)) {
+ error = ip6_output(m, NULL, NULL, 0, &sc->sc_im6o, NULL);
+ if (error) {
+ if (error == ENOBUFS)
+ carpstats.carps_onomem++;
+ else
+ CARP_LOG(sc, ("ip6_output failed: %d", error));
sc->sc_ac.ac_if.if_oerrors++;
if (sc->sc_sendad_errors < INT_MAX)
sc->sc_sendad_errors++;