Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Apr 2015 18:24:25 +1200
From:      Nathan Ward <freebsd@daork.net>
To:        freebsd-mips@freebsd.org
Subject:   Address error trap in ng_netflow on MIPS
Message-ID:  <etPan.55349b99.19495cff.11e@brooklyn.local>

next in thread | raw e-mail | index | archive | help
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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?etPan.55349b99.19495cff.11e>