From 2ac528a98fcb0a6a17e6e8ed2388d23fb5c579ab Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Sat, 5 Oct 1996 11:56:50 +0000 Subject: [PATCH] 1. Change device probing so that high speed network devices are found before SLIP/PPP devices, putting them before the others in the network device selection menu. 2. Change "Other" to "URL" so as not to conflict with the keyboard accellerator for the "OK" button in FTP site selection menu. 3. Detect the NULL last symbol in the name list and initialize the other members correctly. --- release/sysinstall/devices.c | 103 +++++++++++++++++----------------- release/sysinstall/menus.c | 4 +- release/sysinstall/uc_main.c | 18 ++++-- usr.sbin/sade/devices.c | 103 +++++++++++++++++----------------- usr.sbin/sade/menus.c | 4 +- usr.sbin/sysinstall/devices.c | 103 +++++++++++++++++----------------- usr.sbin/sysinstall/menus.c | 4 +- 7 files changed, 173 insertions(+), 166 deletions(-) diff --git a/release/sysinstall/devices.c b/release/sysinstall/devices.c index c3df48a79b7..156ccc92fe5 100644 --- a/release/sysinstall/devices.c +++ b/release/sysinstall/devices.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: devices.c,v 1.47 1996/06/13 17:07:37 jkh Exp $ + * $Id: devices.c,v 1.48 1996/07/13 05:09:29 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -219,9 +219,56 @@ deviceGetAll(void) free(names); } - /* - * Try to get all the types of devices it makes sense to get at the - * second stage of the installation. + /* Now go for the network interfaces. Stolen shamelessly from ifconfig! */ + ifc.ifc_len = sizeof(buffer); + ifc.ifc_buf = buffer; + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + msgConfirm("ifconfig: socket"); + return; + } + if (ioctl(s, SIOCGIFCONF, (char *) &ifc) < 0) { + msgConfirm("ifconfig (SIOCGIFCONF)"); + return; + } + ifflags = ifc.ifc_req->ifr_flags; + end = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len); + for (ifptr = ifc.ifc_req; ifptr < end; ifptr++) { + char *descr; + + /* If it's not a link entry, forget it */ + if (ifptr->ifr_ifru.ifru_addr.sa_family != AF_LINK) + continue; + /* Eliminate network devices that don't make sense */ + if (!strncmp(ifptr->ifr_name, "tun", 3) + || !strncmp(ifptr->ifr_name, "lo0", 3)) + continue; + descr = NULL; + for (i = 0; device_names[i].name; i++) { + int len = strlen(device_names[i].name); + + if (!strncmp(ifptr->ifr_name, device_names[i].name, len)) { + descr = device_names[i].description; + break; + } + } + if (!descr) + descr = ""; + deviceRegister(ifptr->ifr_name, descr, strdup(ifptr->ifr_name), DEVICE_TYPE_NETWORK, TRUE, + mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); + msgDebug("Found a device of type network named: %s\n", ifptr->ifr_name); + close(s); + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + msgConfirm("ifconfig: socket"); + continue; + } + if (ifptr->ifr_addr.sa_len) /* I'm not sure why this is here - it's inherited */ + ifptr = (struct ifreq *)((caddr_t)ifptr + ifptr->ifr_addr.sa_len - sizeof(struct sockaddr)); + } + + /* Finally, try to find all the types of devices one might need + * during the second stage of the installation. */ for (i = 0; device_names[i].name; i++) { char try[FILENAME_MAX]; @@ -287,54 +334,6 @@ deviceGetAll(void) break; } } - - /* Now go for the (other) network interfaces dynamically. Stolen shamelessly from ifconfig! */ - ifc.ifc_len = sizeof(buffer); - ifc.ifc_buf = buffer; - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - msgConfirm("ifconfig: socket"); - return; - } - if (ioctl(s, SIOCGIFCONF, (char *) &ifc) < 0) { - msgConfirm("ifconfig (SIOCGIFCONF)"); - return; - } - ifflags = ifc.ifc_req->ifr_flags; - end = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len); - for (ifptr = ifc.ifc_req; ifptr < end; ifptr++) { - char *descr; - - /* If it's not a link entry, forget it */ - if (ifptr->ifr_ifru.ifru_addr.sa_family != AF_LINK) - continue; - /* Eliminate network devices that don't make sense */ - if (!strncmp(ifptr->ifr_name, "tun", 3) - || !strncmp(ifptr->ifr_name, "lo0", 3)) - continue; - descr = NULL; - for (i = 0; device_names[i].name; i++) { - int len = strlen(device_names[i].name); - - if (!strncmp(ifptr->ifr_name, device_names[i].name, len)) { - descr = device_names[i].description; - break; - } - } - if (!descr) - descr = ""; - deviceRegister(ifptr->ifr_name, descr, strdup(ifptr->ifr_name), DEVICE_TYPE_NETWORK, TRUE, - mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); - msgDebug("Found a device of type network named: %s\n", ifptr->ifr_name); - close(s); - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - msgConfirm("ifconfig: socket"); - continue; - } - if (ifptr->ifr_addr.sa_len) /* I'm not sure why this is here - it's inherited */ - ifptr = (struct ifreq *)((caddr_t)ifptr + ifptr->ifr_addr.sa_len - sizeof(struct sockaddr)); - } } /* diff --git a/release/sysinstall/menus.c b/release/sysinstall/menus.c index 0f5b0fc09b1..4f66844da12 100644 --- a/release/sysinstall/menus.c +++ b/release/sysinstall/menus.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.84 1996/07/31 06:41:29 jkh Exp $ + * $Id: menus.c,v 1.85 1996/09/08 01:39:25 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -440,7 +440,7 @@ guaranteed to carry the full range of possible distributions.", "install", { { "Primary Site", "ftp.freebsd.org", NULL, dmenuSetVariable, NULL, VAR_FTP_PATH "=ftp://ftp.freebsd.org/pub/FreeBSD/" }, - { "Other", "Specify some other ftp site by URL", NULL, dmenuSetVariable, NULL, + { "URL", "Specify some other ftp site by URL", NULL, dmenuSetVariable, NULL, VAR_FTP_PATH "=other" }, { "Australia", "ftp.au.freebsd.org", NULL, dmenuSetVariable, NULL, VAR_FTP_PATH "=ftp://ftp.au.freebsd.org/pub/FreeBSD/" }, diff --git a/release/sysinstall/uc_main.c b/release/sysinstall/uc_main.c index 4ec08101f2b..7a9c13dbc27 100644 --- a/release/sysinstall/uc_main.c +++ b/release/sysinstall/uc_main.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * library functions for userconfig library * - * $Id: uc_main.c,v 1.6 1996/10/05 05:51:12 jkh Exp $ + * $Id: uc_main.c,v 1.7 1996/10/05 10:43:49 jkh Exp $ */ #include @@ -109,12 +109,22 @@ uc_open(char *name){ free(kern); return NULL; } + if (name[0] == '\n') + name[0] = '\0'; nl[i].n_name = strdup(name); if (fscanf(fp, "%d %d %d %ld\n", &(nl[i].n_type), &(nl[i].n_other), &(nl[i].n_desc), &(nl[i].n_value)) != 4) { - msgDebug("Unable to read symbol detail fields from symbol file, entry = %d\n", i); - free(kern); - return NULL; + if (name[0]) { + msgDebug("Unable to read symbol detail fields from symbol file, entry = %d\n", i); + free(kern); + return NULL; + } + else { + nl[i].n_type = 0; + nl[i].n_other = 0; + nl[i].n_desc = 0; + nl[i].n_value = 0; + } } } fclose(fp); diff --git a/usr.sbin/sade/devices.c b/usr.sbin/sade/devices.c index c3df48a79b7..156ccc92fe5 100644 --- a/usr.sbin/sade/devices.c +++ b/usr.sbin/sade/devices.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: devices.c,v 1.47 1996/06/13 17:07:37 jkh Exp $ + * $Id: devices.c,v 1.48 1996/07/13 05:09:29 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -219,9 +219,56 @@ deviceGetAll(void) free(names); } - /* - * Try to get all the types of devices it makes sense to get at the - * second stage of the installation. + /* Now go for the network interfaces. Stolen shamelessly from ifconfig! */ + ifc.ifc_len = sizeof(buffer); + ifc.ifc_buf = buffer; + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + msgConfirm("ifconfig: socket"); + return; + } + if (ioctl(s, SIOCGIFCONF, (char *) &ifc) < 0) { + msgConfirm("ifconfig (SIOCGIFCONF)"); + return; + } + ifflags = ifc.ifc_req->ifr_flags; + end = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len); + for (ifptr = ifc.ifc_req; ifptr < end; ifptr++) { + char *descr; + + /* If it's not a link entry, forget it */ + if (ifptr->ifr_ifru.ifru_addr.sa_family != AF_LINK) + continue; + /* Eliminate network devices that don't make sense */ + if (!strncmp(ifptr->ifr_name, "tun", 3) + || !strncmp(ifptr->ifr_name, "lo0", 3)) + continue; + descr = NULL; + for (i = 0; device_names[i].name; i++) { + int len = strlen(device_names[i].name); + + if (!strncmp(ifptr->ifr_name, device_names[i].name, len)) { + descr = device_names[i].description; + break; + } + } + if (!descr) + descr = ""; + deviceRegister(ifptr->ifr_name, descr, strdup(ifptr->ifr_name), DEVICE_TYPE_NETWORK, TRUE, + mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); + msgDebug("Found a device of type network named: %s\n", ifptr->ifr_name); + close(s); + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + msgConfirm("ifconfig: socket"); + continue; + } + if (ifptr->ifr_addr.sa_len) /* I'm not sure why this is here - it's inherited */ + ifptr = (struct ifreq *)((caddr_t)ifptr + ifptr->ifr_addr.sa_len - sizeof(struct sockaddr)); + } + + /* Finally, try to find all the types of devices one might need + * during the second stage of the installation. */ for (i = 0; device_names[i].name; i++) { char try[FILENAME_MAX]; @@ -287,54 +334,6 @@ deviceGetAll(void) break; } } - - /* Now go for the (other) network interfaces dynamically. Stolen shamelessly from ifconfig! */ - ifc.ifc_len = sizeof(buffer); - ifc.ifc_buf = buffer; - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - msgConfirm("ifconfig: socket"); - return; - } - if (ioctl(s, SIOCGIFCONF, (char *) &ifc) < 0) { - msgConfirm("ifconfig (SIOCGIFCONF)"); - return; - } - ifflags = ifc.ifc_req->ifr_flags; - end = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len); - for (ifptr = ifc.ifc_req; ifptr < end; ifptr++) { - char *descr; - - /* If it's not a link entry, forget it */ - if (ifptr->ifr_ifru.ifru_addr.sa_family != AF_LINK) - continue; - /* Eliminate network devices that don't make sense */ - if (!strncmp(ifptr->ifr_name, "tun", 3) - || !strncmp(ifptr->ifr_name, "lo0", 3)) - continue; - descr = NULL; - for (i = 0; device_names[i].name; i++) { - int len = strlen(device_names[i].name); - - if (!strncmp(ifptr->ifr_name, device_names[i].name, len)) { - descr = device_names[i].description; - break; - } - } - if (!descr) - descr = ""; - deviceRegister(ifptr->ifr_name, descr, strdup(ifptr->ifr_name), DEVICE_TYPE_NETWORK, TRUE, - mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); - msgDebug("Found a device of type network named: %s\n", ifptr->ifr_name); - close(s); - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - msgConfirm("ifconfig: socket"); - continue; - } - if (ifptr->ifr_addr.sa_len) /* I'm not sure why this is here - it's inherited */ - ifptr = (struct ifreq *)((caddr_t)ifptr + ifptr->ifr_addr.sa_len - sizeof(struct sockaddr)); - } } /* diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c index 0f5b0fc09b1..4f66844da12 100644 --- a/usr.sbin/sade/menus.c +++ b/usr.sbin/sade/menus.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.84 1996/07/31 06:41:29 jkh Exp $ + * $Id: menus.c,v 1.85 1996/09/08 01:39:25 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -440,7 +440,7 @@ guaranteed to carry the full range of possible distributions.", "install", { { "Primary Site", "ftp.freebsd.org", NULL, dmenuSetVariable, NULL, VAR_FTP_PATH "=ftp://ftp.freebsd.org/pub/FreeBSD/" }, - { "Other", "Specify some other ftp site by URL", NULL, dmenuSetVariable, NULL, + { "URL", "Specify some other ftp site by URL", NULL, dmenuSetVariable, NULL, VAR_FTP_PATH "=other" }, { "Australia", "ftp.au.freebsd.org", NULL, dmenuSetVariable, NULL, VAR_FTP_PATH "=ftp://ftp.au.freebsd.org/pub/FreeBSD/" }, diff --git a/usr.sbin/sysinstall/devices.c b/usr.sbin/sysinstall/devices.c index c3df48a79b7..156ccc92fe5 100644 --- a/usr.sbin/sysinstall/devices.c +++ b/usr.sbin/sysinstall/devices.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: devices.c,v 1.47 1996/06/13 17:07:37 jkh Exp $ + * $Id: devices.c,v 1.48 1996/07/13 05:09:29 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -219,9 +219,56 @@ deviceGetAll(void) free(names); } - /* - * Try to get all the types of devices it makes sense to get at the - * second stage of the installation. + /* Now go for the network interfaces. Stolen shamelessly from ifconfig! */ + ifc.ifc_len = sizeof(buffer); + ifc.ifc_buf = buffer; + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + msgConfirm("ifconfig: socket"); + return; + } + if (ioctl(s, SIOCGIFCONF, (char *) &ifc) < 0) { + msgConfirm("ifconfig (SIOCGIFCONF)"); + return; + } + ifflags = ifc.ifc_req->ifr_flags; + end = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len); + for (ifptr = ifc.ifc_req; ifptr < end; ifptr++) { + char *descr; + + /* If it's not a link entry, forget it */ + if (ifptr->ifr_ifru.ifru_addr.sa_family != AF_LINK) + continue; + /* Eliminate network devices that don't make sense */ + if (!strncmp(ifptr->ifr_name, "tun", 3) + || !strncmp(ifptr->ifr_name, "lo0", 3)) + continue; + descr = NULL; + for (i = 0; device_names[i].name; i++) { + int len = strlen(device_names[i].name); + + if (!strncmp(ifptr->ifr_name, device_names[i].name, len)) { + descr = device_names[i].description; + break; + } + } + if (!descr) + descr = ""; + deviceRegister(ifptr->ifr_name, descr, strdup(ifptr->ifr_name), DEVICE_TYPE_NETWORK, TRUE, + mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); + msgDebug("Found a device of type network named: %s\n", ifptr->ifr_name); + close(s); + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + msgConfirm("ifconfig: socket"); + continue; + } + if (ifptr->ifr_addr.sa_len) /* I'm not sure why this is here - it's inherited */ + ifptr = (struct ifreq *)((caddr_t)ifptr + ifptr->ifr_addr.sa_len - sizeof(struct sockaddr)); + } + + /* Finally, try to find all the types of devices one might need + * during the second stage of the installation. */ for (i = 0; device_names[i].name; i++) { char try[FILENAME_MAX]; @@ -287,54 +334,6 @@ deviceGetAll(void) break; } } - - /* Now go for the (other) network interfaces dynamically. Stolen shamelessly from ifconfig! */ - ifc.ifc_len = sizeof(buffer); - ifc.ifc_buf = buffer; - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - msgConfirm("ifconfig: socket"); - return; - } - if (ioctl(s, SIOCGIFCONF, (char *) &ifc) < 0) { - msgConfirm("ifconfig (SIOCGIFCONF)"); - return; - } - ifflags = ifc.ifc_req->ifr_flags; - end = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len); - for (ifptr = ifc.ifc_req; ifptr < end; ifptr++) { - char *descr; - - /* If it's not a link entry, forget it */ - if (ifptr->ifr_ifru.ifru_addr.sa_family != AF_LINK) - continue; - /* Eliminate network devices that don't make sense */ - if (!strncmp(ifptr->ifr_name, "tun", 3) - || !strncmp(ifptr->ifr_name, "lo0", 3)) - continue; - descr = NULL; - for (i = 0; device_names[i].name; i++) { - int len = strlen(device_names[i].name); - - if (!strncmp(ifptr->ifr_name, device_names[i].name, len)) { - descr = device_names[i].description; - break; - } - } - if (!descr) - descr = ""; - deviceRegister(ifptr->ifr_name, descr, strdup(ifptr->ifr_name), DEVICE_TYPE_NETWORK, TRUE, - mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); - msgDebug("Found a device of type network named: %s\n", ifptr->ifr_name); - close(s); - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - msgConfirm("ifconfig: socket"); - continue; - } - if (ifptr->ifr_addr.sa_len) /* I'm not sure why this is here - it's inherited */ - ifptr = (struct ifreq *)((caddr_t)ifptr + ifptr->ifr_addr.sa_len - sizeof(struct sockaddr)); - } } /* diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c index 0f5b0fc09b1..4f66844da12 100644 --- a/usr.sbin/sysinstall/menus.c +++ b/usr.sbin/sysinstall/menus.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.84 1996/07/31 06:41:29 jkh Exp $ + * $Id: menus.c,v 1.85 1996/09/08 01:39:25 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -440,7 +440,7 @@ guaranteed to carry the full range of possible distributions.", "install", { { "Primary Site", "ftp.freebsd.org", NULL, dmenuSetVariable, NULL, VAR_FTP_PATH "=ftp://ftp.freebsd.org/pub/FreeBSD/" }, - { "Other", "Specify some other ftp site by URL", NULL, dmenuSetVariable, NULL, + { "URL", "Specify some other ftp site by URL", NULL, dmenuSetVariable, NULL, VAR_FTP_PATH "=other" }, { "Australia", "ftp.au.freebsd.org", NULL, dmenuSetVariable, NULL, VAR_FTP_PATH "=ftp://ftp.au.freebsd.org/pub/FreeBSD/" },