Changeset 7636a18e0688e13d2ee24022bd5e438ea1b54c04

Show
Ignore:
Timestamp:
07/26/12 12:37:20 (2 years ago)
Author:
Theo Schlossnagle <jesus@lethargy.org>
git-committer:
Theo Schlossnagle <jesus@lethargy.org> 1343306240 -0700
git-parent:

[4cebb0acbd14f94545d4dbbdb4b1727384aa355c], [883e7762d20cb19f85e43052327fd10bfb4ebc98]

git-author:
Theo Schlossnagle <jesus@lethargy.org> 1343306240 -0700
Message:

Merge pull request #92 from pquerna/ping_icmp_dont_disclose_memory_addresses

Ping ICMP: Don't disclose memory addresses.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/modules/ping_icmp.c

    rde52002 r883e776  
    4949#include <netinet/ip6.h> 
    5050#include <netinet/icmp6.h> 
     51#include <openssl/rand.h> 
    5152#include <math.h> 
    5253#ifndef MAXFLOAT 
     
    7273}; 
    7374struct ping_session_key { 
    74   void  *addr_of_check; /* ticket #288 */ 
     75  vpsized_uint addr_of_check; /* ticket #288 */ 
    7576  uuid_t checkid; 
    7677}; 
    7778struct ping_payload { 
    78   void  *addr_of_check; /* ticket #288 */ 
     79  vpsized_uint addr_of_check; /* ticket #288 */ 
    7980  uuid_t checkid; 
    8081  u_int64_t tv_sec; 
     
    9798static noit_log_stream_t nldeb = NULL; 
    9899static int in_cksum(u_short *addr, int len); 
     100static vpsized_uint random_num; 
     101 
    99102 
    100103typedef struct  { 
     
    189192  pcl->check->flags &= ~NP_RUNNING; 
    190193  ping_data = noit_module_get_userdata(pcl->self); 
    191   k.addr_of_check = pcl->check
     194  k.addr_of_check = (vpsized_uint)pcl->check ^ random_num
    192195  uuid_copy(k.checkid, pcl->check->checkid); 
    193196  noit_hash_delete(ping_data->in_flight, (const char *)&k, sizeof(k), 
     
    325328      data->timeout_event = NULL; 
    326329      check->flags &= ~NP_RUNNING; 
    327       k.addr_of_check = check
     330      k.addr_of_check = (vpsized_uint)check ^ random_num
    328331      uuid_copy(k.checkid, check->checkid); 
    329332      noit_hash_delete(ping_data->in_flight, (const char *)&k, 
     
    346349  struct protoent *proto; 
    347350  ping_icmp_data_t *data; 
     351 
     352  RAND_pseudo_bytes((unsigned char *)&random_num, sizeof(vpsized_uint)); 
    348353 
    349354  data = malloc(sizeof(*data)); 
     
    528533  ping_data = noit_module_get_userdata(self); 
    529534  k = calloc(1, sizeof(*k)); 
    530   k->addr_of_check = check
     535  k->addr_of_check = (vpsized_uint)check ^ random_num
    531536  uuid_copy(k->checkid, check->checkid); 
    532537  if(!noit_hash_store(ping_data->in_flight, (const char *)k, sizeof(*k), 
     
    593598    } 
    594599 
    595     payload->addr_of_check = check
     600    payload->addr_of_check = (vpsized_uint)check ^ random_num
    596601    uuid_copy(payload->checkid, check->checkid); 
    597602    payload->generation = check->generation & 0xffff;