Date: Mon, 8 Jun 2009 20:55:30 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: Hiroki Sato <hrs@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r193664 - in head: sbin/ifconfig share/man/man4 sys/net sys/netinet sys/netinet6 sys/sys Message-ID: <20090608205308.N22887@maildrop.int.zabbadoz.net> In-Reply-To: <200906072300.n57N0ems008322@svn.freebsd.org> References: <200906072300.n57N0ems008322@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 7 Jun 2009, Hiroki Sato wrote: Hi, > Author: hrs > Date: Sun Jun 7 23:00:40 2009 > New Revision: 193664 > URL: http://svn.freebsd.org/changeset/base/193664 > > Log: > 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 > > Added: > head/sbin/ifconfig/ifgif.c (contents, props changed) > Modified: > head/sbin/ifconfig/Makefile > head/share/man/man4/gif.4 > head/share/man/man4/if_bridge.4 > head/sys/net/if_gif.c > head/sys/net/if_gif.h > head/sys/netinet/in_gif.c > head/sys/netinet6/in6_gif.c > head/sys/sys/priv.h > .... > Modified: head/sys/net/if_gif.c > ============================================================================== > --- head/sys/net/if_gif.c Sun Jun 7 22:55:48 2009 (r193663) > +++ head/sys/net/if_gif.c Sun Jun 7 23:00:40 2009 (r193664) > @@ -653,6 +670,7 @@ gif_ioctl(ifp, cmd, data) > struct gif_softc *sc = ifp->if_softc; > struct ifreq *ifr = (struct ifreq*)data; > int error = 0, size; > + u_int options; > struct sockaddr *dst, *src; > #ifdef SIOCSIFMTU /* xxx */ > u_long mtu; > @@ -887,6 +905,24 @@ gif_ioctl(ifp, cmd, data) > /* if_ioctl() takes care of it */ > break; > > + case GIFGOPTS: > + options = sc->gif_options; > + error = copyout(&options, ifr->ifr_data, > + sizeof(options)); > + break; > + > + case GIFSOPTS: > + if ((error = priv_check(curthread, PRIV_NET_GIF)) != 0) > + break; > + if ((error = copyin(&options, &sc->gif_options, > + sizeof(sc->gif_options)))) { > + if ((options | GIF_FULLOPTS) == GIF_FULLOPTS) > + ifr->ifr_data = (caddr_t)options; > + else > + error = EINVAL; > + } > + break; > + > default: > error = EINVAL; > break; As noticed by ps there is a build problem here. It seems it is the result of some reversed logic. Does this patch look ok? http://people.freebsd.org/~bz/20090608-03-if_gif.c.diff -- Bjoern A. Zeeb The greatest risk is not taking one.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090608205308.N22887>