Index: head/usr.sbin/bsdconfig/include/messages.subr =================================================================== --- head/usr.sbin/bsdconfig/include/messages.subr (revision 301972) +++ head/usr.sbin/bsdconfig/include/messages.subr (revision 301973) @@ -1,428 +1,464 @@ # Copyright (c) 2012 Ron McDowell # Copyright (c) 2012-2016 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ field_password="Password:" field_username="Username:" hline_alnum_arrows_punc_tab_enter="Use alnum, arrows, punctuation, TAB or ENTER" hline_alnum_punc_tab_enter="Use alpha-numeric, punctuation, TAB or ENTER" hline_arrows_tab_enter="Press arrows, TAB or ENTER" hline_arrows_tab_punc_enter="Use arrows, TAB, punctuation, ENTER" hline_choose_help_for_more_information_on_media_types="Choose Help for more information on the various media types" msg_accept_continue="Accept/Continue" msg_accessibility_desc="Ports to help disabled users." msg_adding_package_as_a_dependency_from_media="Adding %s (as a dependency) from %s" msg_adding_package_from_media="Adding %s from %s" msg_afterstep_desc="Ports to support the AfterStep window manager." msg_all="All" msg_all_desc="All available packages in all categories." msg_always_try_sudo_when_run_as="Always try sudo(8) when run as %s" msg_an_unknown_error_occurred="An unknown error occurred" msg_arabic_desc="Ported software for Arab countries." msg_archivers_desc="Utilities for archiving and unarchiving data." msg_armenia="Armenia" msg_assume_network_is_already_configured="Running multi-user, assume that the network is already configured?" msg_assume_yes_to_all_non_critical_dialogs="Assume \"Yes\" answers to all non-critical dialogs" msg_astro_desc="Applications related to astronomy." msg_attempt_automatic_dhcp_configuration="Attempt automatic DHCP configuration of interfaces" msg_attempt_ipv6_configuration_of_interfaces="Attempt IPv6 configuration of interfaces" msg_attempting_to_update_repository_catalogue="Attempting to update repository catalogue from selected media." msg_audio_desc="Audio utilities - most require a supported sound card." msg_australia="Australia" msg_austria="Austria" msg_back="Back" msg_becoming_root_via_sudo="Becoming root via sudo(8)..." msg_benchmarks_desc="Utilities for measuring system performance." msg_biology_desc="Software related to biology." msg_bootstrapping_pkg="Bootstrapping pkg(8)..." msg_brazil="Brazil" msg_building_package_menus="Building package menu(s)..." msg_building_package_main_menu="Building package main menu..." msg_cad_desc="Computer Aided Design utilities." msg_canada="Canada" msg_cancel="Cancel" msg_cancel_exit="Cancel/Exit" msg_cannot_create_permission_denied="%s: cannot create %s: Permission denied" +msg_cannot_edit_wireless_ssid="Cannot edit wireless configuration; no matches for\nSSID \`%s' in wpa_supplicants.conf(5)" msg_cannot_resolve_hostname="Cannot resolve \`%s'! Are you sure that your\nname server, gateway and network interface are correctly configured?" msg_cant_find_distribution="Warning: Can't find the \`%s' distribution on this\nFTP server. You may need to visit a different server for\nthe release you are trying to fetch or go to the Options\nmenu and set the release name to explicitly match what's\navailable on %s (or set to \"any\").\n\nWould you like to select another FTP server?" msg_cant_seem_to_write_out_resolv_conf="Can't seem to write out %s. Net cannot be used." +msg_cant_start_wpa_supplicant="Can't start wpa_supplicant(8). Please create a wlan(4)\ninterface from the \`wlans' option after selecting your\nfavorite wireless adapter (i.e., %s)." msg_cd_dvd="CD/DVD" msg_cdrom="CDROM" msg_checking_access_to="Checking access to\n %s" msg_china="China" msg_chinese_desc="Ported software for the Chinese market." msg_choose_a_cd_dvd_type="Choose a CD/DVD type" msg_choose_a_dos_partition="Choose a DOS partition" msg_choose_a_floppy_drive="Choose a Floppy drive" msg_choose_a_ufs_partition="Choose a UFS partition" msg_choose_a_usb_drive="Choose a USB drive" msg_choose_installation_media="Choose Installation Media" msg_choose_installation_media_description="FreeBSD can be installed from a variety of different installation\nmedia, ranging from floppies to an Internet FTP server. If you're\ninstalling FreeBSD from a supported CD/DVD drive then this is generally\nthe best media to use if you have no overriding reason for using other\nmedia." msg_client_error="Client error, you could try an other server" msg_command_failed_rest_of_script_aborted="Command \`%s' failed - rest of script aborted." msg_comms_desc="Communications utilities." msg_configuration_for_interface="Configuration for Interface" +msg_configured="Configured" +msg_configured_lc="configured" +msg_configured_ssids="Configured SSIDs" msg_converters_desc="Format conversion utilities." msg_could_not_unmount_the_cdrom_dvd="Could not unmount the CDROM/DVD from %s: %s" msg_could_not_unmount_the_dos_partition="Could not unmount the DOS partition from %s: %s" msg_could_not_unmount_the_nfs_partition="Could not unmount the NFS partition from %s: %s" msg_could_not_unmount_the_ufs_partition="Could not unmount the UFS partition from %s: %s" msg_couldnt_connect_to_ftp_server="Couldn't connect to FTP server" msg_couldnt_connect_to_proxy="Couldn't connect to proxy" msg_couldnt_connect_to_server="Couldn't connect to server" msg_couldnt_open_ftp_connection="Couldn't open FTP connection to %s:\n %s." +msg_create_new="Create New" msg_created_path="Created %s" msg_czech_republic="Czech Republic" msg_databases_desc="Database software." msg_debugging="Debugging" msg_denmark="Denmark" msg_deskutils_desc="Various Desktop utilities." +msg_destroy="Destroy" +msg_details="Details" msg_devel_desc="Software development utilities and libraries." msg_device_is_not_configured="The %s device is not configured. You will need to do so\nin the Networking configuration menu before proceeding." msg_dhcp="DHCP" msg_dialog_mixedform_navigation_help="Use / arrows to navigate between fields, TAB to focus buttons, and Enter for OK/Cancel." msg_directory="Directory" msg_directory_not_found="%s: Directory not found." msg_directory_where_package_temporary_files_go="The directory where package temporary files should go" +msg_discovered_ssids="Discovered SSIDs" msg_dns_desc="Domain Name Service tools." msg_docs_desc="Meta-ports for FreeBSD documentation." msg_done="Done" msg_dos="DOS" msg_editor="Editor" msg_editors_desc="Editors." msg_elisp_desc="Things related to Emacs Lisp." msg_emit_extra_debugging_output="Emit extra debugging output" msg_emulators_desc="Utilities for emulating other operating systems." msg_enlightenment_desc="Software for the Enlightenment Desktop Environment." msg_enter_a_fully_qualified_pathname_for_the_directory="Enter a fully qualified pathname for the directory\ncontaining the FreeBSD distribution files:" msg_enter_the_device_name_of_a_ufs_formatted_partition="Enter the device-name of a UFS formatted partition" msg_error="Error" msg_error_mounting_device="Error mounting %s on %s: %s" msg_error_mounting_floppy_device="Error mounting floppy %s (%s) on %s: %s" msg_error_mounting_usb_drive="Error mounting USB drive %s on %s: %s" msg_error_when_requesting_url="Error when requesting %s, you could try an other server" msg_estonia="Estonia" msg_exit="Exit" msg_exit_bsdconfig="Exit bsdconfig" msg_extra_options_to_ifconfig="Extra options to ifconfig (usually empty):" msg_failed_to_add_default_route="Failed to add a default route; please check your network configuration" +msg_failed_to_reach_wpa_supplicant="Failed to reach wpa_supplicant: %s" msg_file_system="File System" msg_finance_desc="Monetary, financial and related applications." msg_finland="Finland" msg_floppy="Floppy" +msg_forget_all="Forget All" +msg_forget_all_confirm="WARNING! Are you really sure you want to forget all known networks\nby re-initializing wpa_supplicants.conf(5)? This cannot be undone." +msg_forget_all_help="Reset wpa_supplicant(8) configuration, forgetting all known networks" +msg_found="found" msg_france="France" msg_french_desc="Ported software for French countries." msg_ftp="FTP" msg_ftp_desc="FTP client and server utilities." msg_ftp_passive="FTP Passive" msg_ftp_username="FTP username" msg_generating_index_from_pkg_database="Generating INDEX from pkg(8) database\n(this can take a while)..." msg_geography_desc="Geography-related software." msg_german_desc="Ported software for Germanic countries." msg_germany="Germany" msg_gnome_desc="Components of the Gnome Desktop environment." msg_gnustep_desc="Software for GNUstep desktop environment." msg_graphics_desc="Graphics libraries and utilities." msg_greece="Greece" msg_hamradio_desc="Software for amateur radio." msg_haskell_desc="Software related to the Haskell language." msg_hebrew_desc="Ported software for Hebrew language." msg_help="Help" msg_host_name_including_domain="Host name (including domain)" msg_hostname_variable_not_set="WARNING: hostname variable not set and is a non-optional\nparameter. Please add this to your installation script\nor set the netInteractive variable (see bsdconfig man page)" msg_http_direct="HTTP Direct" msg_http_proxy="HTTP Proxy" msg_hungarian_desc="Ported software for the Hungarian market." msg_iceland="Iceland" msg_install_from_a_dos_partition="Install from a DOS partition" msg_install_from_a_floppy_disk_set="Install from a floppy disk set" msg_install_from_a_freebsd_cd_dvd="Install from a FreeBSD CD/DVD" msg_install_from_a_ufs_partition="Install from a UFS partition" msg_install_from_a_usb_drive="Install from a USB drive" msg_install_from_an_ftp_server="Install from an FTP server" msg_install_from_an_ftp_server_thru_firewall="Install from an FTP server through a firewall" msg_install_from_an_ftp_server_thru_proxy="Install from an FTP server through an HTTP proxy" msg_install_from_an_http_server="Install from an HTTP server" msg_install_from_the_existing_filesystem="Install from the existing filesystem" msg_install_over_nfs="Install over NFS" msg_installed="Installed" msg_installed_desc="Leave package as-is, installed" msg_installed_lc="installed" msg_invalid_gateway_ipv4_address_specified="Invalid gateway IPv4 address specified" msg_invalid_hostname_value="Invalid hostname value" msg_invalid_ipv4_address="Invalid IPv4 address" msg_invalid_name_server_ip_address_specified="Invalid name server IP address specified" msg_invalid_netmask_value="Invalid netmask value" msg_invalid_nfs_path_specification="Invalid NFS path specification. Must be of the form:\nhost:/full/pathname/to/FreeBSD/distdir" msg_io_error_while_reading_in_the_package="I/O error while reading in the %s package." msg_io_or_format_error_on_index_file="I/O or format error on INDEX file.\nPlease verify media (or path to media) and try again." msg_ipv4_address="IPv4 Address" msg_ipv4_gateway="IPv4 Gateway" msg_ipv6="IPv6" msg_ipv6_desc="IPv6-related software." msg_ipv6_ready="IPv6 ready" msg_irc_desc="Internet Relay Chat utilities." msg_ireland="Ireland" msg_israel="Israel" msg_italy="Italy" msg_japan="Japan" msg_japanese_desc="Ported software for the Japanese market." msg_java_desc="Java language support." msg_kde_desc="Software for the K Desktop Environment." msg_kld_desc="Kernel loadable modules." msg_korea="Korea" msg_korean_desc="Ported software for the Korean market." msg_lang_desc="Computer languages." msg_latvia="Latvia" msg_length_of_specified_url_is_too_long="Length of specified URL is %u characters. Allowable maximum is %u." msg_linux_desc="Linux programs that can run under binary compatibility." msg_lisp_desc="Software related to the Lisp language." msg_lithuania="Lithuania" msg_loading_of_dependent_package_failed="Loading of dependent package %s failed" +msg_loading_wireless_menu="Loading Wireless Menu..." msg_logging_in_to_user_at_host="Logging in to %s@%s.." msg_looking_for_keymap_files="Looking for keymap files..." msg_looking_up_host="Looking up host %s" msg_mail_desc="Electronic mail packages and utilities." msg_main_menu="Main Menu" msg_main_site="Main Site" +msg_manually_connect="Manually Connect" +msg_manually_connect_help="Connect to a wireless network that may be unlisted" msg_math_desc="Mathematical computation software." msg_mbone_desc="Applications and utilities for the MBONE." msg_media_timeout="Media Timeout" msg_media_type="Media Type" msg_menu_text="If you've already installed FreeBSD, you may use\nthis menu to customize it somewhat to suit your\nparticular configuration. Most importantly, you\ncan use the Packages utility to load extra '3rd\nparty' software not provided in the base\ndistributions." msg_misc_desc="Miscellaneous utilities." msg_missing_ftp_host_or_directory="Missing FTP host or directory specification. FTP media not initialized." msg_multimedia_desc="Multimedia software." msg_must_be_root_to_execute="%s: must be root to execute" msg_must_have_pkg_to_execute="%s: must have pkg(8) to execute" msg_must_specify_a_host_name_of_some_sort="Must specify a host name of some sort!" msg_name_server="Name server" msg_net_desc="Networking utilities." msg_net_device_init_failed="Net device init failed." msg_net_im_desc="Instant messaging software." msg_net_mgmt_desc="Network management tools." msg_net_p2p_desc="Peer to peer network applications." msg_netherlands="Netherlands" msg_netmask="Netmask" msg_network_configuration="Network Configuration" msg_network_interface_information_required="Network interface information required" msg_new_zealand="New Zealand" msg_news_desc="USENET News support software." msg_next_page="Next page" msg_nfailed_attempts="%u incorrect password attempts" msg_nfs="NFS" msg_nfs_secure="NFS Secure" msg_nfs_server_talks_only_on_a_secure_port="NFS server talks only on a secure port" msg_nfs_slow="NFS Slow" msg_nfs_tcp="NFS TCP" msg_nfs_version_3="NFS version 3" msg_no="No" msg_no_cd_dvd_devices_found="No CD/DVD devices found! Please check that your system's\nconfiguration is correct and that the CD/DVD drive is of a\nsupported type. For more information, consult the hardware\nguide in the Doc menu." msg_no_description_provided="No description provided" msg_no_dos_primary_partitions_found="No DOS primary partitions found! This installation method is unavailable" msg_no_floppy_devices_found="No floppy devices found! Please check that your system's configuration\nis correct. For more information, consult the hardware guide in the Doc\nmenu." msg_no_gateway_has_been_set="No gateway has been set. You will be unable to access hosts\nnot on your local network" msg_no_network_devices="No network devices available!" msg_no_package_name_passed_in_package_variable="No package name passed in package variable" msg_no_packages_were_selected_for_extraction="No packages were selected for extraction." msg_no_pkg_database_found="No pkg(8) database found!" msg_no_such_file_or_directory="%s: %s: No such file or directory" msg_no_usb_devices_found="No USB devices found (try Options/Re-scan Devices)" msg_no_username="No username provided!" msg_norway="Norway" msg_not_a_directory="%s: %s: Not a directory" msg_not_found="not found" msg_not_yet_set="not yet set" msg_ok="OK" msg_options="Options" msg_options_editor="Options Editor" msg_other="other" msg_package_is_needed_by_other_installed_packages="Warning: Package %s is needed by\n %d other installed package%s." msg_package_not_installed_cannot_delete="Warning: package %s not installed\n No package can be deleted." msg_package_temp="Package Temp" msg_package_was_added_successfully="Package %s was added successfully" msg_packages="packages" msg_page_of_npages="(Page %s of %s)" msg_palm_desc="Software support for the Palm(tm) series." msg_parallel_desc="Applications dealing with parallelism in computing." msg_pear_desc="Software related to the Pear PHP framework." msg_perl5_desc="Utilities/modules for the PERL5 language." msg_permission_denied="%s: %s: Permission denied" +msg_pick_an_interface_to_destroy="Pick an interface to destroy" msg_pkg_delete_failed="Warning: pkg-delete(8) of %s failed.\n Run with debugging for details." msg_pkg_install_apparently_did_not_like_the_package="pkg-install(8) apparently did not like the %s package." msg_pkg_not_yet_installed_install_now="pkg(8) not yet installed. Install now?" msg_plan9_desc="Software from the Plan9 operating system." msg_please_check_the_url_and_try_again="No such directory: %s\nplease check the URL and try again.\n" msg_please_enter_password="Please enter your password for sudo(8):" msg_please_enter_the_address_of_the_http_proxy="Please enter the address of the HTTP proxy in this format:\n hostname:port (the ':port' is optional, default is 3128)" msg_please_enter_the_full_nfs_file_specification="Please enter the full NFS file specification for the remote\nhost and directory containing the FreeBSD distribution files.\nThis should be in the format: hostname:/some/freebsd/dir" msg_please_enter_the_password_for_this_user="Please enter the password for this user:" msg_please_enter_the_username_you_wish_to_login_as="Please enter the username you wish to login as:" msg_please_enter_username_password="Please enter a username and password for sudo(8):" msg_please_insert_floppy_containing="Please insert floppy containing %s in %s" msg_please_insert_floppy_in_drive="Please insert floppy in %s" msg_please_select_a_category_to_display="Please select a category to display." msg_please_select_a_cd_dvd_drive="FreeBSD can be installed directly from a CD/DVD containing a valid\nFreeBSD distribution. If you are seeing this menu it is because\nmore than one CD/DVD drive was found on your system. Please select\none of the following CD/DVD drives as your installation drive." msg_please_select_a_floppy_drive="You have more than one floppy drive. Please choose which drive\nyou would like to use." msg_please_select_a_freebsd_ftp_distribution_site="Please select a FreeBSD FTP distribution site" msg_please_select_a_freebsd_http_distribution_site="Please select a FreeBSD HTTP distribution site" msg_please_select_a_usb_drive="You have more than one USB drive. Please choose which drive\nyou would like to use." msg_please_select_dos_partition="FreeBSD can be installed directly from a DOS partition assuming,\nof course, that you have copied the relevant distributions into\nyour DOS partition before starting this installation. If this is\nnot the case then you should reboot DOS at this time and copy the\ndistributions you wish to install into a \"FREEBSD\" subdirectory\non one of your DOS partitions. Otherwise, please select the DOS\npartition containing the FreeBSD distribution files." msg_please_select_ethernet_device_to_configure="Please select the ethernet or PLIP device to configure." msg_please_select_the_site_closest_to_you_or_other="Please select the site closest to you or \"other\" if you'd like to\nspecify a different choice. Also note that not every site listed here\ncarries more than the base distribution kits. Only Primary sites are\nguaranteed to carry the full range of possible distributions." msg_please_select_ufs_partition="FreeBSD can be installed directly from another FreeBSD partition\nthat is UFS formatted assuming, of course, that you have copied\nthe relevant distributions into said partition before starting\ninstallation." msg_please_specify_a_temporary_directory="Please specify a temporary directory with lots of free space:" msg_please_specify_the_name_of_the_text_editor="Please specify the name of the text editor you wish to use:" msg_please_specify_the_number_of_seconds_to_wait="Please specify the number of seconds to wait for slow media:" msg_please_specify_the_release_you_wish_to_load="Please specify the release you wish to load or\n\"any\" for a generic release install:" msg_please_specify_url_of_a_freebsd_distribution="Please specify the URL of a FreeBSD distribution on a\nremote ftp site. This site must accept either anonymous\nftp or you should have set an ftp username and password\nin the Options screen.\n\nA URL looks like this: ftp:///\nWhere is relative to the anonymous ftp directory or the\nhome directory of the user being logged in as." msg_please_specify_url_of_freebsd_http_distribution="Please specify the URL of a FreeBSD distribution on a\nremote http site.\nA URL looks like this: http:///" msg_poland="Poland" msg_polish_desc="Ported software for the Polish market." msg_ports_mgmt_desc="Utilities for managing ports and packages." msg_portuguese_desc="Ported software for the Portuguese market." msg_previous_page="Previous page" msg_previous_syntax_errors="%s: Not overwriting \`%s' due to previous syntax errors" msg_primary="Primary" msg_print_desc="Utilities for dealing with printing." msg_probing_devices_please_wait_this_can_take_a_while="Probing devices, please wait (this can take a while)..." msg_proceed="Proceed" msg_processing_selection="Processing selection..." msg_python_desc="Software related to the Python language." msg_quick_start_how_to_use_this_menu_system="Quick start - How to use this menu system" msg_reading_package_index_data="Reading package index data" msg_reinstall="Reinstall" msg_reinstall_desc="Mark this package for reinstall" msg_release_name="Release Name" msg_required_package_not_found="Warning: %s is a required package but was not found." msg_rerun_bsdconfig_initial_device_probe="Re-run bsdconfig initial device probe" +msg_rescan_wireless="Rescan Wireless" +msg_rescan_wireless_help="Scan for new wireless networks" msg_rescan_devices="Re-scan Devices" msg_reset="RESET!" msg_reset_all_values_to_startup_defaults="Reset all values to startup defaults" +msg_return_to_previous_menu="Return to previous menu" msg_reuse_old_ftp_site_selection_values="Re-use old FTP site selection values?" msg_reuse_old_http_site_settings="Re-use old HTTP site settings?" msg_review="Review" msg_review_desc="Review/perform pending actions" msg_review_help="Install, Re-Install, or Un-install selected packages and dependencies" msg_reviewing_selected_packages="Reviewing %u selected packages:" msg_ruby_desc="Software related to the Ruby language." msg_rubygems_desc="Ports of RubyGems packages." msg_russia="Russia" msg_russian_desc="Ported software for the Russian market." msg_scanning_for_dhcp_servers="Scanning for DHCP servers..." msg_scanning_for_ra_servers="Scanning for RA servers..." +msg_scanning_wireless_pausing="Scanning Wireless... (pausing for %i seconds)" msg_scheme_desc="Software related to the Scheme language." msg_science_desc="Scientific software." msg_secure_mode_requires_root="Secure-mode requires root-access!" msg_secure_mode_requires_x11="Secure-mode requires X11 (use \`-X')!" msg_security_desc="System security software." msg_select="Select" msg_select_a_site_thats_close="Select a site that's close!" +msg_select_the_configuration_you_would_like="Select the configuration you would like to edit:\nAddional network information displayed in help line." +msg_select_wlan_interfaces_for="Select wlan interfaces for %s:" msg_selected="selected" msg_server_error_when_requesting_url="Server error when requesting %s, you could try an other server" msg_shells_desc="Various shells (tcsh, bash, etc)." +msg_show_all="Show All" +msg_show_all_help="Show wireless networks without an SSID and all BSSIDs" +msg_show_configured="Show Configured" +msg_show_configured_help="Show networks configured in wpa_supplicants.conf(5)" +msg_show_scan_results="Show Scan Results" +msg_show_scan_results_help="Show wpa_cli(8) scan results" +msg_skip="Skip" msg_slovak_republic="Slovak Republic" msg_slovenia="Slovenia" msg_sorry_invalid_url="Sorry, %s is an invalid URL!" msg_sorry_package_was_not_found_in_the_index="Sorry, package %s was not found in the INDEX." msg_sorry_try_again="Sorry, try again." msg_south_africa="South Africa" msg_spain="Spain" msg_spanish_desc="Ported software for the Spanish market." msg_specify_some_other_ftp_site="Specify some other ftp site by URL" msg_specify_some_other_http_site="Specify some other http site by URL" msg_sweden="Sweden" msg_switzerland="Switzerland" msg_sysutils_desc="Various system utilities." msg_taiwan="Taiwan" msg_tcl_desc="TCL and packages that depend on it." msg_textproc_desc="Text processing/search utilities." msg_the_current_installation_media_type="The current installation media type." msg_timeout_value_in_seconds_for_slow_media="Timeout value in seconds for slow media." msg_tk_desc="Tk and packages that depend on it." msg_try_dhcp_configuration="Do you want to try DHCP configuration of the interface?" msg_try_ipv6_configuration="Do you want to try IPv6 configuration of the interface?" msg_try_sudo_only_this_once="Try sudo(8) only this once" msg_ufs="UFS" msg_uk="UK" msg_ukraine="Ukraine" msg_ukrainian_desc="Ported software for the Ukrainian market." msg_unable_to_configure_device="Unable to configure the %s interface!\nThis installation method cannot be used." msg_unable_to_fetch_package_from_selected_media="Unable to fetch package %s from selected media.\nNo package add will be done." msg_unable_to_get_file_from_selected_media="Unable to get %s file from selected media.\n\nThis may be because the packages collection is not available\non the distribution media you've chosen, most likely an FTP site\nwithout the packages collection mirrored. Please verify that\nyour media, or your path to the media, is correct and try again." msg_unable_to_get_proper_ftp_path="Unable to get proper FTP path. FTP media not initialized." msg_unable_to_initialize_media_type_for_package_extract="Unable to initialize media type for package extract." msg_unable_to_make_directory_mountpoint="Unable to make %s directory mountpoint for %s!" msg_unable_to_open="Unable to open %s" msg_unable_to_update_pkg_from_selected_media="Unable to update pkg(8) from selected media." +msg_unconfigured="Unconfigured" msg_uninstall="Uninstall" msg_uninstall_desc="Mark this package for deletion" msg_uninstalling_package_waiting_for_pkg_delete="Uninstalling %s package - waiting for pkg-delete(8)" msg_unknown="unknown" msg_unknown_user="Unknown user: %s" msg_url_was_not_found="%s was not found,\nmaybe directory or release-version are wrong?" msg_usa="USA" msg_usage="Usage" msg_usb="USB" msg_use_defaults="Use Defaults" msg_use_nfs_version_3="Use NFS version 3" msg_use_tcp_protocol_for_nfs="Use TCP protocol for NFS" msg_user_disallowed="User disallowed: %s" msg_user_is_using_a_slow_pc_or_ethernet_card="User is using a slow PC or Ethernet card" msg_username_and_password_to_use="Username and password to use instead of anonymous" msg_using_interface="Using interface %s" msg_using_usb_device="Using USB device: %s" msg_vietnamese_desc="Ported software for the Vietnamese market." msg_view_set_various_media_options="View/Set various media options" +msg_warning_no_wireless_devices="WARNING! No wireless devices found." msg_what_would_you_like_to_do_with="What would you like to do with %s?" msg_which_release_to_attempt_to_load="Which release to attempt to load from installation media" msg_which_text_editor_to_use="Which text editor to use during installation" +msg_wireless_networks_text="Select an unmarked ([ ]) entry to join that network.\nSelect a marked ([X]) entry to edit that configuration." msg_windowmaker_desc="Ports to support the WindowMaker window manager." +msg_wireless_network_configuration_for="Wireless network configuration for SSID \`%s'" msg_would_you_like_to_bring_interface_up="Would you like to bring the %s interface up right now?" +msg_wpa_cli_ping_failed="wpa_cli(8) ping failed" msg_www_desc="Web utilities (browsers, HTTP servers, etc)." msg_x11_clocks_desc="X Window System based clocks." msg_x11_desc="X Window System based utilities." msg_x11_drivers_desc="X Window System drivers." msg_x11_fm_desc="X Window System based file managers." msg_x11_fonts_desc="X Window System fonts and font utilties." msg_x11_servers_desc="X Window System servers." msg_x11_themes_desc="X Window System themes." msg_x11_toolkits_desc="X Window System based development toolkits." msg_x11_wm_desc="X Window System window managers." msg_xfce_desc="Software related to the Xfce Desktop Environment." msg_yes="Yes" msg_yes_to_all="Yes to All" msg_you_are_not_root_but="You are not root but %s can use sudo(8).\nWhat would you like to do?" msg_you_may_remove_the_floppy="You may remove the floppy from %s" msg_youve_already_done_the_network_configuration="You've already done the network configuration once,\nwould you like to skip over it now?" msg_zope_desc="Software related to the Zope platform." tcplayout_extras_help="Any interface-specific options to ifconfig you would like to add" tcplayout_extras_help_for_plip="For PLIP configuration, you must enter the peer's IP address here." tcplayout_gateway_help="IPv4 address of host forwarding packets to non-local destinations" tcplayout_hostname_help="Your fully-qualified hostname, e.g. foo.example.com" tcplayout_ipaddr_help="The IPv4 address to be used for this interface" tcplayout_nameserver_help="IPv4 or IPv6 address of your local DNS server" tcplayout_netmask_help="The netmask for this interface, e.g. 255.255.255.0 for a class C network" Index: head/usr.sbin/bsdconfig/networking/INDEX =================================================================== --- head/usr.sbin/bsdconfig/networking/INDEX (revision 301972) +++ head/usr.sbin/bsdconfig/networking/INDEX (revision 301973) @@ -1,61 +1,64 @@ # Copyright (c) 2012 Ron McDowell -# Copyright (c) 2012 Devin Teske +# Copyright (c) 2012-2016 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ # # Title that will be shown in the bsdconfig menu. # menu_title="Networking Management" # # A short descriptive line shown at the bottom of the bsdconfig menu. keep it # short because any line longer than the terminal width will be truncated. # menu_help="Setup Networking interfaces, services, etc." # # Two-part variable that defines an action to take when `keyword' is passed on # a bsdconfig command line. Variable takes the form "keyword|command" and # multiple occurrences of the variable (with different `keyword's, or different # `keyword's AND `command's) are allowed. If `command' begins with a '/' then # the full path to the program is needed. If `command' begins with anything # else it is a path relative to the directory this INDEX file is in. `keyword' # can be i18n'ed but `command' is the name of a script. # menu_selection="networking|networking" menu_selection="defaultrouter|defaultrouter" menu_selection="hostname|hostname" menu_selection="nameservers|nameservers" menu_selection="netdev|devices" +menu_selection="wireless|wlanconfig" +menu_selection="wlan|wlanconfig" +menu_selection="wifi|wlanconfig" # # ------------ Items below this line do NOT need i18n translation ------------ # # Name of the program to be run when this menu choice is selected. If it begins # with a '/' then the full path to the program is needed. If it begins with # anything else it is a path relative to the directory this INDEX file is in. # menu_program="networking" Index: head/usr.sbin/bsdconfig/networking/Makefile =================================================================== --- head/usr.sbin/bsdconfig/networking/Makefile (revision 301972) +++ head/usr.sbin/bsdconfig/networking/Makefile (revision 301973) @@ -1,11 +1,12 @@ # $FreeBSD$ SUBDIR= include share FILESDIR= ${LIBEXECDIR}/bsdconfig/120.networking FILES= INDEX USAGE SCRIPTSDIR= ${FILESDIR} -SCRIPTS= defaultrouter devices hostname nameservers networking +SCRIPTS= defaultrouter devices hostname nameservers networking \ + wlanconfig .include Index: head/usr.sbin/bsdconfig/networking/include/messages.subr =================================================================== --- head/usr.sbin/bsdconfig/networking/include/messages.subr (revision 301972) +++ head/usr.sbin/bsdconfig/networking/include/messages.subr (revision 301973) @@ -1,105 +1,107 @@ -# Copyright (c) 2012 Devin Teske +# Copyright (c) 2012-2016 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ hline_alnum_punc_tab_enter="Use alpha-numeric, punctuation, TAB or ENTER" hline_arrows_tab_enter="Press arrows, TAB or ENTER" hline_num_punc_tab_enter="Use numbers, punctuation, TAB or ENTER" msg_activate_default_router="Would you like to activate the new defaultrouter right now?\nIf you choose NO or press ESC, changes will be applied\nduring the next boot.\n\n Current Default Router: %s\n New Default Router: %s\n" msg_activate_hostname="Would you like to activate the new hostname right now?\nIf you choose NO or press ESC, changes will be applied\nduring the next boot.\n\n Current Hostname: %s\n New Hostname: %s\n\nNOTE: Your shell prompt may still reflect the original\nhostname until your next login." msg_activate_hostname_x11warning="WARNING! Activating the new hostname during an X11-Forwarded\n ssh(1) session will cause an X11 authentication error.\n\n Current Hostname: %s\n New Hostname: %s\n\nNOTE: Settings will become active upon reboot or if you\n relaunch this utility either locally or on the console." msg_add="Add" msg_add_nameserver="Add a new nameserver" msg_bring_interface_up="Would you like to bring the %s interface up right now?" msg_cancel="Cancel" msg_current_default_router="Current Default Route/Gateway: %s" msg_current_dhcp_status="Current DHCP status for %s: %s" msg_current_ipaddr="Current IP Address for %s: %s" msg_current_options="Current Options for %s: %s" msg_current_subnet="Current Subnet Mask for %s: %s" msg_custom="Custom (Manual)" msg_default_router="Default Router/Gateway" msg_dhcp="DHCP" msg_disabled="Disabled" msg_dns_configuration="DNS Nameserver Configuration:\nChoose Exit when finished else Cancel." msg_dns_nameservers="DNS nameservers" msg_enabled="Enabled" msg_exit="Exit" msg_hostname_domain="Hostname/Domain" msg_hostname_exceeds_max_length="ERROR! The hostname entered exceeds the maximum length of\n255 characters.\n\nInvalid Hostname: %s" msg_hostname_label_contains_invalid_chars="ERROR! One or more individual labels within the hostname\n(separated by dots) contains one or more invalid characters.\nLabels are case-insensitive and must contain only 0-9, a-z,\n or dash (though must not begin with or end with a dash).\n\nInvalid Hostname: %s" msg_hostname_label_exceeds_max_length="ERROR! One or more individual labels within the hostname\n(separated by dots) exceeds the maximum of 63 characters.\n\nInvalid Hostname: %s" msg_hostname_label_is_null="ERROR! One or more individual labels within the hostname\n(separated by dots) are null.\n\nInvalid Hostname: %s" msg_hostname_label_starts_or_ends_with_hyphen="ERROR! One or more individual labels within the hostname\n(separated by dots) starts or ends with a hyphen (hyphens\nare allowed, but a label cannot begin or end with a hyphen).\n\nInvalid Hostname: %s" msg_internal_error_nsindex_value="FATAL! dialog_input_nameserver_edit_awk: variable\nnsindex must be a whole positive integer greater-\nthan or equal-to zero.\n\nInvalid nsindex: %s" msg_ipaddr4="ipaddr" msg_ipv4_addr_octet_contains_invalid_chars="ERROR! One or more individual octets within the IPv4 address\n(separated by dots) contains one or more invalid characters.\nOctets must contain only the characters 0-9.\n\nInvalid IP Address: %s" msg_ipv4_addr_octet_exceeds_max_value="ERROR! One or more individual octets within the IPv4 address\n(separated by dots) exceeds the maximum of 255.\n\nInvalid IP Address: %s" msg_ipv4_addr_octet_is_null="ERROR! One or more individual octets within the IPv4 address\n(separated by dots) are null and/or missing.\n\nInvalid IP Address: %s" msg_ipv4_addr_octet_missing_or_extra="ERROR! The IPv4 address entered has either too few (less than\nfour) or too many (more than four) octets, separated by dots.\n\nInvalid IP Address: %s" msg_ipv4_mask_field_contains_invalid_chars="ERROR! One or more individual fields within the subnet mask\n(separated by dots) contains one or more invalid characters.\n\nInvalid Subnet Mask: %s" msg_ipv4_mask_field_exceeds_max_value="ERROR! One or more individual fields within the subnet mask\n(separated by dots) exceeds the maximum of 255.\n\nInvalid Subnet Mask: %s" msg_ipv4_mask_field_invalid_value="ERROR! One or more individual fields within the subnet mask\n(separated by dots) contains one or more invalid integers.\nFields must be one of 0/128/192/224/240/248/252/254/255.\n\nInvalid Subnet Mask: %s" msg_ipv4_mask_field_is_null="ERROR! One or more individual fields within the subnet mask\n(separated by dots) are null and/or missing.\n\nInvalid Subnet Mask: %s" msg_ipv4_mask_field_missing_or_extra="ERROR! The subnet mask entered has either too few or too many\nfields.\n\nInvalid Subnet Mask: %s" msg_ipv6_addr_segment_contains_invalid_chars="ERROR! One or more individual segments within the IP address\n(separated by colons) contains one or more invalid characters.\nSegments must contain only combinations of the characters 0-9,\nA-F, or a-f.\n\nInvalid IPv6 Address: %s" msg_ipv6_addr_segment_contains_too_many_chars="ERROR! One or more individual segments within the IP address\n(separated by colons) exceeds the length of 4 hex-digits.\n\nInvalid IPv6 Address: %s" msg_ipv6_addr_too_few_or_extra_segments="ERROR! The IP address entered has either too few (less than 3), too\nmany (more than 8), or not enough segments, separated by colons.\n\nInvalid IPv6 Address: %s" msg_ipv6_addr_too_many_null_segments="ERROR! Too many/incorrect null segments. A single null\nsegment is allowed within the IP address (separated by\ncolons) but not allowed at the beginning or end (unless\na double-null segment; i.e., \"::*\" or \"*::\").\n\nInvalid IPv6 Address: %s" msg_netmask="netmask" msg_network_configuration="%s Network Configuration:\nChoose Save/Exit when finished or Cancel." msg_network_interfaces="Network Interfaces" msg_network_management="Network Management" msg_networking_devices="Networking Devices" msg_nfs_mounts_may_cause_hang="WARNING! Changing this setting while NFS directories are\nmounted may cause the system to hang. Are you sure you\nwant to proceed?\n\n%s" msg_no_network_interfaces="No network interfaces detected." msg_no_options="No options (Default)" msg_ok="OK" msg_options="options" msg_please_enter_default_router="Please enter the IP address of your default\nrouter/gateway. The address entered will be\napplied as the default gateway for all interfaces\nusing route(4)." msg_please_enter_fqhn="Please enter your fully qualified hostname (e.g. full.example.com). The\ndomain portion of the hostname will be configured in resolv.conf(5)." msg_please_enter_mediaopts="Please enter additional network media options to be passed to ifconfig(8) for the %s interface:" msg_please_enter_nameserver="Please enter the new IP address of the DNS nameserver:" msg_please_enter_nameserver_existing="Please enter the new IP address of the DNS nameserver\n(set to the NULL string [Ctrl-U] to remove entry):" msg_please_enter_new_ip_addr="Please enter the new IP address of the %s interface:" msg_please_enter_subnet_mask="Please enter the new network subnet mask for the %s interface:" msg_probing_network_interfaces="Probing network interface devices..." msg_removing_nameserver="Removing DNS nameserver from resolv.conf(5)..." msg_resolv_conf_changed_while_editing="ERROR! resolv.conf(5) has changed while editing this\nvalue. Please try again after waiting a few seconds." msg_resolv_conf_entry_no_longer_exists="ERROR! The entry you are trying to edit no longer\nexists in resolv.conf(5). Please try again after\nwaiting a few seconds." msg_return_to_previous_menu="Return to previous menu" msg_save_exit="Save/Exit" msg_saving_default_router="Saving new default router/gateway settings..." msg_saving_hostname="Saving new hostname/domain settings..." msg_saving_nameserver="Saving new DNS nameserver to resolv.conf(5)..." msg_saving_nameserver_existing="Editing DNS nameserver in resolv.conf(5)..." msg_saving_network_interface="Saving %s network interface settings..." msg_scanning_for_dhcp="Scanning for DHCP servers on %s interface..." msg_select_network_interface="Select a network interface to configure.\n\n* Interface is marked as \"active\"" msg_supported_media_options="Below is a list of supported media options for the %s interface. Please select the options that you would like to set for the %s network interface" msg_unknown_networking_menu_selection="Unknown networking menu selection" +msg_wireless_networks="Wireless Networks" +msg_wlans="wlans" xmsg_please_enter_fqhn="Please enter your fully qualified hostname (e.g. foo.bar.com).\n The domain portion of the hostname will be configured in resolv.conf(5)." xmsg_please_enter_nameserver_existing="Please enter the new IP address of the DNS nameserver\n(set to the NULL string to remove entry):" xmsg_supported_media_options="Below is a list of supported media options for the %s interface. Please\nselect the options that you would like to set for the %s network interface" Index: head/usr.sbin/bsdconfig/networking/networking =================================================================== --- head/usr.sbin/bsdconfig/networking/networking (revision 301972) +++ head/usr.sbin/bsdconfig/networking/networking (revision 301973) @@ -1,151 +1,153 @@ #!/bin/sh #- -# Copyright (c) 2006-2013 Devin Teske +# Copyright (c) 2006-2016 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ # ############################################################ INCLUDES BSDCFG_SHARE="/usr/share/bsdconfig" . $BSDCFG_SHARE/common.subr || exit 1 f_dprintf "%s: loading includes..." "$0" f_include $BSDCFG_SHARE/dialog.subr f_include $BSDCFG_SHARE/mustberoot.subr BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking" f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm && pgm="${ipgm:-$pgm}" ############################################################ FUNCTIONS # dialog_menu_main # # Display the dialog(1)-based application main menu. # dialog_menu_main() { local prompt= local menu_list=" 'X' '$msg_exit' '1' '$msg_hostname_domain' '2' '$msg_network_interfaces' - '3' '$msg_default_router' - '4' '$msg_dns_nameservers' + '3' '$msg_wireless_networks' + '4' '$msg_default_router' + '5' '$msg_dns_nameservers' " # END-QUOTE local defaultitem= # Calculated below local hline="$hline_arrows_tab_enter" local height width rows eval f_dialog_menu_size height width rows \ \"\$DIALOG_TITLE\" \ \"\$DIALOG_BACKTITLE\" \ \"\$prompt\" \ \"\$hline\" \ $menu_list # Obtain default-item from previously stored selection f_dialog_default_fetch defaultitem local menu_choice menu_choice=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ --default-item \"\$defaultitem\" \ --menu \"\$prompt\" \ $height $width $rows \ $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? f_dialog_data_sanitize menu_choice f_dialog_menutag_store "$menu_choice" f_dialog_default_store "$menu_choice" return $retval } ############################################################ MAIN # Incorporate rc-file if it exists [ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc" # # Process command-line arguments # while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;; esac done shift $(( $OPTIND - 1 )) # # Initialize # f_dialog_title "$msg_network_management" f_dialog_backtitle "${ipgm:+bsdconfig }$pgm" f_mustberoot_init # # Launch application main menu # while :; do dialog_menu_main || f_die f_dialog_menutag_fetch mtag command= case "$mtag" in X) break ;; 1) command=hostname ;; # Hostname/Domain 2) command=devices ;; # Network Interfaces - 3) command=defaultrouter ;; # Default Router/Gateway - 4) command=nameservers ;; # DNS nameservers + 3) command=wlanconfig ;; # Wireless Networks + 4) command=defaultrouter ;; # Default Router/Gateway + 5) command=nameservers ;; # DNS nameservers esac if [ "$command" ]; then $BSDCFG_LIBE/$APP_DIR/$command ${USE_XDIALOG:+-X} else f_die 1 "$msg_unknown_networking_menu_selection" fi if [ "$mtag" = "devices" ]; then # # Make subsequent uses of this menu faster by not performing # "ifconfig up" (limiting the pain one must endure). See also # `$BSDCFG_SHARE/networking/device.subr'. # export DIALOG_MENU_NETDEV_KICK_INTERFACES= fi done exit $SUCCESS ################################################################################ # END ################################################################################ Index: head/usr.sbin/bsdconfig/networking/share/device.subr =================================================================== --- head/usr.sbin/bsdconfig/networking/share/device.subr (revision 301972) +++ head/usr.sbin/bsdconfig/networking/share/device.subr (revision 301973) @@ -1,385 +1,403 @@ if [ ! "$_NETWORKING_DEVICE_SUBR" ]; then _NETWORKING_DEVICE_SUBR=1 # -# Copyright (c) 2006-2015 Devin Teske +# Copyright (c) 2006-2016 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ # ############################################################ INCLUDES BSDCFG_SHARE="/usr/share/bsdconfig" . $BSDCFG_SHARE/common.subr || exit 1 f_dprintf "%s: loading includes..." networking/device.subr f_include $BSDCFG_SHARE/device.subr f_include $BSDCFG_SHARE/dialog.subr f_include $BSDCFG_SHARE/media/tcpip.subr +f_include $BSDCFG_SHARE/media/wlan.subr f_include $BSDCFG_SHARE/networking/common.subr f_include $BSDCFG_SHARE/networking/ipaddr.subr f_include $BSDCFG_SHARE/networking/media.subr f_include $BSDCFG_SHARE/networking/netmask.subr f_include $BSDCFG_SHARE/networking/resolv.subr f_include $BSDCFG_SHARE/networking/routing.subr f_include $BSDCFG_SHARE/strings.subr f_include $BSDCFG_SHARE/sysrc.subr BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking" f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr ############################################################ GLOBALS # # Settings used while interacting with various dialog(1) menus # : ${DIALOG_MENU_NETDEV_KICK_INTERFACES=1} : ${DIALOG_MENU_NETDEV_SLEEP_AFTER_KICK=3} ############################################################ FUNCTIONS # f_dialog_menu_netdev [$default] # # Display a list of network devices with descriptions. Optionally, if present # and non-NULL, initially highlight $default interface. # f_dialog_menu_netdev() { local menu_list # Calculated below local defaultitem="${1%\*}" # Trim trailing asterisk if present # # Display a message to let the user know we're working... # (message will remain until we throw up the next dialog) # f_dialog_info "$msg_probing_network_interfaces" # # Get list of usable network interfaces # local dev devs if iflist= # Calculated below f_device_rescan_network f_device_find "" $DEVICE_TYPE_NETWORK devs for dev in $devs; do f_struct "$dev" get name if || continue # Skip unsavory interfaces case "$if" in lo[0-9]*|ppp[0-9]*|sl[0-9]*) continue ;; esac iflist="$iflist $if" done iflist="${iflist# }" # # Optionally kick interfaces in the head to get them to accurately # track the carrier status in realtime (required on FreeBSD). # if [ "$DIALOG_MENU_NETDEV_KICK_INTERFACES" ]; then DIALOG_MENU_NETDEV_KICK_INTERFACES= for if in $iflist; do f_quietly ifconfig $if up done if [ "$DIALOG_MENU_NETDEV_SLEEP_AFTER_KICK" ]; then # interfaces need time to update carrier status sleep $DIALOG_MENU_NETDEV_SLEEP_AFTER_KICK fi fi # # Mark any "active" interfaces with an asterisk (*) # to the right of the device name. # menu_list=$( for if in $iflist; do f_device_desc $if $DEVICE_TYPE_NETWORK desc f_shell_escape "$desc" desc if f_device_is_active $if; then printf "'%s\*' '%s'\n" $if "$desc" else printf "'%s' '%s'\n" $if "$desc" fi done ) if [ ! "$menu_list" ]; then f_show_msg "$msg_no_network_interfaces" return $DIALOG_CANCEL fi # Maybe the default item was marked as active f_device_is_active "$defaultitem" && defaultitem="$defaultitem*" # # Ask user to select an interface # local prompt="$msg_select_network_interface" local hline="$hline_arrows_tab_enter" local height width rows eval f_dialog_menu_size height width rows \ \"\$DIALOG_TITLE\" \ \"\$DIALOG_BACKTITLE\" \ \"\$prompt\" \ \"\$hline\" \ $menu_list local menu_choice menu_choice=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ --default-item \"\$defaultitem\" \ --menu \"\$prompt\" \ $height $width $rows \ $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? f_dialog_menutag_store -s "$menu_choice" return $retval } # f_dialog_menu_netdev_edit $interface $ipaddr $netmask $options $dhcp # # Allow a user to edit network interface settings. Current values are not # probed but rather taken from the positional arguments. # f_dialog_menu_netdev_edit() { local funcname=f_dialog_menu_netdev_edit local interface="$1" ipaddr="$2" netmask="$3" options="$4" dhcp="$5" local prompt menu_list height width rows # # Create a duplicate set of variables for change-tracking... # local ipaddr_orig="$2" \ netmask_orig="$3" \ options_orig="$4" \ dhcp_orig="$5" local hline="$hline_arrows_tab_enter" f_sprintf prompt "$msg_network_configuration" "$interface" # # Loop forever until the user has finished configuring the different # components of the network interface. # # To apply the settings, we need to know each of the following: # - IP Address # - Network subnet mask # - Additional ifconfig(8) options # # It is only when we have all of the above values that we can make the # changes effective because all three options must be specified at-once # to ifconfig(8). # local defaultitem= + local wlans wlan_status while :; do local dhcp_status="$msg_disabled" [ "$dhcp" ] && dhcp_status="$msg_enabled" + if f_device_is_wireless "$interface"; then + wlans=$( f_sysrc_get "wlans_$interface" ) + wlan_status="$msg_unconfigured" + [ -e "$( f_sysrc_get wpa_supplicant_conf_file )" ] && + wlan_status="$msg_configured" + fi + # # Display configuration-edit menu # menu_list=" 'X $msg_save_exit' '$msg_return_to_previous_menu' + " # END-QUOTE + f_device_is_wireless "$interface" && menu_list="$menu_list + 'W $msg_wireless_networks' '$wlan_status' + '1 $msg_wlans' '$wlans' + " # END-QUOTE + menu_list="$menu_list '2 $msg_dhcp' '$dhcp_status' '3 $msg_ipaddr4' '$ipaddr' '4 $msg_netmask' '$netmask' '5 $msg_options' '$options' " # END-QUOTE eval f_dialog_menu_size height width rows \ \"\$DIALOG_TITLE\" \ \"\$DIALOG_BACKTITLE\" \ \"\$prompt\" \ \"\$hline\" \ $menu_list local tag tag=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ --help-button \ --help-label \"\$msg_help\" \ ${USE_XDIALOG:+--help \"\"} \ --default-item \"\$defaultitem\" \ --menu \"\$prompt\" \ $height $width $rows \ $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? f_dialog_data_sanitize tag if [ $retval -eq $DIALOG_HELP ]; then f_show_help "$TCP_HELPFILE" continue elif [ $retval -ne $DIALOG_OK ]; then return $retval else # Only update default-item on success defaultitem="$tag" fi # # Call the below ``modifier functions'' whose job it is to take # input from the user and assign the newly-acquired values back # to the ipaddr, netmask, and options variables for us to re- # read and display in the summary dialog. # case "$tag" in X\ *) break ;; + W\ *) f_dialog_menu_wireless_edit ;; + 1\ *) f_dialog_menu_wlandev_edit \ + "$interface" "${wlans%%[$IFS]*}" ;; 2\ *) # # Proceed cautiously (confirm with the user) if/when NFS- # mounts are active. If the network on which these mounts # are made is changed parts of the system may hang. # if f_nfs_mounted && ! f_jailed; then local setting f_sprintf setting "$msg_current_dhcp_status" \ "$interface" "$dhcp_status" f_noyes "$msg_nfs_mounts_may_cause_hang" "$setting" || continue fi # # Toggle DHCP status # if [ "$dhcp_status" = "$msg_enabled" ]; then dhcp= else trap - SIGINT ( # Execute within sub-shell to allow/catch Ctrl-C trap 'exit $FAILURE' SIGINT f_sprintf msg "$msg_scanning_for_dhcp" "$interface" if [ "$USE_XDIALOG" ]; then ( f_quietly ifconfig "$interface" delete f_quietly dhclient "$interface" ) | f_xdialog_info "$msg" else f_dialog_info "$msg" f_quietly ifconfig "$interface" delete f_quietly dhclient "$interface" fi ) retval=$? trap 'interrupt' SIGINT if [ $retval -eq $DIALOG_OK ]; then dhcp=1 f_ifconfig_inet "$interface" ipaddr f_ifconfig_inet6 "$interface" ipaddr6 f_ifconfig_netmask "$interface" netmask options= # Fixup search/domain in resolv.conf(5) hostname=$( f_sysrc_get \ 'hostname:-$(hostname)' ) f_dialog_resolv_conf_update "$hostname" fi fi ;; 3\ *) f_dialog_input_ipaddr "$interface" "$ipaddr" [ $? -eq $DIALOG_OK ] && dhcp= ;; 4\ *) f_dialog_input_netmask "$interface" "$netmask" [ $? -eq $DIALOG_OK -a "$_netmask" ] && dhcp= ;; 5\ *) f_dialog_menu_media_options "$interface" "$options" [ $? -eq $DIALOG_OK ] && dhcp= ;; esac done # # Save only if the user changed at least one feature of the interface # if [ "$ipaddr" != "$ipaddr_orig" -o \ "$netmask" != "$netmask_orig" -o \ "$options" != "$options_orig" -o \ "$dhcp" != "$dhcp_orig" ] then f_show_info "$msg_saving_network_interface" "$interface" local value= if [ "$dhcp" ]; then f_eval_catch $funcname f_sysrc_delete \ 'f_sysrc_delete defaultrouter' value=DHCP else value="inet $ipaddr netmask $netmask" value="$value${options:+ }$options" fi f_eval_catch $funcname f_sysrc_set \ 'f_sysrc_set "ifconfig_%s" "%s"' "$interface" "$value" fi # # Re/Apply the settings if desired # if [ ! "$dhcp" ]; then if f_yesno "$msg_bring_interface_up" "$interface" then f_show_info "$msg_bring_interface_up" "$interface" local dr="$( f_sysrc_get defaultrouter )" if [ "$dr" = "NO" -o ! "$dr" ]; then f_route_get_default dr [ "$dr" ] && f_eval_catch \ $funcname f_sysrc_set \ 'f_sysrc_set defaultrouter "%s"' "$dr" fi # # Make a backup of resolv.conf(5) before using # ifconfig(8) and then restore it afterward. This # allows preservation of nameservers acquired via # DHCP on FreeBSD-8.x (normally lost as ifconfig(8) # usage causes dhclient(8) to exit which scrubs # resolv.conf(5) by-default upon termination). # f_quietly cp -fp "$RESOLV_CONF" "$RESOLV_CONF.$$" if f_eval_catch $funcname ifconfig \ 'ifconfig "%s" inet "%s" netmask "%s" %s' \ "$interface" "$ipaddr" "$netmask" "$options" then [ "$dr" -a "$dr" != "NO" ] && f_eval_catch $funcname route \ 'route add default "%s"' "$dr" fi if cmp -s "$RESOLV_CONF" "$RESOLV_CONF.$$"; then f_quietly rm -f "$RESOLV_CONF.$$" else f_quietly mv -f "$RESOLV_CONF.$$" "$RESOLV_CONF" fi fi fi return $DIALOG_OK } ############################################################ MAIN f_dprintf "%s: Successfully loaded." networking/device.subr fi # ! $_NETWORKING_DEVICE_SUBR Index: head/usr.sbin/bsdconfig/networking/wlanconfig =================================================================== --- head/usr.sbin/bsdconfig/networking/wlanconfig (nonexistent) +++ head/usr.sbin/bsdconfig/networking/wlanconfig (revision 301973) @@ -0,0 +1,78 @@ +#!/bin/sh +#- +# Copyright (c) 2011 Nathan Whitehorn +# Copyright (c) 2013 Tom Rhodes +# Copyright (c) 2013-2016 Devin Teske +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# +############################################################ INCLUDES + +# Prevent device.subr (included indirectly) from auto scanning on load +DEVICE_SELF_SCAN_ALL=NO + +BSDCFG_SHARE="/usr/share/bsdconfig" +. $BSDCFG_SHARE/common.subr || exit 1 +f_dprintf "%s: loading includes..." "$0" +f_include $BSDCFG_SHARE/dialog.subr +f_include $BSDCFG_SHARE/media/wlan.subr +f_include $BSDCFG_SHARE/mustberoot.subr + +BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking" +f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr + +f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm && + pgm="${ipgm:-$pgm}" + +############################################################ MAIN + +# Incorporate rc-file if it exists +[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc" + +# +# Process command-line arguments +# +while getopts h$GETOPTS_STDARGS flag; do + case "$flag" in + h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;; + esac +done +shift $(( $OPTIND - 1 )) + +# +# Initialize +# +f_dialog_title "$msg_wireless_networks" +f_dialog_backtitle "${ipgm:+bsdconfig }$pgm" +f_mustberoot_init + +# +# Launch the wireless network menu +# +f_dialog_menu_wireless_edit + +################################################################################ +# END +################################################################################ Property changes on: head/usr.sbin/bsdconfig/networking/wlanconfig ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: head/usr.sbin/bsdconfig/share/media/Makefile =================================================================== --- head/usr.sbin/bsdconfig/share/media/Makefile (revision 301972) +++ head/usr.sbin/bsdconfig/share/media/Makefile (revision 301973) @@ -1,8 +1,8 @@ # $FreeBSD$ FILESDIR= ${SHAREDIR}/bsdconfig/media FILES= any.subr cdrom.subr common.subr directory.subr dos.subr \ floppy.subr ftp.subr http.subr httpproxy.subr network.subr \ - nfs.subr options.subr tcpip.subr ufs.subr usb.subr + nfs.subr options.subr tcpip.subr ufs.subr usb.subr wlan.subr .include Index: head/usr.sbin/bsdconfig/share/media/wlan.subr =================================================================== --- head/usr.sbin/bsdconfig/share/media/wlan.subr (nonexistent) +++ head/usr.sbin/bsdconfig/share/media/wlan.subr (revision 301973) @@ -0,0 +1,1392 @@ +if [ ! "$_MEDIA_WLAN_SUBR" ]; then _MEDIA_WLAN_SUBR=1 +# +# Copyright (c) 2013-2016 Devin Teske +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# +############################################################ INCLUDES + +BSDCFG_SHARE="/usr/share/bsdconfig" +. $BSDCFG_SHARE/common.subr || exit 1 +f_dprintf "%s: loading includes..." media/wlan.subr +f_include $BSDCFG_SHARE/device.subr +f_include $BSDCFG_SHARE/dialog.subr +f_include $BSDCFG_SHARE/strings.subr +f_include $BSDCFG_SHARE/sysrc.subr + +BSDCFG_LIBE="/usr/libexec/bsdconfig" +f_include_lang $BSDCFG_LIBE/include/messages.subr + +############################################################ GLOBALS + +NWIRELESS_CONFIGS=0 +NWSCAN_RESULTS=0 + +# +# Settings used while interacting with various dialog(1) menus +# +: ${DIALOG_MENU_WLAN_SCAN_DURATION:=5} +: ${DIALOG_MENU_WLAN_SHOW_ALL=} +: ${DIALOG_MENU_WLAN_SHOW_CONFIGURED=1} +: ${DIALOG_MENU_WLAN_SHOW_SCAN_RESULTS=1} + +# +# Structure to contain the wpa_supplicant.conf(5) default overrides +# +f_struct_define WPA_DEFAULTS \ + ap_scan \ + ctrl_interface \ + ctrl_interface_group \ + eapol_version \ + fast_reauth + +# +# Structure of wpa_supplicant.conf(5) network={ ... } entry +# +f_struct_define WPA_NETWORK \ + anonymous_identity \ + auth_alg \ + bssid \ + ca_cert \ + ca_cert2 \ + client_cert \ + client_cert2 \ + dh_file \ + dh_file2 \ + eap \ + eap_workaround \ + eapol_flags \ + eappsk \ + engine \ + engine_id \ + frequency \ + group \ + identity \ + key_id \ + key_mgmt \ + mixed_cell \ + mode \ + nai \ + pac_file \ + pairwise \ + password \ + pcsc \ + phase1 \ + phase2 \ + pin \ + priority \ + private_key \ + private_key2 \ + private_key2_passwd \ + private_key_passwd \ + proto \ + psk \ + scan_ssid \ + server_nai \ + ssid \ + subject_match \ + subject_match2 \ + wep_key0 \ + wep_key1 \ + wep_key2 \ + wep_key3 \ + wpa_ptk_rekey \ + wep_tx_keyidx + +# +# The following properties are ``Lists'' and as such should not be quoted. +# Everything else should be quoted. +# +WPA_NETWORK_LIST_PROPERTIES=" + auth_algo + eap + group + key_mgmt + pairwise + proto +" # END-QUOTE + +# +# Structure of wpa_cli(8) `scan_results' entry +# +f_struct_define WPA_SCAN_RESULT \ + bssid \ + flags \ + freq \ + siglev \ + ssid + +# +# Structure of a menu item in the wireless editor +# +f_struct_define WLAN_MENU_ITEM \ + letter \ + ssid \ + nconfigs \ + nfound \ + help + +############################################################ FUNCTIONS + +# f_wpa_supplicant_init $file +# +# Initialize $file with basic contents of new wpa_supplicant.conf(5). +# +f_wpa_supplicant_init() +{ + local funcname=f_wpa_supplicant_init + local conf_file="$1" tmpfile + + # Create a temporary file + f_eval_catch -k tmpfile $funcname mktemp 'mktemp -t "%s"' "$pgm" || + return $FAILURE + + # Make it unreadable by anyone but ourselves + f_eval_catch $funcname chmod \ + 'chmod 0600 "%s"' "$tmpfile" || return $FAILURE + + # Make it owned by root/wheel + f_eval_catch $funcname chown \ + 'chown 0:0 "%s"' "$tmpfile" || return $FAILURE + + # Populate it + cat <<-EOF >> "$tmpfile" + ctrl_interface=/var/run/wpa_supplicant + eapol_version=2 + ap_scan=1 + fast_reauth=1 + EOF + echo >> "$tmpfile" + + # Move it into place + f_eval_catch $funcname mv 'mv "%s" "%s"' "$tmpfile" "$conf_file" +} + +# f_wpa_supplicant_parse $file [struct_prefix [count_var]] +# +# Parse wpa_supplicant.conf(5) $file. Default overrides are stored in a struct +# (see struct.subr for additional details) named `{struct_prefix}defaults'. See +# WPA_DEFAULTS struct definition in the GLOBALS section above. +# +# In addition, for each one of the wireless networks we parse from $file, +# create a struct named `struct_prefixN' where `N' is a number starting from 1 +# and ending in $count_var (zero means no networks). See WPA_NETWORK struct +# definition in the GLOBALS section above. +# +# If a `blob-base64-*={ ... }' entry appears, a struct named +# `{struct_prefix}blob_base64_*' is created and the `data' property holds the +# base64 encoded binary data without whitespace. +# +# Custom `*={ ... }' definitions are also supported, but should be unique +# (unlike the `network' definition). A struct named `{struct_prefix}*' is +# created if at least one property is defined in the block. +# +f_wpa_supplicant_parse() +{ + local file="$1" struct_prefix="$2" count_var="$3" + + [ "$count_var" ] && setvar "$count_var" 0 + + [ "$file" ] || file=$( f_sysrc_get wpa_supplicant_conf_file ) + if [ ! -e "$file" ]; then + f_dprintf "%s: No such file or directory" "$file" + return $FAILURE + fi + + local list_properties + f_replaceall "$WPA_NETWORK_LIST_PROPERTIES" "$NL" "" list_properties + eval "$( awk \ + -v count_var="$count_var" \ + -v struct_prefix="$struct_prefix" \ + -v list_properties="$list_properties" ' + BEGIN { + if (!count_var && !struct_prefix) exit + blob = count = custom_struct = network = 0 + split(list_properties, lists, FS) + } + function set_value(struct, prop, value) + { + quoted = substr(value, 0, 1) == "\"" + for (l in lists) if (list = prop == lists[l]) break + # Remove data after whitespace if unquoted and not a list + if (!quoted && !list) sub("[[:space:]].*", "", value) + # Otherwise if quoted and not a list, remove the quotes + # NB: wep_keyN needs to retain quoting if/when present + else if (quoted && !list && prop !~ /^wep_key[[:digit:]]+/) { + sub("^\"", "", value) + sub("\".*", "", value) + } + gsub(/'\''/, "'\''\\'\'\''", value) # Sanitize the value + if (!created[struct]) { + print "debug= f_struct_free", struct + print "debug= f_struct_new WPA_NETWORK", struct + created[struct] = 1 + } + printf "debug= %s set %s '\'%s\''\n", struct, prop, value + } + { + if ($1 ~ /^network={/) { + empty = 1 # We do not increment count unless !empty + network = 1 + next + } else if (match($1, "^blob-base64-[[:alnum:]_./-]+={")) { + blob = 1 + blob_data = "" + struct = struct_prefix "blob_bas64_" + struct = struct substr($1, 13, RLENGTH - 14) + next + } else if (match($1, "^[[:alnum:]_./-]+={")) { + empty = 1 + custom_struct = 1 + struct = struct_prefix substr($1, 0, RLENGTH - 2) + gsub(/[^[:alnum:]_]/, "_", struct) + next + } else if ($1 ~ /^}/) { + if (blob) { + gsub("[[:space:]]", "", blob_data) + set_value(struct, "data", blob_data) + } + blob = custom_struct = network = 0 + next + } else if (!match($0, /^[[:space:]]*[[:alnum:]_]+=/)) + next + + if (blob) { + blob_data = blob_data $0 + next + } else if (network) { + if (empty) { count++; empty = 0 } + struct = struct_prefix count + } else if (!custom_struct) + struct = struct_prefix "defaults" + + if (!struct_prefix) next + + prop = substr($0, 0, RLENGTH - 1) + sub(/^[[:space:]]*/, "", prop) + value = substr($0, RSTART + RLENGTH) + + set_value(struct, prop, value) + } + END { if (count_var) print count_var "=" count }' "$file" )" +} + +# f_wpa_scan_results_parse [struct_prefix [count_var]] +# +# Parse the results of wpa_cli(8) `scan_results' into a series of structs (see +# struct.subr for additional details) named `struct_prefixN' where `N' is a +# number starting from 1 and ending in $count_var (zero means no results). See +# WPA_SCAN_RESULT struct definition in the GLOBALS section above. +# +f_wpa_scan_results_parse() +{ + local struct_prefix="$1" count_var="$2" + + [ "$count_var" ] && setvar "$count_var" 0 + + eval "$( wpa_cli scan_results 2> /dev/null | awk \ + -v count_var="$count_var" \ + -v struct_prefix="$struct_prefix" ' + BEGIN { + if (!count_var && !struct_prefix) exit + count = 0 + seg = "[[:xdigit:]][[:xdigit:]]" + bssid = seg":"seg":"seg":"seg":"seg":"seg + freq = siglev = flags = "[^[:space:]]+" + S = "[[:space:]]+" + line = bssid S freq S siglev S flags + line = "^[[:space:]]*" line "[[:space:]]*" + } + function set_value(struct, prop, value) + { + gsub(/'\''/, "'\''\\'\'\''", value) # Sanitize the value + if (!created[struct]) { + print "debug= f_struct_free", struct + print "debug= f_struct_new WPA_SCAN_RESULT", struct + created[struct] = 1 + } + printf "debug= %s set %s '\'%s\''\n", struct, prop, value + } + { + if (!match($0, line)) next + ssid = substr($0, RLENGTH + 1) + + count++ + if (!struct_prefix) next + + struct = struct_prefix count + set_value(struct, "ssid", ssid) + set_value(struct, "bssid", $1) + set_value(struct, "freq", $2) + set_value(struct, "siglev", $3) + set_value(struct, "flags", $4) + } + END { if (count_var) print count_var "=" count }' )" +} + +# f_wpa_scan_match_network WPA_SCAN_RESULT WPA_NETWORK +# +# Compares a WPA_SCAN_RESULT struct to a WPA_NETWORK struct. If they appear to +# be a match returns success, otherwise failure. +# +f_wpa_scan_match_network() +{ + local scan_struct="$1" wireless_struct="$2" + local cp debug= + + f_struct "$scan_struct" || return $FAILURE + f_struct "$wireless_struct" || return $FAILURE + + local scan_ssid scan_bssid + $scan_struct get ssid scan_ssid + $scan_struct get bssid scan_bssid + local wireless_ssid wireless_bssid + $wireless_struct get ssid wireless_ssid + $wireless_struct get bssid wireless_bssid + + local id_matched= + if [ "$wireless_ssid" -a "$wireless_bssid" ]; then + # Must match both SSID and BSSID + [ "$scan_ssid" = "$wireless_ssid" -a \ + "$scan_bssid" = "$wireless_bssid" ] && id_matched=1 + elif [ "$wireless_ssid" ]; then + # Must match SSID only + [ "$scan_ssid" = "$wireless_ssid" ] && id_matched=1 + elif [ "$wireless_bssid" ]; then + # Must match BSSID only + [ "$scan_bssid" = "$wireless_bssid" ] && id_matched=1 + fi + [ "$id_matched" ] || return $FAILURE + + + # + # Get the scanned flags for the next few comparisons + # + local flags + $scan_struct get flags flags + + # + # Compare configured key management against scanned network + # + if $wireless_struct get key_mgmt cp && [ "$cp" -a "$cp" != "NONE" ] + then + local mgmt mgmt_matched= + for mgmt in $cp; do + local mgmt2="$mgmt" + [ "$mgmt" != "${mgmt#WPA-}" ] && + mgmt2="WPA2${mgmt#WPA}" + case "$flags" in + "$mgmt"|"$mgmt"-*|*-"$mgmt"|*-"$mgmt"-*) + mgmt_matched=1 break ;; + "$mgmt2"|"$mgmt2"-*|*-"$mgmt2"|*-"$mgmt2"-*) + mgmt_matched=1 break ;; + esac + done + [ "$mgmt_matched" ] || return $FAILURE + fi + + local enc type flag + + # + # Compare configured encryption against scanned network + # + for enc in psk:PSK eap:EAP \ + wep_key0:WEP wep_key1:WEP wep_key2:WEP wep_key3:WEP + do + type=${enc%%:*} + flag=${enc#*:} + { debug= $wireless_struct get $type cp && [ "$cp" ]; } || + continue + # Configured network requires encryption + case "$flags" in "[$flag]"|*"-$flag-"*) + break # Success; stop after first match + esac + return $FAILURE + done + cp="" # sensitive info + + # + # Compare scanned network encryption against configuration + # NB: Scanned network flags indicates _one_ of PSK EAP or WEP + # NB: Otherwise, no encryption (so encryption won't match) + # + local enc_wanted= + for enc in -PSK-:psk -EAP-:eap; do + flag=${enc%%:*} + type=${enc#*:} + case "$flags" in *"$flag"*) + enc_wanted=1 + { debug= $wireless_struct get $type cp && + [ "$cp" ]; } || return $FAILURE + break # success + esac + done + case "$flags" in *"[WEP]"*) + enc_wanted=1 + local wep_found= + for type in wep_key0 wep_key1 wep_key2 wep_key3; do + debug= $wireless_struct get $type cp && [ "$cp" ] && + wep_found=1 break + done + [ "$wep_found" ] || return $FAILURE + esac + if [ ! "$enc_wanted" ]; then + # No match if the network specifies encryption + for type in psk eap wep_key0 wep_key1 wep_key2 wep_key3; do + debug= $wireless_struct get $type cp && [ "$cp" ] && + return $FAILURE + done + fi + cp="" # sensitive info + + return $SUCCESS +} + +# f_wpa_scan_find_matches scans_prefix $scans_count \ +# wireless_prefix $wireless_count +# +# For each struct from `{scans_prefix}1' up to `{scans_prefix}$scans_count' +# (see struct.subr for additional details) compare the wireless network info +# (defined as struct WPA_SCAN_RESULT) to that of each configured wireless +# stored in `{wireless_prefix}1' (defined as struct WPA_NETWORK) up to +# `{wireless_prefix}$wireless_count'. +# +# If a scanned network is deemed to be a match to a configured wireless +# network, a new `match' property is set on the WPA_NETWORK struct with a value +# of `{scans_prefix}N' (where N represents the scanned network that matched). +# At the same time, a new `matched' property is set on the WPA_SCAN_RESULT +# struct with a value of 1, indicating that this network has been matched to a +# stored [known] configuration and that it should not be displayed in menus. +# +# NB: If a matching entry is not correct, the user can optionally `Forget' the +# network and that will cause the WPA_SCAN_RESULT to no longer match anything, +# causing it to appear in the menus again. +# +# Return status should be ignored. +# +f_wpa_scan_find_matches() +{ + local scans_prefix="$1" scans_count="$2" + local wireless_prefix="$3" wireless_count="$4" + local matches + + [ "$scans_count" -a "$wireless_count" ] || return $SUCCESS + f_isinteger "$scans_count" || return $FAILURE + f_isinteger "$wireless_count" || return $FAILURE + + # + # Go through and eradicate any flags we set in a prior run, as things + # might have changed on us (either from the config side or scan side) + # + local w=1 + while [ $w -le $wireless_count ]; do + f_struct "$wireless_prefix$w" set matches "" + w=$(( $w + 1 )) + done + + # + # Find matches and set match data on structs + # + local s=1 + while [ $s -le $scans_count ]; do + f_struct "$scans_prefix$s" set matched "" + w=1 + while [ $w -le $wireless_count ]; do + if f_wpa_scan_match_network \ + "$scans_prefix$s" "$wireless_prefix$w" + then + f_struct "$scans_prefix$s" set matched 1 + debug= f_struct "$wireless_prefix$w" \ + get matches matches + matches="$matches${matches:+ }$scans_prefix$s" + f_struct "$wireless_prefix$w" \ + set matches "$matches" + break # to next scan result + fi + w=$(( $w + 1 )) + done + s=$(( $s + 1 )) + done +} + +# f_dialog_menu_wlandev_edit $wlandev [$defaultitem] +# +# Display a list of wireless network devices (wlan*) associated with +# $wlandev (e.g., `iwn0'). Allow the user to create and destroy wlan interfaces +# while selecting ones to be cloned at startup (by setting `wlans_$wlandev'). +# +f_dialog_menu_wlandev_edit() +{ + local funcname=f_dialog_menu_wlandev_edit + local wlandev="$1" defaultitem="$2" + local title="$DIALOG_TITLE" + local btitle="$DIALOG_BACKTITLE" + local prompt # Calculated below + local hline="$hline_arrows_tab_enter" + + [ "$wlandev" ] || return $FAILURE + + f_sprintf prompt "$msg_select_wlan_interfaces_for" "wlandev" + + # + # Initially mark wlan devices with a %parent of $wlandev + # + local dev devs if list_to_save= + f_device_find "" $DEVICE_TYPE_NETWORK devs + for dev in $devs; do + f_struct "$dev" get name if || continue + case "$if" in wlan[0-9]*) + parent=$( sysctl -n net.wlan.${if#wlan}.%parent \ + 2> /dev/null ) + if [ "$parent" = "$if" ]; then + local _wlanmark_$if="X" + list_to_save="$list_to_save $if" + fi + esac + done + list_to_save="${list_to_save# }" + + # + # Operate in a loop so we can create/destroy interfaces from here + # + while :; do + # + # Refresh list of wlan interfaces + # + local wlanlist= + f_device_rescan_network + f_device_find "" $DEVICE_TYPE_NETWORK devs + for dev in $devs; do + f_struct "$dev" get name if || continue + case "$if" in wlan[0-9]*) + wlanlist="$wlanlist $if" + esac + done + + # + # Build menu list of wlan devices + # + local menu_list=" + '> $msg_save_exit' '$msg_return_to_previous_menu' + '> $msg_create_new' 'wlan' + '> $msg_destroy' '...' + " # END-QUOTE + local parent X + for if in $wlanlist; do + f_getvar _wlanmark_$if-" " X + menu_list="$menu_list '[$X] $if' '%parent: $parent'" + [ "$defaultitem" = "$if" ] && defaultitem="[$X] $if" + done + + # + # Ask user to make a choice + # + local height width rows + eval f_dialog_menu_size height width rows \ + \"\$title\" \"\$btitle\" \"\$prompt\" \"\$hline\" \ + $menu_list + local menu_choice + menu_choice=$( eval $DIALOG \ + --title \"\$title\" \ + --backtitle \"\$btitle\" \ + --hline \"\$hline\" \ + --ok-label \"\$msg_select\" \ + --cancel-label \"\$msg_cancel\" \ + --default-item \"\$defaultitem\" \ + --menu \"\$prompt\" \ + $height $width $rows \ + $menu_list \ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) || return $FAILURE + f_dialog_data_sanitize menu_choice + + case "$menu_choice" in + "> $msg_save_exit") # Save list to rc.conf(5) `wlans_$wlandev' + f_eval_catch $funcname f_sysrc_set \ + 'f_sysrc_set "wlans_%s" "%s"' \ + "$wlandev" "$list_to_save" || continue + break # to success + ;; + "> $msg_create_new") # Create new wlan interface for wlandev + local wlan + f_eval_catch -k wlan $funcname ifconfig \ + 'ifconfig wlan create wlandev "%s"' \ + "$wlandev" || continue + local _wlanmark_$wlan="X" + list_to_save="$list_to_save${list_to_save:+ }$wlan" + ;; + "> $msg_destroy") # Display a menu to pick one item to destroy + [ "$wlanlist" ] || continue # Nothing to destroy + + menu_list= + for if in $wlanlist; do + menu_list="$menu_list '$if' ''" + done + local msg="$msg_pick_an_interface_to_destroy" + eval f_dialog_menu_size height width rows \ + \"\$title\" \"$btitle\" \"\$msg\" \"\" $menu_list + menu_choice=$( eval $DIALOG \ + --title \"\$title\" \ + --backtitle \"\$btitle\" \ + --ok-label \"\$msg_destroy\" \ + --cancel-label \"\$msg_cancel\" \ + --menu \"\$msg\" \ + $height $width $rows \ + $menu_list \ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) || continue + f_dialog_data_sanitize menu_choice + f_eval_catch $funcname ifconfig \ + 'ifconfig "%s" destroy' "$menu_choice" + ;; + "[ ] wlan"[0-9]*) # Unmarked; Mark + if="${menu_choice#??? }" + local _wlanmark_$if="X" + list_to_save="$list_to_save${list_to_save:+ }$if" + ;; + "[X] wlan"[0-9]*) # Marked; Unmark + menu_choice="${menu_choice#??? }" + local _wlanmark_$menu_choice=" " + local new_list_to_save= + for if in $list_to_save; do + [ "$if" = "$menu_choice" ] && continue + new_list_to_save="$new_list_to_save $if" + done + list_to_save="${new_list_to_save# }" + ;; + esac + done + + return $SUCCESS +} + +# f_dialog_scan_wireless +# +# Initiate a scan for wireless networks. If wpa_supplicant(8) is not running +# but a wlan interface has been created, start an instance of wpa_supplicant(8) +# with the first wlan(4) interface we find. After initiating the scan, displays +# a message for 5 seconds (with option to dismiss). Returns failure if an error +# occurs, otherwise success. +# +f_dialog_scan_wireless() +{ + local funcname=f_dialog_scan_wireless + + # + # Try to communicate with a running wpa_supplicant(8) + # + if ! f_eval_catch -d $funcname wpa_cli 'wpa_cli ping'; then + + # If there is indeed one running, bail! + if ps axo ucomm= | grep -qw wpa_supplicant; then + f_show_msg "$msg_failed_to_reach_wpa_supplicant" \ + "$msg_wpa_cli_ping_failed" + return $FAILURE + fi + + # Try and find a wlan device so we can start wpa_supplicant + local dev devs if wlan= + f_device_rescan_network + f_device_find "" $DEVICE_TYPE_NETWORK devs + for dev in $devs; do + f_struct "$dev" get name if || continue + case "$if" in wlan[0-9]*) + wlan=$if + break + esac + done + if [ ! "$wlan" ]; then + # We can't start wpa_supplicant without wlan interface + # Tell the user they have to create one by navigating + # to a Wireless device to create a wlan interface. But + # let's go one step further and find an interface that + # we can provide in the prompt text. + local wlandev= + for if in $devs; do + case "$if" in wlan[0-9]*) next; esac + if f_device_is_wireless $if; then + wlandev=$if + break + fi + done + if [ "$wlandev" ]; then + f_show_msg "$msg_cant_start_wpa_supplicant" \ + "$wlandev" + else + # Warn user, appears no wireless available + f_show_msg "$msg_warning_no_wireless_devices" + fi + return $FAILURE + fi + + # NB: Before we can proceed to fire up wpa_supplicant(8), let's + # make sure there is a bare-bones wpa_supplicant.conf(5) for it + local conf_file + conf_file=$( f_sysrc_get wpa_supplicant_conf_file ) + if [ ! -e "$conf_file" ]; then + f_wpa_supplicant_init "$conf_file" || return $FAILURE + f_eval_catch -d $funcname wpa_cli 'wpa_cli reconfigure' + fi + + # Try and start wpa_supplicant(8) + f_eval_catch $funcname wpa_supplicant \ + '/etc/rc.d/wpa_supplicant start "%s"' "$wlan" || + return $FAILURE + + # Try to reach this new wpa_supplicant(8) + if ! f_eval_catch -d $funcname wpa_cli 'wpa_cli ping'; then + f_show_msg "$msg_failed_to_reach_wpa_supplicant" \ + "$msg_wpa_cli_ping_failed" + return $FAILURE + fi + + fi # ! f_quietly wpa_cli ping + + # If we reach hear, then it should be OK to scan the airwaves + f_eval_catch -d $funcname wpa_cli 'wpa_cli scan' || return $FAILURE + + # Return immediately if a duration is: null or not a number >= 1 + local duration="$DIALOG_MENU_WLAN_SCAN_DURATION" + f_isinteger "$duration" || return $SUCCESS + [ $duration -gt 0 ] || return $SUCCESS + + # Display a message that times-out if not dismissed manually + local prompt + f_sprintf prompt "$msg_scanning_wireless_pausing" "$duration" + f_dialog_pause "$prompt" "$duration" +} + +# f_dialog_wireless_edit $ssid +# +# Display a menu to allow the user to either create a new entry for the +# wpa_supplicants.conf(5) file, or to edit values for an existing entry. +# +# If more than one wireless network is found to match $ssid, a sub-menu is +# presented, allowing the user to select the desired network. +# +f_dialog_wireless_edit() +{ + local title="$DIALOG_TITLE" + local btitle="$DIALOG_BACKTITLE" + local prompt1="$msg_select_the_configuration_you_would_like" + local prompt2 # Calculated below + local hline="$hline_alnum_arrows_punc_tab_enter" + local ssid="$1" bssid="$2" + + f_sprintf prompt2 "$msg_wireless_network_configuration_for" "$ssid" + + # + # Find one or more configurations that match the SSID selection + # + local height1 width1 rows1 menu_list1= + local n=0 nmatches=0 tag wssid wbssid help matches= + while [ $n -lt $NWIRELESS_CONFIGS ]; do + n=$(( $n + 1 )) + + debug= f_struct WIRELESS_$n get ssid wssid + [ "$ssid" = "$wssid" ] || continue + debug= f_struct WIRELESS_$n get bssid wbssid + [ "${bssid:-$wbssid}" = "$wbssid" ] || continue + + nmatches=$(( $nmatches + 1 )) + [ $nmatches -le ${#DIALOG_MENU_TAGS} ] || break + f_substr -v tag "$DIALOG_MENU_TAGS" $nmatches 1 + + f_wireless_describe WIRELESS_$n help + menu_list1="$menu_list1 + '$tag $wssid' '$wbssid' '$help' + " # END-QUOTE + + matches="$matches WIRELESS_$n" + done + if [ $nmatches -eq 0 ]; then + f_show_msg "$msg_cannot_edit_wireless_ssid" "$ssid" + return $FAILURE + elif [ $nmatches -eq 1 ]; then + struct=${matches# } + else + eval f_dialog_menu_with_help_size height1 width1 rows1 \ + \"\$title\" \"\$btitle\" \"\$prompt1\" \"\$hline\" \ + $menu_list1 + fi + + # + # Operate in a loop; for the case of $nmatches > 1, we can cycle back + # to allow the user to make another choice after inspecting each one. + # + local menu_choice index struct defaultitem1= + while :; do + if [ $nmatches -gt 1 ]; then + menu_choice=$( eval $DIALOG \ + --title \"\$title\" \ + --backtitle \"\$btitle\" \ + --hline \"\$hline\" \ + --ok-label \"\$msg_select\" \ + --cancel-label \"\$msg_cancel\" \ + --item-help \ + --default-item \"\$defaultitem1\" \ + --menu \"\$prompt1\" \ + $height1 $width1 $rows1 \ + $menu_list1 \ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) || return $FAILURE + f_dialog_data_sanitize menu_choice + defaultitem1="$menu_choice" + index=$( eval f_dialog_menutag2index_with_help \ + \"\$menu_choice\" $menu_list1 ) + struct=$( set -- $matches; eval echo \${$index} ) + fi + + # + # Operate within another loop to allow editing multiple values + # + local menu_list2 height2 width2 rows2 member + while :; do + menu_list2=" + '> $msg_save_exit' + '$msg_return_to_previous_menu' + " # END-QUOTE + n=0 + for member in $_struct_typedef_WPA_NETWORK; do + [ "$member" = "ssid" ] && continue + debug= $struct get $member value || continue + n=$(( $n + 1 )) + [ $n -le ${#DIALOG_MENU_TAGS} ] || break + f_substr -v tag "$DIALOG_MENU_TAGS" $n 1 + if [ ${#value} -gt 32 ]; then + f_snprintf value 29 "%s" "$value" + value="$value..." + fi + case "$member" in + password|pin|private_key_passwd|psk|wep_key*) + f_replaceall "$value" "?" "*" value ;; + esac + f_shell_escape "$value" value + menu_list2="$menu_list2 + '$tag $member' '$value' + " # END-QUOTE + done + eval f_dialog_menu_size height2 width2 rows2 \ + \"\$title\" \"\$btitle\" \"\$prompt2\" \ + \"\$hline\" $menu_list2 + menu_choice=$( eval $DIALOG \ + --title \"\$title\" \ + --backtitle \"\$btitle\" \ + --hline \"\$hline\" \ + --ok-label \"\$msg_select\" \ + --cancel-label \"\$msg_cancel\" \ + --default-item \"\$defaultitem2\" \ + --menu \"\$prompt2\" \ + $height2 $width2 $rows2 \ + $menu_list2 \ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) || break + f_dialog_data_sanitize menu_choice + defaultitem2="$menu_choice" + + # XXXDT Unfinished + done + [ $nmatches -eq 1 ] && break + done + + # + # XXXDT Unfinished + # This is where we display a menu that edits the entry + # And then we modify the wpa_supplicants.conf(5) config file + # XXXDT Unfinished + # + + return $FAILURE # XXXDT Simulating DIALOG_CANCEL to mean ``no changes'' +} + +# f_wireless_describe WPA_NETWORK [$var_to_set] +# +# Provide a description of the WPA_NETWORK struct. If $var_to_set is missing or +# NULL, the description is provided on standard output (which is less preferred +# due to performance; e.g., if called in a loop). +# +f_wireless_describe() +{ + local __struct="$1" __var_to_set="$2" debug= + + [ "$__var_to_set" ] && setvar "$__var_to_set" "" + f_struct "$__struct" || return $FAILURE + + # + # Basic description is `proto key_mgmt group eap' + # + local __member __cp __desc= + for __member in proto key_mgmt group eap; do + $__struct get $__member __cp && [ "$__cp" ] && + __desc="$__desc${__desc:+ }$__cp" + done + + local __check __kk + + # + # Make sure we add WEP40/WEP140 even if omitted from the key_mgmt + # section of entry + # + local __wep_keyN __f_wireless_describe_first_char __length + for __wep_keyN in wep_key0 wep_key1 wep_key2 wep_key3; do + $__struct get $__wep_keyN __kk + [ "$__kk" ] || continue + + # What type is it? ASCII or HEX? + __check=WEP + f_substr -v __f_wireless_describe_first_char "$__kk" 1 1 + case "$__f_wireless_describe_first_char" in + \") # ASCII + __length=$(( ${#__kk} - 2 )) + if [ $__length -le 5 ]; then + __check=WEP40 + elif [ $__length -le 13 ]; then + __check=WEP104 + fi ;; + *) # HEX + __length=${#__kk} + if [ $__length -eq 10 ]; then + __check=WEP40 + elif [ $__length -le 26 ]; then + __check=WEP104 + fi + esac + __kk="" # sensitive info + + case "$__desc" in + *"$__check"*) : already there ;; + *) __desc="$__desc${__desc:+ }$__check" + esac + done + + # + # Make sure we display PSK even if omitted + # from the key_mgmt section of the entry + # + $__struct get psk __kk + if [ "$__kk" ]; then + __kk="" # sensitive info + __check=PSK + case "$__desc" in + *"$__check"*) : already there ;; + *) __desc="$__desc${__desc:+ }$__check" + esac + fi + + # + # Produce results + # + if [ "$__var_to_set" ]; then + setvar "$__var_to_set" "${__desc:-NONE}" + else + echo "$__desc" + fi +} + +# f_menu_wireless_configs +# +# Generates the tag/item/help triplets for wireless network menu (`--item-help' +# required) from wpa_supplicant.conf(5) [WPA_NETWORK] structs. +# +f_menu_wireless_configs() +{ + [ "$DIALOG_MENU_WLAN_SHOW_CONFIGURED" ] || return $SUCCESS + + echo "' - $msg_configured_ssids -' ' - $msg_details -' ''" + + local n=0 nunique=0 debug= + local ssid ussid matches nmatches nconfigs nfound help desc w + while [ $n -lt $NWIRELESS_CONFIGS ]; do + n=$(( $n + 1 )) + + f_struct WIRELESS_$n get ssid ssid + [ ! "$DIALOG_MENU_WLAN_SHOW_ALL" -a ! "$ssid" ] && continue + + local u=0 unique=1 + while [ $u -lt $nunique ]; do + u=$(( $u + 1 )) + menuitem_$u get ssid ussid + [ "$ssid" != "$ussid" ] || unique= break + done + if [ "$unique" ]; then + nunique=$(( $nunique + 1 )) + u=$nunique + + # Set SSID and initialize number of configs found (1) + f_struct_new WLAN_MENU_ITEM menuitem_$u + menuitem_$u set ssid "$ssid" + menuitem_$u set nconfigs 1 + + # Set number of wireless networks that match config + WIRELESS_$n get matches matches + f_count nmatches $matches + menuitem_$u set nfound $nmatches + + # Set help to description of the wireless config + f_wireless_describe WIRELESS_$n desc + menuitem_$u set help "$desc" + else + # Increment number of configs found with this SSID + menuitem_$u get nconfigs nconfigs + nconfigs=$(( $nconfigs + 1 )) + menuitem_$u set nconfigs $nconfigs + + # Add number of matched networks to existing count + WIRELESS_$n get matches matches + f_count nmatches $matches + menuitem_$u get nfound nfound + nfound=$(( $nfound + $nmatches )) + menuitem_$u set nfound $nfound + + # Combine description with existing help + menuitem_$u get help help + f_wireless_describe WIRELESS_$n desc + for w in $desc; do + case "$help" in + "$w"|"$w "*|*" $w"|*" $w "*) : already there ;; + *) help="$help $w" + esac + done + menuitem_$u set help "${help# }" + fi + done + + n=0 + while [ $n -lt $nunique ]; do + n=$(( $n + 1 )) + menuitem_$n get ssid ssid + + menuitem_$n get nconfigs nconfigs + desc="$nconfigs $msg_configured_lc" + [ $nconfigs -lt 10 ] && desc=" $desc" + menuitem_$n get nfound nfound + [ $nfound -gt 0 ] && desc="$desc $nfound $msg_found" + + menuitem_$n get help help + echo "'[X] $ssid' '$desc' '$help'" + done | sort -bf | awk 'BEGIN { prefix = "" } + { + cur_prefix = toupper(substr($0, 6, 1)) + if (cur_prefix != "'\''" && prefix != cur_prefix ) { + prefix = cur_prefix + printf "'\''%c%s\n", prefix, substr($0, 2) + } else + printf "'\'' %s\n", substr($0, 2) + }' +} + +# f_menu_wpa_scan_results +# +# Generates the tag/item/help triplets for wireless network menu (`--item-help' +# required) from wpa_cli(8) `scan_results' [WPA_SCAN_RESULT] structs. +# +f_menu_wpa_scan_results() +{ + [ "$DIALOG_MENU_WLAN_SHOW_SCAN_RESULTS" ] || return $SUCCESS + + if [ "$DIALOG_MENU_WLAN_SHOW_ALL" ]; then + echo "' - $msg_discovered_ssids -' ' - $msg_details -' ''" + else + echo "' - $msg_discovered_ssids -' '' ''" + fi + + local n=0 nunique=0 debug= + local ssid ussid matched nfound help flags f + while [ $n -lt $NWSCAN_RESULTS ]; do + n=$(( $n + 1 )) + + WSCANS_$n get ssid ssid + [ ! "$DIALOG_MENU_WLAN_SHOW_ALL" -a ! "$ssid" ] && continue + + WSCANS_$n get matched matched + [ "$DIALOG_MENU_WLAN_SHOW_CONFIGURED" -a "$matched" ] && + continue + + local u=0 unique=1 + while [ $u -lt $nunique ]; do + u=$(( $u + 1 )) + menuitem_$u get ssid ussid + [ "$ssid" != "$ussid" ] || unique= break + done + if [ "$unique" ]; then + nunique=$(( $nunique + 1 )) + u=$nunique + + # Set SSID and initialize number of networks found (1) + f_struct_new WLAN_MENU_ITEM menuitem_$u + menuitem_$u set ssid "$ssid" + menuitem_$u set nfound 1 + + # Set help to flags + WSCANS_$n get flags flags + f_replaceall "$flags" "[" " " flags + f_replaceall "$flags" "]" "" flags + flags="${flags# }" + case "$flags" in + "") flags="NONE" ;; + ESS) flags="NONE ESS" ;; + esac + menuitem_$u set help "$flags" + else + # Increment number of networks found with this SSID + menuitem_$u get nfound nfound + nfound=$(( $nfound + 1 )) + menuitem_$u set nfound $nfound + + # Combine flags into existing help + WSCANS_$n get flags flags + f_replaceall "$flags" "[" " " flags + f_replaceall "$flags" "]" "" flags + local flags_ess= + case "$flags" in *" ESS") + flags_ess=1 + flags="${flags% ESS}" + esac + local help_ess= + menuitem_$u get help help + case "$help" in *" ESS") + help_ess=1 + help="${help% ESS}" + esac + for f in ${flags:-NONE}; do + case "$help" in + "$f"|"$f "*|*" $f"|*" $f "*) : already there ;; + *) help="$help $f" + esac + done + [ "$flags_ess" -a ! "$help_ess" ] && help="$help ESS" + menuitem_$u set help "${help# }" + fi + done + + local desc n=0 + while [ $n -lt $nunique ]; do + n=$(( $n + 1 )) + menuitem_$n get ssid ssid + + desc= + if [ "$DIALOG_MENU_WLAN_SHOW_ALL" ]; then + menuitem_$n get nfound nfound + desc="$nfound $msg_found" + [ $nfound -lt 10 ] && desc=" $desc" + fi + + menuitem_$n get help help + echo "'[ ] $ssid' '$desc' '$help'" + done | sort -bf | awk 'BEGIN { prefix = "" } + { + cur_prefix = toupper(substr($0, 6, 1)) + if (cur_prefix != "'\''" && prefix != cur_prefix ) { + prefix = cur_prefix + printf "'\''%c%s\n", prefix, substr($0, 2) + } else + printf "'\'' %s\n", substr($0, 2) + }' +} + +# f_dialog_menu_wireless_edit +# +# Display a list of wireless networks configured in wpa_supplicants.conf(5) and +# (if wpa_supplicant(8) is running) also displays scan results for unconfigured +# wireless networks. +# +f_dialog_menu_wireless_edit() +{ + local funcname=f_dialog_menu_wireless_edit + local title="$DIALOG_TITLE" + local btitle="$DIALOG_BACKTITLE" + local prompt="$msg_wireless_networks_text" + local menu_list # Calculated below + local defaultitem= # Calculated below + local hline="$hline_alnum_arrows_punc_tab_enter" + + f_show_info "$msg_loading_wireless_menu" + + local conf_file + conf_file=$( f_sysrc_get wpa_supplicant_conf_file ) + + # + # Operate in a loop so we can edit wpa_supplicant.conf(5) and rescan + # for new wireless networks from here. + # + local do_parse=1 remake_menu=1 item + while :; do + # + # If this is the first time here, parse wpa_supplicant.conf(5), + # scan the airwaves, and compare to find matches. + # + if [ "$do_parse" -a "$DIALOG_MENU_WLAN_SHOW_SCAN_RESULTS" ] + then + f_dprintf "$funcname: Parsing wireless scan results" + f_dialog_scan_wireless && + f_wpa_scan_results_parse WSCANS_ NWSCAN_RESULTS + f_dprintf "$funcname: Parsed %i scanned networks" \ + $NWSCAN_RESULTS + fi + if [ "$do_parse" -a "$DIALOG_MENU_WLAN_SHOW_CONFIGURED" ] + then + f_dprintf "$funcname: Parsing wpa_supplicants.conf(5)" + f_wpa_supplicant_parse "$conf_file" \ + WIRELESS_ NWIRELESS_CONFIGS + f_dprintf "%s: Parsed %i wireless configurations" \ + $funcname $NWIRELESS_CONFIGS + f_wpa_scan_find_matches WSCANS_ $NWSCAN_RESULTS \ + WIRELESS_ $NWIRELESS_CONFIGS + fi + do_parse= + + if [ "$remake_menu" ]; then + remake_menu= + + # + # Add both items scanned from the airwaves and networks + # parsed from wpa_supplicants.conf(5). Latter items are + # marked, sorted, and added to top of list above the + # former (which are unmarked and sorted separately). + # + f_dprintf "$funcname: Building menu list..." + menu_list=$( + # Process wpa_supplicant.conf(5) structs + f_menu_wireless_configs + # Process wpa_cli(8) `scan_results' structs + f_menu_wpa_scan_results + ) + f_dprintf "$funcname: menu list built." + + # + # Add static top-level menu items + # + local XA=" " XC=" " XS=" " + [ "$DIALOG_MENU_WLAN_SHOW_ALL" ] && XA="X" + [ "$DIALOG_MENU_WLAN_SHOW_CONFIGURED" ] && XC="X" + [ "$DIALOG_MENU_WLAN_SHOW_SCAN_RESULTS" ] && XS="X" + menu_list=" + '> $msg_exit' '$msg_return_to_previous_menu' + '' + '> $msg_rescan_wireless' '*' + '$msg_rescan_wireless_help' + '> $msg_forget_all' '*' + '$msg_forget_all_help' + '> $msg_show_configured' '[$XC]' + '$msg_show_configured_help' + '> $msg_show_scan_results' '[$XS]' + '$msg_show_scan_results_help' + '> $msg_show_all' '[$XA]' + '$msg_show_all_help' + '> $msg_manually_connect' '...' + '$msg_manually_connect_help' + $menu_list" # END-QUOTE + fi + + local height width rows + eval f_dialog_menu_with_help_size height width rows \ + \"\$title\" \"\$btitle\" \"\$prompt\" \"\$hline\" \ + $menu_list + + local menu_choice + menu_choice=$( eval $DIALOG \ + --title \"\$title\" \ + --backtitle \"\$btitle\" \ + --hline \"\$hline\" \ + --ok-label \"\$msg_select\" \ + --cancel-label \"\$msg_cancel\" \ + --item-help \ + --default-item \"\$defaultitem\" \ + --menu \"\$prompt\" \ + $height $width $rows \ + $menu_list \ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) || break + f_dialog_data_sanitize menu_choice + defaultitem="$menu_choice" + + case "$menu_choice" in + "> $msg_exit") break ;; + "> $msg_rescan_wireless") do_parse=1 remake_menu=1 ;; + "> $msg_forget_all") + if f_noyes "$msg_forget_all_confirm"; then + f_eval_catch $funcname rm \ + 'rm -f "%s"' "$conf_file" || continue + f_wpa_supplicant_init "$conf_file" || continue + f_eval_catch -d $funcname wpa_cli \ + 'wpa_cli reconfigure' + f_wpa_supplicant_parse "$conf_file" \ + WIRELESS_ NWIRELESS_CONFIGS + f_wpa_scan_find_matches \ + WSCANS_ $NWSCAN_RESULTS \ + WIRELESS_ $NWIRELESS_CONFIGS + do_parse=1 remake_menu=1 + fi ;; + "> $msg_show_configured") + item=$( eval f_dialog_menutag2item_with_help \ + \"\$menu_choice\" $menu_list ) + if [ "$item" = "[ ]" ]; then + DIALOG_MENU_WLAN_SHOW_CONFIGURED=1 + else + DIALOG_MENU_WLAN_SHOW_CONFIGURED= + fi + remake_menu=1 ;; + "> $msg_show_scan_results") + item=$( eval f_dialog_menutag2item_with_help \ + \"\$menu_choice\" $menu_list ) + if [ "$item" = "[ ]" ]; then + DIALOG_MENU_WLAN_SHOW_SCAN_RESULTS=1 + else + DIALOG_MENU_WLAN_SHOW_SCAN_RESULTS= + fi + remake_menu=1 ;; + "> $msg_show_all") + item=$( eval f_dialog_menutag2item_with_help \ + \"\$menu_choice\" $menu_list ) + if [ "$item" = "[ ]" ]; then + DIALOG_MENU_WLAN_SHOW_ALL=1 + else + DIALOG_MENU_WLAN_SHOW_ALL= + fi + remake_menu=1 ;; + "> $msg_manually_connect") + f_dialog_wireless_edit && remake_menu=1 ;; + ?"[X] "*) + ssid="${menu_choice#??X? }" + f_dialog_wireless_edit "$ssid" || continue + do_parse=1 remake_menu=1 ;; + "[ ] "*) + : + : XXXDT Unfinished + : + ;; + esac + done + + # + # XXXDT Unfinished + # +} + +############################################################ MAIN + +f_dprintf "%s: Successfully loaded." media/wlan.subr + +fi # ! $_MEDIA_WLAN_SUBR Property changes on: head/usr.sbin/bsdconfig/share/media/wlan.subr ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property