Changeset 547 for trunk/src/ocateth.c
- Timestamp:
- 04/26/10 13:29:15 (2 years ago)
- File:
-
- 1 edited
-
trunk/src/ocateth.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ocateth.c
r539 r547 253 253 254 254 // ethernet header 255 ndp6->eth.ether_d host[0] = 0x33;256 ndp6->eth.ether_d host[1] = 0x33;257 memcpy(&ndp6->eth.ether_d host[2], ((char*) &mcastd) + 12, 4);258 memcpy(ndp6->eth.ether_s host, CNF(ocat_hwaddr), ETHER_ADDR_LEN);255 ndp6->eth.ether_dst[0] = 0x33; 256 ndp6->eth.ether_dst[1] = 0x33; 257 memcpy(&ndp6->eth.ether_dst[2], ((char*) &mcastd) + 12, 4); 258 memcpy(ndp6->eth.ether_src, CNF(ocat_hwaddr), ETHER_ADDR_LEN); 259 259 ndp6->eth.ether_type = htons(ETHERTYPE_IPV6); 260 260 … … 276 276 ohd->nd_opt_type = ND_OPT_SOURCE_LINKADDR; 277 277 ohd->nd_opt_len = 1; 278 memcpy(ohd + 1, ndp6->eth.ether_s host, ETHER_ADDR_LEN);278 memcpy(ohd + 1, ndp6->eth.ether_src, ETHER_ADDR_LEN); 279 279 280 280 // calculate checksum … … 311 311 #endif 312 312 313 if (ndp6->eth.ether_d host[0] & 1)313 if (ndp6->eth.ether_dst[0] & 1) 314 314 { 315 315 // check for right multicast destination on ethernet 316 if (ndp6->eth.ether_d host[2] != 0xff)317 { 318 log_debug("ethernet multicast destination %s cannot be solicited node address", ether_ntoa_r((struct ether_addr*) ndp6->eth.ether_d host, hw));316 if (ndp6->eth.ether_dst[2] != 0xff) 317 { 318 log_debug("ethernet multicast destination %s cannot be solicited node address", ether_ntoa_r((struct ether_addr*) ndp6->eth.ether_dst, hw)); 319 319 return -1; 320 320 } … … 355 355 log_debug("generating response"); 356 356 // add source MAC to table 357 if (mac_set(&ndp6->ip6.ip6_src, ndp6->eth.ether_s host) == -1)358 if (mac_add_entry(ndp6->eth.ether_s host, &ndp6->ip6.ip6_src) == -1)357 if (mac_set(&ndp6->ip6.ip6_src, ndp6->eth.ether_src) == -1) 358 if (mac_add_entry(ndp6->eth.ether_src, &ndp6->ip6.ip6_src) == -1) 359 359 { 360 360 log_msg(LOG_ERR, "MAC table full"); … … 363 363 364 364 // set MAC addresses for response 365 memcpy(ndp6->eth.ether_d host, ndp6->eth.ether_shost, ETHER_ADDR_LEN);366 memcpy(ndp6->eth.ether_s host, CNF(ocat_hwaddr), ETHER_ADDR_LEN);365 memcpy(ndp6->eth.ether_dst, ndp6->eth.ether_src, ETHER_ADDR_LEN); 366 memcpy(ndp6->eth.ether_src, CNF(ocat_hwaddr), ETHER_ADDR_LEN); 367 367 368 368 // init ip6 header … … 406 406 407 407 // add source MAC to table 408 if (mac_set(&ndp6->ip6.ip6_src, ndp6->eth.ether_s host) == -1)409 if (mac_add_entry(ndp6->eth.ether_s host, &ndp6->ip6.ip6_src) == -1)408 if (mac_set(&ndp6->ip6.ip6_src, ndp6->eth.ether_src) == -1) 409 if (mac_add_entry(ndp6->eth.ether_src, &ndp6->ip6.ip6_src) == -1) 410 410 { 411 411 log_msg(LOG_ERR, "MAC table full"); … … 450 450 451 451 // check ethernet destination 452 if ((ndp6->eth.ether_d host[0] != 0x33) && (ndp6->eth.ether_dhost[1] != 0x33) && memcmp(ndp6->eth.ether_dhost, CNF(ocat_hwaddr), ETHER_ADDR_LEN))452 if ((ndp6->eth.ether_dst[0] != 0x33) && (ndp6->eth.ether_dst[1] != 0x33) && memcmp(ndp6->eth.ether_dst, CNF(ocat_hwaddr), ETHER_ADDR_LEN)) 453 453 { 454 454 log_debug("unknown destination MAC");
Note: See TracChangeset
for help on using the changeset viewer.
