aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/in_gif.c
diff options
context:
space:
mode:
authorHiroki Sato <hrs@FreeBSD.org>2009-06-07 23:00:40 +0000
committerHiroki Sato <hrs@FreeBSD.org>2009-06-07 23:00:40 +0000
commitdbe59260468858ff41276c815fdc723a96e55395 (patch)
tree9a067cbb66c280e9da4ac4cea8c84e204039d753 /sys/netinet/in_gif.c
parent385432acf8a3ff4a0d139e1bacc8e0ca9e756f5e (diff)
downloadsrc-dbe59260468858ff41276c815fdc723a96e55395.tar.gz
src-dbe59260468858ff41276c815fdc723a96e55395.zip
Fix and add a workaround on an issue of EtherIP packet with reversed
version field sent via gif(4)+if_bridge(4). The EtherIP implementation found on FreeBSD 6.1, 6.2, 6.3, 7.0, 7.1, and 7.2 had an interoperability issue because it sent the incorrect EtherIP packets and discarded the correct ones. This change introduces the following two flags to gif(4): accept_rev_ethip_ver: accepts both correct EtherIP packets and ones with reversed version field, if enabled. If disabled, the gif accepts the correct packets only. This flag is enabled by default. send_rev_ethip_ver: sends EtherIP packets with reversed version field intentionally, if enabled. If disabled, the gif sends the correct packets only. This flag is disabled by default. These flags are stored in struct gif_softc and can be set by ifconfig(8) on per-interface basis. Note that this is an incompatible change of EtherIP with the older FreeBSD releases. If you need to interoperate older FreeBSD boxes and new versions after this commit, setting "send_rev_ethip_ver" is needed. Reviewed by: thompsa and rwatson Spotted by: Shunsuke SHINOMIYA PR: kern/125003 MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=193664
Diffstat (limited to 'sys/netinet/in_gif.c')
-rw-r--r--sys/netinet/in_gif.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c
index bc62f5ff87b1..ce45672fcfc3 100644
--- a/sys/netinet/in_gif.c
+++ b/sys/netinet/in_gif.c
@@ -148,8 +148,22 @@ in_gif_output(struct ifnet *ifp, int family, struct mbuf *m)
#endif /* INET6 */
case AF_LINK:
proto = IPPROTO_ETHERIP;
- eiphdr.eip_ver = ETHERIP_VERSION & ETHERIP_VER_VERS_MASK;
- eiphdr.eip_pad = 0;
+
+ /*
+ * GIF_SEND_REVETHIP (disabled by default) intentionally
+ * sends an EtherIP packet with revered version field in
+ * the header. This is a knob for backward compatibility
+ * with FreeBSD 7.2R or prior.
+ */
+ if ((sc->gif_options & GIF_SEND_REVETHIP)) {
+ eiphdr.eip_ver = 0;
+ eiphdr.eip_resvl = ETHERIP_VERSION;
+ eiphdr.eip_resvh = 0;
+ } else {
+ eiphdr.eip_ver = ETHERIP_VERSION;
+ eiphdr.eip_resvl = 0;
+ eiphdr.eip_resvh = 0;
+ }
/* prepend Ethernet-in-IP header */
M_PREPEND(m, sizeof(struct etherip_header), M_DONTWAIT);
if (m && m->m_len < sizeof(struct etherip_header))