# ifconfig de0
de0: flags=63<UP,BROADCAST,NOTRAILERS,RUNNING>
inet 192.168.5.99 netmask 0xffffff00 broadcast 192.168.5.255
# ping 192.168.5.99
PING 192.168.5.99 (192.168.5.99): 56 data bytes
64 bytes from 192.168.5.99: icmp_seq=0 ttl=255 time=16.667 ms
64 bytes from 192.168.5.99: icmp_seq=1 ttl=255 time=16.667 ms
64 bytes from 192.168.5.99: icmp_seq=2 ttl=255 time=16.667 ms
^C
--- 192.168.5.99 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 16.667/16.666/16.667 ms
# arp 192.168.5.99
Unexpected net trap (0)
ka6 37160 aps 147044
pc 22526 ps 50240
panic: net crashed
syncing disks... done
dumping to dev 5001 off 512
dump succeeded
# ifconfig de0
de0: flags=63<UP,BROADCAST,NOTRAILERS,RUNNING>
inet 192.168.5.99 netmask 0xffffff00 broadcast 192.168.5.255
# ping 192.168.5.99
PING 192.168.5.99 (192.168.5.99): 56 data bytes
64 bytes from 192.168.5.99: icmp_seq=0 ttl=255 time=16.667 ms
64 bytes from 192.168.5.99: icmp_seq=1 ttl=255 time=16.667 ms
64 bytes from 192.168.5.99: icmp_seq=2 ttl=255 time=16.667 ms
^C
--- 192.168.5.99 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 16.667/16.666/16.667 ms
# arp 192.168.5.99
192.168.5.99 (192.168.5.99) -- no entry
#
To view this discussion visit https://groups.google.com/d/msgid/pidp-11/2985E9CE-7931-4678-9E96-41C83BF4030B%40sytse.net.
This ends up in the arp table:
# arp -a
? (192.168.100.98) at c0:3f:d5:62:7f:d7
Then we send the ping to the wrong MAC address:
01:46:15.766793 08:00:2b:06:2d:f8 > f6:d8:a8:48:5e:01, ethertype IPv4 (0x0800), length 98: 192.168.100.68 > 192.168.100.98: ICMP echo request, id 32768, seq 0, length 64
Incidentally, patch 482 removes /vmunix, updates
/usr/src/usr.sbin/arp/arp.c accordingly, but then forgets to build and
install it, so my system had a non-functional arp binary until I fixed
that.
# cd /usr/src/usr.sbin
I did a little digging, and I think I see the problem – it’s in netinet/if_ether.c, arpresolve(), which is declared with
arpresolve(ac, m, destip, desten, usetrailers)
register struct arpcom *ac;
struct mbuf *m;
register struct in_addr *destip;
register u_char *desten;
int *usetrailers;
{
The compiler assigns R2 to desten and loads it from the value on the stack:
_arpresolve:
~~arpresolve:
jsr r5,csv
mov 4(r5),r4
~ac=r4
~m=6
mov 10(r5),r3
~destip=r3
mov 12(r5),r2
~desten=r2
However, when it looks for the address in arptab using the ARPTAB_LOOK macro, which in turn uses ARPTAB_HASH, the compiler uses R2 as a scratch variable to compute the hash:
s = splimp();
ARPTAB_LOOK(at, destip->s_addr);
L16: movb 177776,r0; movb $240,177776
mov r0,-40(r5)
~n=177736
mov $-20,-(sp)
mov 2(r3),r1
mov (r3),r0
jsr pc,ulsh
tst (sp)+
mov r1,r0
mov 2(r3),r2
mov (r3),r1
xor r2,r0
bic $-100000,r0
mov r0,r1
sxt r0
div $15,r0
mul $106,r1
add $_arptab,r1
mov r1,-12(r5)
clr -42(r5)
Later, the resolved MAC address is supposed to be copied to the buffer at desten, but r2 no longer points there. The out of bounds write will almost certainly cause some other eventual issue, but in addition, the caller will see whatever happened to be in the desten buffer at the time arpresolve was called.
--John
To view this discussion visit https://groups.google.com/d/msgid/pidp-11/61286746-110F-4047-AA79-FD2B134E6004%40teckelworks.com.
I did a little digging, and I think I see the problem – it’s in netinet/if_ether.c, arpresolve(), which is declared with
arpresolve(ac,m,destip,desten,usetrailers)
register structarpcom *ac;
structmbuf *m;
register structin_addr *destip;
register u_char *desten;
int *usetrailers;
{
The compiler assigns R2 to desten and loads it from the value on the stack:
_arpresolve:
~~arpresolve:
jsr r5,csv
mov 4(r5),r4
~ac=r4
~m=6
mov 10(r5),r3
~destip=r3
mov 12(r5),r2
~desten=r2
However, when it looks for the address in arptab using the ARPTAB_LOOK macro, which in turn uses ARPTAB_HASH, the compiler uses R2 as a scratch variable to compute the hash:
s = splimp();
ARPTAB_LOOK(at,destip->s_addr);
An interesting coincidence: when simh is using SLIRP for networking, the IP address does appear in the MAC address. (See slirp/slirp.c, where special_ethaddr is defined to be 52:55:IP:IP:IP:IP). This is visible in the "arp" output on the client. I don't think slirp cares about the MAC address it receives from the client, which may be why this hasn't been more visible. I didn't notice it, and I've done clean builds since applying patch 490.
Incidentally, a very minor bug that I noted while looking into this is this printf in 2.11BSD's netinet/if_ether.c :, function in_arpinput:
printf("arp: ether address is broadcast for IP address %x!\n",
ntohl(isaddr.s_addr));
The format should be "%lx", because the IP address is a long.
--John
From: pid...@googlegroups.com <pid...@googlegroups.com>
On Behalf Of terry-...@glaver.org
Sent: Thursday, 14 August, 2025 19:19
To: [PiDP-11] <pid...@googlegroups.com>
Subject: Re: [PiDP-11] 2.11BSD patch 490 causes issue in arp resolution
On Thursday, August 14, 2025 at 9:29:29 PM UTC-4 Sheepless wrote:
--
You received this message because you are subscribed to the Google Groups "[PiDP-11]" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
pidp-11+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pidp-11/9f7357b3-ad20-461c-83bd-22f0bad1b964n%40googlegroups.com.