From owner-freebsd-mips@FreeBSD.ORG Mon Apr 20 06:24:30 2015 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 34FD9851 for ; Mon, 20 Apr 2015 06:24:30 +0000 (UTC) Received: from mail-pd0-f173.google.com (mail-pd0-f173.google.com [209.85.192.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1041BD44 for ; Mon, 20 Apr 2015 06:24:29 +0000 (UTC) Received: by pdea3 with SMTP id a3so198048797pde.3 for ; Sun, 19 Apr 2015 23:24:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:message-id:subject:mime-version :content-type:content-transfer-encoding:content-disposition; bh=Uklg1b3UJdyqe2/Ws5WqJJgiLvxoTQdISqybjjFYlI8=; b=Fh3VZ4zXsicv0hRMOeClQjxNaMHh9r9MfivSo02vi3nGq5hofzC8KHi4nsBAv6YJz3 RwC7w5Aa3UDP68SnvzUG8QP4B9skyAteer9/r3p4SP5NPtjY00hrcf3Ap9swAkeVvZqJ YfJ6/e6Pfx3lisZ8RqaIFn1enN6Vb8j1z9u4ThLyItPYhepAlRJt4oyzREQbmoD8muqY UpCqtgHiOPDi3SivJ6r0zsU0zPuym+p65E7yWblNaZR1BWWsyOJLaJcdyOTxMajxsx0i oKERlb3mZ2o4El+oOiWY2Ky9M81TTndbZFvVj7/5pdXg177W18iNbK7GLEew4hDZltbb o95Q== X-Gm-Message-State: ALoCoQne9xgz4OnBfh/LPMltO1z4BjQzsqmzl1BqyQYq+I3qVmEfPvpbHsyIhQExQJlcNCeOMp4U X-Received: by 10.68.177.226 with SMTP id ct2mr4248190pbc.105.1429511068981; Sun, 19 Apr 2015 23:24:28 -0700 (PDT) Received: from brooklyn.local ([203.86.202.251]) by mx.google.com with ESMTPSA id oq7sm17051012pac.32.2015.04.19.23.24.27 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 19 Apr 2015 23:24:28 -0700 (PDT) Date: Mon, 20 Apr 2015 18:24:25 +1200 From: Nathan Ward To: freebsd-mips@freebsd.org Message-ID: Subject: Address error trap in ng_netflow on MIPS X-Mailer: Airmail (286) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2015 06:24:30 -0000 Hi all, I am using freebsd on MIPS (on Buffalo=C2=A0WZR-HP-AG300H hardware, which= is basically just Atheros AP96 with some more flash, RAM, and a crippled= u-boot). I am running =46reeBSD 9.1. I am using netgraph=E2=80=99s netflow module, configured to look at both = ingress and egress packets ('msg netflow: setconfig =7B iface=3D0 conf=3D= 3 =7D=E2=80=99). This does not happen if I leave the default of receive-o= nly, however that does not do what I need in my environment. This works fine, for the most part, except when the router tries to trans= mit a DHCP response, which causes the following: + Trap cause =3D 4 (address error (load or I-fetch) - kernel mode) =5B thread pid 226 tid 100066 =5D Stopped at =C2=A0 =C2=A0 =C2=A0export9=5Fadd+0x1230: =C2=A0 =C2=A0 lw =C2= =A0 =C2=A0 =C2=A0a0,0(s7) I hooked up kgdb, and the problem is at this line of code, in sys/netgrap= h/netflow/ng=5Fnetflow.c: 761 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((ip->ip=5Fv =21=3D IPVERSION) =7C=7C Hoping for a quick hack, I replaced all the ip->ip=5Fv references with=C2= =A0(((char *)ip)=5B0=5D >> 4). Nasty, sure, but it worked OK for my purpo= ses :-) Now it=E2=80=99s dying when it calls =22ip->ip=5Fsrc=E2=80=9D in netflow.= c, same sort of error (trap 4). I am unclear exactly what this error means, but it seems to be a MIPS err= or. I don=E2=80=99t know much about CPU architectures, so, here I am. It is curious to me that ip->ip=5Fhl, which is the other 4 bits of the fi= rst octet in the ip header, works fine. Other packets (received, or transmitted - because of forwarding or respon= ding to ping/DNS requests against the local DNS cache) also work fine. Here=E2=80=99s a dump of the ip struct, which all seems just fine: (kgdb) x/10 ip 0x8420380e: 0x45000148 =C2=A00x00004000 =C2=A00x40112584 =C2=A00x0a000001= 0x8420381e: 0x0a000021 =C2=A00x00430044 =C2=A00x01345a50 =C2=A00x02010600= 0x8420382e: 0xea83f35e =C2=A00x00000000 I have tried this on amd64 (VMWare =46usion VM on modern Macbook) and don= =E2=80=99t have any problems - the DHCP reply packets are transmitted jus= t fine, hence I am posting this on this list, rather than whatever list l= ooks after netgraph. Does anyone have pointers to anywhere I might be able to start trying to = fix this=3F Upgrading to =46reeBSD 10.1 is an obvious first step, but I want to be su= re that this will fix it first, I=E2=80=99ve got a handful of changes to = various user land components, I=E2=80=99ve got it on my roadmap, and woul= d avoid bringing that forward for the moment unless it=E2=80=99s necessar= y. I found=C2=A0https://github.com/freebsd/freebsd/commit/6cc0e8d2a0b583db57= 07f811d4ebfbe1ad05e628, which changes netinet/ip.h to use =5F=5Faligned(2= ) rather than 4, which fixes what seems to be a similar issue on ARM, but= it doesn=E2=80=99t seem to help me unfortunately. -- =20 Nathan Ward