Subject: [fwtk-users] Solution: logging src IP without DNS lookups

From: [email-masked]
Date: Thu, 20 Dec 2001 15:00:32 -0500 (EST)

Attached is solution I used.

Brion Leary

----- Forwarded message from [email-masked] -----
Date: Tue, 18 Dec 2001 11:35:13 -0500 (EST)
From: [email-masked]
Reply-To: fwtk-users <[email-masked]>
Subject: [fwtk-users] logging src IP without DNS lookups
To: fwtk-users <[email-masked]>

I have an application where I do not need to log the
name
of the source connection, only the IP address.  I'll be
using
plug-gw.

I figured I should ask before I hack - Does anyone have
a patch
to do this?

Brion Leary

 diff lib/pname.c lib/pname.c.REL
    34,38d33
    <
    <       2001 1218  Brion Leary
    <       Sometimes I'm not paranoid, I just want to be fast. So ...
    <       if (char*)lname == NULL, skip the DNS lookup and the reverse
    <       lookup and just set (char*)sname to the ascii'd IP address.
    88,90d82
    < /* No lookups if lname is a null pointer */
    <       if (lname == NULL) return(0) ;
    <

    diff plug-gw/plug-gw.c plug-gw/plug-gw.c.REL
    16,22d15
    <  *
    <  *    2001 1218 Brion Leary
    <  *    if arg -n, do not do reverse name lookups
    <  *  arg -n goes after [ -daemon port ], before service.
    <  *
    <  *    plug-gw [ -daemon port ] [ -n ] service
    <  *
    53,54d45
    < static        int             rlookup = 1 ;
    <
    81,86d71
    <       /* no reverse lookups? */
    <       if (ac && !strcmp(av[1], "-n")) {
    <               rlookup = 0 ;
    <               ac-- ;
    <               av++ ;
    <       }
    112,122c97,99
    <       if (rlookup) {
    <               if(peername(0,rhost,raddr,sizeof(rhost))) {
    <                       syslog(LLEV,"cannot get remote host: %m");
    <                       exit(1);
    <               }
    <       } else {
    <               if(peername(0,(char*)NULL,raddr,sizeof(rhost))) {
    <                       syslog(LLEV,"cannot get remote host: %m");
    <                       exit(1);
    <               }
    <               rhost[0] = '\0' ;
    ---
    >       if(peername(0,rhost,raddr,sizeof(rhost))) {
    >               syslog(LLEV,"cannot get remote host: %m");
    >               exit(1);

---
You are currently subscribed to fwtk-users as: [email-masked]
To unsubscribe send a blank email to [email-masked]