Changeset bf1733d3 in mainline for uspace/srv/net/dhcp/dhcp.c


Ignore:
Timestamp:
2015-04-27T20:24:41Z (10 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2b5d966
Parents:
c1fd281 (diff), dcba819 (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/dhcp/dhcp.c

    rc1fd281 rbf1733d3  
    418418}
    419419
     420static int dhcp_discover_proc(dhcp_link_t *dlink)
     421{
     422        dlink->state = ds_selecting;
     423
     424        int rc = dhcp_send_discover(dlink);
     425        if (rc != EOK)
     426                return EIO;
     427
     428        dlink->retries_left = dhcp_discover_retries;
     429       
     430        if ((dlink->timeout->state == fts_not_set) ||
     431            (dlink->timeout->state == fts_fired))
     432                fibril_timer_set(dlink->timeout, dhcp_discover_timeout_val,
     433                    dhcpsrv_discover_timeout, dlink);
     434       
     435        return rc;
     436}
     437
    420438int dhcpsrv_link_add(service_id_t link_id)
    421439{
     
    459477        }
    460478
    461         dlink->state = ds_selecting;
    462 
    463479        log_msg(LOG_DEFAULT, LVL_DEBUG, "Send DHCPDISCOVER");
    464         rc = dhcp_send_discover(dlink);
     480        rc = dhcp_discover_proc(dlink);
    465481        if (rc != EOK) {
    466482                log_msg(LOG_DEFAULT, LVL_ERROR, "Error sending DHCPDISCOVER.");
     
    469485                goto error;
    470486        }
    471 
    472         dlink->retries_left = dhcp_discover_retries;
    473         fibril_timer_set(dlink->timeout, dhcp_discover_timeout_val,
    474             dhcpsrv_discover_timeout, dlink);
    475487
    476488        list_append(&dlink->links, &dhcp_links);
     
    487499{
    488500        return ENOTSUP;
     501}
     502
     503int dhcpsrv_discover(service_id_t link_id)
     504{
     505        log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcpsrv_link_add(%zu)", link_id);
     506       
     507        dhcp_link_t *dlink = dhcpsrv_link_find(link_id);
     508       
     509        if (dlink == NULL) {
     510                log_msg(LOG_DEFAULT, LVL_NOTE, "Link %zu doesn't exist",
     511                    link_id);
     512                return EINVAL;
     513        }
     514       
     515        return dhcp_discover_proc(dlink);
    489516}
    490517
Note: See TracChangeset for help on using the changeset viewer.