Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Mar 2001 00:22:17 -0500
From:      "Michael Conlen" <meconlen@obfuscated.net>
To:        "FreeBSD Stable" <freebsd-stable@freebsd.org>
Subject:   TCPDEBUG
Message-ID:  <NFBBJNNKKLIPPJPMCEAPGEAPCDAA.meconlen@obfuscated.net>

next in thread | raw e-mail | index | archive | help
With the current stable (not -current) and

options TCPDEBUG

in the kernel conf file

I get

/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

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
#

which doesn't seem to indicate something really nasty going on.

Normally I can track down these things, but this is just weird. The only
thing I can think of is that the current gcc is not accepting variables
defined anywhere but the top of the function and is treating the var
definition as something weird.

sure enough

# cat a.c
main() {
        printf("hello world\n");
        int a;
        a = 1;
        printf("hello world %d\n", a);
}
# cc a.c
a.c: In function `main':
a.c:3: syntax error before `int'
a.c:4: `a' undeclared (first use in this function)
a.c:4: (Each undeclared identifier is reported only once
a.c:4: for each function it appears in.)

# cat a.c
main() {
        int a;
        printf("hello world\n");
        a = 1;
        printf("hello world %d\n", a);
}
# cc a.c

This seems to be the problem!


--
Groove On Dude
Michael Conlen
Obfuscated Networking
meconlen@obfuscated.net



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




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