Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

4.3 BSD subnet bug

1 view
Skip to first unread message

Tim Seaver

unread,
Sep 9, 1986, 10:53:33 AM9/9/86
to
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
t...@mcnc.org

0 new messages