Changeset 539 for trunk/src/ocatroute.c


Ignore:
Timestamp:
02/05/10 11:59:17 (2 years ago)
Author:
eagle
Message:

pointer dereferences recoded in respect to strict alias checking of compiler

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ocatroute.c

    r535 r539  
    265265 
    266266 
     267void set_tunheader(char *buf, uint32_t tunhdr) 
     268{ 
     269   uint32_t *ibuf = (uint32_t*) buf; 
     270   *ibuf = tunhdr; 
     271} 
     272 
     273 
     274uint32_t get_tunheader(char *buf) 
     275{ 
     276   uint32_t *ibuf = (uint32_t*) buf; 
     277   return *ibuf; 
     278} 
     279 
     280 
    267281void *socket_receiver(void *p) 
    268282{ 
     
    512526                  else 
    513527                  { 
    514                      *((uint32_t*) buf) = *peer->tunhdr; 
     528                     set_tunheader(buf, *peer->tunhdr); 
    515529                     memcpy(buf + 4 + sizeof(struct ether_header), peer->fragbuf, len); 
    516530                     memcpy(eh->ether_shost, CNF(ocat_hwaddr), ETHER_ADDR_LEN); 
     
    864878      } 
    865879 
    866       if (*((uint32_t*) buf) == CNF(fhd_key[IPV6_KEY])) 
     880      if (get_tunheader(buf) == CNF(fhd_key[IPV6_KEY])) 
    867881      { 
    868882         if (((rlen - 4) < IP6HLEN)) 
     
    883897            dest = &((struct ip6_hdr*) &buf[4])->ip6_dst; 
    884898      } 
    885       else if (*((uint32_t*) buf) == CNF(fhd_key[IPV4_KEY])) 
     899      else if (get_tunheader(buf) == CNF(fhd_key[IPV4_KEY])) 
    886900      { 
    887901         if (((rlen - 4) < IPHDLEN)) 
     
    904918      else 
    905919      { 
    906          log_msg(LOG_ERR, "protocol 0x%08x not supported. dropping frame.", ntohl(*((uint32_t*) buf))); 
     920         log_msg(LOG_ERR, "protocol 0x%08x not supported. dropping frame.", ntohl(get_tunheader(buf))); 
    907921         continue; 
    908922      } 
Note: See TracChangeset for help on using the changeset viewer.