From owner-freebsd-questions Tue Sep 19 19: 0:49 2000 Delivered-To: freebsd-questions@freebsd.org Received: from pericles.IPAustralia.gov.au (pericles.IPAustralia.gov.au [202.14.186.30]) by hub.freebsd.org (Postfix) with ESMTP id 7657D37B423 for ; Tue, 19 Sep 2000 19:00:45 -0700 (PDT) Received: (from smap@localhost) by pericles.IPAustralia.gov.au (8.9.3/8.9.3) id NAA16793 for ; Wed, 20 Sep 2000 13:00:44 +1100 (EST) (envelope-from anwsmh@IPAustralia.Gov.AU) Received: from wf-145.aipo.gov.au(192.168.1.145) by pericles.IPAustralia.gov.au via smap (V2.0) id xma016777; Wed, 20 Sep 00 13:00:13 +1100 Received: from localhost (anwsmh@localhost) by stan (8.9.3/8.9.3) with ESMTP id NAA00580 for ; Wed, 20 Sep 2000 13:00:11 +1100 (EST) (envelope-from anwsmh@IPAustralia.Gov.AU) X-Authentication-Warning: stan: anwsmh owned process doing -bs Date: Wed, 20 Sep 2000 13:00:11 +1100 (EST) From: Stanley Hopcroft X-Sender: anwsmh@stan To: questions@FreeBSD.ORG Subject: Re: 4.1-RELEASE + Library functions: syslog Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Dear Ladies and Gentlemen, I am writing to say that I am not sure where this problem is located, despite the program behaving differently on 3.4-RELEASE to 4.1-RELEASE. A test program #include #include #include #include #include #include #define FACILITY LOG_USER /* default */ int main(int argc, char *argv[]) { struct sockaddr_in addr ; struct in_addr my_addr ; if ( argc != 2) { printf("Usage: %s dotted decimal IP address\n", argv[0]) ; return(1) ; } bzero(&addr, sizeof(addr)) ; if ( inet_aton(argv[1], &addr.sin_addr) == 0 ) { printf("%s: inet_aton failed\n", argv[0]) ; return(1) ; } openlog ("test_me", (LOG_CONS | LOG_PID), FACILITY); syslog ((FACILITY | LOG_NOTICE), "connect from [%s]", inet_ntoa (addr.sin_addr)); printf("address was %s\n", inet_ntoa(addr.sin_addr)) ; return(0) ; } on the problem system (4.1-R) works Ok so the problem is not obviously a different syslog or inet_ntoa on 4.1-R. The usage that causes the client address to be mangled is while (TRUE) { /* wait for a client to connect */ if ((csfd = accept (ssfd, (struct sockaddr *) &c_addr, &c_addr_len)) == -1) { .. yada yada .. syslog ((FACILITY | LOG_NOTICE), "connect from [%s]", inet_ntoa (c_addr.sin_addr)); This seems quite reasonable to me. I would appreciate your comments. Thank you, Yours sincerely. S Hopcroft Network Specialist IP Australia +61 2 6283 3189 +61 2 6281 1353 FAX To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message