Show
Ignore:
Timestamp:
05/26/09 16:30:33 (5 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1243355433 +0000
git-parent:

[222027809f476c8187ccf88ac8b565d3787094c4]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1243355433 +0000
Message:

fixes #137

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/stratcon_datastore.c

    raeee96e rca9d732  
    266266   
    267267  for(i=0; i<row_count; i++) { 
     268    int rv; 
     269    int8_t family; 
     270    struct sockaddr *sin; 
     271    struct sockaddr_in sin4 = { sin_family: AF_INET }; 
     272    struct sockaddr_in6 sin6 = { sin6_family: AF_INET6 }; 
    268273    char *remote, *id, *target, *module, *name; 
    269274    PG_GET_STR_COL(remote, i, "remote_address"); 
     
    274279    snprintf(buff, sizeof(buff), "C\t0.000\t%s\t%s\t%s\t%s\n", id, target, module, name); 
    275280 
     281    family = AF_INET; 
     282    sin = (struct sockaddr *)&sin4; 
     283    rv = inet_pton(family, remote, &sin4.sin_addr); 
     284    if(rv != 1) { 
     285      family = AF_INET6; 
     286      sin = (struct sockaddr *)&sin6; 
     287      rv = inet_pton(family, remote, &sin6.sin6_addr); 
     288      if(rv != 1) { 
     289        noitL(noit_stderr, "Cannot translate '%s' to IP\n", remote); 
     290        sin = NULL; 
     291      } 
     292    } 
     293 
    276294    /* stratcon_iep_line_processor takes an allocated operand and frees it */ 
    277     stratcon_iep_line_processor(DS_OP_INSERT, NULL, strdup(buff)); 
     295    stratcon_iep_line_processor(DS_OP_INSERT, sin, strdup(buff)); 
    278296    good++; 
    279297  }