Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Mar 2001 18:36:37 -0500 (EST)
From:      dgilbert@velocet.ca
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/25758: tcp_usrreq.c doesn't compile with TCPDEBUG set.
Message-ID:  <20010310233637.D22A7384A6@repeat.velocet.ca>

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

>Number:         25758
>Category:       kern
>Synopsis:       tcp_usrreq.c doesn't compile with TCPDEBUG set
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 12 20:00:03 PST 2001
>Closed-Date:
>Last-Modified:
>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:
>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?20010310233637.D22A7384A6>