NetBSD Problem Report #57152

From he@smistad.uninett.no  Sun Jan  1 21:29:42 2023
Return-Path: <he@smistad.uninett.no>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 220921A9239
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  1 Jan 2023 21:29:42 +0000 (UTC)
Message-Id: <20230101212937.3EFFE4402F5@smistad.uninett.no>
Date: Sun,  1 Jan 2023 22:29:37 +0100 (CET)
From: he@NetBSD.org
Reply-To: he@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: BPF / dhcpcd on mipsn64-be appears to malfunction
X-Send-Pr-Version: 3.95

>Number:         57152
>Category:       kern
>Synopsis:       BPF / dhcpcd on mipsn64-be appears to malfunction
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 01 21:30:01 +0000 2023
>Last-Modified:  Sat Jan 07 11:30:01 +0000 2023
>Originator:     he@NetBSD.org
>Release:        NetBSD 9.99.106
>Organization:
	I try...
>Environment:
System: NetBSD n64 9.99.106 NetBSD 9.99.106 (MIPSSIM64) #0: Sat Dec 31 12:39:58 CET 2022  he@mt.urc.uninett.no:/u/build/HEAD/obj/evbmipsn64-eb/sys/arch/evbmips/compile/MIPSSIM64 evbmips
Architecture: mipsn64eb
Machine: evbmips
>Description:
	Running a MIPSSIM64 kernel built with "-m evbmipsn64-eb"
	within qemu with "user" networking, like so:

MEM=2g
CPU=5Kf

qemu-system-mips64 \
        -M mipssim-virtio \
        -m $MEM  \
        -cpu $CPU \
        -kernel netbsd \
        -nographic \
        -device virtio-rng-device \
        -drive id=hda,format=raw,file=disk.img \
        -device virtio-blk-device,drive=hda \
        -netdev user,id=net0,hostfwd=tcp::2228-:22,ipv6=off \
        -device virtio-net-device,netdev=net0,mac=00:11:1e:01:02:08

	I am using qemu 7.0.0nb1 at the moment.

	and having dhcpcd=YES in /etc/rc.conf results in the machine
	not getting an IP address via dhcp, but instead it ends up
	with an "unusable" address on 169.254.0.0/16.

	Doing "tcpdump -x -n -e -i vioif0 -c 2" while dhcpcd is running
	results in

11:31:36.013042 ff:00:11:1e:01:02 > 00:ff:ff:ff:ff:ff, ethertype Unknown (0x0808), length 4294967295:
        0x0000:  0045 0001 482f 2000 0040 114a 8600 0000  .E..H/...@.J....
        0x0010:  00ff ffff ff00 4400 4301 3403 8001 0106  ......D.C.4.....
        0x0020:  00ec d229 c800 bd00 0000 0000 0000 0000  ...)............
	...

	On the wire, the destination address travels first, source
	address thereafter, and then the "type / length" field.

	So ... here it looks like the "snap" of the ethernet header
	has started one byte too early.  Note that the first "0x08" in
	the type field should be part of the source address, and the
	first byte in the source address should be part of the
	destination address instead, and "0x45" should be the first
	byte (IPv4, IHL=5), but it isn't.

>How-To-Repeat:
	Spin up a big-endian 64-bit MIPS kernel in qemu, and try to
	use dhcpcd, and watch it fail miserably.

>Fix:
	Sorry, don't know.

>Audit-Trail:
From: Havard Eidnes <he@NetBSD.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/57152: BPF / dhcpcd on mipsn64-be appears to malfunction
Date: Sat, 07 Jan 2023 12:26:51 +0100 (CET)

 Hi,

 I've made a few changes which has still not solved this issue for
 me:

 1) I updated the MIPSSIM64 kernel to 10.99.2.  No change.

 2) I updated qemu to 7.1.0nb1, and rebooted again.  No change.

 The host system runs NetBSD/amd64 9.3.

 So, still no idea what is causing this issue, particularly since
 I hear some co-developers do not observe this issue.

 Again, doing "tcpdump -c 2 -w x.td" and looking at the captured
 packets shows the same result as before:

 11:20:14.731817 ff:00:11:1e:01:02 > 00:ff:ff:ff:ff:ff, ethertype Unknow=
 n (0x0808), length 4294967295: =

         0x0000:  0045 0001 4872 e500 0040 1106 c100 0000  .E..Hr...@...=
 ...
         0x0010:  00ff ffff ff00 4400 4301 3493 6701 0106  ......D.C.4.g=
 ...
         0x0020:  0024 da61 da00 bc00 0000 0000 0000 0000  .$.a.........=
 ...
         0x0030:  0000 0000 0000 0000 0000 111e 0102 0800  .............=
 ...

 and the boot log contains two "EAGAIN" error messages from dhcpcd
 related to BPF.

 Regards,

 - H=E5vard

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.