From root@velocet.ca  Mon Mar 12 19:55:09 2001
Return-Path: <root@velocet.ca>
Received: from strike.velocet.ca (strike.velocet.ca [204.138.54.214])
	by hub.freebsd.org (Postfix) with ESMTP id 8755237B71B
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 12 Mar 2001 19:55:08 -0800 (PST)
	(envelope-from root@velocet.ca)
Received: by repeat.velocet.ca (Postfix, from userid 0)
	id D22A7384A6; Sat, 10 Mar 2001 18:36:37 -0500 (EST)
Message-Id: <20010310233637.D22A7384A6@repeat.velocet.ca>
Date: Sat, 10 Mar 2001 18:36:37 -0500 (EST)
From: dgilbert@velocet.ca
Reply-To: dgilbert@velocet.ca
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: tcp_usrreq.c doesn't compile with TCPDEBUG set.
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         25758
>Category:       kern
>Synopsis:       tcp_usrreq.c doesn't compile with TCPDEBUG set
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 12 20:00:03 PST 2001
>Closed-Date:    Tue Mar 13 06:47:58 PST 2001
>Last-Modified:  Tue Mar 13 06:48:18 PST 2001
>Originator:     David Gilbert
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
Velocet Communications
>Environment:
System: FreeBSD strike.velocet.ca 4.2-STABLE FreeBSD 4.2-STABLE #3: Sun Jan 7 23:36:46 EST 2001 root@strike.velocet.ca:/usr/src/sys/compile/STRIKE i386


>Description:
The following code in tcp_usrreq.c (line 412)

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;

        if (so->so_state & SS_ISDISCONNECTED) {
                error = ECONNABORTED;
                goto out;
        }
        COMMON_START();
        in_setpeeraddr(so, nam);
        COMMON_END(PRU_ACCEPT);
}

invokes COMMON_START() incorrectly:

#define COMMON_START()  TCPDEBUG0; \
                        do { \
                                     if (inp == 0) { \
                                             splx(s); \
                                             return EINVAL; \
                                     } \
                                     tp = intotcpcb(inp); \
                                     TCPDEBUG1(); \
                     } while(0)

Where TCPDEBUG0 is

#ifdef TCPDEBUG
#define TCPDEBUG0       int ostate
#define TCPDEBUG1()     ostate = tp ? tp->t_state : 0
#define TCPDEBUG2(req)  if (tp && (so->so_options & SO_DEBUG)) \
                                tcp_trace(TA_USER, ostate, tp, 0, 0, req)
#else
#define TCPDEBUG0
#define TCPDEBUG1()
#define TCPDEBUG2(req)
#endif

Which obviously doesn't work if TCPDEBUG is set.

>How-To-Repeat:
Put "options TCPDEBUG" in your kernel and try to compile
>Fix:

I'm not familiar with this code ... or what affects what.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: roam 
State-Changed-When: Mon Mar 12 23:05:40 PST 2001 
State-Changed-Why:  
Is this a duplicate of kern/25651, which also contains a patch? 
Does the patch in http://www.FreeBSD.org/cgi-bin/query-pr.cgi?pr=25651 
solve your problem? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25758 
State-Changed-From-To: feedback->closed 
State-Changed-By: jlemon 
State-Changed-When: Tue Mar 13 06:47:58 PST 2001 
State-Changed-Why:  
Fixed. 

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