summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorRyan Thomas McBride <mcbride@cvs.openbsd.org>2011-08-20 06:21:33 +0000
committerRyan Thomas McBride <mcbride@cvs.openbsd.org>2011-08-20 06:21:33 +0000
commit57f3a3fa7c3d3ec71f96f30e2f2bbc13689a0b7d (patch)
tree05dcfbf7f015279d1dd237b01d6c0707c0678f9f /sys/net
parent3eaace369c2ea90ba6052926d153d7bf9f3d5015 (diff)
Fix packet accounting in error cases.
From Christiano F. Haesbaert.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_mpe.c4
-rw-r--r--sys/net/if_pppx.c6
-rw-r--r--sys/net/if_vlan.c8
3 files changed, 11 insertions, 7 deletions
diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c
index 2e7a4192ac6..7be3d4582b4 100644
--- a/sys/net/if_mpe.c
+++ b/sys/net/if_mpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mpe.c,v 1.25 2011/01/28 14:58:24 reyk Exp $ */
+/* $OpenBSD: if_mpe.c,v 1.26 2011/08/20 06:21:32 mcbride Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -265,7 +265,7 @@ mpeoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
if (error) {
/* mbuf is already freed */
splx(s);
- return (error);
+ goto out;
}
if_start(ifp);
splx(s);
diff --git a/sys/net/if_pppx.c b/sys/net/if_pppx.c
index 79686d2597d..a1f9b6738e5 100644
--- a/sys/net/if_pppx.c
+++ b/sys/net/if_pppx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pppx.c,v 1.9 2011/07/07 20:42:56 henning Exp $ */
+/* $OpenBSD: if_pppx.c,v 1.10 2011/08/20 06:21:32 mcbride Exp $ */
/*
* Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org>
@@ -1057,6 +1057,10 @@ pppx_if_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
s = splnet();
IFQ_ENQUEUE(&ifp->if_snd, m, NULL, error);
+ if (error) {
+ splx(s);
+ goto out;
+ }
if_start(ifp);
splx(s);
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index c7499600250..6fe8c34ac19 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan.c,v 1.87 2011/02/18 17:06:45 reyk Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.88 2011/08/20 06:21:32 mcbride Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
@@ -251,15 +251,15 @@ vlan_start(struct ifnet *ifp)
* Send it, precisely as ether_output() would have.
* We are already running at splnet.
*/
- p->if_obytes += m->m_pkthdr.len;
- if (m->m_flags & M_MCAST)
- p->if_omcasts++;
IFQ_ENQUEUE(&p->if_snd, m, NULL, error);
if (error) {
/* mbuf is already freed */
ifp->if_oerrors++;
continue;
}
+ p->if_obytes += m->m_pkthdr.len;
+ if (m->m_flags & M_MCAST)
+ p->if_omcasts++;
ifp->if_opackets++;
if_start(p);