summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Pascoe <pascoe@cvs.openbsd.org>2005-01-06 00:46:59 +0000
committerChristopher Pascoe <pascoe@cvs.openbsd.org>2005-01-06 00:46:59 +0000
commit3391ddf55fd3d98616d9ca3afe2a99e7be299755 (patch)
tree15d5c34e6b5b1a7f89b762660f3bc5acbf03264b
parenta25b62a03325e84af85ffc6ce3817b7518eddcda (diff)
Error path cleanups for carp_output. Use ENOBUFS instead of ENOMEM when
unable to tag a packet, and free mbuf chain on all failures. ok mcbride@
-rw-r--r--sys/netinet/ip_carp.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 2ce518bc084..517988664ce 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.90 2005/01/06 00:41:51 pascoe Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.91 2005/01/06 00:46:58 pascoe Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -2036,15 +2036,17 @@ carp_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *sa,
((struct carp_softc *)ifp->if_softc
)->sc_if.if_oerrors++;
carpstats.carps_onomem++;
- return (ENOMEM);
+ return (ENOBUFS);
}
bcopy(&ifp, (caddr_t)(mtag + 1),
sizeof(struct ifnet *));
m_tag_prepend(m, mtag);
}
return (ifp0->if_output(ifp, m, sa, rt));
- } else
+ } else {
+ m_freem(m);
return (EINVAL);
+ }
}
int