[pups] 2.11BSD networking on simh

Andru Luvisi luvisi at andru.sonoma.edu
Tue Dec 3 07:52:27 AEST 2002


I finally tracked it down with strace.  The send() function was
complaining about not being connected.

By changing it to a sendto and providing some hard coded data I was able
to make it work.  Obviously this is not the "correct" solution, but it
illustrates the problem.

Here's the patch:

--- sim_ether.c.org     Mon Dec  2 12:43:49 2002
+++ sim_ether.c Mon Dec  2 13:51:47 2002
@@ -406,7 +406,9 @@

 int pcap_sendpacket(pcap_t* handle, u_char* msg, int len)
 {
-  return (send(pcap_fileno(handle), msg, len, 0) == len)?0:-1;
+  struct sockaddr_pkt spkt = { AF_INET, "eth0", -1 };
+  return (sendto(pcap_fileno(handle), msg, len, 0,
+                 (struct sockaddr *)&spkt, sizeof(spkt)) == len)?0:-1;
 }

 int PacketGetAdapterNames(char* buffer, int* size)





More information about the TUHS mailing list