Changeset a17356fd in mainline for uspace/srv/net/inetsrv/addrobj.c


Ignore:
Timestamp:
2013-07-12T15:33:20Z (11 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bb9b0c6
Parents:
f5f79cd
Message:

iplink IPv6 datagram support
rudimentary IPv6 support (sans fragmentation)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/inetsrv/addrobj.c

    rf5f79cd ra17356fd  
    4242#include <stdlib.h>
    4343#include <str.h>
     44#include <net/socket_codes.h>
    4445#include "addrobj.h"
    4546#include "inetsrv.h"
    4647#include "inet_link.h"
     48#include "ndp.h"
    4749
    4850static inet_addrobj_t *inet_addrobj_find_by_name_locked(const char *, inet_link_t *);
     
    214216        inet_naddr_addr(&addr->naddr, &lsrc_addr);
    215217       
    216         return inet_link_send_dgram(addr->ilink, &lsrc_addr, ldest, dgram,
    217             proto, ttl, df);
     218        addr32_t lsrc_v4;
     219        addr128_t lsrc_v6;
     220        uint16_t lsrc_af = inet_addr_get(&lsrc_addr, &lsrc_v4, &lsrc_v6);
     221       
     222        addr32_t ldest_v4;
     223        addr128_t ldest_v6;
     224        uint16_t ldest_af = inet_addr_get(ldest, &ldest_v4, &ldest_v6);
     225       
     226        if (lsrc_af != ldest_af)
     227                return EINVAL;
     228       
     229        int rc;
     230        addr48_t ldest_mac;
     231       
     232        switch (ldest_af) {
     233        case AF_INET:
     234                return inet_link_send_dgram(addr->ilink, lsrc_v4, ldest_v4,
     235                    dgram, proto, ttl, df);
     236        case AF_INET6:
     237                /*
     238                 * Translate local destination IPv6 address.
     239                 */
     240                rc = ndp_translate(lsrc_v6, ldest_v6, ldest_mac, addr->ilink);
     241                if (rc != EOK)
     242                        return rc;
     243               
     244                return inet_link_send_dgram6(addr->ilink, ldest_mac, dgram,
     245                    proto, ttl, df);
     246        }
     247       
     248        return ENOTSUP;
    218249}
    219250
Note: See TracChangeset for help on using the changeset viewer.