if case of empty automatic interface try all interfaces in turn
based on 42b2e94c by Vladislav Zavjalov <slazav@altlinux.org>
This commit is contained in:
parent
67997d7701
commit
3c3b7111de
8
dhcp.c
8
dhcp.c
@ -211,6 +211,8 @@ static void parse_reply(struct bootp_request * breq, struct interface_info * int
|
||||
|
||||
memcpy(&intf->ip, &breq->yiaddr, 4);
|
||||
memcpy(&next_server, &breq->server_ip, 4);
|
||||
log_message("got ip: %s", inet_ntoa(intf->ip));
|
||||
log_message("got next-server: %s", inet_ntoa(next_server));
|
||||
|
||||
chptr = breq->vendor;
|
||||
chptr += 4;
|
||||
@ -264,7 +266,7 @@ static void parse_reply(struct bootp_request * breq, struct interface_info * int
|
||||
memcpy(tmp_str, chptr, length);
|
||||
tmp_str[length] = '\0';
|
||||
rootpath = strdup(tmp_str);
|
||||
log_message("got next-server: %s rootpath: %s", inet_ntoa(next_server), rootpath);
|
||||
log_message("got rootpath: %s", rootpath);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -519,7 +521,7 @@ enum return_type perform_dhcp(struct interface_info * intf)
|
||||
char requested_options[50];
|
||||
|
||||
if (strncmp(intf->device, "eth", 3)) {
|
||||
stg1_error_message("DHCP available only for Ethernet networking.");
|
||||
stg1_info_message("DHCP available only for Ethernet networking.");
|
||||
return RETURN_ERROR;
|
||||
}
|
||||
|
||||
@ -562,7 +564,7 @@ enum return_type perform_dhcp(struct interface_info * intf)
|
||||
remove_wait_message();
|
||||
|
||||
if (i != 0) {
|
||||
stg1_error_message("No DHCP reply received.");
|
||||
stg1_info_message("No DHCP reply received.");
|
||||
close(s);
|
||||
return RETURN_ERROR;
|
||||
}
|
||||
|
25
network.c
25
network.c
@ -430,14 +430,13 @@ static enum return_type setup_network_interface(struct interface_info * intf)
|
||||
} else if (streq(choice, "DHCP")) {
|
||||
results = perform_dhcp(intf);
|
||||
|
||||
if (results == RETURN_BACK)
|
||||
return setup_network_interface(intf);
|
||||
if (results == RETURN_ERROR)
|
||||
return results;
|
||||
if (results != RETURN_OK)
|
||||
return RETURN_BACK;
|
||||
intf->boot_proto = BOOTPROTO_DHCP;
|
||||
|
||||
if (configure_net_device(intf))
|
||||
return RETURN_ERROR;
|
||||
return RETURN_BACK;
|
||||
|
||||
#ifndef DISABLE_ADSL
|
||||
} else if (streq(choice, "ADSL")) {
|
||||
results = perform_adsl(intf);
|
||||
@ -553,6 +552,7 @@ static char * interface_select(void)
|
||||
char * choice;
|
||||
int i, count = 0;
|
||||
enum return_type results;
|
||||
static int current_iface_auto=0;
|
||||
|
||||
interfaces = get_net_devices();
|
||||
|
||||
@ -579,6 +579,16 @@ static char * interface_select(void)
|
||||
i++;
|
||||
}
|
||||
|
||||
if (streq(get_auto_value("interface"), "")) {
|
||||
if (interfaces[current_iface_auto]!=NULL)
|
||||
return interfaces[current_iface_auto++];
|
||||
else
|
||||
unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */
|
||||
} else {
|
||||
if (current_iface_auto++ > 1)
|
||||
unset_param(MODE_AUTOMATIC); /* if interface was defined make only one try */
|
||||
}
|
||||
|
||||
results = ask_from_list_comments_auto("Please choose the NET device to use for the installation.",
|
||||
interfaces, descriptions, &choice, "interface", interfaces);
|
||||
|
||||
@ -619,8 +629,11 @@ static enum return_type intf_select_and_up(void)
|
||||
sel_intf->is_up = 0;
|
||||
num_interfaces++;
|
||||
}
|
||||
|
||||
|
||||
log_message("trying with iface %s", sel_intf->device);
|
||||
results = bringup_networking(sel_intf);
|
||||
if (results == RETURN_BACK)
|
||||
return intf_select_and_up();
|
||||
|
||||
if (results == RETURN_OK) {
|
||||
save_netinfo(sel_intf);
|
||||
|
Loading…
x
Reference in New Issue
Block a user