Changeset 539
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ocat.h
r538 r539 524 524 void set_select_timeout(struct timeval *); 525 525 void set_nonblock(int); 526 void set_tunheader(char *, uint32_t); 527 uint32_t get_tunheader(char *); 526 528 527 529 /* ocatthread.c */ -
trunk/src/ocateth.c
r510 r539 250 250 251 251 // tunnel header 252 *((uint32_t*) buf) = htonl(CNF(fhd_key[IPV6_KEY]));252 set_tunheader(buf, htonl(CNF(fhd_key[IPV6_KEY]))); 253 253 254 254 // ethernet header 255 *((uint16_t*) ndp6->eth.ether_dhost) = 0x3333; 255 ndp6->eth.ether_dhost[0] = 0x33; 256 ndp6->eth.ether_dhost[1] = 0x33; 256 257 memcpy(&ndp6->eth.ether_dhost[2], ((char*) &mcastd) + 12, 4); 257 258 memcpy(ndp6->eth.ether_shost, CNF(ocat_hwaddr), ETHER_ADDR_LEN); … … 449 450 450 451 // check ethernet destination 451 if (( *((uint16_t*) &ndp6->eth.ether_dhost) != 0x3333) && memcmp(ndp6->eth.ether_dhost, CNF(ocat_hwaddr), ETHER_ADDR_LEN))452 if ((ndp6->eth.ether_dhost[0] != 0x33) && (ndp6->eth.ether_dhost[1] != 0x33) && memcmp(ndp6->eth.ether_dhost, CNF(ocat_hwaddr), ETHER_ADDR_LEN)) 452 453 { 453 454 log_debug("unknown destination MAC"); -
trunk/src/ocatroute.c
r535 r539 265 265 266 266 267 void set_tunheader(char *buf, uint32_t tunhdr) 268 { 269 uint32_t *ibuf = (uint32_t*) buf; 270 *ibuf = tunhdr; 271 } 272 273 274 uint32_t get_tunheader(char *buf) 275 { 276 uint32_t *ibuf = (uint32_t*) buf; 277 return *ibuf; 278 } 279 280 267 281 void *socket_receiver(void *p) 268 282 { … … 512 526 else 513 527 { 514 *((uint32_t*) buf) = *peer->tunhdr;528 set_tunheader(buf, *peer->tunhdr); 515 529 memcpy(buf + 4 + sizeof(struct ether_header), peer->fragbuf, len); 516 530 memcpy(eh->ether_shost, CNF(ocat_hwaddr), ETHER_ADDR_LEN); … … 864 878 } 865 879 866 if ( *((uint32_t*)buf) == CNF(fhd_key[IPV6_KEY]))880 if (get_tunheader(buf) == CNF(fhd_key[IPV6_KEY])) 867 881 { 868 882 if (((rlen - 4) < IP6HLEN)) … … 883 897 dest = &((struct ip6_hdr*) &buf[4])->ip6_dst; 884 898 } 885 else if ( *((uint32_t*)buf) == CNF(fhd_key[IPV4_KEY]))899 else if (get_tunheader(buf) == CNF(fhd_key[IPV4_KEY])) 886 900 { 887 901 if (((rlen - 4) < IPHDLEN)) … … 904 918 else 905 919 { 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))); 907 921 continue; 908 922 }
Note: See TracChangeset
for help on using the changeset viewer.
