Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Sep 2000 23:34:57 +1100 (EST)
From:      Stanley Hopcroft <Stanley.Hopcroft@IPAustralia.Gov.AU>
To:        Questions@FreeBSD.ORG
Subject:   Re: 4.1-RELEASE + Library functions: syslog("connect from [%s]", 
Message-ID:  <Pine.BSF.4.21.0009202326260.310-100000@stan>

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

Dear Ladies and Gentlemen,

I am writing to say that the logging of client connection requests with
garbage values in FreeBSD 4.x is dealt with by

***************
*** 323,329 ****
    /*---------------------------Start real processing loop */
    while (TRUE) {
      /* wait for a client to connect */
-     c_addr_len = sizeof(c_addr) ;
      if ((csfd = accept (ssfd, (struct sockaddr *) &c_addr,
&c_addr_len)) == -1) {
        /* no connection - check the reason of the "error" */
        switch (errno) {
--- 323,328 ----
***************

ie initialise the c_addr_len before passing it to the kernel in
accept().

At a guess, the function prototypes have changed to support IP v6 and
the difference in the lengths of sockaddr_in (between the address
families) leads to *any* client address being logged as the same
(rubbish) value.

This is how "Unix Network Programming" suggests that all calls to
accept be made.

However, it seems strange that it's unnecessary in 3.x (or Linux 2.2
kernels evidently).

Its very handy to have the daemon call openlog with option argument
including LOG_PERROR so that the connection requests are logged on
STDERROR.

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.0009202326260.310-100000>