NetBSD Problem Report #31348
From www@netbsd.org Mon Sep 19 10:11:22 2005
Return-Path: <www@netbsd.org>
Received: by narn.netbsd.org (Postfix, from userid 31301)
id C49DF63B894; Mon, 19 Sep 2005 10:11:22 +0000 (UTC)
Message-Id: <20050919101122.C49DF63B894@narn.netbsd.org>
Date: Mon, 19 Sep 2005 10:11:22 +0000 (UTC)
From: isaki@par.odn.ne.jp
Reply-To: isaki@par.odn.ne.jp
To: gnats-bugs@netbsd.org
Subject: bpf(4) does not strip CRC on rtk(4)
X-Send-Pr-Version: www-1.0
>Number: 31348
>Category: kern
>Synopsis: bpf(4) does not strip CRC on rtk(4)
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Sep 19 10:12:00 +0000 2005
>Closed-Date: Fri Sep 29 08:48:03 +0000 2006
>Last-Modified: Fri Sep 29 08:48:03 +0000 2006
>Originator: Tetsuya Isaki
>Release: NetBSD 3.0_BETA/i386
>Organization:
>Environment:
NetBSD 3.0_BETA (XXX) #14: Thu Sep 15 14:31:38 JST 2005
isaki@xxxxxx:/obj/sys/arch/i386/compile/XXX
>Description:
dev/ic/rtl81x9.c (rtk) sets M_HASFCS to m->m_flags,
instead of subtracting ETHER_CRC_LEN from packet length.
Then ether_input() subtracts ETHER_CRC_LEN from packet
ength if M_HASFCS was set.
However, bpf(4) does not subtract ETHER_CRC_LEN even if
M_HASFCS was set. So tcpdump shows trailing 4byte gabage
on each packets from rtk.
Here is a sample.
On the sender side:
% perl -e 'print "0123456789" x 4;' | nc -u targethost 7
On the reciever side:
% tcpdump -npexX -i rtk0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on rtk0, link-type EN10MB (Ethernet), capture size 96 bytes
18:44:36.874822 00:0f:ea:XX:XX:XX > 00:60:e0:YY:YY:YY, ethertype IPv4 (0x0800),
length 86: IP 10.xx.xx.xx.55216 > 10.yy.yy.yy.7: UDP, length: 40
0x0000: 0060 e0YY YYYY 000f eaXX XXXX 0800 4500 .`............E.
0x0010: 0044 d6b0 0000 4011 8ca2 0axx xxxx 0ayy .D....@.........
0x0020: yyyy d7b0 0007 0030 fc57 3031 3233 3435 .......0.W012345
0x0030: 3637 3839 3031 3233 3435 3637 3839 3031 6789012345678901
0x0040: 3233 3435 3637 3839 3031 3233 3435 3637 2345678901234567
0x0050: 3839 0109 2159 89..!Y
^^^^^^^^^
>How-To-Repeat:
Send some packet, and tcpdump it on rtk0.
>Fix:
Subtract ETHER_CRC_LEN when M_HASFCS was set
in bpf_mtap() (and bpf_mtap2 ?).
>Release-Note:
>Audit-Trail:
From: Izumi Tsutsui <tsutsui@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: PR/31348 CVS commit: src/sys/dev/ic
Date: Fri, 29 Sep 2006 08:33:06 +0000 (UTC)
Module Name: src
Committed By: tsutsui
Date: Fri Sep 29 08:33:06 UTC 2006
Modified Files:
src/sys/dev/ic: rtl81x9.c
Log Message:
In rtk_rxeof():
- discard too short packets as well as too large ones
- trim CRC off rather than setting M_HASFCS
Closes PR kern/31348.
To generate a diff of this commit:
cvs rdiff -r1.53 -r1.54 src/sys/dev/ic/rtl81x9.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->closed
State-Changed-By: tsutsui@netbsd.org
State-Changed-When: Fri, 29 Sep 2006 17:48:03 +0900
State-Changed-Why:
rtk(4) is fixed since M_HASFCS looks deprecated.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.