NetBSD Problem Report #1609

From gnats  Mon Oct  9 23:53:55 1995
Received: from mail.telstra.com.au (mail.telstra.com.au [192.148.160.10]) by sun-lamp.pc.cs.cmu.edu (8.6.11/8.6.10) with ESMTP id XAA02981 for <gnats-bugs@gnats.netbsd.org>; Mon, 9 Oct 1995 23:53:52 -0400
Message-Id: <199510100442.OAA14478@hobbit.dn.itg.telecom.com.au.>
Date: Tue, 10 Oct 1995 14:42:56 +1000
From: "Simon J. Gerraty" <sjg@hobbit.dn.itg.telecom.com.au>
Reply-To: sjg@hobbit.dn.itg.telecom.com.au
To: gnats-bugs@gnats.netbsd.org
Subject: make route/query work
X-Send-Pr-Version: 3.2

>Number:         1609
>Category:       bin
>Synopsis:       make route/query work
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 17 14:22:35 +0000 1995
>Closed-Date:    Sat May 31 09:56:17 +0000 1997
>Last-Modified:  Sat May 31 09:58:07 +0000 1997
>Originator:     Simon J. Gerraty
>Release:        1995-08-18
>Organization:

>Environment:

System: NetBSD hobbit 1.0A NetBSD 1.0A (HOBBIT) #0: Thu Aug 17 13:06:38 EST 1995 root@hobbit:/usr/bsd_src/usr.src/sys/arch/sparc/compile/HOBBIT sparc


>Description:

usr/src/routed/query/query.c does not compile.

The patch below make query compile and as far as I can tell, work on
NetBSD.

>How-To-Repeat:

>Fix:


Index: query.c
===================================================================
RCS file: /prod/cvsroot/usr.src/sbin/routed/query/query.c,v
retrieving revision 1.1.1.2
diff -c -b -r1.1.1.2 query.c
*** /tmp/T0a22359	Tue Oct 10 13:47:58 1995
--- query.c	Tue Oct 10 13:46:36 1995
***************
*** 172,178 ****
--- 172,182 ----
  	router.sin_port = sp->s_port;
  	msg->rip_cmd = RIPCMD_REQUEST;
  	msg->rip_vers = RIP_VERSION_1;
+ #ifdef BSD4_4
+ 	msg->rip_nets[0].rip_family = htons(AF_UNSPEC);
+ #else
  	msg->rip_nets[0].rip_dst.sa_family = htons(AF_UNSPEC);
+ #endif
  	msg->rip_nets[0].rip_metric = htonl(HOPCNT_INFINITY);
  	if (sendto(s, packet, sizeof (struct rip), 0,
  	  (struct sockaddr *)&router, sizeof(router)) < 0)
***************
*** 189,195 ****
  	register struct rip *msg = (struct rip *)packet;
  	register struct netinfo *n;
  	char *name;
! 	int lna, net, subnet;
  	struct hostent *hp;
  	struct netent *np;

--- 193,199 ----
  	register struct rip *msg = (struct rip *)packet;
  	register struct netinfo *n;
  	char *name;
! 	int lna, net, subnet, sa_family;
  	struct hostent *hp;
  	struct netent *np;

***************
*** 210,225 ****
  	    if (size < sizeof (struct netinfo))
  		    break;
  	    if (msg->rip_vers > 0) {
! 		    n->rip_dst.sa_family =
  			    ntohs(n->rip_dst.sa_family);
  		    n->rip_metric = ntohl(n->rip_metric);
  	    }
! 	    switch (n->rip_dst.sa_family) {

  	    case AF_INET:
  		{ register struct sockaddr_in *sin;

  		sin = (struct sockaddr_in *)&n->rip_dst;
  		net = inet_netof(sin->sin_addr);
  		subnet = inet_subnetof(sin->sin_addr);
  		lna = inet_lnaof(sin->sin_addr);
--- 214,240 ----
  	    if (size < sizeof (struct netinfo))
  		    break;
  	    if (msg->rip_vers > 0) {
! #ifdef BSD4_4
! 		    sa_family = ntohs(n->rip_family);
! #else
! 		    sa_family = n->rip_dst.sa_family =
  			    ntohs(n->rip_dst.sa_family);
+ #endif
  		    n->rip_metric = ntohl(n->rip_metric);
  	    }
! 	    switch (sa_family) {

  	    case AF_INET:
  		{ register struct sockaddr_in *sin;

+ #ifdef BSD4_4
+ 		  struct sockaddr sa;
+ 
+ 		  sin = (struct sockaddr_in *) &sa;
+ 		  sin->sin_addr.s_addr = n->rip_dst;
+ #else
  		sin = (struct sockaddr_in *)&n->rip_dst;
+ #endif
  		net = inet_netof(sin->sin_addr);
  		subnet = inet_subnetof(sin->sin_addr);
  		lna = inet_lnaof(sin->sin_addr);
***************
*** 259,269 ****
  		}

  	    default:
! 		{ u_short *p = (u_short *)n->rip_dst.sa_data;

  		printf("\t(af %d) %x %x %x %x %x %x %x, metric %d\n",
  		    p[0], p[1], p[2], p[3], p[4], p[5], p[6],
! 		    n->rip_dst.sa_family,
  		    n->rip_metric);
  		break;
  		}
--- 274,289 ----
  		}

  	    default:
! 		{ u_short *p =
! #ifdef BSD4_4
! 			  (u_short *)n->rip_dst;
! #else
! 			  (u_short *)n->rip_dst.sa_data;
! #endif

  		printf("\t(af %d) %x %x %x %x %x %x %x, metric %d\n",
  		    p[0], p[1], p[2], p[3], p[4], p[5], p[6],
! 		    sa_family,
  		    n->rip_metric);
  		break;
  		}
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: pk 
State-Changed-When: Sat May 31 02:56:17 PDT 1997 
State-Changed-Why:  
We now use a different implementation of routed(8). 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.