Changeset b5ba8f6 in mainline for uspace/srv/net/inetsrv/inetsrv.c


Ignore:
Timestamp:
2013-09-13T13:11:53Z (11 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1eaa3cf
Parents:
95027b5 (diff), 1c5f6f8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge mainline changes

File:
1 edited

Legend:

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

    r95027b5 rb5ba8f6  
    6868};
    6969
     70static inet_addr_t broadcast4_all_hosts = {
     71        .family = AF_INET,
     72        .addr = 0xffffffff
     73};
     74
    7075static inet_addr_t multicast_all_nodes = {
    7176        .family = AF_INET6,
     
    119124        }
    120125       
    121         inet_sroute_t *sroute = inet_sroute_new();
    122         if (sroute == NULL) {
    123                 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed creating default route (%d).", rc);
    124                 return ENOMEM;
    125         }
    126 
    127         inet_naddr(&sroute->dest, 0, 0, 0, 0, 0);
    128         inet_addr(&sroute->router, 10, 0, 2, 2);
    129         sroute->name = str_dup("default");
    130         inet_sroute_add(sroute);
    131 
    132126        rc = inet_link_discovery_start();
    133127        if (rc != EOK)
     
    186180{
    187181        inet_dir_t dir;
     182        inet_link_t *ilink;
    188183        int rc;
     184
     185        if (dgram->iplink != 0) {
     186                log_msg(LOG_DEFAULT, LVL_DEBUG, "dgram directly to iplink %zu",
     187                    dgram->iplink);
     188                /* Send packet directly to the specified IP link */
     189                ilink = inet_link_get_by_id(dgram->iplink);
     190                if (ilink == 0)
     191                        return ENOENT;
     192
     193                if (dgram->src.family != AF_INET ||
     194                        dgram->dest.family != AF_INET)
     195                        return EINVAL;
     196
     197                return inet_link_send_dgram(ilink, dgram->src.addr,
     198                    dgram->dest.addr, dgram, proto, ttl, df);
     199        }
     200
     201        log_msg(LOG_DEFAULT, LVL_DEBUG, "dgram to be routed");
     202
     203        /* Route packet using source/destination addresses */
    189204
    190205        rc = inet_find_dir(&dgram->src, &dgram->dest, dgram->tos, &dir);
     
    214229
    215230        /* Take source address from the address object */
     231        if (remote->family == AF_INET && remote->addr == 0xffffffff) {
     232                local->family = AF_INET;
     233                local->addr = 0;
     234                return EOK;
     235        }
    216236        inet_naddr_addr(&dir.aobj->naddr, local);
    217237        return EOK;
     
    282302        inet_dgram_t dgram;
    283303       
    284         dgram.tos = IPC_GET_ARG1(*icall);
    285        
    286         uint8_t ttl = IPC_GET_ARG2(*icall);
     304        dgram.iplink = IPC_GET_ARG1(*icall);
     305        dgram.tos = IPC_GET_ARG2(*icall);
     306       
     307        uint8_t ttl = IPC_GET_ARG3(*icall);
    287308        int df = IPC_GET_ARG3(*icall);
    288309       
     
    524545        if ((addr != NULL) ||
    525546            (inet_naddr_compare_mask(&solicited_node_mask, &packet->dest)) ||
    526             (inet_addr_compare(&multicast_all_nodes, &packet->dest))) {
     547            (inet_addr_compare(&multicast_all_nodes, &packet->dest)) ||
     548            (inet_addr_compare(&broadcast4_all_hosts, &packet->dest))) {
    527549                /* Destined for one of the local addresses */
    528550
Note: See TracChangeset for help on using the changeset viewer.