Subject: Kernel fault when configuring NAT
To: None <port-i386@netbsd.org>
From: Keith Browne <tuxedo@icomm.ca>
List: port-i386
Date: 07/30/2000 19:49:47
I'm trying to configure NAT on a small 486 box running NetBSD-1.4.2.
The examples in /usr/share/examples/ipf have been quite helpful, but
now I'm getting a kernel memory fault.

Contents of nat.me:

map ppp0 10.0.0.0/24 -> 0/32 portmap tcp/udp 40000:60000
map ppp0 10.0.0.0/24 -> 0/32

Results of running ipnat:

bash-2.03# /usr/sbin/ipnat -f nat.me
uvm_fault(0xc1b7e370, 0x0, 0, 1) -> 1
kernel: page fault trap, code=0
Stopped in ipnat at     _nat_ioctl+0x319:      cmpl    $0,0(%edx)
db> trace
_nat_ioctl(c1c1deb4,80707250,3,c1c1dde8,2c01) at _nat_ioctl+0x319
_iplioctl(2c01,80707250,c1c1deb4,3,c1b7c3a8) at _iplioctl+0x81
_spec_ioctl(c1c1dde8,0,c1b8c024,80707250,c021c3a6) at _spec_ioctl+0x42
vn_ioctl(c1b8c024,80707250,c1c1deb4,c1b7c3a8,c1c1df88) at
_vn_ioctl+0x113
_sys_ioctl(c1b7c3a8,c1c1df88,c1c1df80,0,61fc) at _sys_ioctl+0x2d9
_syscall() at _syscall+0x221
--- syscall (number 54) ---
0x4007a2b7:
db>

I'm not experienced with the kernel debugger, but it looks to me as if
this is happening somewhere around this code fragment in
netinet/ip_nat.c:

			hv = NAT_HASH_FN(j, ipf_natrules_sz);
			np = nat_rules + hv;
			while (*np != NULL)

(The cmpl $0,0(%edx) looks to my untrained eye like it's part of the
while clause.)

I've never used NAT before, so it's entirely possible that I'm
misconfiguring it.  Has anyone else got this sort of thing working?
Am I doing something obviously wrong?  Or should I just send-pr this?

Thanks.

Keith Browne
tuxedo@icomm.ca