From brad@comstyle.com Wed Apr 15 01:50:50 2015 Delivered-To: david@gwynne.id.au Received: by 10.194.71.146 with SMTP id v18csp2025911wju; Tue, 14 Apr 2015 08:50:51 -0700 (PDT) X-Received: by 10.170.141.85 with SMTP id i82mr19464646ykc.39.1429026650879; Tue, 14 Apr 2015 08:50:50 -0700 (PDT) Return-Path: Received: from cvs.openbsd.org (cvs.openbsd.org. [199.185.137.3]) by mx.google.com with ESMTPS id h75si714032yhd.189.2015.04.14.08.50.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Apr 2015 08:50:50 -0700 (PDT) Received-SPF: pass (google.com: domain of brad@comstyle.com designates 199.185.137.3 as permitted sender) client-ip=199.185.137.3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of brad@comstyle.com designates 199.185.137.3 as permitted sender) smtp.mail=brad@comstyle.com; dkim=pass header.i=@comstyle.com Received: from shear.ucar.edu (lists.openbsd.org [192.43.244.163]) by cvs.openbsd.org (OpenSMTPD) with ESMTPS id f21c5513 TLS version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL; Tue, 14 Apr 2015 09:50:48 -0600 (MDT) Received: from mail.comstyle.com (speedy.comstyle.com [206.51.28.2]) by shear.ucar.edu (8.14.7/8.14.7) with ESMTP id t3EFokV5006895 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-GCM-SHA256 bits=128 verify=NO); Tue, 14 Apr 2015 09:50:47 -0600 (MDT) Received: from mail.comstyle.com (localhost [127.0.0.1]) by mail.comstyle.com (Postfix) with ESMTP id 08768986AB; Tue, 14 Apr 2015 11:50:46 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=comstyle.com; h=date:from :to:subject:message-id:mime-version:content-type; s=selector1; bh=1yPimtR5zjij9WHhwB4Yp7pwXbs=; b=JxKgbggIixWvj9dpk4r/zy9tkqD5 oEzsRUol1iXVIpPPui4SF/Z4NXbuXK6aNUIkKPxbU2H8NBhApJCEPsZWH4BgWSbg HYuPX/xRnZIVr1rorL8z/b9iQNjGEPDtkYT2l9JAfNM1D2Ft/iQwMyx5e1RF1ULk dTH3koW5NUflv0Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=comstyle.com; h=date:from:to :subject:message-id:mime-version:content-type; q=dns; s= selector1; b=JGkSPXhzl9KbFrdMkutc7JZ18likwj2QPV2o2Ef5GSjnZIhpGAa J79lhPCLC3IhHVlodzkXw7P/6pqyIaUapa7l7UDsPEGAnjmnGVsaeP8mpdu183pV CV440HxBA7mZbv2fDRNNZoRbIrjP7vCetRlrDy2wpKaZhGVFoONFJvvg= X-Spam-Status: No X-comstyle-MailScanner-From: brad@comstyle.com X-comstyle-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (not cached, score=-2.9, required 6, autolearn=not spam, ALL_TRUSTED -1.00, BAYES_00 -1.90) X-comstyle-MailScanner: Found to be clean X-comstyle-MailScanner-ID: A272A98578.A069B X-comstyle-MailScanner-Information: Please contact the ISP for more information Received: from humpty.home.comstyle.com (unknown [IPv6:2001:470:b01e:3:785f:45b6:2ec8:6798]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: brad) by mail.comstyle.com (Postfix) with ESMTPSA id A272A98578; Tue, 14 Apr 2015 11:50:43 -0400 (EDT) Date: Tue, 14 Apr 2015 11:50:42 -0400 From: Brad Smith To: sthen@openbsd.org, henning@openbsd.org, chris@openbsd.org, dlg@openbsd.org, claudio@openbsd.org Subject: VLAN MTU handling Message-ID: <20150414155041.GA25799@humpty.home.comstyle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Status: RO Content-Length: 1978 Lines: 67 Have VLAN's inherit the hardmtu of the parent interface and simplify the VLAN MTU handling. Comments? OK? Index: if_vlan.c =================================================================== RCS file: /cvs/src/sys/net/if_vlan.c,v retrieving revision 1.116 diff -u -p -u -p -r1.116 if_vlan.c --- if_vlan.c 13 Apr 2015 08:52:51 -0000 1.116 +++ if_vlan.c 14 Apr 2015 15:48:17 -0000 @@ -388,10 +388,13 @@ vlan_config(struct ifvlan *ifv, struct i ifv->ifv_p = p; ifv->ifv_if.if_baudrate = p->if_baudrate; - if (p->if_capabilities & IFCAP_VLAN_MTU) + if (p->if_capabilities & IFCAP_VLAN_MTU) { ifv->ifv_if.if_mtu = p->if_mtu; - else + ifv->ifv_if.if_hardmtu = p->if_hardmtu; + } else { ifv->ifv_if.if_mtu = p->if_mtu - EVL_ENCAPLEN; + ifv->ifv_if.if_hardmtu = p->if_hardmtu - EVL_ENCAPLEN; + } ifv->ifv_if.if_flags = p->if_flags & (IFF_UP | IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); @@ -492,6 +495,7 @@ vlan_unconfig(struct ifnet *ifp, struct /* Disconnect from parent. */ ifv->ifv_p = NULL; ifv->ifv_if.if_mtu = ETHERMTU; + ifv->ifv_if.if_hardmtu = ETHERMTU; ifv->ifv_flags = 0; /* Clear our MAC address. */ @@ -544,7 +548,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd struct ifreq *ifr; struct ifvlan *ifv; struct vlanreq vlr; - int error = 0, p_mtu = 0, s; + int error = 0, s; ifr = (struct ifreq *)data; ifa = (struct ifaddr *)data; @@ -572,12 +576,8 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd case SIOCSIFMTU: if (ifv->ifv_p != NULL) { - if (ifv->ifv_p->if_capabilities & IFCAP_VLAN_MTU) - p_mtu = ifv->ifv_p->if_hardmtu; - else - p_mtu = ifv->ifv_p->if_hardmtu - EVL_ENCAPLEN; - - if (ifr->ifr_mtu > p_mtu || ifr->ifr_mtu < ETHERMIN) + if (ifr->ifr_mtu < ETHERMIN || + ifr->ifr_mtu > ifv->ifv_if.if_hardmtu) error = EINVAL; else ifp->if_mtu = ifr->ifr_mtu; -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.