NetBSD Problem Report #49788

From www@NetBSD.org  Thu Mar 26 08:11:32 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 7622EA654B
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 26 Mar 2015 08:11:32 +0000 (UTC)
Message-Id: <20150326081130.DA9A5A6567@mollari.NetBSD.org>
Date: Thu, 26 Mar 2015 08:11:30 +0000 (UTC)
From: ozaki-r@netbsd.org
Reply-To: ozaki-r@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: vlan(4) extra padding
X-Send-Pr-Version: www-1.0

>Number:         49788
>Category:       kern
>Synopsis:       vlan(4) extra padding
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 26 08:15:00 +0000 2015
>Closed-Date:    Fri Apr 17 02:16:04 +0000 2015
>Last-Modified:  Fri Apr 17 02:16:04 +0000 2015
>Originator:     Ryota Ozaki
>Release:        current
>Organization:
IIJ
>Environment:
NetBSD kvm 7.99.7 NetBSD 7.99.7 (KVM) #141: Thu Mar 26 15:16:00 JST 2015  ozaki-r@rangeley:(hidden) amd64

>Description:
http://nxr.netbsd.org/xref/src/sys/net/if_vlan.c#808

Here vlan pads a frame with zeros up to 68 bytes
(ETHER_MIN_LEN + ETHER_VLAN_ENCAP_LEN). It expects
that if the frame is untagged, it keeps 64 bytes
at least. However, it lacks concern about CRC
(4 bytes) that needs to be added by the hardware;
we should pad up to 64 bytes here and output frames
will be 68 bytes expectedly.
>How-To-Repeat:
Create and set up a vlan interface, ping to somewhere via it and see packet size.
>Fix:
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 2d5b861..02b6686 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -806,9 +806,10 @@ vlan_start(struct ifnet *ifp)
                                 * after deleting a tag.
                                 */
                                if (m->m_pkthdr.len <
-                                   (ETHER_MIN_LEN + ETHER_VLAN_ENCAP_LEN)) {
+                                   (ETHER_MIN_LEN - ETHER_CRC_LEN +
+                                    ETHER_VLAN_ENCAP_LEN)) {
                                        m_copyback(m, m->m_pkthdr.len,
-                                           (ETHER_MIN_LEN +
+                                           (ETHER_MIN_LEN - ETHER_CRC_LEN +
                                             ETHER_VLAN_ENCAP_LEN) -
                                             m->m_pkthdr.len,
                                            vlan_zero_pad_buff);

>Release-Note:

>Audit-Trail:
From: "Ryota Ozaki" <ozaki-r@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49788 CVS commit: src/sys/net
Date: Sun, 29 Mar 2015 13:30:43 +0000

 Module Name:	src
 Committed By:	ozaki-r
 Date:		Sun Mar 29 13:30:43 UTC 2015

 Modified Files:
 	src/sys/net: if_vlan.c

 Log Message:
 Correct frame padding length

 vlan pads a frame with zeros up to 68 bytes
 (ETHER_MIN_LEN + ETHER_VLAN_ENCAP_LEN). It expects
 that even if the frame is untagged, it keeps 64 bytes
 at least. However, it lacks concern about CRC
 (4 bytes). So a sending frame can be 72 (68 + 4) bytes.

 PR 49788


 To generate a diff of this commit:
 cvs rdiff -u -r1.79 -r1.80 src/sys/net/if_vlan.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->pending-pullups
State-Changed-By: ozaki-r@NetBSD.org
State-Changed-When: Sun, 29 Mar 2015 13:48:44 +0000
State-Changed-Why:
Need pullup-7 and pullup-6.


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49788 CVS commit: [netbsd-7] src/sys/net
Date: Sat, 4 Apr 2015 14:56:48 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sat Apr  4 14:56:48 UTC 2015

 Modified Files:
 	src/sys/net [netbsd-7]: if_vlan.c

 Log Message:
 Pull up following revision(s) (requested by ozaki-r in ticket #653):
 	sys/net/if_vlan.c: revision 1.80
 Correct frame padding length
 vlan pads a frame with zeros up to 68 bytes
 (ETHER_MIN_LEN + ETHER_VLAN_ENCAP_LEN). It expects
 that even if the frame is untagged, it keeps 64 bytes
 at least. However, it lacks concern about CRC
 (4 bytes). So a sending frame can be 72 (68 + 4) bytes.
 PR 49788


 To generate a diff of this commit:
 cvs rdiff -u -r1.70.2.1 -r1.70.2.2 src/sys/net/if_vlan.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49788 CVS commit: [netbsd-6] src/sys/net
Date: Thu, 16 Apr 2015 09:27:32 +0000

 Module Name:	src
 Committed By:	msaitoh
 Date:		Thu Apr 16 09:27:32 UTC 2015

 Modified Files:
 	src/sys/net [netbsd-6]: if_vlan.c

 Log Message:
 Pull up following revision(s) (requested by ozaki-r in ticket #1286):
 	sys/net/if_vlan.c: revision 1.80
 Correct frame padding length
 vlan pads a frame with zeros up to 68 bytes
 (ETHER_MIN_LEN + ETHER_VLAN_ENCAP_LEN). It expects
 that even if the frame is untagged, it keeps 64 bytes
 at least. However, it lacks concern about CRC
 (4 bytes). So a sending frame can be 72 (68 + 4) bytes.
 PR 49788


 To generate a diff of this commit:
 cvs rdiff -u -r1.69.8.2 -r1.69.8.3 src/sys/net/if_vlan.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49788 CVS commit: [netbsd-7] src/doc
Date: Thu, 16 Apr 2015 09:30:36 +0000

 Module Name:	src
 Committed By:	msaitoh
 Date:		Thu Apr 16 09:30:36 UTC 2015

 Modified Files:
 	src/doc [netbsd-7]: CHANGES-7.0

 Log Message:
 Note about PR#49788.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1.2.255 -r1.1.2.256 src/doc/CHANGES-7.0

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: msaitoh@NetBSD.org
State-Changed-When: Fri, 17 Apr 2015 02:16:04 +0000
State-Changed-Why:
Pulled up.
Thanks.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.