karl@triceratops.cis.ohio-state.edu (Karl Kleinpaste) (02/17/89)
For the first time for myself, I had to install news with NNTP on a
Sun4 running SunOS 4.0.1. I installed news with NNTP on a Sun3/280
running 4.0.1 about a month ago, and it installed and is running just
fine. However, apparent hardware peculiarities (byte alignment
restrictions, or perhaps a compiler bug) bit me on the Sun4. It was
necessary to apply this diff to nntp-1.5/server/subnet.c in order to
keep the beastie from dropping a core (8.5Mbytes?!?) when executed.
Surely I'm not the first one ever to install nntpd on a Sun4 - did I
miss a patch somewhere along the way?
--Karl
*** subnet.c~ Thu Feb 16 15:41:10 1989
--- subnet.c Thu Feb 16 16:15:00 1989
***************
*** 90,95 ****
--- 90,96 ----
register struct ifreq *ifr;
u_long inet_netof();
u_long addr;
+ struct in_addr duh;
/*
* Find out how many interfaces we have, and malloc
***************
*** 134,140 ****
if (ifr->ifr_addr.sa_family != AF_INET)
continue;
addr = (*(struct sockaddr_in *)&ifr->ifr_addr).sin_addr.s_addr;
! in_ifsni[j].i_net = inet_netof(addr);
if (ioctl(s, SIOCGIFNETMASK, ifr) < 0)
continue;
in_ifsni[j].i_subnetmask =
--- 135,142 ----
if (ifr->ifr_addr.sa_family != AF_INET)
continue;
addr = (*(struct sockaddr_in *)&ifr->ifr_addr).sin_addr.s_addr;
! duh.s_addr = addr;
! in_ifsni[j].i_net = inet_netof(duh);
if (ioctl(s, SIOCGIFNETMASK, ifr) < 0)
continue;
in_ifsni[j].i_subnetmask =
***************
*** 198,205 ****
register u_long i = ntohl(in);
register u_long net;
u_long inet_netof(), inet_lnaof();
! net = inet_netof(in);
/*
* Check whether network is a subnet;
--- 200,209 ----
register u_long i = ntohl(in);
register u_long net;
u_long inet_netof(), inet_lnaof();
+ struct in_addr duh;
! duh.s_addr = in;
! net = inet_netof(duh);
/*
* Check whether network is a subnet;
***************
*** 212,218 ****
if (net == in_ifsni[j].i_net) {
#endif
net = i & in_ifsni[j].i_subnetmask;
! if (inet_lnaof(htonl(net)) == 0)
return (0);
else
return (net >> in_ifsni[j].i_bitshift);
--- 216,223 ----
if (net == in_ifsni[j].i_net) {
#endif
net = i & in_ifsni[j].i_subnetmask;
! duh.s_addr = htonl(net);
! if (inet_lnaof(duh) == 0)
return (0);
else
return (net >> in_ifsni[j].i_bitshift);jdiaz@hqsun1.oracle.com (Jean Marie Diaz) (02/17/89)
I am extremely grateful to Karl for pointing out what was going on with my
nntpd lo these many moons, and to show my gratitude, I'm going to post a
patch to his patch -- this to fix similar problems in inet_snetof().
AMBAR
ambar@oracle.com {uunet,pyramid}!oracle!ambar
*** subnet.c~ Thu Feb 16 16:49:24 1989
--- subnet.c Thu Feb 16 16:45:23 1989
***************
*** 198,206 ****
register u_long i = ntohl(in);
register u_long net;
u_long inet_netof(), inet_lnaof();
- net = inet_netof(in);
-
/*
* Check whether network is a subnet;
* if so, return subnet number.
--- 198,208 ----
register u_long i = ntohl(in);
register u_long net;
u_long inet_netof(), inet_lnaof();
+ struct in_addr duh;
+
+ duh.s_addr = in;
+ net = inet_netof(duh);
/*
* Check whether network is a subnet;
* if so, return subnet number.
***************
*** 212,218 ****
if (net == in_ifsni[j].i_net) {
#endif
net = i & in_ifsni[j].i_subnetmask;
! if (inet_lnaof(htonl(net)) == 0)
return (0);
else
return (net >> in_ifsni[j].i_bitshift);
--- 214,221 ----
if (net == in_ifsni[j].i_net) {
#endif
net = i & in_ifsni[j].i_subnetmask;
! duh.s_addr = htonl(net);
! if (inet_lnaof(duh) == 0)
return (0);
else
return (net >> in_ifsni[j].i_bitshift);