From owner-svn-src-all@FreeBSD.ORG Mon Jun 8 21:00:08 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 645961065672; Mon, 8 Jun 2009 21:00:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3]) by mx1.freebsd.org (Postfix) with ESMTP id D7EC48FC08; Mon, 8 Jun 2009 21:00:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id D128941C751; Mon, 8 Jun 2009 23:00:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([195.88.108.3]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id Hl-rHr0+ucrR; Mon, 8 Jun 2009 23:00:06 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id 1F58341C75C; Mon, 8 Jun 2009 23:00:06 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id E6F254448E6; Mon, 8 Jun 2009 20:55:30 +0000 (UTC) Date: Mon, 8 Jun 2009 20:55:30 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Hiroki Sato In-Reply-To: <200906072300.n57N0ems008322@svn.freebsd.org> Message-ID: <20090608205308.N22887@maildrop.int.zabbadoz.net> References: <200906072300.n57N0ems008322@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed 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 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jun 2009 21:00:08 -0000 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.