summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2016-11-29 10:09:57 +0000
committerreyk <reyk@openbsd.org>2016-11-29 10:09:57 +0000
commitfc3b235ffdda6271635ba0ea8a75edaee48b859e (patch)
treea6f362aa7323d861649006e27c0c739c2550c4a3 /sys
parentCorrect a bit test introduced in user.c rev 1.111 that made it impossible (diff)
downloadwireguard-openbsd-fc3b235ffdda6271635ba0ea8a75edaee48b859e.tar.xz
wireguard-openbsd-fc3b235ffdda6271635ba0ea8a75edaee48b859e.zip
For virtual Ethernet drivers that don't have a technical limit of the
hardmtu, pick a value of 65435 that leaves space for some encapsulation and almost a complete max-IP packet. After some discussion we picked this arbitrary value. OK dlg@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_pair.c4
-rw-r--r--sys/net/if_vether.c3
-rw-r--r--sys/net/if_vxlan.c4
-rw-r--r--sys/netinet/if_ether.h7
4 files changed, 12 insertions, 6 deletions
diff --git a/sys/net/if_pair.c b/sys/net/if_pair.c
index 92241b6a0bb..03e66f329ee 100644
--- a/sys/net/if_pair.c
+++ b/sys/net/if_pair.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pair.c,v 1.7 2016/04/13 11:41:15 mpi Exp $ */
+/* $OpenBSD: if_pair.c,v 1.8 2016/11/29 10:09:57 reyk Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -122,7 +122,7 @@ pair_clone_create(struct if_clone *ifc, int unit)
ifp->if_start = pairstart;
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
- ifp->if_hardmtu = 0xffff;
+ ifp->if_hardmtu = ETHER_MAX_HARDMTU_LEN;
ifp->if_capabilities = IFCAP_VLAN_MTU;
ifmedia_init(&sc->sc_media, 0, pair_media_change,
diff --git a/sys/net/if_vether.c b/sys/net/if_vether.c
index dbc90a7cdc2..082c05615d6 100644
--- a/sys/net/if_vether.c
+++ b/sys/net/if_vether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vether.c,v 1.27 2016/04/13 11:41:15 mpi Exp $ */
+/* $OpenBSD: if_vether.c,v 1.28 2016/11/29 10:09:57 reyk Exp $ */
/*
* Copyright (c) 2009 Theo de Raadt
@@ -89,6 +89,7 @@ vether_clone_create(struct if_clone *ifc, int unit)
ifp->if_start = vetherstart;
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
+ ifp->if_hardmtu = ETHER_MAX_HARDMTU_LEN;
ifp->if_capabilities = IFCAP_VLAN_MTU;
ifmedia_init(&sc->sc_media, 0, vether_media_change,
diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c
index c87b17899fb..366c78b0378 100644
--- a/sys/net/if_vxlan.c
+++ b/sys/net/if_vxlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vxlan.c,v 1.51 2016/10/25 16:31:08 bluhm Exp $ */
+/* $OpenBSD: if_vxlan.c,v 1.52 2016/11/29 10:09:57 reyk Exp $ */
/*
* Copyright (c) 2013 Reyk Floeter <reyk@openbsd.org>
@@ -146,7 +146,7 @@ vxlan_clone_create(struct if_clone *ifc, int unit)
ifp->if_start = vxlanstart;
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
- ifp->if_hardmtu = 0xffff;
+ ifp->if_hardmtu = ETHER_MAX_HARDMTU_LEN;
ifp->if_capabilities = IFCAP_VLAN_MTU;
ifmedia_init(&sc->sc_media, 0, vxlan_media_change,
diff --git a/sys/netinet/if_ether.h b/sys/netinet/if_ether.h
index 279632102f8..fdff5c8c1cf 100644
--- a/sys/netinet/if_ether.h
+++ b/sys/netinet/if_ether.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.h,v 1.72 2016/06/28 17:18:24 chris Exp $ */
+/* $OpenBSD: if_ether.h,v 1.73 2016/11/29 10:09:57 reyk Exp $ */
/* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */
/*
@@ -60,6 +60,11 @@
#define ETHER_ALIGN 2 /* driver adjust for IP hdr alignment */
/*
+ * The maximum supported Ethernet length and some space for encapsulation.
+ */
+#define ETHER_MAX_HARDMTU_LEN 65435
+
+/*
* Ethernet address - 6 octets
*/
struct ether_addr {