NetBSD Problem Report #50456
From www@NetBSD.org Sat Nov 21 12:10:38 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" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 8B648A6655
for <gnats-bugs@gnats.NetBSD.org>; Sat, 21 Nov 2015 12:10:38 +0000 (UTC)
Message-Id: <20151121121037.8737BA66FC@mollari.NetBSD.org>
Date: Sat, 21 Nov 2015 12:10:37 +0000 (UTC)
From: freddy.dsx+netbsd@free.fr
Reply-To: freddy.dsx+netbsd@free.fr
To: gnats-bugs@NetBSD.org
Subject: alc - packet loose when tcpdump
X-Send-Pr-Version: www-1.0
>Number: 50456
>Category: kern
>Synopsis: alc - packet loose when tcpdump
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Nov 21 12:15:00 +0000 2015
>Closed-Date: Tue Nov 24 23:14:22 +0000 2015
>Last-Modified: Tue Nov 24 23:14:22 +0000 2015
>Originator: freddy dissaux
>Release: NetBSD 7.0
>Organization:
>Environment:
NetBSD n7010.bsdsx.fr 7.0 NetBSD 7.0 (GENERIC) #1: Sat Nov 21 13:36:17 CET 2015 root@n7010.bsdsx.fr:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
When tcpdump on alc, some packets are lost:
dsx@n7010>ping 172.16.40.1
PING 172.16.40.1 (172.16.40.1): 56 data bytes
64 bytes from 172.16.40.1: icmp_seq=0 ttl=64 time=0.972398 ms
64 bytes from 172.16.40.1: icmp_seq=1 ttl=64 time=0.921371 ms
# sudo tcpdump -n -i alc0 not port ssh
64 bytes from 172.16.40.1: icmp_seq=8 ttl=64 time=1.025976 ms
64 bytes from 172.16.40.1: icmp_seq=9 ttl=64 time=0.911102 ms
64 bytes from 172.16.40.1: icmp_seq=10 ttl=64 time=0.948231 ms
# ^C tcpdump
64 bytes from 172.16.40.1: icmp_seq=18 ttl=64 time=0.954294 ms
64 bytes from 172.16.40.1: icmp_seq=19 ttl=64 time=0.907106 ms
^C
----172.16.40.1 PING Statistics----
20 packets transmitted, 7 packets received, 65.0% packet loss
round-trip min/avg/max/stddev = 0.907106/0.948640/1.025976/0.041744 ms
>How-To-Repeat:
- configure an alc interface
- ping the gateway
- tcpdump on alc
>Fix:
Patch based on OpenBSD's sys/dev/pci/if_alc.c rev 1.36 follow
>Release-Note:
>Audit-Trail:
From: Leonardo Taccari <leot@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: kern/50456: alc - packet loose when tcpdump
Date: Sat, 21 Nov 2015 17:23:40 +0100
Dear freddy,
freddy.dsx+netbsd@free.fr writes:
> >Number: 50456
> >Category: kern
> >Synopsis: alc - packet loose when tcpdump
> >Confidential: no
> >Severity: non-critical
> >Priority: low
> >Responsible: kern-bug-people
> >State: open
> >Class: sw-bug
> >Submitter-Id: net
> >Arrival-Date: Sat Nov 21 12:15:00 +0000 2015
> >Originator: freddy dissaux
> >Release: NetBSD 7.0
> >Organization:
> >Environment:
> NetBSD n7010.bsdsx.fr 7.0 NetBSD 7.0 (GENERIC) #1: Sat Nov 21 13:36:17 C=
ET 2015 root@n7010.bsdsx.fr:/usr/src/sys/arch/amd64/compile/
> GENERIC amd64
> =
> >Description:
> When tcpdump on alc, some packets are lost:
> =
> dsx@n7010>ping 172.16.40.1
> PING 172.16.40.1 (172.16.40.1): 56 data bytes
> 64 bytes from 172.16.40.1: icmp_seq=3D0 ttl=3D64 time=3D0.972398 ms
> 64 bytes from 172.16.40.1: icmp_seq=3D1 ttl=3D64 time=3D0.921371 ms
> # sudo tcpdump -n -i alc0 not port ssh
> 64 bytes from 172.16.40.1: icmp_seq=3D8 ttl=3D64 time=3D1.025976 ms
> 64 bytes from 172.16.40.1: icmp_seq=3D9 ttl=3D64 time=3D0.911102 ms
> 64 bytes from 172.16.40.1: icmp_seq=3D10 ttl=3D64 time=3D0.948231 ms
> # ^C tcpdump
> 64 bytes from 172.16.40.1: icmp_seq=3D18 ttl=3D64 time=3D0.954294 ms
> 64 bytes from 172.16.40.1: icmp_seq=3D19 ttl=3D64 time=3D0.907106 ms
> ^C
> ----172.16.40.1 PING Statistics----
> 20 packets transmitted, 7 packets received, 65.0% packet loss
> round-trip min/avg/max/stddev =3D 0.907106/0.948640/1.025976/0.041744 ms
> >How-To-Repeat:
> - configure an alc interface
> - ping the gateway
> - tcpdump on alc
> >Fix:
> Patch based on OpenBSD's sys/dev/pci/if_alc.c rev 1.36 follow
Can you please try to backport from NetBSD-current to NetBSD 7.0 the
following?:
* src/sys/dev/pci/if_alc.c rev 1.15
* src/sys/dev/pci/if_alcreg.h rev 1.4 =
I think they will apply cleanly to NetBSD-7.0.
Unfortunately during the porting from FreeBSD alc(4) I've missed some
bits that I have only committed ~2 months ago (thanks to mrg@ and bad@
for pointing out that!).
Please let us know if it will solve the problems and I will request a
pull-up for netbsd-7.
Thank you in advance!
L.
From: Freddy DISSAUX <freddy.dsx@free.fr>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: kern/50456: alc - packet loose when tcpdump
Date: Tue, 24 Nov 2015 21:00:05 +0100
After applying this patch based on OpenBSD, my interface don't loose
packets when i run tcpdump:
--- sys/dev/pci/if_alc.c.orig Sun Nov 15 11:48:15 2015
+++ sys/dev/pci/if_alc.c Sat Nov 21 11:37:49 2015
@@ -2034,11 +2034,41 @@
alc_ioctl(struct ifnet *ifp, u_long cmd, void *data)
{
struct alc_softc *sc = ifp->if_softc;
+ struct mii_data *mii = &sc->sc_miibus;
+ struct ifreq *ifr = (struct ifreq *)data;
int s, error = 0;
s = splnet();
- error = ether_ioctl(ifp, cmd, data);
+ switch (cmd) {
+ case SIOCSIFADDR:
+ ifp->if_flags |= IFF_UP;
+ if (!(ifp->if_flags & IFF_RUNNING))
+ alc_init(ifp);
+ break;
+
+ case SIOCSIFFLAGS:
+ if (ifp->if_flags & IFF_UP) {
+ if (ifp->if_flags & IFF_RUNNING)
+ error = ENETRESET;
+ else
+ alc_init(ifp);
+ } else {
+ if (ifp->if_flags & IFF_RUNNING)
+ alc_stop(ifp, 0);
+ }
+ break;
+
+ case SIOCSIFMEDIA:
+ case SIOCGIFMEDIA:
+ error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd);
+ break;
+
+ default:
+ error = ether_ioctl(ifp, cmd, data);
+ break;
+ }
+
if (error == ENETRESET) {
if (ifp->if_flags & IFF_RUNNING)
alc_iff(sc);
Regards.
State-Changed-From-To: open->closed
State-Changed-By: leot@NetBSD.org
State-Changed-When: Tue, 24 Nov 2015 23:14:22 +0000
State-Changed-Why:
christos@ committed the patches.
Thank you very much freddy for the analysis and the patches!
>Unformatted:
(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.