diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2015-11-10 06:34:36 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2015-11-10 06:34:36 +0000 |
commit | 82e0d994af1be41aa7ef261ce4de3e253f387c9d (patch) | |
tree | 6400e9e49b0bd1c14d93b7517cf1e1553e608f1a | |
parent | 822be8dbc3c515f14f7ff21a92922e71fb1fe525 (diff) |
dont use IF_DROP when there was some arbitary problem sending a packet.
IF_DROP increments the drop counter on the send queue, it exists
to indicate a drop on the send queue. if there was an error sending
a packet be content incrementing if_oerrors.
ok mpi@ uebayasi@
-rw-r--r-- | sys/net/if_gre.c | 14 | ||||
-rw-r--r-- | sys/net/if_vlan.c | 3 |
2 files changed, 2 insertions, 15 deletions
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index 4d5e8f0461b..6caae4043a5 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gre.c,v 1.77 2015/11/09 15:18:52 benno Exp $ */ +/* $OpenBSD: if_gre.c,v 1.78 2015/11/10 06:34:35 dlg Exp $ */ /* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */ /* @@ -215,7 +215,6 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, for (mtag = m_tag_find(m, PACKET_TAG_GRE, NULL); mtag; mtag = m_tag_find(m, PACKET_TAG_GRE, mtag)) { if (!bcmp((caddr_t)(mtag + 1), &ifp, sizeof(struct ifnet *))) { - IF_DROP(&ifp->if_snd); m_freem(m); error = EIO; goto end; @@ -224,7 +223,6 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, mtag = m_tag_get(PACKET_TAG_GRE, sizeof(struct ifnet *), M_NOWAIT); if (mtag == NULL) { - IF_DROP(&ifp->if_snd); m_freem(m); error = ENOBUFS; goto end; @@ -241,7 +239,6 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, if (sc->g_proto == IPPROTO_MOBILE) { if (ip_mobile_allow == 0) { - IF_DROP(&ifp->if_snd); m_freem(m); error = EACCES; goto end; @@ -258,7 +255,6 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, if (m->m_len < sizeof(struct ip)) { m = m_pullup(m, sizeof(struct ip)); if (m == NULL) { - IF_DROP(&ifp->if_snd); error = ENOBUFS; goto end; } else @@ -267,7 +263,6 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, if (m->m_len < inp->ip_hl << 2) { m = m_pullup(m, inp->ip_hl << 2); if (m == NULL) { - IF_DROP(&ifp->if_snd); error = ENOBUFS; goto end; } @@ -303,7 +298,6 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, /* Need new mbuf */ MGETHDR(m0, M_DONTWAIT, MT_HEADER); if (m0 == NULL) { - IF_DROP(&ifp->if_snd); m_freem(m); error = ENOBUFS; goto end; @@ -334,14 +328,12 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, bcopy(&mob_h, (caddr_t)(inp + 1), (unsigned) msiz); inp->ip_len = htons(ntohs(inp->ip_len) + msiz); } else { /* AF_INET */ - IF_DROP(&ifp->if_snd); m_freem(m); error = EINVAL; goto end; } } else if (sc->g_proto == IPPROTO_GRE) { if (gre_allow == 0) { - IF_DROP(&ifp->if_snd); m_freem(m); error = EACCES; goto end; @@ -352,7 +344,6 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, if (m->m_len < sizeof(struct ip)) { m = m_pullup(m, sizeof(struct ip)); if (m == NULL) { - IF_DROP(&ifp->if_snd); error = ENOBUFS; goto end; } @@ -376,7 +367,6 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, break; #endif default: - IF_DROP(&ifp->if_snd); m_freem(m); error = EAFNOSUPPORT; goto end; @@ -384,14 +374,12 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, M_PREPEND(m, sizeof(struct greip), M_DONTWAIT); } else { - IF_DROP(&ifp->if_snd); m_freem(m); error = EINVAL; goto end; } if (m == NULL) { - IF_DROP(&ifp->if_snd); error = ENOBUFS; goto end; } diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index e088976bae3..3029b223813 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.146 2015/10/25 12:05:40 mpi Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.147 2015/11/10 06:34:35 dlg Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -248,7 +248,6 @@ vlan_start(struct ifnet *ifp) if ((p->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) { - IF_DROP(&p->if_snd); ifp->if_oerrors++; m_freem(m); continue; |