Browse Source

* Reverted Thiemo Seufer's "code cleanup", which broke the state machine

and made netcfg hang after getting a dhcp lease. Test before committing,
      people!

r7114
master
Joey Hess 19 years ago
parent
commit
81be209f88
  1. 4
      netcfg-common.c
  2. 11
      netcfg-dhcp.c
  3. 12
      netcfg-static.c
  4. 7
      netcfg.c

4
netcfg-common.c

@ -760,10 +760,11 @@ int netcfg_get_static(struct debconfclient *client)
debconf_metaget(client, "netcfg/internal-none", "description");
none = client->value ? strdup(client->value) : strdup("<none>");
while (1) {
while (state != QUIT) {
switch (state) {
case BACKUP:
return 10; // Back to main
break;
case GET_IPADDRESS:
if (netcfg_get_ipaddress (client)) {
state = BACKUP;
@ -840,6 +841,7 @@ int netcfg_get_static(struct debconfclient *client)
break;
case QUIT:
return 0;
break;
}
}
return 0;

11
netcfg-dhcp.c

@ -50,10 +50,12 @@ int main(void)
client = debconfclient_new();
debconf_capb(client,"backup");
while (1) {
while (state != QUIT) {
switch(state) {
case BACKUP:
return 10;
exit(10);
break;
case GET_INTERFACE:
state = netcfg_get_interface(client, &interface, &num_interfaces) ?
BACKUP : GET_DHCP;
@ -65,11 +67,12 @@ int main(void)
state = QUIT;
break;
case QUIT:
if (netcfg_activate_dhcp(client) != 0)
return 1;
break;
}
}
if (netcfg_activate_dhcp(client) != 0)
exit(1);
return 0;
}

12
netcfg-static.c

@ -46,10 +46,12 @@ int main(void)
client = debconfclient_new();
debconf_capb(client, "backup");
while (1) {
while (state != QUIT) {
switch(state) {
case BACKUP:
return 10;
exit(10);
break;
case GET_INTERFACE:
state = netcfg_get_interface(client, &interface, &num_interfaces) ?
BACKUP : GET_STATIC;
@ -61,11 +63,13 @@ int main(void)
state = QUIT;
break;
case QUIT:
if (netcfg_activate_static(client) != 0)
return 1;
break;
}
}
if (netcfg_activate_static(client) != 0)
exit(1);
return 0;
}

7
netcfg.c

@ -71,10 +71,12 @@ int main(void)
debconf_metaget(client, "netcfg/internal-none", "description");
none = client->value ? strdup(client->value) : strdup("<none>");
while (1) {
while (state != QUIT) {
switch(state) {
case BACKUP:
return 10;
exit(10);
break;
case GET_INTERFACE:
state = netcfg_get_interface(client, &interface, &num_interfaces) ?
BACKUP : GET_METHOD;
@ -114,5 +116,6 @@ int main(void)
}
return 0;
}

Loading…
Cancel
Save