Changeset 547 for trunk/src/ocateth.c


Ignore:
Timestamp:
04/26/10 13:29:15 (2 years ago)
Author:
eagle
Message:
  • configure.ac refined
  • OC now compiles and runs on Solaris 10 using the Universal TUN/TAP driver version 1.1 (http://vtun.sourceforge.net/tun/index.html)
  • ocathosts.[ch] added. It reads IPv6 addresses from /etc/hosts
  • /etc/hosts reverse lookup for I2P .b32 names added
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ocateth.c

    r539 r547  
    253253 
    254254   // ethernet header 
    255    ndp6->eth.ether_dhost[0] = 0x33; 
    256    ndp6->eth.ether_dhost[1] = 0x33; 
    257    memcpy(&ndp6->eth.ether_dhost[2], ((char*) &mcastd) + 12, 4); 
    258    memcpy(ndp6->eth.ether_shost, 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); 
    259259   ndp6->eth.ether_type = htons(ETHERTYPE_IPV6); 
    260260 
     
    276276   ohd->nd_opt_type = ND_OPT_SOURCE_LINKADDR; 
    277277   ohd->nd_opt_len = 1; 
    278    memcpy(ohd + 1, ndp6->eth.ether_shost, ETHER_ADDR_LEN); 
     278   memcpy(ohd + 1, ndp6->eth.ether_src, ETHER_ADDR_LEN); 
    279279 
    280280   // calculate checksum 
     
    311311#endif 
    312312 
    313    if (ndp6->eth.ether_dhost[0] & 1) 
     313   if (ndp6->eth.ether_dst[0] & 1) 
    314314   { 
    315315      // check for right multicast destination on ethernet 
    316       if (ndp6->eth.ether_dhost[2] != 0xff) 
    317       { 
    318          log_debug("ethernet multicast destination %s cannot be solicited node address", ether_ntoa_r((struct ether_addr*) ndp6->eth.ether_dhost, 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)); 
    319319         return -1; 
    320320      } 
     
    355355   log_debug("generating response"); 
    356356   // add source MAC to table 
    357    if (mac_set(&ndp6->ip6.ip6_src, ndp6->eth.ether_shost) == -1) 
    358       if (mac_add_entry(ndp6->eth.ether_shost, &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) 
    359359      { 
    360360         log_msg(LOG_ERR, "MAC table full"); 
     
    363363 
    364364   // set MAC addresses for response 
    365    memcpy(ndp6->eth.ether_dhost, ndp6->eth.ether_shost, ETHER_ADDR_LEN); 
    366    memcpy(ndp6->eth.ether_shost, 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); 
    367367 
    368368   // init ip6 header 
     
    406406 
    407407   // add source MAC to table 
    408    if (mac_set(&ndp6->ip6.ip6_src, ndp6->eth.ether_shost) == -1) 
    409       if (mac_add_entry(ndp6->eth.ether_shost, &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) 
    410410      { 
    411411         log_msg(LOG_ERR, "MAC table full"); 
     
    450450 
    451451   // check ethernet destination 
    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   if ((ndp6->eth.ether_dst[0] != 0x33) && (ndp6->eth.ether_dst[1] != 0x33) && memcmp(ndp6->eth.ether_dst, CNF(ocat_hwaddr), ETHER_ADDR_LEN)) 
    453453   { 
    454454      log_debug("unknown destination MAC"); 
Note: See TracChangeset for help on using the changeset viewer.