summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2018-02-24 07:20:05 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2018-02-24 07:20:05 +0000
commit50c8f23126e20c79eb360094f9b2387c9d0b7ea1 (patch)
tree4d00560882a1de14db894756f2b9bfc7f1950808
parent97ad854d19cd8e4bae1997e2bfd834ec439fa7f2 (diff)
when comparing nvgre entries, compare a with b, not a with itself.
-rw-r--r--sys/net/if_gre.c5
-rw-r--r--sys/net/if_tun.c11
2 files changed, 5 insertions, 11 deletions
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index 91fbbf32d0e..d5516223214 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gre.c,v 1.112 2018/02/22 09:47:12 dlg Exp $ */
+/* $OpenBSD: if_gre.c,v 1.113 2018/02/24 07:20:04 dlg Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
@@ -1056,7 +1056,6 @@ nvgre_input_map(struct nvgre_softc *sc, const struct gre_tunnel *key,
}
memcpy(&nv->nv_dst, eh->ether_shost, ETHER_ADDR_LEN);
- memcpy(&nv->nv_dst, eh->ether_shost, ETHER_ADDR_LEN);
nv->nv_type = NVGRE_ENTRY_DYNAMIC;
nv->nv_gateway = key->t_dst;
refcnt_init(&nv->nv_refs);
@@ -2889,7 +2888,7 @@ RBT_GENERATE(egre_tree, egre_softc, sc_entry, egre_cmp);
static inline int
nvgre_entry_cmp(const struct nvgre_entry *a, const struct nvgre_entry *b)
{
- return (memcmp(&a->nv_dst, &a->nv_dst, sizeof(a->nv_dst)));
+ return (memcmp(&a->nv_dst, &b->nv_dst, sizeof(a->nv_dst)));
}
RBT_GENERATE(nvgre_map, nvgre_entry, nv_entry, nvgre_entry_cmp);
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 81dd0148a3f..33f97655d53 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.180 2018/01/09 15:24:24 bluhm Exp $ */
+/* $OpenBSD: if_tun.c,v 1.181 2018/02/24 07:20:04 dlg Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -614,7 +614,6 @@ tun_dev_ioctl(struct tun_softc *tp, u_long cmd, caddr_t data, int flag,
struct proc *p)
{
struct tuninfo *tunp;
- struct mbuf *m;
switch (cmd) {
case TUNSIFINFO:
@@ -668,12 +667,8 @@ tun_dev_ioctl(struct tun_softc *tp, u_long cmd, caddr_t data, int flag,
tp->tun_flags &= ~TUN_ASYNC;
break;
case FIONREAD:
- m = ifq_deq_begin(&tp->tun_if.if_snd);
- if (m != NULL) {
- *(int *)data = m->m_pkthdr.len;
- ifq_deq_rollback(&tp->tun_if.if_snd, m);
- } else
- *(int *)data = 0;
+ *(int *)data = ifq_empty(&tp->tun_if.if_snd) ?
+ 0 : tp->tun_if.if_mtu;
break;
case TIOCSPGRP:
tp->tun_pgid = *(int *)data;