Changeset 340 for branches


Ignore:
Timestamp:
10/28/08 21:57:55 (4 years ago)
Author:
eagle
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/tap/src/ocateth.c

    r328 r340  
    6363 *  RFC2460 8.1, (RFC1885 2.3) RFC2463, RFC1071. */ 
    6464 
     65/* IPv6 Ethernet Multicast: (MAC) 33:33:xx:xx:xx:xx, xx -> 4 lowest order bytes of IPv6 source. 
     66 * Solicited-Node address: (IPv6) FF02:0:0:0:0:1:ffxx:xxxx, -> xx -> 3 lowest order bytes of IPv6 Source. (RFC4291) 
     67 * IPv4 Ethernet Multicast: 01:00:5e:0xx:xx:xx, */ 
     68 
    6569void mac_cleanup(void) 
    6670{ 
     
    191195 
    192196   return (uint16_t*) psh; 
     197} 
     198 
     199 
     200int ndp_(const struct in6_addr *in6) 
     201{ 
     202   char buf[FRAME_SIZE]; 
     203   struct ether_header *eh = (struct ether_header*) (buf + 4); 
     204   struct ip6_hdr *ip6 = (struct ip6_hdr*) (eh + 1); // ip6 header starts behind ether_header 
     205   struct nd_neighbor_solicit *nds = (struct nd_neighbor_solicit*) ip6; 
     206   struct nd_opt_hdr *ohd = (struct nd_opt_hdr*) (nds + 1); 
     207   uint16_t *ckb, cksum; 
     208 
    193209} 
    194210 
     
    239255   } 
    240256 
    241    /* 
    242    memcpy(&ip6ph->src, &ip6->ip6_src, sizeof(struct in6_addr)); 
    243    memcpy(&ip6ph->dst, &ip6->ip6_dst, sizeof(struct in6_addr)); 
    244    ip6ph->len = ip6->ip6_plen; 
    245    ip6ph->nxt = IPPROTO_ICMPV6; 
    246    memcpy(ip6ph + 1, icmp6, ntohs(ip6->ip6_plen)); 
    247    */ 
    248  
    249257   ckb = malloc_ckbuf(&ip6->ip6_src, &ip6->ip6_dst, ntohs(ip6->ip6_plen), IPPROTO_ICMPV6, icmp6); 
    250258   cksum = checksum(ckb, ntohs(ip6->ip6_plen) + sizeof(struct ip6_psh)); 
     
    276284   memcpy(ohd + 1, setup.ocat_hwaddr, ETH_ALEN); 
    277285 
    278    /* 
    279    memcpy(&ip6ph->src, &ip6->ip6_src, sizeof(struct in6_addr)); 
    280    memcpy(&ip6ph->dst, &ip6->ip6_dst, sizeof(struct in6_addr)); 
    281    ip6ph->len = ip6->ip6_plen; 
    282    ip6ph->nxt = IPPROTO_ICMPV6; 
    283    memcpy(ip6ph + 1, icmp6, ntohs(ip6->ip6_plen)); 
    284    */ 
    285  
    286286   ckb = malloc_ckbuf(&ip6->ip6_src, &ip6->ip6_dst, ntohs(ip6->ip6_plen), IPPROTO_ICMPV6, icmp6); 
    287287   nda->nd_na_hdr.icmp6_cksum = checksum(ckb, ntohs(ip6->ip6_plen) + sizeof(struct ip6_psh)); 
Note: See TracChangeset for help on using the changeset viewer.