From root@snark.rinet.ru  Sat Mar 10 06:24:02 2001
Return-Path: <root@snark.rinet.ru>
Received: from relay.rinet.ru (relay.rinet.ru [195.54.192.35])
	by hub.freebsd.org (Postfix) with ESMTP id 1C3A237B718
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 10 Mar 2001 06:24:01 -0800 (PST)
	(envelope-from root@snark.rinet.ru)
Received: from snark.rinet.ru (root@snark.rinet.ru [195.54.192.73])
	by relay.rinet.ru (8.9.3/8.9.3) with ESMTP id RAA00712
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 10 Mar 2001 17:23:58 +0300 (MSK)
Received: (from root@localhost)
	by snark.rinet.ru (8.11.3/8.11.3) id f2AENw900884;
	Sat, 10 Mar 2001 17:23:58 +0300 (MSK)
	(envelope-from root)
Message-Id: <200103101423.f2AENw900884@snark.rinet.ru>
Date: Sat, 10 Mar 2001 17:23:58 +0300 (MSK)
From: alexs@snark.rinet.ru
Reply-To: alexs@snark.rinet.ru
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Syntax error in tcp_usrreq.c
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         25651
>Category:       kern
>Synopsis:       Syntax error in tcp_usrreq.c (COMMON_START macros)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 10 06:30:01 PST 2001
>Closed-Date:    Tue Mar 13 06:47:29 PST 2001
>Last-Modified:  Tue Mar 13 06:47:43 PST 2001
>Originator:     Alex Semenyaka
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
Cronyx Plus ISP
>Environment:
System: FreeBSD snark.rinet.ru 4.2-STABLE FreeBSD 4.2-STABLE #2: Thu Feb 15 15:39:23 MSK 2001 root@snark.rinet.ru:/usr/obj/usr/src/sys/SNARK i386
It is box with AMD K7 Duron 700MHz, 192M of RAM

All sources has been cvsup'ed about 1 pm (GMT) from cvsup.ru.freebsd.org
(src-all, RELENG_4). Then make buildworld, make installworld has been done
without any problem.

>Description:
	Sources has been updated via cvsup at 1pm March 10, 2001. Then

	make buildworld
	make installworld

	was completed successfully. And after this attempt to do

	make KERNCONF=SNARK kernel
	
	leads to the following diagnostics:

cc -c -O -pipe -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -fformat-extensions -ansi  -nostdinc -I- -I. -I../.. -I../../../include  -D_KERNEL -include opt_global.h -elf  -mpreferred-stack-boundary=2  ../../netinet/tcp_usrreq.c
../../netinet/tcp_usrreq.c: In function `tcp_usr_accept':
../../netinet/tcp_usrreq.c:424: syntax error before `int'
../../netinet/tcp_usrreq.c:424: `ostate' undeclared (first use in this function)
../../netinet/tcp_usrreq.c:424: (Each undeclared identifier is reported only once
../../netinet/tcp_usrreq.c:424: for each function it appears in.)
../../netinet/tcp_usrreq.c:418: warning: `tp' might be used uninitialized in this function
*** Error code 1

Stop in /usr/src/sys/compile/SNARK.


The error is generated if there is option TCPDEBUG in the kernel config,
and then works 

#define TCPDEBUG0 	int ostate

TCPDEBUG0 then is used in the definition of COMMON_START(). Usually
COMMON_START() is placed immidiately after the definitions, but in the
couple of places it is not the case and thus the syntax error occured.

>How-To-Repeat:

	1) Update sources
	2) Put option TCPDEBUG in the kernel config
	3) Try to compile the kernel

>Fix:

As a workaround the following patch can be used:

--- tcp_usrreq.c.old	Sat Mar 10 16:25:29 2001
+++ tcp_usrreq.c	Sat Mar 10 16:16:50 2001
@@ -165,25 +165,25 @@
 	TCPDEBUG1();
 	tp = tcp_disconnect(tp);
 
 	TCPDEBUG2(PRU_DETACH);
 	splx(s);
 	return error;
 }
 
-#define	COMMON_START()	TCPDEBUG0; \
-			do { \
+#define	COMMON_START1()	do { \
 				     if (inp == 0) { \
 					     splx(s); \
 					     return EINVAL; \
 				     } \
 				     tp = intotcpcb(inp); \
 				     TCPDEBUG1(); \
 		     } while(0)
+#define	COMMON_START()	TCPDEBUG0; COMMON_START1()
 			     
 #define COMMON_END(req)	out: TCPDEBUG2(req); splx(s); return error; goto out
 
 
 /*
  * Give the socket an address.
  */
 static int
@@ -412,39 +412,43 @@
 static int
 tcp_usr_accept(struct socket *so, struct sockaddr **nam)
 {
 	int s = splnet();
 	int error = 0;
 	struct inpcb *inp = sotoinpcb(so);
 	struct tcpcb *tp;
 
+	TCPDEBUG0;
+
 	if (so->so_state & SS_ISDISCONNECTED) {
 		error = ECONNABORTED;
 		goto out;
 	}
-	COMMON_START();
+	COMMON_START1();
 	in_setpeeraddr(so, nam);
 	COMMON_END(PRU_ACCEPT);
 }
 
 #ifdef INET6
 static int
 tcp6_usr_accept(struct socket *so, struct sockaddr **nam)
 {
 	int s = splnet();
 	int error = 0;
 	struct inpcb *inp = sotoinpcb(so);
 	struct tcpcb *tp;
 
+	TCPDEBUG0;
+
 	if (so->so_state & SS_ISDISCONNECTED) {
 		error = ECONNABORTED;
 		goto out;
 	}
-	COMMON_START();
+	COMMON_START1();
 	in6_mapped_peeraddr(so, nam);
 	COMMON_END(PRU_ACCEPT);
 }
 #endif /* INET6 */
 /*
  * Mark the connection as being incapable of further output.
  */
 static int
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: jlemon 
State-Changed-When: Tue Mar 13 06:47:29 PST 2001 
State-Changed-Why:  
Fixed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25651 
>Unformatted:
