Set DHCP maximum retransmission timeout to 3 seconds in secchan.
This should help discovery complete faster, especially with hops across multiple OpenFlow switches to the controller.
This commit is contained in:
1 parent
a1aa580282
commit
2c5272bc28
3 files changed
+14
-1
No files matched your search
@@ -44,6 +44,7 @@ int dhclient_create(const char *netdev,
|
||||
void (*modify_request)(struct dhcp_msg *, void *aux),
|
||||
bool (*validate_offer)(const struct dhcp_msg *, void *aux),
|
||||
void *aux, struct dhclient **);
|
||||
void dhclient_set_max_timeout(struct dhclient *, unsigned int max_timeout);
|
||||
void dhclient_destroy(struct dhclient *);
|
||||
|
||||
struct netdev *dhclient_get_netdev(struct dhclient *);
|
||||
|
||||
+12
-1
@@ -103,6 +103,7 @@ struct dhclient {
|
||||
bool changed;
|
||||
|
||||
unsigned int retransmit, delay; /* Used by send_reliably(). */
|
||||
unsigned int max_timeout;
|
||||
|
||||
unsigned int init_delay; /* Used by S_INIT. */
|
||||
|
||||
@@ -199,6 +200,7 @@ dhclient_create(const char *netdev_name,
|
||||
cli->ipaddr = 0;
|
||||
cli->server_ip = 0;
|
||||
cli->retransmit = cli->delay = 0;
|
||||
cli->max_timeout = 64;
|
||||
cli->min_timeout = 1;
|
||||
ds_init(&cli->s);
|
||||
cli->changed = true;
|
||||
@@ -206,6 +208,15 @@ dhclient_create(const char *netdev_name,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Sets the maximum amount of timeout that 'cli' will wait for a reply from
|
||||
* the DHCP server before retransmitting, in seconds, to 'max_timeout'. The
|
||||
* default is 64 seconds. */
|
||||
void
|
||||
dhclient_set_max_timeout(struct dhclient *cli, unsigned int max_timeout)
|
||||
{
|
||||
cli->max_timeout = MAX(2, max_timeout);
|
||||
}
|
||||
|
||||
/* Destroys 'cli' and frees all related resources. */
|
||||
void
|
||||
dhclient_destroy(struct dhclient *cli)
|
||||
@@ -867,7 +878,7 @@ send_reliably(struct dhclient *cli,
|
||||
cli->modify_request(&msg, cli->aux);
|
||||
}
|
||||
do_send_msg(cli, &msg);
|
||||
cli->delay = MIN(64, MAX(4, cli->delay * 2));
|
||||
cli->delay = MIN(cli->max_timeout, MAX(4, cli->delay * 2));
|
||||
cli->retransmit += fuzz(cli->delay, 1);
|
||||
timeout(cli, cli->retransmit);
|
||||
dhcp_msg_uninit(&msg);
|
||||
|
||||
@@ -2378,6 +2378,7 @@ discovery_local_port_cb(const struct ofp_phy_port *port, void *d_)
|
||||
"discovery disabled: %s", strerror(retval));
|
||||
return;
|
||||
}
|
||||
dhclient_set_max_timeout(d->dhcp, 3);
|
||||
dhclient_init(d->dhcp, 0);
|
||||
} else {
|
||||
dhclient_destroy(d->dhcp);
|
||||
|
||||
Reference in new issue
Block a user