Changeset 1f13369b30f3e373a33db896fd3bdf16bad9590d

Show
Ignore:
Timestamp:
01/11/11 20:27:29 (3 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1294777649 +0000
git-parent:

[440237fe4e16e1450d92cef6a3c2b6a63907bc04]

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

Squeezing all that info into such at tight space...
I'm reminded of why I stopped watching Oz.
Painfully uncomfortable.

Thanks for that Google.

closes #341

Files:

Legend:

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

    rb553f9a r1f13369  
    6262 
    6363struct check_info { 
    64   int check_no; 
    65   int check_seq_no; 
    66   int seq; 
    67   int32_t expected_count; 
     64  u_int16_t check_no; 
     65  u_int8_t check_seq_no; 
     66  u_int8_t seq; 
     67  int8_t expected_count; 
    6868  float *turnaround; 
    6969  eventer_t timeout_event; 
     
    7676  void  *addr_of_check; /* ticket #288 */ 
    7777  uuid_t checkid; 
    78   u_int32_t generation;     
    79   struct timeval whence; 
    80   int    check_no; 
    81   int    check_pack_no; 
    82   int    check_pack_cnt; 
     78  u_int64_t tv_sec; 
     79  u_int32_t tv_usec; 
     80  u_int16_t generation;     
     81  u_int16_t check_no; 
     82  u_int8_t  check_pack_no; 
     83  u_int8_t  check_pack_cnt; 
     84  u_int8_t  size_bookend; 
    8385}; 
     86#define PING_PAYLOAD_LEN offsetof(struct ping_payload, size_bookend) 
    8487struct ping_closure { 
    8588  noit_module_t *self; 
     
    212215    void *vcheck; 
    213216    noit_check_t *check; 
    214     struct timeval tt
     217    struct timeval tt, whence
    215218 
    216219    from_len = sizeof(from); 
     
    222225    if(inlen < 0) { 
    223226      if(errno == EAGAIN || errno == EINTR) break; 
    224       noitLT(nlerr, now, "ping_icmp recvfrom: %s\n", strerror(errno)); 
     227      noitLT(nldeb, now, "ping_icmp recvfrom: %s\n", strerror(errno)); 
    225228      break; 
    226229    } 
    227230    iphlen = ip->ip_hl << 2; 
    228     if((inlen-iphlen) != (sizeof(struct icmp)+sizeof(struct ping_payload))) { 
     231    if((inlen-iphlen) != (sizeof(struct icmp)+PING_PAYLOAD_LEN)) { 
    229232      noitLT(nldeb, now, 
    230233             "ping_icmp bad size: %d+%d\n", iphlen, inlen-iphlen);  
     
    234237    payload = (struct ping_payload *)(icp + 1); 
    235238    if(icp->icmp_type != ICMP_ECHOREPLY) { 
     239      noitLT(nldeb, now, "ping_icmp bad type: %d\n", icp->icmp_type); 
    236240      continue; 
    237241    } 
    238242    if(icp->icmp_id != (((vpsized_uint)self) & 0xffff)) { 
    239       noitLT(nlerr, now, 
     243      noitLT(nldeb, now, 
    240244               "ping_icmp not sent from this instance (%d:%d) vs. %lu\n", 
    241245               icp->icmp_id, ntohs(icp->icmp_seq), 
     
    259263      continue; 
    260264    } 
    261     if(check->generation != payload->generation) { 
     265    if((check->generation & 0xffff) != payload->generation) { 
    262266      noitLT(nldeb, now, 
    263267             "ping_icmp response in generation gap\n"); 
     
    276280       payload->check_pack_no >= data->expected_count) continue; 
    277281 
    278     sub_timeval(*now, payload->whence, &tt); 
     282    whence.tv_sec = payload->tv_sec; 
     283    whence.tv_usec = payload->tv_usec; 
     284    sub_timeval(*now, whence, &tt); 
    279285    data->turnaround[payload->check_pack_no] = 
    280286      (float)tt.tv_sec + (float)tt.tv_usec / 1000000.0; 
     
    383389  struct icmp *icp; 
    384390  struct ping_payload *payload; 
     391  struct timeval whence; 
    385392  ping_icmp_data_t *data; 
    386393  void *vcheck; 
     
    402409 
    403410  noitLT(nldeb, now, "ping_icmp_real_send(%s)\n", pcl->check->target_ip); 
    404   gettimeofday(&payload->whence, NULL); /* now isn't accurate enough */ 
     411  gettimeofday(&whence, NULL); /* now isn't accurate enough */ 
     412  payload->tv_sec = whence.tv_sec; 
     413  payload->tv_usec = whence.tv_usec; 
    405414  icp->icmp_cksum = in_cksum(pcl->payload, pcl->payload_len); 
    406415  if(pcl->check->target_family == AF_INET) { 
     
    495504  p_int.tv_sec = interval / 1000; 
    496505  p_int.tv_usec = (interval % 1000) * 1000; 
    497   packet_len = sizeof(*icp) + sizeof(*payload)
     506  packet_len = sizeof(*icp) + PING_PAYLOAD_LEN
    498507 
    499508  /* Prep holding spots for return info */ 
     
    524533    payload->addr_of_check = check; 
    525534    uuid_copy(payload->checkid, check->checkid); 
    526     payload->generation = check->generation
     535    payload->generation = check->generation & 0xffff
    527536    payload->check_no = ci->check_no; 
    528537    payload->check_pack_no = i;