Changeset 94e46c9 in mainline for uspace/srv/net/dhcp/dhcp.c


Ignore:
Timestamp:
2015-05-23T04:09:11Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b5143bd
Parents:
a25d893 (diff), 0683992 (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:

Mainline changes

File:
1 edited

Legend:

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

    ra25d893 r94e46c9  
    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);
     
    489501}
    490502
     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);
     516}
     517
    491518static void dhcpsrv_recv_offer(dhcp_link_t *dlink, dhcp_offer_t *offer)
    492519{
     
    534561                return;
    535562        }
     563
     564        /* XXX Work around multiple simultaneous sessions issue */
     565        dhcp_transport_fini(&dlink->dt);
    536566
    537567        log_msg(LOG_DEFAULT, LVL_NOTE, "%s: Successfully configured.",
Note: See TracChangeset for help on using the changeset viewer.