Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Mar 2001 21:58:52 -0800 (PST)
From:      meconlen@obfuscated.net
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/25721: kernel builds on March 12th -stable fail
Message-ID:  <200103120558.f2C5wqD36607@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         25721
>Category:       kern
>Synopsis:       kernel builds on March 12th -stable fail
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 11 22:00:04 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Michael Conlen
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
Obfuscated Networking
>Environment:
FreeBSD eno.obfuscated.net 4.2-STABLE FreeBSD 4.2-STABLE #7: Tue Feb 27 23:20:23 EST 2001     meconlen@eno.obfuscated.net:/usr/obj/usr/src/sys/ENO  i386

with a cvsup today, and a make buildworld performed

/usr/src/sys/i*/conf/ENO (my kernel conf) has

options         TCPDEBUG

This problem only happens when this is turned on.


>Description:
#make buildkernel KERNCONF=ENO
<snip>

/usr/src/sys/netinet/tcp_usrreq.c: In function `tcp_usr_accept':
/usr/src/sys/netinet/tcp_usrreq.c:424: syntax error before `int'
/usr/src/sys/netinet/tcp_usrreq.c:424: `ostate' undeclared (first use in this function)
/usr/src/sys/netinet/tcp_usrreq.c:424: (Each undeclared identifier is reported only once
/usr/src/sys/netinet/tcp_usrreq.c:424: for each function it appears in.)
/usr/src/sys/netinet/tcp_usrreq.c:418: warning: `tp' might be used uninitialized in this function
*** Error code 1

Stop in /usr/obj/usr/src/sys/ENO.
Investigation shows the following

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);
}

Line 424 is COMMON_START();

which is

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

TCPDEBUG0 is defined with

#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

Here we can see why the option in the conf file matters, however, the
definition seems to be fine.

Now, tracking down if it might be some other macro I only found

# cd /usr/include/netinet
# grep SS_ISDISCONNECTED *h
# cd ../sys
# grep SS_ISDISCONNECTED *h
socketvar.h:#define     SS_ISDISCONNECTED       0x2000  /* socket
disconnected from peer */
# cd ../net
# grep SS_ISDISCONNECTED *h
#


>How-To-Repeat:

>Fix:
First fix is to turn off TCPDEBUG. 

the second fix (actually fixing the code) is a lot harder, because the TCPDEBUG2 code references the variable. That code is in COMMON_END, so you can't just wrap COMMON_START in {}... ...I'll let you guys sort it out... ...and what is goto doing in there? Looks like the code could use some work in general...

BTW: I submitted this to -stable before I remembered the pr database, so someone might  move it in here from there as well, it would be a dup.






>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200103120558.f2C5wqD36607>