tas@mcnc.UUCP (Tim Seaver) (09/09/86)
The 4.3 BSD in_localaddr routine in sys/netinet/in.c is completely broken in its handling of subnets. This causes the wrong tcp maximum segment size to be chosen when making connections to non-local subnets of the local network, leading to extra fragmentation. I believe the following replacement handles things correctly: in_localaddr(in) struct in_addr in; { register u_long net = ntohl(in.s_addr); register struct in_ifaddr *ia; if (subnetsarelocal) { for (ia = in_ifaddr; ia; ia = ia->ia_next) if ((net&ia->ia_netmask) == ia->ia_net) return (1); } else { for (ia = in_ifaddr; ia; ia = ia->ia_next) if ((net&ia->ia_subnetmask) == ia->ia_subnet) return (1); } return (0); } Tim Seaver Microelectronics Center of North Carolina mcnc!tas tas@mcnc.org