Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Sep 2000 13:00:11 +1100 (EST)
From:      Stanley Hopcroft <Stanley.Hopcroft@IPAustralia.Gov.AU>
To:        questions@FreeBSD.ORG
Subject:   Re: 4.1-RELEASE + Library functions: syslog
Message-ID:  <Pine.BSF.4.21.0009201249470.553-100000@stan>

next in thread | raw e-mail | index | archive | help
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 <strings.h>
#include <stdio.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <syslog.h>
#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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0009201249470.553-100000>