From 3391ddf55fd3d98616d9ca3afe2a99e7be299755 Mon Sep 17 00:00:00 2001 From: Christopher Pascoe Date: Thu, 6 Jan 2005 00:46:59 +0000 Subject: 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@ --- sys/netinet/ip_carp.c | 8 +++++--- 1 file 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 -- cgit v1.2.3