summaryrefslogtreecommitdiffstats
path: root/patches/source/network-scripts/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'patches/source/network-scripts/scripts')
-rw-r--r--patches/source/network-scripts/scripts/HOSTNAME1
-rw-r--r--patches/source/network-scripts/scripts/host.conf2
-rw-r--r--patches/source/network-scripts/scripts/hosts19
-rw-r--r--patches/source/network-scripts/scripts/hosts.allow12
-rw-r--r--patches/source/network-scripts/scripts/hosts.deny12
-rw-r--r--patches/source/network-scripts/scripts/hosts.equiv14
-rw-r--r--patches/source/network-scripts/scripts/netconfig1080
-rw-r--r--patches/source/network-scripts/scripts/networks10
-rw-r--r--patches/source/network-scripts/scripts/nntpserver1
-rw-r--r--patches/source/network-scripts/scripts/protocols146
-rw-r--r--patches/source/network-scripts/scripts/rc.inet1703
-rw-r--r--patches/source/network-scripts/scripts/rc.inet1.conf240
-rw-r--r--patches/source/network-scripts/scripts/rc.inet2152
-rw-r--r--patches/source/network-scripts/scripts/rc.ip_forward100
-rw-r--r--patches/source/network-scripts/scripts/resolv.conf1
-rw-r--r--patches/source/network-scripts/scripts/setup.netconfig13
16 files changed, 2506 insertions, 0 deletions
diff --git a/patches/source/network-scripts/scripts/HOSTNAME b/patches/source/network-scripts/scripts/HOSTNAME
new file mode 100644
index 000000000..409452f78
--- /dev/null
+++ b/patches/source/network-scripts/scripts/HOSTNAME
@@ -0,0 +1 @@
+darkstar.example.net
diff --git a/patches/source/network-scripts/scripts/host.conf b/patches/source/network-scripts/scripts/host.conf
new file mode 100644
index 000000000..a659e913a
--- /dev/null
+++ b/patches/source/network-scripts/scripts/host.conf
@@ -0,0 +1,2 @@
+order hosts, bind
+multi on
diff --git a/patches/source/network-scripts/scripts/hosts b/patches/source/network-scripts/scripts/hosts
new file mode 100644
index 000000000..2c26f958b
--- /dev/null
+++ b/patches/source/network-scripts/scripts/hosts
@@ -0,0 +1,19 @@
+#
+# hosts This file describes a number of hostname-to-address
+# mappings for the TCP/IP subsystem. It is mostly
+# used at boot time, when no name servers are running.
+# On small systems, this file can be used instead of a
+# "named" name server. Just add the names, addresses
+# and any aliases to this file...
+#
+# By the way, Arnt Gulbrandsen <agulbra@nvg.unit.no> says that 127.0.0.1
+# should NEVER be named with the name of the machine. It causes problems
+# for some (stupid) programs, irc and reputedly talk. :^)
+#
+
+# For loopbacking.
+127.0.0.1 localhost
+127.0.0.1 darkstar.example.net darkstar
+
+# End of hosts.
+
diff --git a/patches/source/network-scripts/scripts/hosts.allow b/patches/source/network-scripts/scripts/hosts.allow
new file mode 100644
index 000000000..d375b5f82
--- /dev/null
+++ b/patches/source/network-scripts/scripts/hosts.allow
@@ -0,0 +1,12 @@
+#
+# hosts.allow This file describes the names of the hosts which are
+# allowed to use the local INET services, as decided by
+# the '/usr/sbin/tcpd' server.
+#
+# Version: @(#)/etc/hosts.allow 1.00 05/28/93
+#
+# Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org
+#
+#
+
+# End of hosts.allow.
diff --git a/patches/source/network-scripts/scripts/hosts.deny b/patches/source/network-scripts/scripts/hosts.deny
new file mode 100644
index 000000000..c0db7e913
--- /dev/null
+++ b/patches/source/network-scripts/scripts/hosts.deny
@@ -0,0 +1,12 @@
+#
+# hosts.deny This file describes the names of the hosts which are
+# *not* allowed to use the local INET services, as decided
+# by the '/usr/sbin/tcpd' server.
+#
+# Version: @(#)/etc/hosts.deny 1.00 05/28/93
+#
+# Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org
+#
+#
+
+# End of hosts.deny.
diff --git a/patches/source/network-scripts/scripts/hosts.equiv b/patches/source/network-scripts/scripts/hosts.equiv
new file mode 100644
index 000000000..cb371ea39
--- /dev/null
+++ b/patches/source/network-scripts/scripts/hosts.equiv
@@ -0,0 +1,14 @@
+#
+# hosts.equiv This file describes the names of the hosts which are
+# to be considered "equivalent", i.e. which are to be
+# trusted enought for allowing rsh(1) commands.
+#
+# Version: @(#)/etc/hosts.equiv 2.00 04/30/93
+#
+# Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
+#
+#
+
+localhost
+
+# End of hosts.equiv.
diff --git a/patches/source/network-scripts/scripts/netconfig b/patches/source/network-scripts/scripts/netconfig
new file mode 100644
index 000000000..bb11b3eba
--- /dev/null
+++ b/patches/source/network-scripts/scripts/netconfig
@@ -0,0 +1,1080 @@
+#!/bin/bash
+# A script to do basic network configuration.
+# Mostly written by Patrick Volkerding <volkerdi@slackware.com>.
+# Modified to use /etc/rc.d/rc.inet1.conf Tue Aug 26 16:51:48 PDT 2003 <pjv>
+
+write_config_files() {
+#
+############################################################################
+# The rc.inet1.conf file.
+############################################################################
+#
+
+# If we're doing loopback, we don't want 127.0.0.1 and 255.255.255.0 in
+# rc.inet1.conf... it's better to leave the values null. However, since
+# we use the IP in other places, we need to make a copy for here.
+RCIPCOPY=("${IPADDRS[@]}")
+RCIP6COPY=("${IP6ADDRS[@]}")
+if [ "${RCIPCOPY[0]}" = "127.0.0.1/8" ]; then
+ RCIPCOPY=()
+fi
+if [ "${RCIP6COPY[0]}" = "::1/128" ]; then
+ RCIP6COPY=()
+fi
+
+# echo "Creating /$RC..."
+/bin/cat << ENDFILE > $RC
+# /etc/rc.d/rc.inet1.conf
+#
+# This file contains the configuration settings for network interfaces.
+#
+# If USE_DHCP[interface] is set to "yes", this overrides any other settings.
+# If you don't have an interface, leave the settings null ("").
+#
+# You can configure network interfaces other than eth0,eth1... by setting
+# IFNAME[interface] to the interface's name. If IFNAME[interface] is unset
+# or empty, it is assumed you're configuring eth<interface>.
+#
+# Several other parameters are available; the end of this file contains a
+# comprehensive set of examples.
+#
+# Important note for IPv6 stateless auto configuration (SLAAC) users:
+# From Slackware 15.0 onwards, you need to set USE_SLAAC[0]="yes" below.
+
+# =============================================================================
+
+ENDFILE
+
+if [ -n "$VLAN" ]; then
+ VLAN=".$(( 10#$VLAN ))"
+ echo "IFNAME[0]=\"eth0$VLAN\"" >>$RC
+fi
+
+/bin/cat << ENDFILE >> $RC
+# IPv4 config options for eth0$VLAN:
+IPADDRS[0]="${RCIPCOPY[@]}"
+USE_DHCP[0]="$USE_DHCP"
+# IPv6 config options for eth0$VLAN:
+IP6ADDRS[0]="${RCIP6COPY[@]}"
+USE_SLAAC[0]="$USE_SLAAC"
+USE_DHCP6[0]="$USE_DHCP6"
+# Generic options for eth0$VLAN:
+DHCP_HOSTNAME[0]="$DHCP_HOSTNAME"
+
+# IPv4 config options for eth1:
+IPADDRS[1]=""
+USE_DHCP[1]=""
+# IPv6 config options for eth1:
+IP6ADDRS[1]=""
+USE_SLAAC[1]=""
+USE_DHCP6[1]=""
+# Generic options for eth1:
+DHCP_HOSTNAME[1]=""
+
+# IPv4 config options for eth2:
+IPADDRS[2]=""
+USE_DHCP[2]=""
+# IPv6 config options for eth2:
+IP6ADDRS[2]=""
+USE_SLAAC[2]=""
+USE_DHCP6[2]=""
+# Generic options for eth2:
+DHCP_HOSTNAME[2]=""
+
+# IPv4 config options for eth3:
+IPADDRS[3]=""
+USE_DHCP[3]=""
+# IPv6 config options for eth3:
+IP6ADDRS[3]=""
+USE_SLAAC[3]=""
+USE_DHCP6[3]=""
+# Generic options for eth3:
+DHCP_HOSTNAME[3]=""
+
+# IPv4 default gateway IP address:
+GATEWAY="$GATEWAY"
+# IPv6 default gateway IP address:
+GATEWAY6="$GATEWAY6"
+
+# =============================================================================
+
+# Example of how to configure a bond (link aggregation) interface.
+# Note the addition of the BONDNICS and BONDMODE parameters.
+# BONDNICS is a space delimited list of interfaces to add to this bond. The
+# BONDNICS interfaces will be brought up and configured while bringing up the
+# bond interface, so do not need to be previously defined in rc.inet1.conf.
+# BONDMODE sets the bonding mode for this interface. If not specified when
+# BONDNICS has been used, the default is 'balance-rr'.
+# IFOPTS is a pipe (|) delimited list of bonding module specific settings to be
+# applied to the interface, and should always include the 'miimon' option when
+# configuring bonding - not using this option will result in network
+# degradation. In 'active-backup' mode, the 'primary' option should also be
+# supplied. When using '802.3ad' mode, set "lacp_rate fast" for faster
+# recovery from an interface failure. In other modes, the 'xmit_hash_policy'
+# should be set. See the /usr/src/linux/Documentation/networking/bonding.txt
+# file (search for "Bonding Driver Options") for the full set of options.
+#IFNAME[0]="bond0"
+#BONDNICS[0]="eth0 eth1"
+#BONDMODE[0]="balance-rr"
+#IFOPTS[0]="xmit_hash_policy layer2+3 | miimon 100"
+#IPADDRS[0]="192.168.0.1/24"
+#USE_DHCP[0]=""
+#DHCP_HOSTNAME[0]=""
+#IP6ADDRS[0]=""
+#USE_SLAAC[0]=""
+#USE_DHCP6[0]=""
+
+# =============================================================================
+
+# Example of how to configure a VLAN interface:
+# The VLAN ID is taken from the full interface name, which is comprised of the
+# underlying interface name, a period (.) and then the VLAN ID.
+# IFOPTS is a pipe (|) delimited list of VLAN module specific settings to be
+# applied to the interface. See the ip-link(8) man page (search for "VLAN Type
+# Support") for details of the options available. This option is not required
+# for a standard VLAN to be configured.
+#IFNAME[0]="eth0.10"
+#IFOPTS[0]=""
+#IPADDRS[0]="192.168.10.1/24"
+#USE_DHCP[0]=""
+#DHCP_HOSTNAME[0]=""
+#IP6ADDRS[0]=""
+#USE_SLAAC[0]=""
+#USE_DHCP6[0]=""
+
+# =============================================================================
+
+# Example of how to configure a bridge:
+# Note the added "BRNICS" variable which contains a space-separated list
+# of the physical or virtual network interfaces you want to add to the bridge.
+# IFOPTS is a pipe (|) delimited list of bridge module specific settings to be
+# applied to the interface. See the ip-link(8) man page (search for "BRIDGE
+# Type Support") for details of the options available. This option is not
+# required for a standard bridge to be configured.
+#IFNAME[0]="br0"
+#BRNICS[0]="eth0"
+#IFOPTS[0]=""
+#IPADDRS[0]="192.168.0.1/24"
+#USE_DHCP[0]=""
+#DHCP_HOSTNAME[0]=""
+
+# =============================================================================
+
+# Virtual interfaces to create - these are created before any address
+# configuration or bridge setup is done, so you may use these interfaces
+# as IFNAME or BRNICS values. These can be tun or tap interfaces:
+# adjust VIRTIFNAME and VIRTIFTYPE accordingly.
+# Starting with VIRTIFNAME[0] is mandatory, and each next one must be
+# incremented by one, so VIRTIFNAME[1], VIRTIFNAME[2], and so on.
+# Virtual tap interface example
+#VIRTIFNAME[0]="tap0"
+#VIRTIFTYPE[0]="tap"
+#VIRTIFUSER[0]="root"
+#VIRTIFGROUP[0]="root"
+
+# Virtual tun interface example
+#VIRTIFNAME[1]="tun0"
+#VIRTIFTYPE[1]="tun"
+#VIRTIFUSER[1]="someuser"
+#VIRTIFGROUP[1]="somegroup"
+
+# =============================================================================
+
+# Example config information for wlan0:
+# Uncomment the lines you need and fill in your data. You may not need all of
+# these for your wireless network.
+#IFNAME[4]="wlan0"
+#IPADDRS[4]=""
+#USE_DHCP[4]="yes"
+#DHCP_HOSTNAME[4]="icculus-wireless"
+#DHCP_KEEPRESOLV[4]="yes"
+#DHCP_KEEPNTP[4]="yes"
+#DHCP_KEEPGW[4]="yes"
+#DHCP_IPADDR[4]=""
+#WLAN_ESSID[4]=DARKSTAR
+#WLAN_MODE[4]=Managed
+#WLAN_RATE[4]="54M auto"
+#WLAN_CHANNEL[4]="auto"
+#WLAN_KEY[4]="D5A31F54ACF0487C2D0B1C10D2"
+#WLAN_IWPRIV[4]="set AuthMode=WPAPSK | set EncrypType=TKIP | set WPAPSK=96389dc66eaf7e6efd5b5523ae43c7925ff4df2f8b7099495192d44a774fda16"
+#WLAN_WPA[4]="wpa_supplicant"
+#WLAN_WPADRIVER[4]="wext"
+#WLAN_WPAWAIT[4]=30
+
+# =============================================================================
+
+# Some examples of additional network parameters that you can use.
+#IFNAME[4]="wlan0" # Use a different interface name instead of
+ # the default 'eth4'
+#IFOPTS[4]="" # A pipe (|) delimited list of interface type
+ # specific options to apply. These options
+ # can be found in the ip-link(8) man page in
+ # the approprite section for the interface
+ # type being configured.
+#HWADDR[4]="00:01:23:45:67:89" # Overrule the card's hardware MAC address
+#MTU[4]="" # The default MTU is 1500, but you might need
+ # 1360 when you use NAT'ed IPSec traffic.
+#PROMISCUOUS[4]="yes" # Set promiscuous mode on the interface.
+#DHCP_TIMEOUT[4]="15" # The default timeout for the DHCP client to
+ # wait for server resonse is 15 seconds, but
+ # you might want a shorter or longer wait.
+#DHCP_KEEPRESOLV[4]="yes" # If you don't want /etc/resolv.conf overwritten
+#DHCP_KEEPNTP[4]="yes" # If you don't want ntp.conf overwritten
+#DHCP_KEEPGW[4]="yes" # If you don't want the DHCP server to change
+ # your default gateway
+#DHCP_IPADDR[4]="" # Request a specific IP address from the DHCP
+ # server
+#DHCP_DEBUG[4]="yes" # Make dhcpcd show verbose diagnostics
+#DHCP_NOIPV4LL[4]="yes" # Do not assign an ipv4ll address when a DHCP
+ # server is not found (ipv4ll link-local
+ # adresses in the IP range 169.254.0.0/16 are
+ # also known as "zeroconf" addresses)
+#SLAAC_TIMEOUT[4]="15" # The default timeout for auto configuration to
+ # wait for the interface to come up is 15 sec.
+ # Increase the timeout if required.
+#SLAAC_PRIVIPGEN[4]="yes" # When assigning addresses via SLAAC, use the
+ # 'private' (RFC7217) address generation method.
+ # It is advisable to also set SLAAC_SECRET[x].
+#SLAAC_SECRET[4]="xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx"
+ # When SLAAC_PRIVIPGEN[x]="yes" is set, this is
+ # the secret to be used. This must be in the
+ # form of an IPv6 address. When left unset, a
+ # random secret is used (this is the default).
+#SLAAC_TEMPADDR[4]="yes" # Use a temporary address with SLAAC to enhance
+ # security.
+#USE_RA[4]="yes" # Accept router advertisements even when SLAAC
+ # is disabled on the interface.
+#WLAN_ESSID[4]="DARKSTAR" # An example of how you can override _any_
+ # parameter defined in rc.wireless.conf, by
+ # prepending 'WLAN_' to the parameter's name.
+ # Useful with multiple wireless interfaces.
+#WLAN_IWPRIV[4]="set AuthMode=WPAPSK | set EncrypType=TKIP | set WPAPSK=thekey"
+ # Some drivers require a private ioctl to be
+ # set through the iwpriv command. If more than
+ # one is required, you can place them in the
+ # IWPRIV parameter (separated with the pipe (|)
+ # character, see the example).
+#WLAN_WPA[4]="wpa_supplicant" # Run wpa_supplicant for WPA support
+#WLAN_WPADRIVER[4]="ndiswrapper"# Tell wpa_supplicant to specifically use the
+ # ndiswrapper driver (if you leave this empty
+ # the 'wext' driver is used by default)
+#WLAN_WPAWAIT[4]="30" # In case it takes long for the WPA association
+ # to finish, you can increase the wait time
+ # (defaults to 10 seconds)
+
+# =============================================================================
+
+# Change this to "yes" for debugging output to syslog (if available, stdout if
+# not).
+DEBUG_ETH_UP="no"
+
+# MAXNICS is the maximum number of interfaces that will be configured.
+# You may need to increase the MAXNICS value if you have many interfaces, or
+# you use multiple VLANs and/or bridges. The default is 6.
+#MAXNICS="6"
+ENDFILE
+#
+############################################################################
+# The networks file.
+############################################################################
+#
+#echo "Creating /$ETCNETWORKS..."
+/bin/cat <<EOF >$ETCNETWORKS
+#
+# networks This file describes a number of netname-to-address
+# mappings for the TCP/IP subsystem. It is mostly
+# used at boot time, when no name servers are running.
+#
+
+loopback 127.0.0.0
+localnet $NETWORK
+
+# End of networks.
+EOF
+chmod 644 $ETCNETWORKS
+#
+############################################################################
+# The hosts file.
+############################################################################
+#
+#echo "Creating /$HOSTS..."
+/bin/cat << EOF > $HOSTS
+#
+# hosts This file describes a number of hostname-to-address
+# mappings for the TCP/IP subsystem. It is mostly
+# used at boot time, when no name servers are running.
+# On small systems, this file can be used instead of a
+# "named" name server. Just add the names, addresses
+# and any aliases to this file...
+#
+
+# For loopbacking.
+127.0.0.1 localhost
+::1 localhost
+EOF
+[ -n "${IPADDRS[0]}" ] && echo -e "${IPADDRS[0]%%/*}\t\t$HOSTNM.$DOMAIN $HOSTNM" >>$HOSTS
+[ -n "${IP6ADDRS[0]}" ] && echo -e "${IP6ADDRS[0]%%/*}\t\t\t$HOSTNM.$DOMAIN $HOSTNM" >>$HOSTS
+chmod 644 $HOSTS
+#
+############################################################################
+# The resolv.conf file.
+############################################################################
+#
+if [ ! "$NAMESERVER" = "" ]; then
+ echo "search $DOMAIN" >$RESOLV
+ echo "nameserver $NAMESERVER" >>$RESOLV
+else
+ echo "search $DOMAIN" >$RESOLV
+fi
+if [ -f $RESOLV ]; then
+ chmod 644 $RESOLV
+fi
+#
+############################################################################
+# The rc.netdevice file.
+############################################################################
+#
+if [ -r /cardfound ]; then
+ if [ ! "`cat /cardfound`" = "" ]; then
+ cat << EOF > etc/rc.d/rc.netdevice
+# Load module for network device.
+# This script is automatically generated during the installation.
+
+/sbin/modprobe `cat /cardfound`
+
+EOF
+ chmod 755 etc/rc.d/rc.netdevice
+ fi
+fi
+rm -f $TMP/tempmsg /cardfound
+} # end write_config_files
+
+# Covert CIDR notation masks to old style dotted quad.
+cidr2mask() {
+ # https://forum.archive.openwrt.org/viewtopic.php?id=47986&p=1#p220781
+ set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
+ [ $1 -gt 1 ] && shift $1 || shift
+ echo "${1-0}.${2-0}.${3-0}.${4-0}"
+}
+
+# This checks IPv4 address syntax.
+# usage: syntax_check_v4 ADDRESS #-OF-EXPECTED-SEGMENTS (up to 4)
+# example: syntax_check_v4 123.22.43.1 4
+# returns: 0=found correct 1=too many fields 2=non numeric field found
+syntax_check_v4() {
+ RET_CODE=0
+ SCRATCH=$1
+ SCRATCH=`echo $SCRATCH | tr "." "/"`
+ INDEX=$2
+ while [ ! "$INDEX" = "0" ]; do
+ # OK, so I'm a LISP-head :^)
+ FIELD=`basename $SCRATCH`
+ SCRATCH=`dirname $SCRATCH`
+ if expr $FIELD + 1 1> /dev/null 2> /dev/null; then
+ true
+ else
+ RET_CODE=2; # non-numeric field
+ fi
+ INDEX=`expr $INDEX - 1`
+ done
+ if [ ! "$SCRATCH" = "." ]; then
+ RET_CODE=1; # too many arguments
+ fi
+ if [ "$3" = "WARN" -a ! "$RET_CODE" = "0" ]; then
+ cat << EOF > $TMP/tempmsg
+The IP address you entered:
+ $1
+is not valid.
+
+There should be $2 groups of numbers seperated by dots, for example:
+ 192.168.1.1
+
+Please correct any mistakes in the IP.
+EOF
+ dialog --title "INVALID IP" --ok-button "Back" --msgbox \
+ "`cat $TMP/tempmsg`" 12 72
+ rm -r $TMP/tempmsg
+ else
+ if [ "$3" = "ECHO" ]; then
+ echo $RET_CODE;
+ fi
+ fi
+ return $RET_CODE;
+}
+
+# This does cursary checks to validate an IPv6 address.
+syntax_check_v6() {
+ # We can only do a basic validation of the entered address
+ # as regexes for IPv6 addresses are very complex.
+ if [[ "$1" =~ ^[0-9a-fA-F:]+$ ]] && [[ "$1" =~ :[0-9a-fA-F]{1,4}$ ]]; then
+ return 0
+ else
+ dialog --title "INVALID IP" --ok-button "Back" --msgbox \
+"The IP address you entered:
+ $1
+is not valid.
+
+Please enter a valid IPv6 address." 9 72
+ fi
+ return 1
+}
+
+TMP=/var/log/setup/tmp
+if [ ! -d $TMP ]; then
+ mkdir -p $TMP
+ chmod 700 $TMP
+fi
+
+# Figure out where we are... cheap hack.
+if [ ! -e etc/slackware-version -a ! -e /etc/installer -a ! -e bin/bash ]; then
+ cd /
+fi;
+
+# IMPORTANT!!! NO LEADING '/' in the paths below, or this script will not
+# function from the bootdisk.
+RC=etc/rc.d/rc.inet1.conf # Where rc.inet1.conf file is.
+RESOLV=etc/resolv.conf # Where resolv.conf file is.
+HOSTS=etc/hosts # Where hosts file is.
+ETCNETWORKS=etc/networks # Where networks file is.
+#
+# defaults:
+IPADDRS=()
+IP6ADDRS=()
+USE_DHCP="" # Use DHCP? "" == no.
+USE_DHCP6=""
+DHCP_HOSTNAME="" # This is our DHCP hostname.
+NETWORK=127.0.0.0
+
+while [ 0 ]; do
+ cat << EOF > $TMP/tempmsg
+First, we'll need the name you'd like to give your host.
+Only the base hostname is needed right now - not the domain.
+For example: darkstar
+
+Enter hostname:
+EOF
+ dialog --title "ENTER HOSTNAME" --cancel-label "Exit" --inputbox \
+ "`cat $TMP/tempmsg`" 12 64 "$HOSTNM" 2> $TMP/SeThost
+ if [ $? = 1 -o $? = 255 ]; then
+ rm -f $TMP/SeThost $TMP/tempmsg
+ exit
+ fi
+ HOSTNM="`cat $TMP/SeThost`"
+ rm -f $TMP/SeThost $TMP/tempmsg
+ if [ ! "$HOSTNM" = "" ]; then
+ break;
+ fi
+done
+
+while [ 0 ]; do
+ cat << EOF > $TMP/tempmsg
+Now, we need the domain name for this machine, such as:
+ example.org
+Do not supply a leading '.'
+
+Enter domain name for $HOSTNM:
+EOF
+ dialog --title "ENTER DOMAINNAME FOR '$HOSTNM'" --cancel-label "Exit" \
+ --inputbox "`cat $TMP/tempmsg`" 12 59 "$DOMAIN" 2> $TMP/SeTdom
+ if [ $? = 1 -o $? = 255 ]; then
+ rm -f $TMP/SeTdom $TMP/tempmsg
+ exit
+ fi
+ DOMAIN="`cat $TMP/SeTdom`"
+ rm -f $TMP/SeTdom $TMP/tempmsg
+ if [ ! "$DOMAIN" = "" ]; then
+ break;
+ fi
+done
+
+dialog --title "CONNECT VIA VLAN" --defaultno --yesno \
+"Some advanced networking set ups require a VLAN ID in order to \
+connect to the network. Do you wish to configure a VLAN ID now?\n\n\
+Unless you are sure you require a VLAN ID, select 'No'." 8 68
+ERRNO="$?"
+if [ "$ERRNO" = "255" ]; then
+ exit
+elif [ "$ERRNO" = "1" ]; then
+ true
+else
+ while true; do
+ [ -r $TMP/SeTVLAN ] && VLAN="$(cat $TMP/SeTVLAN)"
+ dialog --title "VLAN ID" --cancel-label "Skip" --inputbox \
+ "Enter the VLAN ID used on this network:" 8 45 "$VLAN" 2>$TMP/reply
+ ERRNO="$?"
+ if [ "$ERRNO" = "255" ]; then
+ rm -f $TMP/SeTVLAN
+ exit
+ elif [ "$ERRNO" = "1" ]; then
+ unset VLAN
+ rm -f $TMP/SeTVLAN
+ break
+ else
+ VLAN="$(cat $TMP/reply)"
+ echo "$VLAN" >$TMP/SeTVLAN
+ if [[ ! "$VLAN" =~ ^[0-9]+$ ]]; then
+ dialog --title "VLAN ID" --ok-button "Back" --msgbox \
+ "That doesn't appear to be a valid VLAN ID." 5 46
+ if [ "$?" = "255" ]; then
+ exit
+ fi
+ continue
+ else
+ rm -f $TMP/SeTVLAN
+ break
+ fi
+ fi
+ done
+fi
+
+dialog --title "CONFIGURATION TYPE FOR '$HOSTNM.$DOMAIN'" \
+--default-item NetworkManager --cancel-button "Exit" \
+--menu \
+"Now we need to know how your machine connects to the network.\n\
+If you have an internal network card and an assigned IP address, gateway, \
+and DNS, use the 'static IP' choice to enter these values. If your IP \
+address is assigned by a DHCP server (commonly used by cable modem and DSL \
+services), select 'DHCP'. Select 'NetworkManager' if you would like to \
+have the NetworkManager daemon automatically handle your wired and \
+wireless network interfaces (this is simple and usually works). \
+IPv6 networks may also use SLAAC (Stateless Address Autoconfiguration) to \
+assign an address based on Router Advertisments. If you do not have a \
+network card, select the 'loopback' choice. \n\
+Which type of network setup would you like?" 22 77 5 \
+"static IP" "Use a static IPv4 or IPv6 address to configure ethernet" \
+"DHCP" "Use a DHCP (IPv4 or IPv6) server to configure ethernet" \
+"NetworkManager" "Autoconfigure network using NetworkManager" \
+"SLAAC" "Use SLAAC to configure ethernet (IPv6 only)" \
+"loopback" "Set up a loopback connection (modem or no net)" 2> $TMP/reply
+if [ $? = 1 -o $? = 255 ]; then
+ rm -f $TMP/reply
+ exit
+fi
+REPLY=`cat $TMP/reply`
+rm -f $TMP/reply
+
+if [ "$REPLY" = "DHCP" ]; then
+ dialog --title "SELECT DHCP TYPE" --default-item "DHCPv4" \
+ --cancel-button "Exit" --menu \
+"Please select the type of DHCP to use to configure your networking.
+Select 'DHCPv4' to configure for an IPv4 network (this is the most
+common type of network, and the safe choice). Select 'DHCPv6' for a
+pure IPv6 network, or 'Both' to try and set up both types of network." 13 73 3 \
+"DHCPv4" "An IPv4 based network, with no IPv6 configuration" \
+"DHCPv6" "An IPv6 based network, with no IPv4 configuration" \
+"Both" "A combination of IPv4 and IPv6 networks" 2>$TMP/reply
+ if [ $? = 1 -o $? = 255 ]; then
+ rm -f $TMP/reply
+ exit
+ fi
+ TYPE=`cat $TMP/reply`
+ if [ "$TYPE" = "DHCPv4" ]; then
+ USE_DHCP="yes"
+ elif [ "$TYPE" = "DHCPv6" ]; then
+ USE_DHCP6="yes"
+ else
+ USE_DHCP="yes"
+ USE_DHCP6="yes"
+ fi
+ dialog --title "SET DHCP HOSTNAME" --cancel-label "Skip" \
+ --inputbox "Some network providers require \
+that the DHCP hostname be set in order to connect. If so, they'll have assigned \
+a hostname to your machine, which may look something like CC-NUMBER-A (this \
+depends on your ISP). If you were assigned a DHCP hostname, please enter it \
+below. If you do not have a DHCP hostname, just leave it blank or select 'Skip'." 13 67 \
+ 2> $TMP/SeTDHCPHOST
+ ERRNO="$?"
+ if [ "$ERRNO" = "255" ]; then
+ rm -f $TMP/SeTDHCPHOST
+ exit
+ elif [ "$ERRNO" = "0" ]; then
+ # OK, if we actually got something, use it.
+ DHCP_HOSTNAME="$(cat $TMP/SeTDHCPHOST)"
+ fi
+ rm -f $TMP/SeTDHCPHOST
+elif [ "$REPLY" = "loopback" ]; then
+ LOOPBACK="yes"
+elif [ "$REPLY" = "NetworkManager" ]; then
+ LOOPBACK="yes"
+ NETWORKMANAGER="yes"
+elif [ "$REPLY" = "SLAAC" ]; then
+ LOOPBACK="no"
+ USE_SLAAC="yes"
+else
+ LOOPBACK="no"
+fi
+
+if [ "$LOOPBACK" = "no" -a ! "$USE_DHCP" = "yes" -a ! "$USE_SLAAC" = "yes" ]; then
+ while [ 0 ]; do
+ while [ 0 ]; do
+ if [ -r $TMP/SeTIPSv4 ]; then
+ IPADDRS=($(cat $TMP/SeTIPSv4))
+ fi
+ dialog --title "ENTER IPv4 ADDRESSES" --cancel-label "Skip" \
+ --colors --inputbox \
+"Enter the \Z1IPv4\Zn addresses for this host. You may list one or more,
+space delimited, IPv4 addresses with netmasks in the format:
+ <IP address>/<CIDR netmask>
+For example:
+ 111.112.113.114/24 or 111.112.113.114/24 10.0.1.114/8
+Old style netmask 255.255.255.0 is equivalent of 24 in CIDR style.
+If a netmask is not specified a default of 24 will be used.
+
+The first address entered will become the primary IPv4 address
+of this host. If you do not want to configure a static IPv4
+address, just leave it blank or select 'Skip'." \
+ 18 71 "${IPADDRS[*]}" 2> $TMP/SeTIPSv4
+ ERRNO="$?"
+ if [ "$ERRNO" = "1" ]; then
+ IPADDRS=()
+ rm -f $TMP/SeTIPSv4
+ break
+ elif [ "$ERRNO" = "255" ]; then
+ rm -f $TMP/SeTIPSv4
+ exit
+ fi
+ IPADDRS=($(cat $TMP/SeTIPSv4))
+ rm -f $TMP/SeTIPSv4
+ if [ "${IPADDRS[*]}" = "" ]; then
+ break
+ fi
+ for ((I=0; I < ${#IPADDRS[@]}; I++)); do
+ IP="${IPADDRS[$I]%/*}"
+ MASK="${IPADDRS[$I]#*/}"
+ if [ "$IP" = "" ]; then
+ dialog --title "NO IPv4 ADDRESSES" --ok-button "Back" --msgbox \
+ "No IP specified in entry: ${IPADDRS[$I]}." 5 55
+ if [ "$?" = "255" ]; then
+ rm -f $TMP/SeTIPSv4
+ exit
+ fi
+ continue 2
+ fi
+ syntax_check_v4 "$IP" 4 WARN || continue 2
+ if [ "$MASK" = "" ] || [ "$IP" = "$MASK" ]; then
+ IPADDRS[$I]="$IP/24"
+ MASK="24"
+ fi
+ if [[ ! "$MASK" =~ ^[0-9]+$ ]] || (($MASK <= 0)) || (($MASK > 32)); then
+ dialog --title "INVALID NETMASK" --msgbox \
+"Invalid netmask specified for entry: ${IPADDRS[$I]}.
+Valid netmasks will be in the range 1-32." 6 65
+ if [ "$?" = "255" ]; then
+ rm -f $TMP/SeTIPSv4
+ exit
+ fi
+ echo "${IPADDRS[@]}" >$TMP/SeTIPSv4
+ continue 2
+ fi
+ done
+ rm -f $TMP/SeTIPSv4
+ break
+ done
+
+ if [ ! "${IPADDRS[*]}" = "" ]; then
+ while [ 0 ]; do
+ if [ -r $TMP/SeTgateway4 ]; then
+ GATEWAY="`cat $TMP/SeTgateway4`"
+ fi
+ dialog --title "ENTER IPv4 GATEWAY ADDRESS" --cancel-label "Skip" --inputbox \
+"Enter the address for the IPv4 gateway on your network, such as:
+ `echo ${IPADDRS[0]} | cut -f 1-3 -d .`.1
+
+If you don't have an IPv4 gateway on your network, leave it blank
+or select 'Skip'.
+
+Enter IPv4 gateway address:" 14 69 "$GATEWAY" 2> $TMP/SeTgateway4
+ ERRNO="$?"
+ if [ "$ERRNO" = "1" ]; then
+ GATEWAY=""
+ rm -f $TMP/SeTgateway4
+ break
+ elif [ "$ERRNO" = "255" ]; then
+ rm -f $TMP/SeTgateway4
+ exit
+ fi
+ GATEWAY="`cat $TMP/SeTgateway4`"
+ rm -f $TMP/SeTgateway4
+ if [ "$GATEWAY" = "" ]; then
+ break
+ fi
+ syntax_check_v4 "$GATEWAY" 4 WARN
+ if [ $? = 0 ]; then
+ break
+ fi
+ done
+ rm -f $TMP/SeTgateway4
+ fi
+
+ while [ 0 ]; do
+ if [ -r $TMP/SeTIPSv6 ]; then
+ IP6ADDRS=($(cat $TMP/SeTIPSv6))
+ fi
+ dialog --title "ENTER IPv6 ADDRESSES" --cancel-label "Skip" \
+ --colors --inputbox \
+"Enter the \Z1IPv6\Zn addresses for this host. You may list one or more,
+space delimited, IPv6 addresses with their prefixes in the format:
+ <IP address>/<prefix>
+For example:
+ 1a:1b:1c:1d::abc/64 or 1a:1b:1c:1d::abc/64 2b2c::2:3:4:abc/64
+If a prefix is not specified a default of 64 will be used.
+
+If you do not want to configure a static IPv6 address or don't
+know what to put, just leave it blank or select 'Skip'." \
+ 16 70 "${IP6ADDRS[*]}" 2> $TMP/SeTIPSv6
+ ERRNO="$?"
+ if [ "$ERRNO" = "1" ]; then
+ IP6ADDRS=()
+ rm -f $TMP/SeTIPSv6
+ break
+ elif [ "$ERRNO" = "255" ]; then
+ rm -f $TMP/SeTIPSv6
+ exit
+ fi
+ IP6ADDRS=($(cat $TMP/SeTIPSv6))
+ rm -f $TMP/SeTIPSv6
+ if [ "${IP6ADDRS[*]}" = "" ]; then
+ break
+ fi
+ for ((I=0; I < ${#IP6ADDRS[@]}; I++)); do
+ IP="${IP6ADDRS[$I]%/*}"
+ PREFIX="${IP6ADDRS[$I]#*/}"
+ if [ "$IP" = "" ]; then
+ dialog --title "NO IPv6 ADDRESSES" --ok-button "Back" --msgbox \
+ "No IP specified in entry: ${IP6ADDRS[$I]}." 5 60
+ if [ "$?" = "255" ]; then
+ rm -f $TMP/SeTIPSv6
+ exit
+ fi
+ continue 2
+ fi
+ syntax_check_v6 "$IP" || continue 2
+ if [ "$PREFIX" = "" ] || [ "$IP" == "$PREFIX" ]; then
+ IP6ADDRS[$I]="$IP/64"
+ PREFIX="64"
+ fi
+ if [[ ! "$PREFIX" =~ ^[0-9]+$ ]] || (($PREFIX <= 0)) || (($PREFIX > 128)); then
+ dialog --title "INVALID PREFIX" --msgbox \
+"Invalid prefix specified for entry: ${IP6ADDRS[$I]}.
+Valid prefixes will be in the range 1-128." 6 70
+ if [ "$?" = "255" ]; then
+ rm -f $TMP/SeTIPSv6
+ exit
+ fi
+ echo "${IP6ADDRS[@]}" >$TMP/SeTIPSv6
+ continue 2
+ fi
+ done
+ rm -f $TMP/SeTIPSv6
+ break
+ done
+
+ if [ ! "${IP6ADDRS[*]}" = "" ]; then
+ while [ 0 ]; do
+ if [ -r $TMP/SeTgateway6 ]; then
+ GATEWAY6="`cat $TMP/SeTgateway6`"
+ fi
+ dialog --title "ENTER IPv6 GATEWAY ADDRESS" --cancel-label "Skip" --inputbox \
+"Enter the address for the IPv6 gateway on your network, such as:
+ fe80:426c:ffff::1
+
+If you don't have an IPv6 gateway on your network, leave it blank
+or select 'Skip'.
+
+Enter IPv6 gateway address:" 14 69 "$GATEWAY6" 2> $TMP/SeTgateway6
+ ERRNO="$?"
+ if [ "$ERRNO" = "1" ]; then
+ GATEWAY6=""
+ rm -f $TMP/SeTgateway6
+ break
+ elif [ "$ERRNO" = "255" ]; then
+ rm -f $TMP/SeTgateway6
+ exit
+ fi
+ GATEWAY6="`cat $TMP/SeTgateway6`"
+ rm -f $TMP/SeTgateway6
+ if [ "$GATEWAY6" = "" ]; then
+ break
+ fi
+ syntax_check_v6 "$GATEWAY6"
+ if [ $? = 0 ]; then
+ break
+ fi
+ done
+ rm -f $TMP/SeTgateway6
+ fi
+
+ if [ "${IPADDRS[*]}" = "" ] && [ "${IP6ADDRS[*]}" = "" ]; then
+ dialog --title "NO IP ADDRESSES" --colors --defaultno --yesno \
+"\Z1You have not configured any IP addresses for this host.
+Are you sure you want to proceed with no IPs?\Zn" 6 59
+ ERRNO="$?"
+ if [ "$ERRNO" = "255" ]; then
+ exit
+ elif [ "$ERRNO" = "1" ]; then
+ continue
+ fi
+ fi
+ break
+ done
+fi
+
+if [ "$LOOPBACK" = "no" ]; then
+ dialog --title "USE A NAMESERVER?" --yesno "Do you wish to configure \
+a nameserver?" 5 42
+ if [ $? = 0 ]; then
+ if [ ! "${IPADDRS[*]}" = "" ]; then
+ if [ ! "$GATEWAY" = "" ]; then
+ DNSSAMPLE="$GATEWAY"
+ DNSDEFAULT="$GATEWAY"
+ else
+ DNSSAMPLE="`echo ${IPADDRS[0]} | cut -f 1-3 -d .`.1"
+ DNSDEFAULT="${DNSSAMPLE%.1}."
+ fi
+ fi
+ if [ ! "${IP6ADDRS[*]}" = "" ]; then
+ if [ ! "$GATEWAY6" = "" ]; then
+ DNSSAMPLE="${DNSSAMPLE:+$DNSSAMPLE or }$GATEWAY6"
+ # Keep the v4 nameserver the default, for now.
+ DNSDEFAULT="${DNSDEFAULT:-$GATEWAY6}"
+ else
+ DNSSAMPLE="${DNSSAMPLE:+$DNSSAMPLE or }${IP6ADDRS[0]%:*}:1"
+ DNSDEFAULT="${DNSSAMPLE:-${IP6ADDRS[0]%:*}}:"
+ fi
+ fi
+ while [ "$NAMESERVER" = "" ]; do
+ dialog --title "ENTER NAMESERVER IP ADDRESS" --cancel-label "Skip" \
+ --inputbox \
+"Please give the IP address of the name server to use, such as
+ ${DNSSAMPLE:-1:2:3:4::1}
+You can add more Domain Name Servers later by editing
+ /$RESOLV.
+
+Primary name server to use:" 13 65 "$DNSDEFAULT" 2> $TMP/SeTns
+ ERRNO="$?"
+ if [ $ERRNO = 255 ]; then
+ rm -f $TMP/SeTns
+ exit
+ elif [ $ERRNO = 1 ]; then
+ rm -f $TMP/SeTns
+ NAMESERVER=""
+ break
+ else
+ NAMESERVER="`cat $TMP/SeTns`"
+ rm -f $TMP/SeTns
+ if [[ "$NAMESERVER" =~ ^.*:.*$ ]]; then
+ syntax_check_v6 "$NAMESERVER"
+ if [ ! $? = 0 ]; then
+ DNSDEFAULT="$NAMESERVER"
+ NAMESERVER=""
+ continue
+ fi
+ else
+ syntax_check_v4 "$NAMESERVER" 4 WARN
+ if [ ! $? = 0 ]; then
+ DNSDEFAULT="$NAMESERVER"
+ NAMESERVER=""
+ continue
+ fi
+ fi
+ break
+ fi
+ done
+ fi
+elif [ "$LOOPBACK" = "yes" ]; then
+ IPADDRS=(127.0.0.1/8)
+ IP6ADDRS=(::1/128)
+ VLAN=""
+fi
+
+# Check for existing network driver:
+unset DONOTPROBE
+if cat /proc/net/dev | grep eth0 1> /dev/null 2> /dev/null ; then
+ DONOTPROBE=true
+fi
+
+# Really, this rc.netdevice thing is mostly obsolete except for
+# handmade local scripts anyway, these days with udev...
+# So, we'll skip it:
+DONOTPROBE=true
+
+if [ -d lib/modules/`uname -r` \
+ -a ! "$LOOPBACK" = "yes" \
+ -a ! -x etc/rc.d/rc.hotplug \
+ -a ! "$DONOTPROBE" = "true" \
+ -a ! -r /cardfound ]; then
+ dialog --title "PROBE FOR NETWORK CARD?" --menu "If you like, we \
+can look to see what kind of network card you have in your machine, and \
+if we find one create an /etc/rc.d/rc.netdevice script to load the module \
+for it at boot time. There's a slight bit of danger that the probing \
+can cause problems, but it almost always works. If you'd rather configure \
+your system manually, you can skip the probing process and edit \
+/etc/rc.d/rc.modules or /etc/modules.conf later to have it load the right module." \
+16 68 2 \
+"probe" "look for network cards to set up" \
+"skip" "skip probe; edit /etc/rc.d/rc.modules later" 2> $TMP/reply
+ if [ $? = 1 -o $? = 255 ]; then
+ rm -f $TMP/reply
+ exit
+ fi
+ REPLY=`cat $TMP/reply`
+ rm -f $TMP/reply
+ if [ ! "$REPLY" = "skip" ]; then
+ for card in 3c59x 82596 dgrs eepro100 e1000 epic100 hp100 lance \
+ ne2k-pci olympic pcnet32 rcpci 8139too 8139cp tlan tulip via-rhine \
+ yellowfin natsemi ; do
+ chroot . /sbin/modprobe $card 2> /dev/null
+ if [ $? = 0 ]; then
+ dialog --title "CARD DETECTED" --msgbox "A networking card using \
+the $card.o module has been detected." 5 72
+ echo "$card" > /cardfound
+ break;
+ fi
+ done
+ if [ ! -r /cardfound ]; then
+ # Don't probe for com20020, because it doesn't check and will always load.
+ # Don't probe for arlan, because it needs irq= to work.
+ # Don't probe for com90io or com90xx because they taint the kernel.
+ for card in depca ibmtr 3c359 3c501 3c503 3c505 3c507 3c509 3c515 ac3200 \
+ abyss acenic at1700 cosa cs89x0 de4x5 de600 \
+ de620 dmfe dl2k e2100 eepro eexpress eth16i ewrk3 fealnx hamachi hostess_sv11 \
+ hp-plus hp lanstreamer ni5010 ni52 ni65 ns83820 sb1000 sealevel sis900 sk98lin skfp smc-ultra \
+ smc9194 smctr starfire sungem sunhme tg3 wd e100 iph5526 lp486e tmspci winbond-840 ; do
+ chroot . /sbin/modprobe $card 2> /dev/null
+ if [ $? = 0 ]; then
+ dialog --title "CARD DETECTED" --msgbox "A networking card using \
+the $card.o module has been detected." 5 72
+ echo "$card" > /cardfound
+ break
+ fi
+ done
+ fi
+ if [ ! -r /cardfound ]; then
+ dialog --title "NO CARD DETECTED" --msgbox "Sorry, but no network \
+card could be probed for on your system. Some cards (like non-PCI NE2000s) \
+must be supplied with the I/O address to use and can't be probed for safely. \
+You'll have to try to configure the card later by editing \
+/etc/rc.d/rc.modules or recompiling your kernel." 9 70
+ fi
+ fi
+fi
+
+if [ "$LOOPBACK" = "yes" -a ! "$NETWORKMANAGER" = "yes" ]; then
+ dialog --title "NETWORK SETUP COMPLETE" --yesno "Your networking \
+system is now configured to use loopback:
+
+IP addresses: 127.0.0.1/8 ::1/128
+
+Is this correct? Press 'Yes' to continue, or 'No' to abandon." 9 70
+ RETVAL=$?
+ if [ "$RETVAL" = "255" ]; then
+ exit
+ fi
+elif [ "$LOOPBACK" = "yes" -a "$NETWORKMANAGER" = "yes" ]; then
+ dialog --title "NETWORK SETUP COMPLETE" --yesno "Your networking \
+system is now configured to use NetworkManager for
+wired and wireless network management. To set up wireless networks
+and view status, add the Network Management control panel widget to
+your desktop.
+
+Is this correct? Press 'Yes' to confirm, or 'No' to abandon." 10 71
+ RETVAL=$?
+ if [ "$RETVAL" = "255" ]; then
+ exit
+ fi
+elif [ "$USE_SLAAC" = "yes" ]; then
+ dialog --title "NETWORK SETUP COMPLETE" --yesno \
+"Your system is now set up to autoconfigure an IPv6 IP address:
+ Hostname: $HOSTNM
+ Domain name: $DOMAIN
+ VLAN ID: ${VLAN:-(none)}
+ IP addresses: (use IPv6 SLAAC)
+ Nameserver: ${NAMESERVER:-(none)}
+
+If this is correct, hit 'Yes' to confirm, or 'No' to abandon." 12 66
+ RETVAL=$?
+ if [ "$RETVAL" = "255" ]; then
+ exit
+ fi
+elif [ "$USE_DHCP" = "" -a "$USE_DHCP6" = "" ]; then
+ while [ 0 ]; do
+ dialog --title "CONFIRM NETWORK SETUP" \
+--ok-label Accept --extra-label Edit --cancel-label Abandon --inputmenu \
+"These are the settings you have entered. To accept them and complete \
+the networking setup, press ENTER. If you need to make any changes, you \
+can do that now using 'Edit' (or reconfigure later using 'netconfig')." \
+24 75 15 \
+"Hostname:" "$HOSTNM" \
+"Domain Name:" "$DOMAIN" \
+"VLAN ID:" "$VLAN" \
+"IPv4 Addresses:" "${IPADDRS[*]}" \
+"IPv4 Gateway:" "$GATEWAY" \
+"IPv6 Addresses:" "${IP6ADDRS[*]}" \
+"IPv6 Gateway:" "$GATEWAY6" \
+"Nameserver:" "$NAMESERVER" 2> $TMP/tempmsg
+ RETVAL=$?
+ if [ "$RETVAL" = "3" ]; then
+ FIELD=`cat $TMP/tempmsg | cut -f 1 -d : | cut -f 2- -d ' '`
+ NEWVAL=`cat $TMP/tempmsg | cut -f 2 -d : | cut -f 2- -d ' '`
+ if [ "$FIELD" = "Hostname" ]; then
+ HOSTNM=$NEWVAL
+ elif [ "$FIELD" = "Domain Name" ]; then
+ DOMAIN=$NEWVAL
+ elif [ "$FIELD" = "VLAN ID" ]; then
+ VLAN=$NEWVAL
+ elif [ "$FIELD" = "IPv4 Addresses" ]; then
+ IPADDRS=( $NEWVAL )
+ elif [ "$FIELD" = "IPv4 Gateway" ]; then
+ GATEWAY=$NEWVAL
+ elif [ "$FIELD" = "IPv6 Addresses" ]; then
+ IP6ADDRS=( $NEWVAL )
+ elif [ "$FIELD" = "IPv6 Gateway" ]; then
+ GATEWAY6=$NEWVAL
+ elif [ "$FIELD" = "Nameserver" ]; then
+ NAMESERVER=$NEWVAL
+ fi
+ elif [ "$RETVAL" = "255" ]; then
+ exit
+ else
+ break
+ fi
+ done
+ if [ ! "${IPADDRS[0]}" = "" ]; then
+ NM="$(cidr2mask "${IPADDRS[0]#*/}")"
+ BROADCAST="$(ipmask "$NM" "${IPADDRS[0]%/*}" | cut -f 1 -d ' ')"
+ NETWORK="$(ipmask "$NM" "${IPADDRS[0]%/*}" | cut -f 2 -d ' ')"
+ fi
+else # DHCP was used
+ dialog --title "CONFIRM NETWORK SETUP" \
+--yesno "Your networking system is now configured to use DHCP:
+
+ Hostname: $HOSTNM
+ Domain name: $DOMAIN
+ VLAN ID: ${VLAN:-(none)}
+ DHCP hostname: ${DHCP_HOSTNAME:-(none)}
+ IP addresses: (use DHCP server)
+ Netmask & Prefix: (use DHCP server)
+ Gateways: (use DHCP server)
+ Nameserver: (use DHCP server)
+
+Is this correct? Press 'Yes' to continue, or 'No' to reconfigure." 16 76
+ RETVAL=$?
+fi
+
+if [ "$RETVAL" = "0" ]; then
+ # Write the hostname with domain to /etc/HOSTNAME:
+ echo $HOSTNM.$DOMAIN > etc/HOSTNAME
+ # Also make sure the hostname is written to /etc/NetworkManager/NetworkManager.conf:
+ if [ -w etc/NetworkManager/NetworkManager.conf ]; then
+ sed -i "s/^hostname=.*$/hostname=$HOSTNM/g" etc/NetworkManager/NetworkManager.conf
+ fi
+ write_config_files
+ if [ "$NETWORKMANAGER" = "yes" -a -r etc/rc.d/rc.networkmanager ]; then
+ chmod 755 etc/rc.d/rc.networkmanager
+ fi
+ dialog --msgbox "Settings accepted. Basic network configuration is complete." 6 40
+else
+ dialog --msgbox "Settings discarded. Run the 'netconfig' command again if you need to reconfigure your network settings." 6 60
+fi
+
+exit $RETVAL
diff --git a/patches/source/network-scripts/scripts/networks b/patches/source/network-scripts/scripts/networks
new file mode 100644
index 000000000..50d5162ee
--- /dev/null
+++ b/patches/source/network-scripts/scripts/networks
@@ -0,0 +1,10 @@
+#
+# networks This file describes a number of netname-to-address
+# mappings for the TCP/IP subsystem. It is mostly
+# used at boot time, when no name servers are running.
+#
+
+loopback 127.0.0.0
+localnet 127.0.0.0
+
+# End of networks.
diff --git a/patches/source/network-scripts/scripts/nntpserver b/patches/source/network-scripts/scripts/nntpserver
new file mode 100644
index 000000000..3fa9a61b1
--- /dev/null
+++ b/patches/source/network-scripts/scripts/nntpserver
@@ -0,0 +1 @@
+news.my_news_server.com
diff --git a/patches/source/network-scripts/scripts/protocols b/patches/source/network-scripts/scripts/protocols
new file mode 100644
index 000000000..db3254c97
--- /dev/null
+++ b/patches/source/network-scripts/scripts/protocols
@@ -0,0 +1,146 @@
+#
+# Internet protocols
+#
+# $FreeBSD: src/etc/protocols,v 1.16 2002/02/10 08:19:58 dd Exp $
+# from: @(#)protocols 5.1 (Berkeley) 4/17/89
+#
+# See also http://www.iana.org/assignments/protocol-numbers
+#
+ip 0 IP # internet protocol, pseudo protocol number
+#hopopt 0 HOPOPT # hop-by-hop options for ipv6
+icmp 1 ICMP # internet control message protocol
+igmp 2 IGMP # internet group management protocol
+ggp 3 GGP # gateway-gateway protocol
+ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'')
+st2 5 ST2 # ST2 datagram mode (RFC 1819)
+tcp 6 TCP # transmission control protocol
+cbt 7 CBT # CBT, Tony Ballardie <A.Ballardie@cs.ucl.ac.uk>
+egp 8 EGP # exterior gateway protocol
+igp 9 IGP # any private interior gateway (Cisco: for IGRP)
+bbn-rcc 10 BBN-RCC-MON # BBN RCC Monitoring
+nvp 11 NVP-II # Network Voice Protocol
+pup 12 PUP # PARC universal packet protocol
+argus 13 ARGUS # ARGUS
+emcon 14 EMCON # EMCON
+xnet 15 XNET # Cross Net Debugger
+chaos 16 CHAOS # Chaos
+udp 17 UDP # user datagram protocol
+mux 18 MUX # Multiplexing protocol
+dcn 19 DCN-MEAS # DCN Measurement Subsystems
+hmp 20 HMP # host monitoring protocol
+prm 21 PRM # packet radio measurement protocol
+xns-idp 22 XNS-IDP # Xerox NS IDP
+trunk-1 23 TRUNK-1 # Trunk-1
+trunk-2 24 TRUNK-2 # Trunk-2
+leaf-1 25 LEAF-1 # Leaf-1
+leaf-2 26 LEAF-2 # Leaf-2
+rdp 27 RDP # "reliable datagram" protocol
+irtp 28 IRTP # Internet Reliable Transaction Protocol
+iso-tp4 29 ISO-TP4 # ISO Transport Protocol Class 4
+netblt 30 NETBLT # Bulk Data Transfer Protocol
+mfe-nsp 31 MFE-NSP # MFE Network Services Protocol
+merit-inp 32 MERIT-INP # MERIT Internodal Protocol
+sep 33 SEP # Sequential Exchange Protocol
+3pc 34 3PC # Third Party Connect Protocol
+idpr 35 IDPR # Inter-Domain Policy Routing Protocol
+xtp 36 XTP # Xpress Tranfer Protocol
+ddp 37 DDP # Datagram Delivery Protocol
+idpr-cmtp 38 IDPR-CMTP # IDPR Control Message Transport Proto
+tp++ 39 TP++ # TP++ Transport Protocol
+il 40 IL # IL Transport Protocol
+ipv6 41 IPV6 # ipv6
+sdrp 42 SDRP # Source Demand Routing Protocol
+ipv6-route 43 IPV6-ROUTE # routing header for ipv6
+ipv6-frag 44 IPV6-FRAG # fragment header for ipv6
+idrp 45 IDRP # Inter-Domain Routing Protocol
+rsvp 46 RSVP # Resource ReSerVation Protocol
+gre 47 GRE # Generic Routing Encapsulation
+mhrp 48 MHRP # Mobile Host Routing Protocol
+bna 49 BNA # BNA
+esp 50 ESP # encapsulating security payload
+ah 51 AH # authentication header
+i-nlsp 52 I-NLSP # Integrated Net Layer Security TUBA
+swipe 53 SWIPE # IP with Encryption
+narp 54 NARP # NBMA Address Resolution Protocol
+mobile 55 MOBILE # IP Mobility
+tlsp 56 TLSP # Transport Layer Security Protocol
+skip 57 SKIP # SKIP
+ipv6-icmp 58 IPV6-ICMP # ICMP for IPv6
+ipv6-nonxt 59 IPV6-NONXT # no next header for ipv6
+ipv6-opts 60 IPV6-OPTS # destination options for ipv6
+# 61 # any host internal protocol
+cftp 62 CFTP # CFTP
+# 63 # any local network
+sat-expak 64 SAT-EXPAK # SATNET and Backroom EXPAK
+kryptolan 65 KRYPTOLAN # Kryptolan
+rvd 66 RVD # MIT Remote Virtual Disk Protocol
+ippc 67 IPPC # Internet Pluribus Packet Core
+# 68 # any distributed file system
+sat-mon 69 SAT-MON # SATNET Monitoring
+visa 70 VISA # VISA Protocol
+ipcv 71 IPCV # Internet Packet Core Utility
+cpnx 72 CPNX # Computer Protocol Network Executive
+cphb 73 CPHB # Computer Protocol Heart Beat
+wsn 74 WSN # Wang Span Network
+pvp 75 PVP # Packet Video Protocol
+br-sat-mon 76 BR-SAT-MON # Backroom SATNET Monitoring
+sun-nd 77 SUN-ND # SUN ND PROTOCOL-Temporary
+wb-mon 78 WB-MON # WIDEBAND Monitoring
+wb-expak 79 WB-EXPAK # WIDEBAND EXPAK
+iso-ip 80 ISO-IP # ISO Internet Protocol
+vmtp 81 VMTP # Versatile Message Transport
+secure-vmtp 82 SECURE-VMTP # SECURE-VMTP
+vines 83 VINES # VINES
+ttp 84 TTP # TTP
+nsfnet-igp 85 NSFNET-IGP # NSFNET-IGP
+dgp 86 DGP # Dissimilar Gateway Protocol
+tcf 87 TCF # TCF
+eigrp 88 EIGRP # Enhanced Interior Routing Protocol (Cisco)
+ospf 89 OSPFIGP # Open Shortest Path First IGP
+sprite-rpc 90 Sprite-RPC # Sprite RPC Protocol
+larp 91 LARP # Locus Address Resolution Protocol
+mtp 92 MTP # Multicast Transport Protocol
+ax.25 93 AX.25 # AX.25 Frames
+ipip 94 IPIP # Yet Another IP encapsulation
+micp 95 MICP # Mobile Internetworking Control Pro.
+scc-sp 96 SCC-SP # Semaphore Communications Sec. Pro.
+etherip 97 ETHERIP # Ethernet-within-IP Encapsulation
+encap 98 ENCAP # Yet Another IP encapsulation
+# 99 # any private encryption scheme
+gmtp 100 GMTP # GMTP
+ifmp 101 IFMP # Ipsilon Flow Management Protocol
+pnni 102 PNNI # PNNI over IP
+pim 103 PIM # Protocol Independent Multicast
+aris 104 ARIS # ARIS
+scps 105 SCPS # SCPS
+qnx 106 QNX # QNX
+a/n 107 A/N # Active Networks
+ipcomp 108 IPComp # IP Payload Compression Protocol
+snp 109 SNP # Sitara Networks Protocol
+compaq-peer 110 Compaq-Peer # Compaq Peer Protocol
+ipx-in-ip 111 IPX-in-IP # IPX in IP
+vrrp 112 VRRP # Virtual Router Redundancy Protocol
+pgm 113 PGM # PGM Reliable Transport Protocol
+# 114 # any 0-hop protocol
+l2tp 115 L2TP # Layer Two Tunneling Protocol
+ddx 116 DDX # D-II Data Exchange
+iatp 117 IATP # Interactive Agent Transfer Protocol
+st 118 ST # Schedule Transfer
+srp 119 SRP # SpectraLink Radio Protocol
+uti 120 UTI # UTI
+smp 121 SMP # Simple Message Protocol
+sm 122 SM # SM
+ptp 123 PTP # Performance Transparency Protocol
+isis 124 ISIS # ISIS over IPv4
+fire 125 FIRE
+crtp 126 CRTP # Combat Radio Transport Protocol
+crudp 127 CRUDP # Combat Radio User Datagram
+sscopmce 128 SSCOPMCE
+iplt 129 IPLT
+sps 130 SPS # Secure Packet Shield
+pipe 131 PIPE # Private IP Encapsulation within IP
+sctp 132 SCTP # Stream Control Transmission Protocol
+fc 133 FC # Fibre Channel
+# 134-254 # Unassigned
+divert 254 DIVERT # Divert pseudo-protocol [non IANA]
+# 255 # Reserved
diff --git a/patches/source/network-scripts/scripts/rc.inet1 b/patches/source/network-scripts/scripts/rc.inet1
new file mode 100644
index 000000000..d33ab7747
--- /dev/null
+++ b/patches/source/network-scripts/scripts/rc.inet1
@@ -0,0 +1,703 @@
+#!/bin/bash
+# /etc/rc.d/rc.inet1
+# This script is used to bring up the various network interfaces.
+#
+# @(#)/etc/rc.d/rc.inet1 10.2 Sun Jul 24 12:45:56 PDT 2005 (pjv)
+
+############################
+# READ NETWORK CONFIG FILE #
+############################
+
+# Get the configuration information from /etc/rc.d/rc.inet1.conf:
+. /etc/rc.d/rc.inet1.conf
+
+###########
+# LOGGING #
+###########
+
+# Message logging.
+info_log() {
+ # If possible, log events in /var/log/messages:
+ if [ -f /var/run/syslogd.pid ] && [ -x /usr/bin/logger ]; then
+ /usr/bin/logger -t "rc.inet1" --id="$$" "$*"
+ else
+ printf "%s: %s\\n" "rc.inet1" "$*"
+ fi
+}
+
+# Verbose logging.
+debug_log() {
+ if [ "$DEBUG_ETH_UP" = "yes" ]; then
+ info_log "$*"
+ fi
+}
+
+############################
+# DETERMINE INTERFACE LIST #
+############################
+
+# Compose a list of interfaces from /etc/rc.d/rc.inet1.conf (with a maximum
+# of 6 interfaces, but you can easily enlarge the interface limit
+# - send me a picture of such a box :-).
+# If a value for IFNAME[n] is not set, we assume it is an eth'n' interface.
+# This way, the new script is compatible with older rc.inet1.conf files.
+# The IFNAME array will be used to determine which interfaces to bring up/down.
+MAXNICS=${MAXNICS:-6}
+i=0
+while [ $i -lt $MAXNICS ];
+do
+ IFNAME[$i]=${IFNAME[$i]:=eth${i}}
+ i=$((i+1))
+done
+debug_log "List of interfaces: ${IFNAME[*]}"
+
+####################
+# PRE-LOAD MODULES #
+####################
+
+for i in "${IFNAME[@]}"; do
+ # If the interface isn't in the kernel yet (but there's an alias for it in modules.conf),
+ # then it should be loaded first:
+ if [ ! -e /sys/class/net/${i%%[:.]*} ]; then # no interface yet
+ if /sbin/modprobe -c | grep -v "^#" | grep -w "alias ${i%%[:.]*}" | grep -vw "alias ${i%%[:.]*} off" >/dev/null; then
+ debug_log "/sbin/modprobe ${i%%[:.]*}"
+ /sbin/modprobe ${i%%[:.]*}
+ _DID_MODPROBE=1
+ fi
+ fi
+done
+# Normally the ipv6 module would be automatically loaded when the first IP is assigned to an
+# interface (assuming ipv6 has not been disabled entirely), but autoconf/accept_ra need to be
+# set to 0 before that happens, so try to pre-load ipv6 here.
+if [ ! -e /proc/sys/net/ipv6 ]; then
+ debug_log "/sbin/modprobe ipv6"
+ /sbin/modprobe -q ipv6
+ _DID_MODPROBE=1
+fi
+# If we did any module loading in the blocks above, sleep for a couple of
+# seconds to give time for everything to "take"
+[ -n "${_DID_MODPROBE}" ] && sleep 2
+unset _DID_MODPROBE
+
+######################
+# LOOPBACK FUNCTIONS #
+######################
+
+# Function to bring up the loopback interface. If loopback is
+# already up, do nothing.
+lo_up() {
+ if [ -e /sys/class/net/lo ]; then
+ if ! /sbin/ip link show dev lo | grep -wq -e "state UP" -e "state UNKNOWN" ; then
+ info_log "lo: configuring interface"
+ debug_log "/sbin/ip -4 address add 127.0.0.1/8 dev lo"
+ /sbin/ip -4 address add 127.0.0.1/8 dev lo
+ if [ -e /proc/sys/net/ipv6 ]; then
+ debug_log "/sbin/ip -6 address add ::1/128 dev lo"
+ /sbin/ip -6 address add ::1/128 dev lo
+ fi
+ debug_log "/sbin/ip link set dev lo up"
+ /sbin/ip link set dev lo up
+ debug_log "/sbin/ip route add 127.0.0.0/8 dev lo"
+ /sbin/ip route add 127.0.0.0/8 dev lo
+ fi
+ fi
+}
+
+# Function to take down the loopback interface:
+lo_down() {
+ if [ -e /sys/class/net/lo ]; then
+ info_log "lo: de-configuring interface"
+ debug_log "/sbin/ip address flush dev lo"
+ /sbin/ip address flush dev lo
+ debug_log "/sbin/ip link set dev lo down"
+ /sbin/ip link set dev lo down
+ fi
+}
+
+#######################
+# INTERFACE FUNCTIONS #
+#######################
+
+# Function to create virtual interfaces
+virtif_create() {
+ # argument is 'i' - the position of this interface in the VIRTIFNAME array.
+ # this loop goes from i=0 to i=number_of_configured_virtual_interfaces_minus_one
+ # which means it doesn't do anything if there are none.
+ for i in $(seq 0 $((${#VIRTIFNAME[@]} - 1))); do
+ info_log "${VIRTIFNAME[$i]}: creating virtual interface"
+ debug_log "/sbin/ip tuntap add dev ${VIRTIFNAME[$i]} mode ${VIRTIFTYPE[$i]} user ${VIRTIFUSER[$i]} group ${VIRTIFGROUP[$i]}"
+ /sbin/ip tuntap add dev ${VIRTIFNAME[$i]} mode ${VIRTIFTYPE[$i]} user ${VIRTIFUSER[$i]} group ${VIRTIFGROUP[$i]}
+ done
+}
+
+# Function to destroy virtual interfaces
+virtif_destroy() {
+ # argument is 'i' - the position of this interface in the VIRTIFNAME array.
+ for i in $(seq 0 $((${#VIRTIFNAME[@]} - 1))); do
+ info_log "${VIRTIFNAME[$i]}: destroying virtual interface"
+ debug_log "/sbin/ip tuntap del dev ${VIRTIFNAME[$i]} mode ${VIRTIFTYPE[$i]}"
+ /sbin/ip tuntap del dev ${VIRTIFNAME[$i]} mode ${VIRTIFTYPE[$i]}
+ done
+}
+
+# Function to assemble a bridge interface.
+br_open() {
+ # argument is 'i' - the position of this interface in the IFNAME array.
+ info_log "${IFNAME[$1]}: creating bridge"
+ debug_log "/sbin/ip link add name ${IFNAME[$1]} type bridge"
+ /sbin/ip link add name ${IFNAME[$1]} type bridge
+ for BRIF in ${BRNICS[$1]}; do
+ debug_log "/sbin/ip address flush dev $BRIF"
+ /sbin/ip address flush dev $BRIF
+ debug_log "/sbin/ip link set dev $BRIF master ${IFNAME[$1]}"
+ /sbin/ip link set dev $BRIF master ${IFNAME[$1]}
+ debug_log "/sbin/ip link set dev $BRIF up"
+ /sbin/ip link set dev $BRIF up
+ done
+ while read -r -d \| IFOPT; do
+ if [ -n "$IFOPT" ]; then
+ debug_log "/sbin/ip link set dev ${IFNAME[$1]} type bridge $IFOPT"
+ /sbin/ip link set dev ${IFNAME[$1]} type bridge $IFOPT
+ fi
+ done <<<"${IFOPTS[$1]/%|*([[:blank:]])}|" # The | on the end is required.
+ # Don't bring up the interface if it will be brought up later during IP configuration.
+ # This prevents a situation where SLAAC takes a while to apply if the interface is already up.
+ if [ -z "${IPADDRS[$1]}" ] && [ -z "${IP6ADDRS[$1]}" ] && [ -z "${IPADDR[$1]}" ] && [ "${USE_DHCP[$1]}" != "yes" ] && [ "${USE_DHCP6[$1]}" != "yes" ] && [ "${USE_SLAAC[$1]}" != "yes" ]; then
+ debug_log "/sbin/ip link set dev ${IFNAME[$1]} up"
+ /sbin/ip link set dev ${IFNAME[$1]} up
+ fi
+}
+
+# Function to disassemble a bridge interface.
+br_close() {
+ # argument is 'i' - the position of this interface in the IFNAME array.
+ info_log "${IFNAME[$1]}: destroying bridge"
+ debug_log "/sbin/ip link set dev ${IFNAME[$1]} down"
+ /sbin/ip link set dev ${IFNAME[$1]} down
+ for BRIF in $(ls --indicator-style=none /sys/class/net/${IFNAME[$1]}/brif/)
+ do
+ debug_log "/sbin/ip link set dev $BRIF nomaster"
+ /sbin/ip link set dev $BRIF nomaster
+ done
+ for BRIF in ${BRNICS[$1]}; do
+ debug_log "/sbin/ip link set dev $BRIF down"
+ /sbin/ip link set dev $BRIF down
+ done
+ debug_log "/sbin/ip link del ${IFNAME[$1]}"
+ /sbin/ip link del ${IFNAME[$1]}
+}
+
+# Function to create a bond.
+bond_create() {
+ # Argument is 'i' - the position of this interface in the IFNAME array.
+ info_log "${IFNAME[$1]}: creating bond"
+ debug_log "/sbin/ip link add name ${IFNAME[$1]} type bond"
+ /sbin/ip link add name ${IFNAME[$1]} type bond
+ debug_log "/sbin/ip link set dev ${IFNAME[$1]} type bond mode ${BONDMODE[$1]:-balance-rr}"
+ /sbin/ip link set dev ${IFNAME[$1]} type bond mode ${BONDMODE[$1]:-balance-rr}
+ for BONDIF in ${BONDNICS[$1]}; do
+ debug_log "/sbin/ip address flush dev $BONDIF"
+ /sbin/ip address flush dev $BONDIF
+ debug_log "/sbin/ip link set $BONDIF master ${IFNAME[$1]}"
+ /sbin/ip link set $BONDIF master ${IFNAME[$1]}
+ debug_log "/sbin/ip link set dev $BONDIF up"
+ /sbin/ip link set dev $BONDIF up
+ done
+ # This has to be done *after* the interface is brought up because the
+ # 'primary <interface>' option has to occur after the interface is active.
+ while read -r -d \| IFOPT; do
+ if [ -n "$IFOPT" ]; then
+ debug_log "/sbin/ip link set dev ${IFNAME[$1]} type bond $IFOPT"
+ /sbin/ip link set dev ${IFNAME[$1]} type bond $IFOPT
+ fi
+ done <<<"${IFOPTS[$1]/%|*([[:blank:]])}|" # The | on the end is required.
+}
+
+# Function to destroy a bond.
+bond_destroy() {
+ # Argument is 'i' - the position of this interface in the IFNAME array.
+ info_log "${IFNAME[$1]}: destroying bond"
+ debug_log "/sbin/ip link set dev ${IFNAME[$1]} down"
+ /sbin/ip link set dev ${IFNAME[$1]} down
+ debug_log "/sbin/ip address flush dev ${IFNAME[$1]}"
+ /sbin/ip address flush dev ${IFNAME[$1]}
+ for BONDIF in ${BONDNICS[$1]}; do
+ debug_log "/sbin/ip link set $BONDIF nomaster"
+ /sbin/ip link set $BONDIF nomaster
+ debug_log "/sbin/ip link set dev $BONDIF down"
+ /sbin/ip link set dev $BONDIF down
+ done
+ debug_log "/sbin/ip link del name ${IFNAME[$1]} type bond"
+ /sbin/ip link del name ${IFNAME[$1]} type bond
+}
+
+# Function to bring up a network interface. If the interface is
+# already up or does not yet exist (perhaps because the kernel driver
+# is not loaded yet), do nothing.
+if_up() {
+ # Determine position 'i' of this interface in the IFNAME array:
+ i=0
+ while [ $i -lt $MAXNICS ]; do
+ [ "${IFNAME[$i]}" = "${1}" ] && break
+ i=$((i+1))
+ done
+ # If "i" is greater or equal to "MAXNICS" at this point, it means we didn't
+ # find an entry in IFNAME array corresponding to "${1}", which likely means
+ # there are more interfaces configured than MAXNICS. Let's err on the
+ # side of caution and do nothing instead of possibly doing the wrong thing.
+ if [ $i -ge $MAXNICS ]; then
+ info_log "${1}: skipping - you might need to increase MAXNICS"
+ return
+ fi
+ info_log "${1}: configuring interface"
+ # If you need to set hardware addresses for the underlying interfaces in a
+ # bond or bridge, configure the interfaces with IPs of 0.0.0.0 and set the
+ # MAC address with HWADDR. Then, finally, define the bond or bridge.
+ # If the interface is a bond, create it.
+ [ -n "${BONDNICS[$i]}" ] && bond_create $i
+ # If the interface is a bridge, create it.
+ [ -n "${BRNICS[$i]}" ] && br_open $i
+ if [ -e /sys/class/net/${1%%[:.]*} ]; then # interface exists
+ if ! /sbin/ip address show scope global dev ${1} 2>/dev/null | grep -Ewq '(inet|inet6)' || \
+ ! /sbin/ip link show dev ${1} | grep -wq "state UP"; then # interface not up or not configured
+ local IF_UP=0
+ # Initialize any wireless parameters:
+ if [ -x /etc/rc.d/rc.wireless ]; then
+ . /etc/rc.d/rc.wireless ${1} start
+ fi
+ # Handle VLAN interfaces before trying to configure IP addresses.
+ if echo "${1}" | grep -Fq .; then
+ IFACE="${1%.*}"
+ VLAN="${1##*.}"
+ # Check if the underlying interface is already up.
+ if ! /sbin/ip link show dev $IFACE 2>/dev/null| grep -wq "state UP"; then
+ # Bring up the underlying interface.
+ debug_log "/sbin/ip link set dev $IFACE up"
+ if ! /sbin/ip link set dev $IFACE up; then
+ info_log "${1}: failed to bring up interface $IFACE"
+ return
+ fi
+ IF_UP=1
+ fi
+ # Configure the VLAN interface.
+ info_log "${1}: creating VLAN interface"
+ debug_log "/sbin/ip link add link $IFACE name ${1} type vlan id $VLAN"
+ if ! /sbin/ip link add link $IFACE name ${1} type vlan id $VLAN; then
+ info_log "${1}: failed to create VLAN interface"
+ ((IF_UP == 1)) && /sbin/ip link set dev $IFACE down
+ return
+ fi
+ while read -r -d \| IFOPT; do
+ if [ -n "$IFOPT" ]; then
+ debug_log "/sbin/ip link set dev ${1} type vlan $IFOPT"
+ /sbin/ip link set dev ${1} type vlan $IFOPT
+ fi
+ done <<<"${IFOPTS[$i]/%|*([[:blank:]])}|" # The | on the end is required.
+ elif [ -z "${BONDNICS[$i]}" ] && [ -z "${BRNICS[$i]}" ]; then
+ # Only apply IFOPTS for a physical interface if it's not been handled
+ # by a higher level interface.
+ while read -r -d \| IFOPT; do
+ if [ -n "$IFOPT" ]; then
+ debug_log "/sbin/ip link set dev ${1} $IFOPT"
+ /sbin/ip link set dev ${1} $IFOPT
+ fi
+ done <<<"${IFOPTS[$i]/%|*([[:blank:]])}|" # The | on the end is required.
+ fi
+ # Set hardware address:
+ if [ -n "${HWADDR[$i]}" ]; then
+ debug_log "/sbin/ip link set dev ${1} address ${HWADDR[$i]}"
+ if ! /sbin/ip link set dev ${1} address ${HWADDR[$i]} 2>/dev/null; then
+ info_log "${1}: failed to set hardware address"
+ fi
+ fi
+ if [ -e /proc/sys/net/ipv6 ]; then # ipv6 networking is available
+ # Disable v6 IP auto configuration before trying to bring up the interface:
+ debug_log "${1}: disabling IPv6 autoconf"
+ echo "0" >/proc/sys/net/ipv6/conf/${1}/autoconf
+ if [ "${USE_RA[$i]}" = "yes" ]; then
+ # Unconditionally accept router advertisements on this interface:
+ debug_log "${1}: accepting IPv6 RA"
+ echo "1" >/proc/sys/net/ipv6/conf/${1}/accept_ra
+ else
+ # Disable router advertisments on this interface until SLAAC is enabled:
+ debug_log "${1}: ignoring IPv6 RA"
+ echo "0" >/proc/sys/net/ipv6/conf/${1}/accept_ra
+ fi
+ fi
+ debug_log "/sbin/ip address flush dev ${1}"
+ /sbin/ip address flush dev ${1}
+ IF_UP=0
+ if [ -e /proc/sys/net/ipv6 ] && [ "${USE_DHCP6[$i]}" != "yes" ] && [ "${USE_SLAAC[$i]}" = "yes" ]; then # configure via SLAAC
+ info_log "${1}: enabling SLAAC"
+ # Enable accepting of RA packets, unless explicitly configured not to:
+ if [ "${USE_RA[$i]}" = "no" ]; then
+ debug_log "${1}: ignoring IPv6 RA"
+ echo "0" >/proc/sys/net/ipv6/conf/${1}/accept_ra
+ else
+ debug_log "${1}: accepting IPv6 RA"
+ echo "1" >/proc/sys/net/ipv6/conf/${1}/accept_ra
+ fi
+ # Set up SLAAC privacy enhancements if configured.
+ if [ "${SLAAC_PRIVIPGEN[$i]}" = "yes" ]; then
+ if [ -n "${SLAAC_SECRET[$i]}" ]; then
+ debug_log "${1}: seeding secret and enabling private IPv6 generation"
+ echo "${SLAAC_SECRET[$i]}" >/proc/sys/net/ipv6/conf/${1}/stable_secret
+ echo "2" >/proc/sys/net/ipv6/conf/${1}/addr_gen_mode
+ else
+ debug_log "${1}: using random secret and enabling private IPv6 generation"
+ echo -n >/proc/sys/net/ipv6/conf/${1}/stable_secret
+ echo "3" >/proc/sys/net/ipv6/conf/${1}/addr_gen_mode
+ fi
+ fi
+ if [ "${SLAAC_TEMPADDR[$i]}" = "yes" ]; then
+ debug_log "${1}: enabling SLAAC tempaddr"
+ echo "2" >/proc/sys/net/ipv6/conf/${1}/use_tempaddr
+ fi
+ # Enable auto configuration of interfaces:
+ echo "1" >/proc/sys/net/ipv6/conf/${1}/autoconf
+ # Bring the interface up:
+ debug_log "/sbin/ip link set dev ${1} up"
+ /sbin/ip link set dev ${1} up
+ echo "${1}: waiting for router announcement"
+ for ((j = ${SLAAC_TIMEOUT[$i]:=15} * 2; j--;)); do # by default, wait a max of 15 seconds for the interface to configure
+ /sbin/ip -6 address show dynamic dev ${1} 2>/dev/null | grep -Ewq 'inet6' && { IF_UP=1; break; }
+ sleep 0.5
+ done
+ if ((IF_UP != 1)); then
+ echo "${1}: timed out"
+ info_log "${1}: failed to auto configure after ${SLAAC_TIMEOUT[$i]} seconds"
+ debug_log "/sbin/ip address flush dev ${1}"
+ /sbin/ip address flush dev ${1}
+ debug_log "/sbin/ip link set dev ${1} down"
+ /sbin/ip link set dev ${1} down
+ fi
+ fi
+ # Slackware historically favours dynamic configuration over fixed IP to configure interfaces, so keep that tradition:
+ if [ "${USE_DHCP[$i]}" = "yes" ] || { [ -e /proc/sys/net/ipv6 ] && [ "${USE_DHCP6[$i]}" = "yes" ]; }; then # use dhcpcd
+ info_log "${1}: starting dhcpcd"
+ # Declare DHCP_OPTIONS array before adding new options to it:
+ local -a DHCP_OPTIONS=()
+ # Set DHCP_OPTIONS for this interface:
+ if [ -e /proc/sys/net/ipv6 ]; then
+ if [ "${USE_DHCP[$i]}" = "yes" ] && [ "${USE_DHCP6[$i]}" != "yes" ]; then # only try v4 dhcp
+ DHCP_OPTIONS+=("-4")
+ elif [ "${USE_DHCP[$i]}" != "yes" ] && [ "${USE_DHCP6[$i]}" = "yes" ]; then # only try v6 dhcp
+ DHCP_OPTIONS+=("-6")
+ fi
+ else
+ DHCP_OPTIONS+=("-4")
+ fi
+ [ -n "${DHCP_HOSTNAME[$i]}" ] && DHCP_OPTIONS+=("-h" "${DHCP_HOSTNAME[$i]}")
+ [ "${DHCP_KEEPRESOLV[$i]}" = "yes" ] && DHCP_OPTIONS+=("-C" "resolv.conf")
+ [ "${DHCP_KEEPNTP[$i]}" = "yes" ] && DHCP_OPTIONS+=("-C" "ntp.conf")
+ [ "${DHCP_KEEPGW[$i]}" = "yes" ] && DHCP_OPTIONS+=("-G")
+ [ "${DHCP_DEBUG[$i]}" = "yes" ] && DHCP_OPTIONS+=("-d")
+ # The -L option used to be hard coded into the dhcpcd command line in -current. It was added to assist ARM users
+ # get networking up and running. Previous versions of Slackware did not have -L hard coded - the code here keeps
+ # the 14.2 behaviour, but can be altered to make the use of -L default as in -current. To change the behaviour,
+ # alter the test below to be: [ "${DHCP_NOIPV4LL[$i]}" != "no" ].
+ # Note: ARM users should make use of the DHCP_NOIPV4LL[x]="yes" parameter in rc.inet1.conf - this is the correct
+ # way to get the behaviour they seek.
+ [ "${DHCP_NOIPV4LL[$i]}" = "yes" ] && DHCP_OPTIONS+=("-L")
+ echo "${1}: polling for DHCP server"
+ # 15 seconds should be a reasonable default DHCP timeout. 30 was too much.
+ debug_log "/sbin/dhcpcd -t ${DHCP_TIMEOUT[$i]:-15} ${DHCP_OPTIONS[*]} ${1}"
+ if /sbin/dhcpcd -t "${DHCP_TIMEOUT[$i]:-15}" "${DHCP_OPTIONS[@]}" ${1}; then
+ # Enable accepting of RA packets if explicitly told to:
+ if [ -e /proc/sys/net/ipv6 ] && [ "${USE_RA[$i]}" = "yes" ]; then
+ debug_log "${1}: unconditionally accepting IPv6 RA"
+ echo "1" >/proc/sys/net/ipv6/conf/${1}/accept_ra
+ fi
+ IF_UP=1
+ else
+ info_log "${1}: failed to obtain DHCP lease"
+ debug_log "/sbin/ip address flush dev ${1}"
+ /sbin/ip address flush dev ${1}
+ debug_log "/sbin/ip link set dev ${1} down"
+ /sbin/ip link set dev ${1} down
+ fi
+ fi
+ if [ -e /proc/sys/net/ipv6 ] && [ -n "${IP6ADDRS[$i]}" ]; then # add v6 IPs
+ info_log "${1}: setting IPv6 addresses"
+ # IPv6's Duplicate Address Detection (DAD) causes a race condition when bringing up interfaces, as
+ # described here: https://www.agwa.name/blog/post/beware_the_ipv6_dad_race_condition
+ # Disable DAD while bringing up the interface - but note that this means the loss of detection of a
+ # duplicate address. It's a trade off, unfortunately.
+ debug_log "${1}: disabling IPv6 DAD"
+ echo "0" >/proc/sys/net/ipv6/conf/${1}/accept_dad
+ for V6IP in ${IP6ADDRS[$i]}; do
+ IP="${V6IP%/*}"
+ PREFIX="${V6IP#*/}"
+ if [ -z "$PREFIX" ] || [ "$IP" == "$PREFIX" ]; then
+ info_log "${1}: no prefix length set for IP $IP - assuming 64"
+ PREFIX="64"
+ fi
+ debug_log "/sbin/ip -6 address add $IP/$PREFIX dev ${1}"
+ if /sbin/ip -6 address add $IP/$PREFIX dev ${1} && /sbin/ip link set dev ${1} up; then
+ # Enable accepting of RA packets if explicitly told to.
+ if [ "${USE_RA[$i]}" = "yes" ]; then
+ debug_log "${1}: unconditionally accepting IPv6 RA"
+ echo "1" >/proc/sys/net/ipv6/conf/${1}/accept_ra
+ fi
+ IF_UP=1
+ else
+ info_log "${1}: failed to set IP $IP"
+ if ((IF_UP != 1)); then # a v4 address was configured, don't flush it
+ debug_log "/sbin/ip address flush dev ${1}"
+ /sbin/ip address flush dev ${1}
+ debug_log "/sbin/ip link set dev ${1} down"
+ /sbin/ip link set dev ${1} down
+ fi
+ fi
+ done
+ # Reset accept_dad back to default now all the IPs are configured:
+ debug_log "${1}: resetting IPv6 DAD to default"
+ cat /proc/sys/net/ipv6/conf/default/accept_dad >/proc/sys/net/ipv6/conf/${1}/accept_dad
+ fi
+ if [ -n "${IPADDRS[$i]}" ] || [ -n "${IPADDR[$i]}" ]; then # add v4 IPs
+ info_log "${1}: setting IPv4 addresses"
+ # Only use IPADDR if no dynamic configuration was done.
+ if [ "${USE_DHCP[$i]}" == "yes" ] || [ "${USE_DHCP6[$i]}" == "yes" ] || [ "${USE_SLAAC[$i]}" == "yes" ]; then
+ V4IPS="${IPADDRS[$i]}"
+ else
+ V4IPS="${IPADDRS[$i]} ${IPADDR[$i]}${NETMASK[$i]:+/${NETMASK[$i]}}"
+ fi
+ for V4IP in $V4IPS; do
+ IP="${V4IP%/*}"
+ NM="${V4IP#*/}"
+ if [ -z "$NM" ] || [ "$IP" == "$NM" ]; then
+ info_log "${1}: no netmask set for IP $IP - assuming 24 (aka, 255.255.255.0)"
+ NM="24"
+ fi
+ debug_log "/sbin/ip -4 address add $IP/$NM broadcast + dev ${1}"
+ if /sbin/ip -4 address add $IP/$NM broadcast + dev ${1} && /sbin/ip link set dev ${1} up; then
+ IF_UP=1
+ else
+ info_log "${1}: failed to set IP $IP"
+ if ((IF_UP != 1)); then # if at least one address was configured, don't flush the device
+ debug_log "/sbin/ip address flush dev ${1}"
+ /sbin/ip address flush dev ${1}
+ debug_log "/sbin/ip link set dev ${1} down"
+ /sbin/ip link set dev ${1} down
+ fi
+ fi
+ done
+ fi
+ if ((IF_UP == 1)) && [ -n "${IPALIASES[$i]}" ]; then # Only apply IPALIASES onto an up interface
+ info_log "${1}: setting extra IPv4 addresses"
+ NUM=0
+ for EXTRAIP in ${IPALIASES[$i]}; do
+ IP="${EXTRAIP%/*}"
+ NM="${EXTRAIP#*/}"
+ if [ -z "$NM" ] || [ "$IP" == "$NM" ]; then
+ info_log "${1}: no netmask set for alias IP $IP - assuming 24 (aka, 255.255.255.0)"
+ NM="24"
+ fi
+ debug_log "/sbin/ip -4 address add $IP/$NM broadcast + dev ${1} label ${1}:$NUM"
+ if /sbin/ip -4 address add $IP/$NM broadcast + dev ${1} label ${1}:$NUM; then
+ NUM=$((NUM + 1))
+ else
+ info_log "${1}: failed to add alias IP $IP"
+ fi
+ done
+ fi
+ if ((IF_UP == 1)); then
+ # Force an MTU (possibly overriding that set by DHCP or RA):
+ if [ -n "${MTU[$i]}" ]; then
+ info_log "${1}: setting custom MTU"
+ debug_log "/sbin/ip link set dev ${1} mtu ${MTU[$i]}"
+ if ! /sbin/ip link set dev ${1} mtu ${MTU[$i]}; then
+ info_log "${1}: failed to set MTU"
+ fi
+ fi
+ # Set promiscuous mode on the interface:
+ if [ "${PROMISCUOUS[$i]}" = "yes" ]; then
+ info_log "${1}: setting promiscuous mode"
+ debug_log "/sbin/ip link set dev ${1} promisc on"
+ if ! /sbin/ip link set dev ${1} promisc on; then
+ info_log "${1}: failed to set promiscuous mode"
+ fi
+ fi
+ fi
+ else
+ debug_log "${1}: skipping configuration - already up"
+ fi
+ else
+ debug_log "${1}: skipping configuration - does not exist (yet)"
+ fi
+}
+
+# Function to take down a network interface:
+if_down() {
+ # Determine position 'i' of this interface in the IFNAME array:
+ i=0
+ while [ $i -lt $MAXNICS ]; do
+ [ "${IFNAME[$i]}" = "${1}" ] && break
+ i=$((i+1))
+ done
+ if [ $i -ge $MAXNICS ]; then
+ info_log "${1}: skipping - you might need to increase MAXNICS"
+ return
+ fi
+ info_log "${1}: de-configuring interface"
+ if [ -e /sys/class/net/${1} ]; then
+ if [ "${USE_DHCP[$i]}" = "yes" ] || [ "${USE_DHCP6[$i]}" = "yes" ]; then # take down dhcpcd
+ info_log "${1}: stopping dhcpcd"
+ # When using -k, dhcpcd requires some command line options to match those used to invoke it:
+ if [ "${USE_DHCP[$i]}" = "yes" ] && [ "${USE_DHCP6[$i]}" != "yes" ]; then # only v4 dhcp
+ DHCP_OPTIONS=( -4 )
+ elif [ "${USE_DHCP[$i]}" != "yes" ] && [ "${USE_DHCP6[$i]}" = "yes" ]; then # only v6 dhcp
+ DHCP_OPTIONS=( -6 )
+ fi
+ debug_log "/sbin/dhcpcd ${DHCP_OPTIONS[*]} -k -d ${1}"
+ /sbin/dhcpcd "${DHCP_OPTIONS[*]}" -k -d ${1} 2>/dev/null || info_log "${1}: failed to stop dhcpcd"
+ fi
+ # Disable v6 IP auto configuration and RA before trying to clear the IP from the interface:
+ if [ -e /proc/sys/net/ipv6 ]; then
+ debug_log "${1}: disabling IPv6 autoconf and RA"
+ echo "0" >/proc/sys/net/ipv6/conf/${1}/autoconf
+ echo "0" >/proc/sys/net/ipv6/conf/${1}/accept_ra
+ fi
+ sleep 0.5 # allow time for DHCP/RA to unconfigure the interface
+ # Flush any remaining IPs:
+ debug_log "/sbin/ip address flush dev ${1}"
+ /sbin/ip address flush dev ${1}
+ # Bring the interface down:
+ debug_log "/sbin/ip link set dev ${1} down"
+ /sbin/ip link set dev ${1} down
+ # Reset everything back to defaults:
+ if [ -e /proc/sys/net/ipv6 ]; then
+ debug_log "${1}: resetting IPv6 configuration to defaults"
+ cat /proc/sys/net/ipv6/conf/default/autoconf >/proc/sys/net/ipv6/conf/${1}/autoconf
+ cat /proc/sys/net/ipv6/conf/default/accept_ra >/proc/sys/net/ipv6/conf/${1}/accept_ra
+ cat /proc/sys/net/ipv6/conf/default/use_tempaddr >/proc/sys/net/ipv6/conf/${1}/use_tempaddr
+ cat /proc/sys/net/ipv6/conf/default/addr_gen_mode >/proc/sys/net/ipv6/conf/${1}/addr_gen_mode
+ echo -n >/proc/sys/net/ipv6/conf/${1}/stable_secret
+ fi
+ # If the interface is a bridge, then destroy it now:
+ [ -n "${BRNICS[$i]}" ] && br_close $i
+ # If the interface is a bond, then destroy it now.
+ [ -n "${BONDNICS[$i]}" ] && bond_destroy $i
+ # Take down VLAN interface, if configured.
+ if echo "${1}" | grep -Fq .; then
+ info_log "${1}: destroying VLAN interface"
+ debug_log "/sbin/ip link set dev ${1} down"
+ /sbin/ip link set dev ${1} down
+ debug_log "/sbin/ip link delete ${1}"
+ /sbin/ip link delete ${1}
+ if ! /sbin/ip address show scope global dev ${1%.*} 2>/dev/null | grep -Ewq '(inet|inet6)'; then
+ debug_log "/sbin/ip link set dev ${1%.*} down"
+ /sbin/ip link set dev ${1%.*} down
+ fi
+ fi
+ # Kill wireless daemons if any:
+ if [ -x /etc/rc.d/rc.wireless ]; then
+ . /etc/rc.d/rc.wireless ${1} stop
+ fi
+ fi
+}
+
+#####################
+# GATEWAY FUNCTIONS #
+#####################
+
+# Function to bring up the gateway if there is not yet a default route:
+gateway_up() {
+ info_log "Configuring gateways"
+ # Bring up the IPv4 gateway:
+ if [ -n "$GATEWAY" ]; then
+ if ! /sbin/ip -4 route show | grep -wq default; then
+ debug_log "/sbin/ip -4 route add default via ${GATEWAY}"
+ /sbin/ip -4 route add default via ${GATEWAY}
+ fi
+ fi
+ # Bring up the IPv6 gateway:
+ if [ -n "$GATEWAY6" ]; then
+ if ! /sbin/ip -6 route show | grep -wq default; then
+ debug_log "/sbin/ip -6 route add default via ${GATEWAY6}"
+ /sbin/ip -6 route add default via ${GATEWAY6}
+ fi
+ fi
+}
+
+# Function to take down an existing default gateway:
+gateway_down() {
+ info_log "De-configuring gateways"
+ if /sbin/ip -4 route show | grep -wq default ; then
+ debug_log "/sbin/ip -4 route del default"
+ /sbin/ip -4 route del default
+ fi
+ if /sbin/ip -6 route show | grep -wq default ; then
+ debug_log "/sbin/ip -6 route del default"
+ /sbin/ip -6 route del default
+ fi
+}
+
+# Function to start the network:
+start() {
+ echo "Starting the network interfaces..."
+ lo_up
+ virtif_create
+ for i in "${IFNAME[@]}" ; do
+ if_up $i
+ done
+ gateway_up
+}
+
+# Function to stop the network:
+stop() {
+ echo "Stopping the network interfaces..."
+ gateway_down
+ for (( i = MAXNICS - 1; i >= 0; i-- )); do
+ if_down ${IFNAME[$i]}
+ done
+ virtif_destroy
+ lo_down
+}
+
+
+############
+### MAIN ###
+############
+
+# extglob is required for some functionallity.
+shopt -s extglob
+
+case "${1}" in
+start|up) # "start" (or "up") brings up all configured interfaces:
+ start
+ ;;
+stop|down) # "stop" (or "down") takes down all configured interfaces:
+ stop
+ ;;
+restart) # "restart" restarts the network:
+ stop
+ start
+ ;;
+lo_start|lo_up) # Start the loopback interface:
+ lo_up
+ ;;
+lo_stop|lo_down) # Stop the loopback interface:
+ lo_down
+ ;;
+*_start|*_up) # Example: "eth1_start" (or "eth1_up") will start the specified interface 'eth1'
+ INTERFACE=$(echo ${1} | /bin/cut -d '_' -f 1)
+ if_up $INTERFACE
+ gateway_up
+ ;;
+*_stop|*_down) # Example: "eth0_stop" (or "eth0_down") will stop the specified interface 'eth0'
+ INTERFACE=$(echo ${1} | /bin/cut -d '_' -f 1)
+ if_down $INTERFACE
+ ;;
+*_restart) # Example: "wlan0_restart" will take 'wlan0' down and up again
+ INTERFACE=$(echo ${1} | /bin/cut -d '_' -f 1)
+ if_down $INTERFACE
+ sleep 1
+ if_up $INTERFACE
+ gateway_up
+ ;;
+*) # The default is to bring up all configured interfaces:
+ start
+esac
+
+# End of /etc/rc.d/rc.inet1
diff --git a/patches/source/network-scripts/scripts/rc.inet1.conf b/patches/source/network-scripts/scripts/rc.inet1.conf
new file mode 100644
index 000000000..e952498e9
--- /dev/null
+++ b/patches/source/network-scripts/scripts/rc.inet1.conf
@@ -0,0 +1,240 @@
+# /etc/rc.d/rc.inet1.conf
+#
+# This file contains the configuration settings for network interfaces.
+#
+# If USE_DHCP[interface] is set to "yes", this overrides any other settings.
+# If you don't have an interface, leave the settings null ("").
+#
+# You can configure network interfaces other than eth0,eth1... by setting
+# IFNAME[interface] to the interface's name. If IFNAME[interface] is unset
+# or empty, it is assumed you're configuring eth<interface>.
+#
+# Several other parameters are available; the end of this file contains a
+# comprehensive set of examples.
+#
+# Important note for IPv6 stateless auto configuration (SLAAC) users:
+# From Slackware 15.0 onwards, you need to set USE_SLAAC[0]="yes" below.
+
+# =============================================================================
+
+# IPv4 config options for eth0:
+IPADDRS[0]=""
+USE_DHCP[0]=""
+# IPv6 config options for eth0:
+IP6ADDRS[0]=""
+USE_SLAAC[0]=""
+USE_DHCP6[0]=""
+# Generic options for eth0:
+DHCP_HOSTNAME[0]=""
+
+# IPv4 config options for eth1:
+IPADDRS[1]=""
+USE_DHCP[1]=""
+# IPv6 config options for eth1:
+IP6ADDRS[1]=""
+USE_SLAAC[1]=""
+USE_DHCP6[1]=""
+# Generic options for eth1:
+DHCP_HOSTNAME[1]=""
+
+# IPv4 config options for eth2:
+IPADDRS[2]=""
+USE_DHCP[2]=""
+# IPv6 config options for eth2:
+IP6ADDRS[2]=""
+USE_SLAAC[2]=""
+USE_DHCP6[2]=""
+# Generic options for eth2:
+DHCP_HOSTNAME[2]=""
+
+# IPv4 config options for eth3:
+IPADDRS[3]=""
+USE_DHCP[3]=""
+# IPv6 config options for eth3:
+IP6ADDRS[3]=""
+USE_SLAAC[3]=""
+USE_DHCP6[3]=""
+# Generic options for eth3:
+DHCP_HOSTNAME[3]=""
+
+# IPv4 default gateway IP address:
+GATEWAY=""
+# IPv6 default gateway IP address:
+GATEWAY6=""
+
+# =============================================================================
+
+# Example of how to configure a bond (link aggregation) interface.
+# Note the addition of the BONDNICS and BONDMODE parameters.
+# BONDNICS is a space delimited list of interfaces to add to this bond. The
+# BONDNICS interfaces will be brought up and configured while bringing up the
+# bond interface, so do not need to be previously defined in rc.inet1.conf.
+# BONDMODE sets the bonding mode for this interface. If not specified when
+# BONDNICS has been used, the default is 'balance-rr'.
+# IFOPTS is a pipe (|) delimited list of bonding module specific settings to be
+# applied to the interface, and should always include the 'miimon' option when
+# configuring bonding - not using this option will result in network
+# degradation. In 'active-backup' mode, the 'primary' option should also be
+# supplied. When using '802.3ad' mode, set "lacp_rate fast" for faster
+# recovery from an interface failure. In other modes, the 'xmit_hash_policy'
+# should be set. See the /usr/src/linux/Documentation/networking/bonding.txt
+# file (search for "Bonding Driver Options") for the full set of options.
+#IFNAME[0]="bond0"
+#BONDNICS[0]="eth0 eth1"
+#BONDMODE[0]="balance-rr"
+#IFOPTS[0]="xmit_hash_policy layer2+3 | miimon 100"
+#IPADDRS[0]="192.168.0.1/24"
+#USE_DHCP[0]=""
+#DHCP_HOSTNAME[0]=""
+#IP6ADDRS[0]=""
+#USE_SLAAC[0]=""
+#USE_DHCP6[0]=""
+
+# =============================================================================
+
+# Example of how to configure a VLAN interface:
+# The VLAN ID is taken from the full interface name, which is comprised of the
+# underlying interface name, a period (.) and then the VLAN ID.
+# IFOPTS is a pipe (|) delimited list of VLAN module specific settings to be
+# applied to the interface. See the ip-link(8) man page (search for "VLAN Type
+# Support") for details of the options available. This option is not required
+# for a standard VLAN to be configured.
+#IFNAME[0]="eth0.10"
+#IFOPTS[0]=""
+#IPADDRS[0]="192.168.10.1/24"
+#USE_DHCP[0]=""
+#DHCP_HOSTNAME[0]=""
+#IP6ADDRS[0]=""
+#USE_SLAAC[0]=""
+#USE_DHCP6[0]=""
+
+# =============================================================================
+
+# Example of how to configure a bridge:
+# Note the added "BRNICS" variable which contains a space-separated list
+# of the physical or virtual network interfaces you want to add to the bridge.
+# IFOPTS is a pipe (|) delimited list of bridge module specific settings to be
+# applied to the interface. See the ip-link(8) man page (search for "BRIDGE
+# Type Support") for details of the options available. This option is not
+# required for a standard bridge to be configured.
+#IFNAME[0]="br0"
+#BRNICS[0]="eth0"
+#IFOPTS[0]=""
+#IPADDRS[0]="192.168.0.1/24"
+#USE_DHCP[0]=""
+#DHCP_HOSTNAME[0]=""
+
+# =============================================================================
+
+# Virtual interfaces to create - these are created before any address
+# configuration or bridge setup is done, so you may use these interfaces
+# as IFNAME or BRNICS values. These can be tun or tap interfaces:
+# adjust VIRTIFNAME and VIRTIFTYPE accordingly.
+# Starting with VIRTIFNAME[0] is mandatory, and each next one must be
+# incremented by one, so VIRTIFNAME[1], VIRTIFNAME[2], and so on.
+# Virtual tap interface example
+#VIRTIFNAME[0]="tap0"
+#VIRTIFTYPE[0]="tap"
+#VIRTIFUSER[0]="root"
+#VIRTIFGROUP[0]="root"
+
+# Virtual tun interface example
+#VIRTIFNAME[1]="tun0"
+#VIRTIFTYPE[1]="tun"
+#VIRTIFUSER[1]="someuser"
+#VIRTIFGROUP[1]="somegroup"
+
+# =============================================================================
+
+# Example config information for wlan0:
+# Uncomment the lines you need and fill in your data. You may not need all of
+# these for your wireless network.
+#IFNAME[4]="wlan0"
+#IPADDRS[4]=""
+#USE_DHCP[4]="yes"
+#DHCP_HOSTNAME[4]="icculus-wireless"
+#DHCP_KEEPRESOLV[4]="yes"
+#DHCP_KEEPNTP[4]="yes"
+#DHCP_KEEPGW[4]="yes"
+#DHCP_IPADDR[4]=""
+#WLAN_ESSID[4]=DARKSTAR
+#WLAN_MODE[4]=Managed
+#WLAN_RATE[4]="54M auto"
+#WLAN_CHANNEL[4]="auto"
+#WLAN_KEY[4]="D5A31F54ACF0487C2D0B1C10D2"
+#WLAN_IWPRIV[4]="set AuthMode=WPAPSK | set EncrypType=TKIP | set WPAPSK=96389dc66eaf7e6efd5b5523ae43c7925ff4df2f8b7099495192d44a774fda16"
+#WLAN_WPA[4]="wpa_supplicant"
+#WLAN_WPADRIVER[4]="wext"
+#WLAN_WPAWAIT[4]=30
+
+# =============================================================================
+
+# Some examples of additional network parameters that you can use.
+#IFNAME[4]="wlan0" # Use a different interface name instead of
+ # the default 'eth4'
+#IFOPTS[4]="" # A pipe (|) delimited list of interface type
+ # specific options to apply. These options
+ # can be found in the ip-link(8) man page in
+ # the approprite section for the interface
+ # type being configured.
+#HWADDR[4]="00:01:23:45:67:89" # Overrule the card's hardware MAC address
+#MTU[4]="" # The default MTU is 1500, but you might need
+ # 1360 when you use NAT'ed IPSec traffic.
+#PROMISCUOUS[4]="yes" # Set promiscuous mode on the interface.
+#DHCP_TIMEOUT[4]="15" # The default timeout for the DHCP client to
+ # wait for server resonse is 15 seconds, but
+ # you might want a shorter or longer wait.
+#DHCP_KEEPRESOLV[4]="yes" # If you don't want /etc/resolv.conf overwritten
+#DHCP_KEEPNTP[4]="yes" # If you don't want ntp.conf overwritten
+#DHCP_KEEPGW[4]="yes" # If you don't want the DHCP server to change
+ # your default gateway
+#DHCP_IPADDR[4]="" # Request a specific IP address from the DHCP
+ # server
+#DHCP_DEBUG[4]="yes" # Make dhcpcd show verbose diagnostics
+#DHCP_NOIPV4LL[4]="yes" # Do not assign an ipv4ll address when a DHCP
+ # server is not found (ipv4ll link-local
+ # adresses in the IP range 169.254.0.0/16 are
+ # also known as "zeroconf" addresses)
+#SLAAC_TIMEOUT[4]="15" # The default timeout for auto configuration to
+ # wait for the interface to come up is 15 sec.
+ # Increase the timeout if required.
+#SLAAC_PRIVIPGEN[4]="yes" # When assigning addresses via SLAAC, use the
+ # 'private' (RFC7217) address generation method.
+ # It is advisable to also set SLAAC_SECRET[x].
+#SLAAC_SECRET[4]="xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx"
+ # When SLAAC_PRIVIPGEN[x]="yes" is set, this is
+ # the secret to be used. This must be in the
+ # form of an IPv6 address. When left unset, a
+ # random secret is used (this is the default).
+#SLAAC_TEMPADDR[4]="yes" # Use a temporary address with SLAAC to enhance
+ # security.
+#USE_RA[4]="yes" # Accept router advertisements even when SLAAC
+ # is disabled on the interface.
+#WLAN_ESSID[4]="DARKSTAR" # An example of how you can override _any_
+ # parameter defined in rc.wireless.conf, by
+ # prepending 'WLAN_' to the parameter's name.
+ # Useful with multiple wireless interfaces.
+#WLAN_IWPRIV[4]="set AuthMode=WPAPSK | set EncrypType=TKIP | set WPAPSK=thekey"
+ # Some drivers require a private ioctl to be
+ # set through the iwpriv command. If more than
+ # one is required, you can place them in the
+ # IWPRIV parameter (separated with the pipe (|)
+ # character, see the example).
+#WLAN_WPA[4]="wpa_supplicant" # Run wpa_supplicant for WPA support
+#WLAN_WPADRIVER[4]="ndiswrapper"# Tell wpa_supplicant to specifically use the
+ # ndiswrapper driver (if you leave this empty
+ # the 'wext' driver is used by default)
+#WLAN_WPAWAIT[4]="30" # In case it takes long for the WPA association
+ # to finish, you can increase the wait time
+ # (defaults to 10 seconds)
+
+# =============================================================================
+
+# Change this to "yes" for debugging output to syslog (if available, stdout if
+# not).
+DEBUG_ETH_UP="no"
+
+# MAXNICS is the maximum number of interfaces that will be configured.
+# You may need to increase the MAXNICS value if you have many interfaces, or
+# you use multiple VLANs and/or bridges. The default is 6.
+#MAXNICS="6"
diff --git a/patches/source/network-scripts/scripts/rc.inet2 b/patches/source/network-scripts/scripts/rc.inet2
new file mode 100644
index 000000000..ec68ba0b1
--- /dev/null
+++ b/patches/source/network-scripts/scripts/rc.inet2
@@ -0,0 +1,152 @@
+#!/bin/sh
+#
+# rc.inet2 This shell script boots up the entire network system.
+# Note, that when this script is used to also fire
+# up any important remote NFS disks (like the /usr
+# directory), care must be taken to actually
+# have all the needed binaries online _now_ ...
+#
+# Uncomment or comment out sections depending on which
+# services your site requires.
+#
+# Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
+# Modified for Slackware by Patrick Volkerding <volkerdi@slackware.com>
+
+
+# At this point, we are (almost) ready to talk to The World...
+
+
+# If there is a firewall script, run it before enabling packet forwarding.
+# See the HOWTOs on http://www.netfilter.org/ for documentation on
+# setting up a firewall or NAT on Linux. In some cases this might need to
+# be moved past the section below dealing with IP packet forwarding.
+if [ -x /etc/rc.d/rc.firewall ]; then
+ /etc/rc.d/rc.firewall start
+fi
+
+# Turn on IPv4 packet forwarding support.
+if [ -x /etc/rc.d/rc.ip_forward ]; then
+ . /etc/rc.d/rc.ip_forward start
+fi
+
+# Start krb5kdc, which is the Kerberos version 5 Authentication Service
+# and Key Distribution Center (AS/KDC). This needs to run first on both
+# master and secondary KDCs.
+if [ -x /etc/rc.d/rc.krb5kdc ]; then
+ sh /etc/rc.d/rc.krb5kdc start
+fi
+
+# Start the Kerberos administration server. This typically runs on the
+# master Kerberos server, which stores the KDC database.
+if [ -x /etc/rc.d/rc.kadmind ]; then
+ sh /etc/rc.d/rc.kadmind start
+fi
+
+# Start the Kerberos V5 slave KDC update server. This runs on a slave
+# (secondary) KDC server. It allows the master Kerberos server to use
+# kprop(8) to propagate its database to the slave servers.
+if [ -x /etc/rc.d/rc.kpropd ]; then
+ sh /etc/rc.d/rc.kpropd start
+fi
+
+# Mount remote (NFS) filesystems:
+if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then
+ # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS
+ # volumes defined in /etc/fstab since these will need to be running in order
+ # to mount them. If they are not running, attempting to mount an NFS
+ # partition will cause mount to hang, or at least result in unreliable
+ # operation. Keep this in mind if you plan to mount unlisted NFS
+ # partitions...
+ # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run
+ # whether it is set as executable or not. If you don't want to run it,
+ # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.
+ if [ -r /etc/rc.d/rc.rpc ]; then
+ sh /etc/rc.d/rc.rpc start
+ fi
+ echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"
+ /sbin/mount -a -t nfs # This may be our /usr runtime!
+ # Show the mounted volumes:
+ /sbin/mount -v -t nfs
+fi
+
+# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,
+# and rpc.statd. This might be needed to mount NFS partitions that are not
+# listed in /etc/fstab. Starting this twice won't hurt as the script will
+# check if things are already running before trying to start them.
+if [ -x /etc/rc.d/rc.rpc ]; then
+ sh /etc/rc.d/rc.rpc start
+fi
+
+# Mount remote CIFS filesystems. Note that where possible, using CIFS is
+# preferred over SMBFS. SMBFS is no longer actively maintained.
+if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then
+ echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"
+ /sbin/mount -a -t cifs
+ # Show the mounted volumes:
+ /sbin/mount -v -t cifs
+fi
+
+# Mount remote SMB filesystems:
+if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then
+ echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"
+ /sbin/mount -a -t smbfs
+ # Show the mounted volumes:
+ /sbin/mount -v -t smbfs
+fi
+
+# Start the system logger if it is not already running (maybe because /usr
+# is on a network partition). NOTE: Don't put /usr on a network partition,
+# or even a separate local partition. This is not supported and is likely to
+# cause some problems...
+if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then
+ . /etc/rc.d/rc.syslog start
+fi
+
+# Start the inetd server:
+if [ -x /etc/rc.d/rc.inetd ]; then
+ /etc/rc.d/rc.inetd start
+fi
+
+# Start the OpenSSH SSH daemon:
+if [ -x /etc/rc.d/rc.sshd ]; then
+ echo "Starting OpenSSH SSH daemon: /usr/sbin/sshd"
+ /etc/rc.d/rc.sshd start
+fi
+
+# Start the BIND name server daemon:
+if [ -x /etc/rc.d/rc.bind ]; then
+ /etc/rc.d/rc.bind start
+fi
+
+# Start NIS (the Network Information Service):
+if [ -x /etc/rc.d/rc.yp ]; then
+ /etc/rc.d/rc.yp start
+fi
+
+# Start OpenVPN:
+if [ -x /etc/rc.d/rc.openvpn ]; then
+ /etc/rc.d/rc.openvpn start
+fi
+
+# Start the NFS server. Note that for this to work correctly, you'll
+# need nfsd support in the kernel (the startup script will try to load
+# the module for you).
+# You'll also need to set up some shares in /etc/exports.
+# Starting the NFS server:
+if [ -x /etc/rc.d/rc.nfsd ]; then
+ /etc/rc.d/rc.nfsd start
+fi
+
+# Stuff you won't need follows. ;-)
+
+# # Start the network routing daemon:
+# if [ -x /usr/sbin/routed ]; then
+# echo "Starting network routing daemon: /usr/sbin/routed"
+# /usr/sbin/routed -g -s
+# fi
+
+# # Start the system status server:
+# if [ -x /usr/sbin/rwhod ]; then
+# echo "Starting system status server: /usr/sbin/rwhod"
+# /usr/sbin/rwhod
+# fi
diff --git a/patches/source/network-scripts/scripts/rc.ip_forward b/patches/source/network-scripts/scripts/rc.ip_forward
new file mode 100644
index 000000000..1fa6b57cd
--- /dev/null
+++ b/patches/source/network-scripts/scripts/rc.ip_forward
@@ -0,0 +1,100 @@
+#!/bin/sh
+# /etc/rc.d/rc.ip_forward: start/stop IP packet forwarding
+#
+# If you intend to run your Linux box as a router, i.e. as a
+# computer that forwards and redistributes network packets, you
+# will need to enable IP packet forwarding in your kernel.
+#
+# To activate IP packet forwarding at boot time, make this
+# script executable: chmod 755 /etc/rc.d/rc.ip_forward
+#
+# To disable IP packet forwarding at boot time, make this
+# script non-executable: chmod 644 /etc/rc.d/rc.ip_forward
+
+# Start IP packet forwarding:
+ip_forward_start() {
+ if [ -f /proc/sys/net/ipv4/ip_forward ]; then
+ echo "Activating IPv4 packet forwarding."
+ echo 1 > /proc/sys/net/ipv4/ip_forward
+ # Changing /proc/sys/net/ipv4/ip_forward results in resetting all
+ # non-default ipv4 parameters for the interface as mentioned in
+ # /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we
+ # will reapply any ipv4 sysctl parameters now:
+ if [ -r /etc/sysctl.conf ]; then
+ /bin/grep ipv4 /etc/sysctl.conf | sysctl -p - 1> /dev/null 2> /dev/null
+ fi
+ fi
+ if [ -f /proc/sys/net/ipv6/conf/all/forwarding ]; then
+ echo "Activating IPv6 packet forwarding."
+ echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
+ # Changing /proc/sys/net/ipv6/conf/all/forwarding results in resetting
+ # all non-default ipv6 parameters for the interface as mentioned in
+ # /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we
+ # will reapply any ipv6 sysctl parameters now:
+ if [ -r /etc/sysctl.conf ]; then
+ /bin/grep ipv6 /etc/sysctl.conf | sysctl -p - 1> /dev/null 2> /dev/null
+ fi
+ fi
+ # When using IPv4 packet forwarding, you will also get the
+ # rp_filter, which automatically rejects incoming packets if the
+ # routing table entry for their source address doesn't match the
+ # network interface they're arriving on. This has security
+ # advantages because it prevents the so-called IP spoofing,
+ # however it can pose problems if you use asymmetric routing
+ # (packets from you to a host take a different path than packets
+ # from that host to you) or if you operate a non-routing host
+ # which has several IP addresses on different interfaces. To
+ # turn rp_filter off, uncomment the lines below:
+ #if [ -r /proc/sys/net/ipv4/conf/all/rp_filter ]; then
+ # echo "Disabling rp_filter."
+ # echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
+ #fi
+}
+
+# Stop IP packet forwarding:
+ip_forward_stop() {
+ if [ -f /proc/sys/net/ipv4/ip_forward ]; then
+ echo "Disabling IPv4 packet forwarding."
+ echo 0 > /proc/sys/net/ipv4/ip_forward
+ # Changing /proc/sys/net/ipv4/ip_forward results in resetting all
+ # non-default ipv4 parameters for the interface as mentioned in
+ # /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we
+ # will reapply any ipv4 sysctl parameters now:
+ if [ -r /etc/sysctl.conf ]; then
+ /bin/grep ipv4 /etc/sysctl.conf | sysctl -p - 1> /dev/null 2> /dev/null
+ fi
+ fi
+ if [ -f /proc/sys/net/ipv6/conf/all/forwarding ]; then
+ echo "Disabling IPv6 packet forwarding."
+ echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
+ # Changing /proc/sys/net/ipv6/conf/all/forwarding results in resetting
+ # all non-default ipv6 parameters for the interface as mentioned in
+ # /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we
+ # will reapply any ipv6 sysctl parameters now:
+ if [ -r /etc/sysctl.conf ]; then
+ /bin/grep ipv6 /etc/sysctl.conf | sysctl -p - 1> /dev/null 2> /dev/null
+ fi
+ fi
+}
+
+# Restart IP packet forwarding:
+ip_forward_restart() {
+ ip_forward_stop
+ sleep 1
+ ip_forward_start
+}
+
+case "$1" in
+'start')
+ ip_forward_start
+ ;;
+'stop')
+ ip_forward_stop
+ ;;
+'restart')
+ ip_forward_restart
+ ;;
+*)
+ echo "usage $0 start|stop|restart"
+esac
+
diff --git a/patches/source/network-scripts/scripts/resolv.conf b/patches/source/network-scripts/scripts/resolv.conf
new file mode 100644
index 000000000..96726f016
--- /dev/null
+++ b/patches/source/network-scripts/scripts/resolv.conf
@@ -0,0 +1 @@
+search example.net
diff --git a/patches/source/network-scripts/scripts/setup.netconfig b/patches/source/network-scripts/scripts/setup.netconfig
new file mode 100644
index 000000000..7165a4a96
--- /dev/null
+++ b/patches/source/network-scripts/scripts/setup.netconfig
@@ -0,0 +1,13 @@
+#!/bin/sh
+#BLURB="Configure basic network settings"
+TMP=/var/log/setup/tmp
+dialog --title "CONFIGURE NETWORK?" --yesno "Would you like to \
+configure your network?" 5 60
+if [ $? = 0 ]; then
+ while [ 0 ]; do # we're gonna do this until we get it right :-)
+ sh sbin/netconfig $*
+ if [ "$?" = "0" ]; then # success
+ break;
+ fi
+ done
+fi