Common subdirectories: sysinst/CVS and sysinst.mez/CVS Common subdirectories: sysinst/arch and sysinst.mez/arch diff -c sysinst/defs.h sysinst.mez/defs.h *** sysinst/defs.h Sat Oct 16 19:07:29 2004 --- sysinst.mez/defs.h Sat Oct 16 18:33:12 2004 *************** *** 242,251 **** --- 242,253 ---- EXTERN char net_domain[STRSIZE] INIT(""); EXTERN char net_host[STRSIZE] INIT(""); EXTERN char net_ip[STRSIZE] INIT(""); + EXTERN char net_ip_2nd[STRSIZE] INIT(""); EXTERN char net_mask[STRSIZE] INIT(""); EXTERN char net_namesvr[STRSIZE] INIT(""); EXTERN char net_defroute[STRSIZE] INIT(""); EXTERN char net_media[STRSIZE] INIT(""); + EXTERN char sl_flags[STRSIZE]; EXTERN int net_dhcpconf INIT(0); #define DHCPCONF_IPADDR 0x01 #define DHCPCONF_NAMESVR 0x02 diff -c sysinst/msg.mi.en sysinst.mez/msg.mi.en *** sysinst/msg.mi.en Sat Oct 16 19:07:36 2004 --- sysinst.mez/msg.mi.en Sat Oct 16 18:33:12 2004 *************** *** 504,509 **** --- 504,512 ---- message net_ip {Your IPv4 number} + message net_ip_2nd + {Server IPv4 number} + message net_mask {IPv4 Netmask} *************** *** 532,537 **** --- 535,554 ---- Media type: %s } + message netok_slip + {The following are the values you entered. Are they OK? + + DNS Domain: %s + Host Name: %s + Primary Interface: %s + Host IP: %s + Server IP: %s + Netmask: %s + IPv4 Nameserver: %s + IPv4 Gateway: %s + Media type: %s + } + message netokv6 {IPv6 autoconf: %s IPv6 Nameserver: %s *************** *** 883,886 **** --- 900,907 ---- one mount point with "/". Press to continue. + } + + message slattach { + Enter slattach flags } diff -c sysinst/net.c sysinst.mez/net.c *** sysinst/net.c Sat Oct 16 19:07:37 2004 --- sysinst.mez/net.c Sat Oct 16 18:33:12 2004 *************** *** 58,63 **** --- 58,66 ---- #include "menu_defs.h" #include "txtwalk.h" + #include + #include + int network_up = 0; /* URL encode unsafe characters. */ *************** *** 197,203 **** #endif "nsip", /* netns */ "ppp", /* net */ ! "sl", /* net */ "strip", /* net */ "tun", /* net */ /* XXX others? */ --- 200,206 ---- #endif "nsip", /* netns */ "ppp", /* net */ ! /* "sl", */ /* net */ "strip", /* net */ "tun", /* net */ /* XXX others? */ *************** *** 394,399 **** --- 397,408 ---- int octet0; int pass, v6config, dhcp_config; + int slip; + int pid, status; + char **ap, *slcmd[10], *in_buf; + char buffer[STRSIZE]; + + FILE *f; time_t now; *************** *** 430,497 **** /* Remove that space we added. */ net_dev[strlen(net_dev) - 1] = 0; #ifdef INET6 v6config = 1; #else v6config = 0; #endif ! /* Preload any defaults we can find */ ! get_ifinterface_info(); ! pass = strlen(net_mask) == 0 ? 0 : 1; ! ! /* domain and host */ ! msg_display(MSG_netinfo); ! ! /* ethernet medium */ ! if (strlen(net_media) != 0) ! msg_prompt_add(MSG_net_media, net_media, net_media, STRSIZE); ! ! /* try a dhcp configuration */ ! dhcp_config = config_dhcp(net_dev); ! if (dhcp_config) { ! /* Get newly configured data off interface. */ get_ifinterface_info(); ! net_dhcpconf |= DHCPCONF_IPADDR; ! ! /* run route show and extract data */ ! get_command_out(net_defroute, AF_INET, ! "/sbin/route -n show -inet 2>/dev/null", "default"); ! ! /* pull nameserver info out of /etc/resolv.conf */ ! get_command_out(net_namesvr, AF_INET, ! "cat /etc/resolv.conf 2> /dev/null", "nameserver"); ! if (strlen(net_namesvr) != 0) ! net_dhcpconf |= DHCPCONF_NAMESVR; ! ! /* pull domainname out of leases file */ ! get_dhcp_value(net_domain, "domain-name"); ! if (strlen(net_domain) != 0) ! net_dhcpconf |= DHCPCONF_DOMAIN; ! ! /* pull hostname out of leases file */ ! get_dhcp_value(net_host, "hostname"); ! if (strlen(net_host) != 0) ! net_dhcpconf |= DHCPCONF_HOST; ! } msg_prompt_add(MSG_net_domain, net_domain, net_domain, STRSIZE); msg_prompt_add(MSG_net_host, net_host, net_host, STRSIZE); if (!dhcp_config) { /* Manually configure IPv4 */ msg_prompt_add(MSG_net_ip, net_ip, net_ip, STRSIZE); ! octet0 = atoi(net_ip); ! if (!pass) { ! if (0 <= octet0 && octet0 <= 127) ! strcpy(net_mask, "0xff000000"); ! else if (128 <= octet0 && octet0 <= 191) ! strcpy(net_mask, "0xffff0000"); ! else if (192 <= octet0 && octet0 <= 223) ! strcpy(net_mask, "0xffffff00"); ! } ! msg_prompt_add(MSG_net_mask, net_mask, net_mask, STRSIZE); msg_prompt_add(MSG_net_defroute, net_defroute, net_defroute, STRSIZE); msg_prompt_add(MSG_net_namesrv, net_namesvr, net_namesvr, --- 439,520 ---- /* Remove that space we added. */ net_dev[strlen(net_dev) - 1] = 0; + /* We have got SLIP interface */ + if (strncmp(net_dev, "sl", 2) == 0) + slip = 1; + else + slip = 0; + #ifdef INET6 v6config = 1; #else v6config = 0; #endif ! if (!slip) { ! /* Preload any defaults we can find */ get_ifinterface_info(); + pass = strlen(net_mask) == 0 ? 0 : 1; ! /* domain and host */ ! msg_display(MSG_netinfo); + /* ethernet medium */ + if (strlen(net_media) != 0) + msg_prompt_add(MSG_net_media, net_media, net_media, STRSIZE); + + /* try a dhcp configuration */ + dhcp_config = config_dhcp(net_dev); + if (dhcp_config) { + /* Get newly configured data off interface. */ + get_ifinterface_info(); + + net_dhcpconf |= DHCPCONF_IPADDR; + + /* run route show and extract data */ + get_command_out(net_defroute, AF_INET, + "/sbin/route -n show -inet 2>/dev/null", "default"); + + /* pull nameserver info out of /etc/resolv.conf */ + get_command_out(net_namesvr, AF_INET, + "cat /etc/resolv.conf 2> /dev/null", "nameserver"); + if (strlen(net_namesvr) != 0) + net_dhcpconf |= DHCPCONF_NAMESVR; + + /* pull domainname out of leases file */ + get_dhcp_value(net_domain, "domain-name"); + if (strlen(net_domain) != 0) + net_dhcpconf |= DHCPCONF_DOMAIN; + + /* pull hostname out of leases file */ + get_dhcp_value(net_host, "hostname"); + if (strlen(net_host) != 0) + net_dhcpconf |= DHCPCONF_HOST; + } + } else dhcp_config = 0; + msg_prompt_add(MSG_net_domain, net_domain, net_domain, STRSIZE); msg_prompt_add(MSG_net_host, net_host, net_host, STRSIZE); if (!dhcp_config) { /* Manually configure IPv4 */ msg_prompt_add(MSG_net_ip, net_ip, net_ip, STRSIZE); ! if (!slip) { ! octet0 = atoi(net_ip); ! if (!pass) { ! if (0 <= octet0 && octet0 <= 127) ! strcpy(net_mask, "0xff000000"); ! else if (128 <= octet0 && octet0 <= 191) ! strcpy(net_mask, "0xffff0000"); ! else if (192 <= octet0 && octet0 <= 223) ! strcpy(net_mask, "0xffffff00"); ! } ! } else ! msg_prompt_add(MSG_net_ip_2nd, net_ip_2nd, net_ip_2nd, STRSIZE); ! /* We don't want netmasks for SLIP, ! * just in case of ... */ ! if (!slip) ! msg_prompt_add(MSG_net_mask, net_mask, net_mask, STRSIZE); msg_prompt_add(MSG_net_defroute, net_defroute, net_defroute, STRSIZE); msg_prompt_add(MSG_net_namesrv, net_namesvr, net_namesvr, *************** *** 515,528 **** net_namesvr6, STRSIZE); } #endif - /* confirm the setting */ ! msg_display(MSG_netok, net_domain, net_host, net_dev, ! *net_ip == '\0' ? "" : net_ip, ! *net_mask == '\0' ? "" : net_mask, ! *net_namesvr == '\0' ? "" : net_namesvr, ! *net_defroute == '\0' ? "" : net_defroute, ! *net_media == '\0' ? "" : net_media); #ifdef INET6 msg_display_add(MSG_netokv6, !is_v6kernel() ? "" : --- 538,560 ---- net_namesvr6, STRSIZE); } #endif /* confirm the setting */ ! if (slip) ! msg_display(MSG_netok_slip, net_domain, net_host, net_dev, ! *net_ip == '\0' ? "" : net_ip, ! *net_ip_2nd == '\0' ? "" : net_ip_2nd, ! *net_mask == '\0' ? "" : net_mask, ! *net_namesvr == '\0' ? "" : net_namesvr, ! *net_defroute == '\0' ? "" : net_defroute, ! *net_media == '\0' ? "" : net_media); ! ! else ! msg_display(MSG_netok, net_domain, net_host, net_dev, ! *net_ip == '\0' ? "" : net_ip, ! *net_mask == '\0' ? "" : net_mask, ! *net_namesvr == '\0' ? "" : net_namesvr, ! *net_defroute == '\0' ? "" : net_defroute, ! *net_media == '\0' ? "" : net_media); #ifdef INET6 msg_display_add(MSG_netokv6, !is_v6kernel() ? "" : *************** *** 594,600 **** *net_media = '\0'; } ! if (*net_media != '\0') run_prog(0, NULL, "/sbin/ifconfig %s media %s", net_dev, net_media); --- 626,632 ---- *net_media = '\0'; } ! if (!slip && *net_media != '\0') run_prog(0, NULL, "/sbin/ifconfig %s media %s", net_dev, net_media); *************** *** 609,621 **** #endif if (strcmp(net_ip, "") != 0) { ! if (strcmp(net_mask, "") != 0) { ! run_prog(0, NULL, ! "/sbin/ifconfig %s inet %s netmask %s", ! net_dev, net_ip, net_mask); } else { ! run_prog(0, NULL, ! "/sbin/ifconfig %s inet %s", net_dev, net_ip); } } --- 641,674 ---- #endif if (strcmp(net_ip, "") != 0) { ! if (slip) { ! /* Set SLIP interface UP */ ! run_prog(0, NULL, "/sbin/ifconfig %s inet %s %s up", net_dev, net_ip, net_ip_2nd); ! strcpy(sl_flags, "-s 115200 -l /dev/tty00"); ! msg_prompt_add(MSG_slattach, sl_flags, sl_flags, 255); ! ! pid = fork(); ! if (pid == 0) { ! strcpy(buffer, "/sbin/slattach "); ! strcat(buffer, sl_flags); ! in_buf = buffer; ! ! for (ap = slcmd; (*ap = strsep(&in_buf, " ")) != NULL;) ! if (**ap != '\0') ! ++ap; ! ! execvp(slcmd[0], slcmd); ! } else ! wait4(pid, &status, WNOHANG, 0); } else { ! if (strcmp(net_mask, "") != 0) { ! run_prog(0, NULL, ! "/sbin/ifconfig %s inet %s netmask %s", ! net_dev, net_ip, net_mask); ! } else { ! run_prog(0, NULL, ! "/sbin/ifconfig %s inet %s", net_dev, net_ip); ! } } }