Subject: Re: u6_addr failure in rtsol.c
To: None <itojun@iijlab.net>
From: Assar Westerlund <assar@sics.se>
List: current-users
Date: 10/10/1999 02:37:12
itojun@iijlab.net writes:
> >I've apparently been trying to report this to the wrong list, so I'll
> >try here.
> >In sbin/rtsol:
> >cc -O  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith  -DINET6 -c rtsol.c
> >rtsol.c: In function `sendit':
> >rtsol.c:232: structure has no member named `u6_addr'
> >*** Error code 1
> 
> 	What is the revision of /usr/include/netinet6/in6.h and
> 	src/sys/netinet6/in6.h?  The latest is 1.6, it looks that you have
> 	out-of-sync header file.

I got the same error with the following versions:

datan# ident /usr/include/netinet6/in6.h /usr/src/sys/netinet6/in6.h /usr/src/sbin/rtsol/rtsol.c
/usr/include/netinet6/in6.h:
     $NetBSD: in6.h,v 1.6 1999/07/06 12:23:22 itojun Exp $

/usr/src/sys/netinet6/in6.h:
     $NetBSD: in6.h,v 1.6 1999/07/06 12:23:22 itojun Exp $

/usr/src/sbin/rtsol/rtsol.c:
     $NetBSD: rtsol.c,v 1.3 1999/07/29 09:57:58 itojun Exp $

But the following simple fix takes care of that.

--- rtsol.c.orig	Sun Oct 10 02:15:31 1999
+++ rtsol.c	Sun Oct 10 02:16:45 1999
@@ -229,7 +229,7 @@
 	int ifindex;
 {
 #ifndef ADVAPI
-	sock->sin6_addr.u6_addr.u6_addr16[1] = htons(ifindex);
+	sock->sin6_addr.s6_addr16[1] = htons(ifindex);
 	return sendto(s, p, len, 0, (struct sockaddr *)sock, sock->sin6_len);
 #else
 	struct msghdr m;

My next question is if rtsol really should use code from rtsold?  It
doesn't build and gives error like this:

----------------------------------------------------------------------

cc  -static -o rtsol rtsold.o rtsol.o if.o probe.o -lkvm
rtsol.o: In function `main':
rtsol.o(.text+0x0): multiple definition of `main'
rtsold.o(.text+0x0): first defined here
/usr/bin/ld: Warning: size of symbol `main' changed from 730 to 1106 in rtsol.o
if.o: In function `interface_up':
if.o(.text+0x44): multiple definition of `interface_up'
rtsol.o(.text+0x540): first defined here
/usr/bin/ld: Warning: size of symbol `interface_up' changed from 542 to 313 in if.o
rtsold.o: In function `main':
rtsold.o(.text+0x1a1): undefined reference to `sockopen'
rtsold.o(.text+0x2c1): undefined reference to `rtsol_input'
rtsold.o: In function `rtsol_check_timer':
rtsold.o(.text+0x68e): undefined reference to `sendpacket'
collect2: ld returned 1 exit status
*** Error code 1

----------------------------------------------------------------------

I simply made rtsol self-sufficient and it worked:

--- Makefile.orig	Sun Oct 10 02:33:45 1999
+++ Makefile	Sun Oct 10 02:33:57 1999
@@ -1,7 +1,7 @@
 # $NetBSD: Makefile,v 1.2 1999/09/03 05:25:44 itojun Exp $
 
 PROG=	rtsol
-SRCS=	rtsold.c rtsol.c if.c probe.c
+SRCS=	rtsol
 
 CPPFLAGS+=-DINET6
 
@@ -11,6 +11,6 @@
 #MAN=	rtsold.8
 NOMAN=	yes
 
-.PATH:	${.CURDIR}/../../usr.sbin/rtsold
 
 .include <bsd.prog.mk>

/assar