NetBSD Problem Report #17867
Received: (qmail 3262 invoked by uid 605); 7 Aug 2002 10:01:30 -0000
Message-Id: <20020807100127.9DE5B11122@narn.netbsd.org>
Date: Wed, 7 Aug 2002 03:01:27 -0700 (PDT)
From: manu@netbsd.org
Sender: gnats-bugs-owner@netbsd.org
Reply-To: manu@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: UDP broadcast is broken
X-Send-Pr-Version: www-1.0
>Number: 17867
>Category: kern
>Synopsis: UDP broadcast is broken
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: itojun
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Aug 07 10:02:00 +0000 2002
>Closed-Date: Thu Sep 05 22:40:06 +0000 2002
>Last-Modified: Thu Mar 27 13:17:00 +0000 2003
>Originator: Emmanuel Dreyfus
>Release: NetBSD-1.6_BETA5
>Organization:
The NetBSD Project
>Environment:
NetBSD mmX 1.6_BETA5 NetBSD 1.6_BETA5 (GENERIC) #0: Fri Aug 2 19:35:27 UTC 2002 autobuild@tgm.daemon.org:/autobuild/i386/OBJ/autobuild/src/sys/arch/i386/compile/GENERIC i386
>Description:
When sending UDP/IP packets to a broadcast address on 1.6_BETA5, the generated packets are corrupted.
Here are tcpdump outputs on 1.6_BETA5:
10:39:23.484316 truncated-ip - 9945 bytes missing!mmX.info.local.65506 > 192.168.3.255.4000: udp 782
and on 1.5.3:
10:50:35.352326 mmX.info.local.65534 > 192.168.3.255.4000: udp 782
The two dumps are caused by exactly the same command (netcat), ran on
the same machine, with just the OS changed. The problem exists on
1.6BETA_5 when using a netcat built on 1.6BETA5 and a netcat built on
1.5.3, so this is not a binary compatibility problem.
Additionnaly, I discovered the problem with a home grown program,
so it is not netcat specific. I beleive the problem happens in sendto()
Of course no host on the LAN is able to understand the packets sent
by NetBSD-1.6BETA5, so this is quite serious. I have not checked if
multicast programs are affected.
>How-To-Repeat:
simple test with netcat such as
nc -u -b 192.168.3.255 < /etc/passwd
while dumping packets with tcpdump on another machine will show the problem
>Fix:
not known yet.
>Release-Note:
>Audit-Trail:
From: Matthias Scheler <tron@zhadum.de>
To: NetBSD GNATS <gnats-bugs@gnats.netbsd.org>
Cc:
Subject: kern/17867: UDP broadcast is broken
Date: Thu, 8 Aug 2002 11:09:02 +0200
Hello,
1.) Your example doesn't work:
tron@colwyn:~tron#nc -u -b 192.168.25.255 < /etc/passwd
no port[s] to connect to
2.) UDP broadcasts work fine for me:
tron@lyssa:~tron#tcpdump -i epic0 udp
tcpdump: listening on epic0
[...]
11:03:04.598930 colwyn.zhadum.de.60221 > 192.168.25.255.netbios-ns: udp 50
11:03:04.899277 colwyn.zhadum.de.60221 > 192.168.25.255.netbios-ns: udp 50
11:03:05.199581 colwyn.zhadum.de.60221 > 192.168.25.255.netbios-ns: udp 50
^C
64 packets received by filter
0 packets dropped by kernel
"colwyn" is running NetBSD 1.6_BETA5 built from 2002-08-06 sources. It is
connected to the LAN via this network card:
fxp0 at pci2 dev 4 function 0: i82558 Ethernet, rev 5
fxp0: interrupting at irq 10
fxp0: Ethernet address 00:d0:b7:b9:48:d1
inphy0 at fxp0 phy 1: i82555 10/100 media interface, rev. 0
Kind regards
--
Matthias Scheler http://scheler.de/~matthias/
From: enami tsugutomo <enami@sm.sony.co.jp>
To: manu@netbsd.org
Cc: gnats-bugs@gnats.netbsd.org, thorpej@netbsd.org, itojun@netbsd.org
Subject: Re: kern/17867: UDP broadcast is broken
Date: 08 Aug 2002 18:57:19 +0900
manu@netbsd.org writes:
> Here are tcpdump outputs on 1.6_BETA5:
> 10:39:23.484316 truncated-ip - 9945 bytes missing!mmX.info.local.65506 > 192.168.3.255.4000: udp 782
>
> and on 1.5.3:
> 10:50:35.352326 mmX.info.local.65534 > 192.168.3.255.4000: udp 782
For me, it was reproducable by following command:
# dd if=/dev/zero bs=1 count=453 | nc -b -u 43.11.135.255 4000
It occurs when this or longer packet and only ip_len field is swapped.
And following change work around this (for AF_INET packets). So, I
guess ip_input() modifies a shared mbuf cluster before the packet is
sent to wire.
enami.
Index: if_ethersubr.c
===================================================================
RCS file: /cvsroot/syssrc/sys/net/if_ethersubr.c,v
retrieving revision 1.95
diff -u -r1.95 if_ethersubr.c
--- if_ethersubr.c 2002/05/18 22:52:44 1.95
+++ if_ethersubr.c 2002/08/08 09:43:53
@@ -263,7 +263,7 @@
return (0); /* if not yet resolved */
/* If broadcasting on a simplex interface, loopback a copy */
if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX))
- mcopy = m_copy(m, 0, (int)M_COPYALL);
+ mcopy = m_dup(m, 0, (int)M_COPYALL, M_DONTWAIT);
etype = htons(ETHERTYPE_IP);
break;
From: Matthias Scheler <tron@zhadum.de>
To: NetBSD GNATS <gnats-bugs@gnats.netbsd.org>
Cc:
Subject: kern/17867: UDP broadcast is broken
Date: Thu, 8 Aug 2002 12:40:31 +0200
Hello,
using the new suggested "nc" command I can reproduce the problem under
NetBSD-i386 1.6_BETA5 and 1.6F with fxp(4) and epic(4). So it is neither
a hardware nor a driver problem.
Kind regards
--
Matthias Scheler http://scheler.de/~matthias/
From: Emmanuel Dreyfus <manu@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: Matthias Scheler <tron@zhadum.de>, enami tsugutomo <enami@sm.sony.co.jp>
Subject: kern/17867 UDP broadcast is broken
Date: Thu, 8 Aug 2002 13:30:13 +0200
> 1.) Your example doesn't work:
> tron@colwyn:~tron#nc -u -b 192.168.25.255 < /etc/passwd
> no port[s] to connect to
Oopsn sorry, I meant nc -u -b 192.168.25.255 4000 < /etc/passwd
(the port was missing)
I also forgot to tell it's on a fxp0 interface:
fxp0 at pci1 dev 8 function 0: Intel i82562 Ethernet, rev 3
fxp0: interrupting at irq 11
fxp0: Ethernet address 00:02:55:f7:79:18
ukphy0 at fxp0 phy 1: Generic IEEE 802.3u media interface
ukphy0: i82562ET 10/100 media interface (OUI 0x005500, model 0x0033), rev. 0
ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
--
Emmanuel Dreyfus Emmanuel.Dreyfus@espci.fr
Cette signature vous est fournie telle quelle, sans aucune garantie de
fonctionnement. En la lisant, vous acceptez les préjudices matériels,
physiques, et moraux qu'elle pourrait causer.
From: Emmanuel Dreyfus <manu@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: Matthias Scheler <tron@zhadum.de>, enami tsugutomo <enami@sm.sony.co.jp>
Subject: kern/17867 UDP broadcast is broken
Date: Thu, 8 Aug 2002 15:58:45 +0200
Enami's patch fixed the problem for me (Thank you).
Is it reasonable to commit this and request a pull-up?
--
Emmanuel Dreyfus
manu@netbsd.org
From: itojun@iijlab.net
To: enami tsugutomo <enami@sm.sony.co.jp>
Cc: manu@netbsd.org, gnats-bugs@gnats.netbsd.org, thorpej@netbsd.org
Subject: Re: kern/17867: UDP broadcast is broken
Date: Fri, 09 Aug 2002 00:37:17 +0900
>menu@netbsd.org writes:
>
>> Here are tcpdump outputs on 1.6_BETA5:
>> 10:39:23.484316 truncated-ip - 9945 bytes missing!mmX.info.local.65506 > 192.168.3.255.4000: udp 782
>>
>> and on 1.5.3:
>> 10:50:35.352326 mmX.info.local.65534 > 192.168.3.255.4000: udp 782
>
>For me, it was reproducable by following command:
>
># dd if=/dev/zero bs=1 count=453 | nc -b -u 43.11.135.255 4000
>
>It occurs when this or longer packet and only ip_len field is swapped.
>And following change work around this (for AF_INET packets). So, I
>guess ip_input() modifies a shared mbuf cluster before the packet is
>sent to wire.
this is because of the change to M_LEADINGSPACE().
- M_PREPEND() in udp_output will use the topmost part of cluster mbuf
(with 1.5.3, it will allocate new !M_EXT mbuf)
- ip_output() generate output
- ether_output() loops back a copy
- ip_input() overwrite the shared mbuf
(with 1.5.3, the mbuf is not shared so)
we can fix it in multiple ways:
- make M_PREPEND() allocate new mbuf if M_EXT
safest, slow
- do m_pullup() in ip_input() if M_EXT
- do not let ip_input() modify the packet (avoid NTOHS)
cleanest, need modifications here and there, need some time to
test (especially raw ip socket)
for 1.6, i vote for the first one (patch attached).
itojun
Index: mbuf.h
===================================================================
RCS file: /cvsroot/syssrc/sys/sys/mbuf.h,v
retrieving revision 1.65
diff -u -r1.65 mbuf.h
--- mbuf.h 2002/05/02 16:22:45 1.65
+++ mbuf.h 2002/08/08 15:35:39
@@ -547,7 +547,7 @@
*/
#define M_PREPEND(m, plen, how) \
do { \
- if (M_LEADINGSPACE(m) >= (plen)) { \
+ if (!((m)->m_flags & M_EXT) && M_LEADINGSPACE(m) >= (plen)) { \
(m)->m_data -= (plen); \
(m)->m_len += (plen); \
} else \
From: itojun@iijlab.net
To: enami tsugutomo <enami@sm.sony.co.jp>, manu@netbsd.org,
gnats-bugs@gnats.netbsd.org, thorpej@netbsd.org
Cc:
Subject: Re: kern/17867: UDP broadcast is broken
Date: Fri, 09 Aug 2002 01:09:17 +0900
> for 1.6, i vote for the first one (patch attached).
...because the problem could be in other places too (ip_input change
may not be enough).
itojun
From: Jason R Thorpe <thorpej@wasabisystems.com>
To: itojun@iijlab.net
Cc: enami tsugutomo <enami@sm.sony.co.jp>, manu@netbsd.org,
gnats-bugs@gnats.netbsd.org
Subject: Re: kern/17867: UDP broadcast is broken
Date: Thu, 8 Aug 2002 10:24:06 -0700
On Fri, Aug 09, 2002 at 01:09:17AM +0900, itojun@iijlab.net wrote:
> > for 1.6, i vote for the first one (patch attached).
>
> ...because the problem could be in other places too (ip_input change
> may not be enough).
Sigh. This is okay with me, as long as we can fix the problem differently
for 1.6.1.
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>
From: manu@netbsd.org (Emmanuel Dreyfus)
To: itojun@iijlab.net
Cc: enami@sm.sony.co.jp (enami tsugutomo), gnats-bugs@gnats.netbsd.org,
thorpej@netbsd.org
Subject: Re: kern/17867: UDP broadcast is broken
Date: Thu, 8 Aug 2002 20:43:30 +0200
> for 1.6, i vote for the first one (patch attached).
The patch is okay for me, the problem disapear.
--
Emmanuel Dreyfus.
Il ne suffit pas de crier l'iMac, l'iMac! en sautant comme un cabri...
manu@netbsd.org
From: enami tsugutomo <enami@sm.sony.co.jp>
To: itojun@iijlab.net, Jason R Thorpe <thorpej@wasabisystems.com>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/17867: UDP broadcast is broken
Date: Fri, 9 Aug 2002 07:43:48 +0900 (JST)
> From: Jason R Thorpe <thorpej@wasabisystems.com>
>
> On Fri, Aug 09, 2002 at 01:09:17AM +0900, itojun@iijlab.net wrote:
>
> > > for 1.6, i vote for the first one (patch attached).
> >
> > ...because the problem could be in other places too (ip_input change
> > may not be enough).
>
> Sigh. This is okay with me, as long as we can fix the problem differently
> for 1.6.1.
Agreed.
enami.
From: itojun@iijlab.net
To: enami tsugutomo <enami@sm.sony.co.jp>
Cc: Jason R Thorpe <thorpej@wasabisystems.com>, manu@netbsd.org,
gnats-bugs@gnats.netbsd.org
Subject: Re: kern/17867: UDP broadcast is broken
Date: Fri, 09 Aug 2002 07:45:43 +0900
>> From: Jason R Thorpe <thorpej@wasabisystems.com>
>> On Fri, Aug 09, 2002 at 01:09:17AM +0900, itojun@iijlab.net wrote:
>> > > for 1.6, i vote for the first one (patch attached).
>> > ...because the problem could be in other places too (ip_input change
>> > may not be enough).
>> Sigh. This is okay with me, as long as we can fix the problem differently
>> for 1.6.1.
>Agreed.
sent a pullup. i'll try to remove NTOHS from ip_input codepath
on main trunk.
itojun
Responsible-Changed-From-To: kern-bug-people->itojun
Responsible-Changed-By: itojun
Responsible-Changed-When: Thu Aug 8 16:57:30 PDT 2002
Responsible-Changed-Why:
mine.
From: Jason R Thorpe <thorpej@wasabisystems.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: kern/17867
Date: Thu, 8 Aug 2002 18:10:42 -0700
I believe that kern/10195 is related.
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>
State-Changed-From-To: open->feedback
State-Changed-By: itojun
State-Changed-When: Fri Aug 16 22:59:15 PDT 2002
State-Changed-Why:
should be fixed on current (and 1.6)
From: manu@netbsd.org (Emmanuel Dreyfus)
To: gnats-bugs@netbsd.org
Cc:
Subject: kern/17867
Date: Thu, 5 Sep 2002 20:17:22 +0200
The bug is fixed, I think we can close this PR.
--
Emmanuel Dreyfus.
Hiroshima 45. Tchernobyl 86. Windows 95.
manu@netbsd.org
State-Changed-From-To: feedback->closed
State-Changed-By: itojun
State-Changed-When: Thu Sep 5 15:39:45 PDT 2002
State-Changed-Why:
fixed
edit-pr 10195
From: Luke Mewburn <lukem@netbsd.org>
To: gnats-bugs@gnats.netbsd.org
Cc:
Subject: pr/17867 CVS commit: src/usr.bin/wall
Date: Thu, 27 Mar 2003 15:16:20 +0200 (EET)
Module Name: src
Committed By: lukem
Date: Thu Mar 27 13:16:20 UTC 2003
Modified Files:
src/usr.bin/wall: wall.1 wall.c
Log Message:
* Add support for "-g group", to send messages to users in this group.
This option may be specified multiple times, and any user in any of the
specified groups will receive the message.
(From OpenBSD, with tweaks from FreeBSD fed back into OpenBSD).
* Ensure that paths are MAXPATHLEN. (From OpenBSD)
* Display timezone when printing time. (From FreeBSD PR 17867 via wall.c 1.14)
To generate a diff of this commit:
cvs rdiff -r1.5 -r1.6 src/usr.bin/wall/wall.1
cvs rdiff -r1.20 -r1.21 src/usr.bin/wall/wall.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>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.