diff options
Diffstat (limited to 'patches/source')
33 files changed, 4325 insertions, 0 deletions
diff --git a/patches/source/network-scripts/0000-rc.inet1.new-lxc-additions.patch b/patches/source/network-scripts/0000-rc.inet1.new-lxc-additions.patch new file mode 100644 index 000000000..d9c14d44b --- /dev/null +++ b/patches/source/network-scripts/0000-rc.inet1.new-lxc-additions.patch @@ -0,0 +1,39 @@ +From 2ef0c19e3ebfd99c1c89bf13dee0ec198c5ef559 Mon Sep 17 00:00:00 2001 +From: Patrick J. Volkerding <volkerdi@slackware.com> +Date: Wed, 10 Nov 2021 16:22:43 -0600 +Subject: [PATCH] Skip bridge and bond configuration in LXC container + +Add LXC detection at the beginning of the script to set container="lxc" if an +LXC container is detected. Later, use this to skip bridge and bond creation in +an LXC container. Patched script works in both LXC and on bare metal. + +--- ./etc/rc.d/rc.inet1.new.orig 2021-03-08 18:13:50.484386646 -0600 ++++ ./etc/rc.d/rc.inet1.new 2021-11-10 02:32:58.780223136 -0600 +@@ -2,7 +2,14 @@ + # /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) ++# @(#)/etc/rc.d/rc.inet1 15.0 Wed Nov 10 08:17:22 UTC 2021 (pjv) ++ ++# If we are in an lxc container, set $container to skip parts of the script. ++# Thanks to Matteo Bernardini <ponce@slackbuilds.org> and Chris Willing for ++# the initial work making this script lxc compatible. ++if grep -aq container=lxc /proc/1/environ 2> /dev/null ; then ++ container="lxc" ++fi + + ############################ + # READ NETWORK CONFIG FILE # +@@ -254,9 +261,9 @@ + # 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 ++ [ -n "${BONDNICS[$i]}" -a -z "$container" ] && bond_create $i + # If the interface is a bridge, create it. +- [ -n "${BRNICS[$i]}" ] && br_open $i ++ [ -n "${BRNICS[$i]}" -a -z "$container" ] && 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 diff --git a/patches/source/network-scripts/0001-netconfig-turn-off-rc.networkmanager-if-networkmanager-is-not-selected.patch b/patches/source/network-scripts/0001-netconfig-turn-off-rc.networkmanager-if-networkmanager-is-not-selected.patch new file mode 100644 index 000000000..75700804e --- /dev/null +++ b/patches/source/network-scripts/0001-netconfig-turn-off-rc.networkmanager-if-networkmanager-is-not-selected.patch @@ -0,0 +1,20 @@ +From d5e9803b79f3bf909b01c3ff3a5cdb0d7594dba0 Mon Sep 17 00:00:00 2001 +From: Patrick J. Volkerding <volkerdi@slackware.com> +Date: Wed, 10 Nov 2021 16:27:08 -0600 +Subject: [PATCH] Ensure proper rc.networkmanager permissions + +In case rc.networkmanager was made executable by the admin or with a previous +run of netconfig, we need to disable it if networkmanager wasn't selected in +this netconfig run. + +--- ./sbin/netconfig.orig 2021-04-16 13:51:20.261045081 -0500 ++++ ./sbin/netconfig 2021-11-10 16:14:09.388939104 -0600 +@@ -1071,6 +1071,8 @@ + write_config_files + if [ "$NETWORKMANAGER" = "yes" -a -r etc/rc.d/rc.networkmanager ]; then + chmod 755 etc/rc.d/rc.networkmanager ++ elif [ ! "$NETWORKMANAGER" = "yes" -a -x etc/rc.d/rc.networkmanager ]; then ++ chmod 644 etc/rc.d/rc.networkmanager + fi + dialog --msgbox "Settings accepted. Basic network configuration is complete." 6 40 + else diff --git a/patches/source/network-scripts/0002-add-hostname-loopback-entries-in-etc-hosts-for-dhcp.patch b/patches/source/network-scripts/0002-add-hostname-loopback-entries-in-etc-hosts-for-dhcp.patch new file mode 100644 index 000000000..08cc1807f --- /dev/null +++ b/patches/source/network-scripts/0002-add-hostname-loopback-entries-in-etc-hosts-for-dhcp.patch @@ -0,0 +1,25 @@ +From aab9ad500096d67919f7e4f12a7466a74770d3a5 Mon Sep 17 00:00:00 2001 +From: Patrick J. Volkerding <volkerdi@slackware.com> +Date: Sun, 2 Jan 2022 14:17:08 -0600 +Subject: [PATCH] Add hostname-labeled loopback entries for DHCP + +This addresses a regression since the netconfig in Slackware 14.2. Previously, +when selecting to configure the machine with DHCP we would have entries with +the loopback addresses that were labeled with the machine's hostname. +Without these, a machine will not be able to contact itself using its own +hostname unless something else is providing matching name service, and we +do not want to have to rely on this. + +--- ./sbin/netconfig.orig 2022-01-02 14:07:01.168594490 -0600 ++++ ./sbin/netconfig 2022-01-02 14:14:30.835569617 -0600 +@@ -554,6 +554,10 @@ + rm -f $TMP/reply + + if [ "$REPLY" = "DHCP" ]; then ++ # We need the line below to make sure there are entries for loopback in ++ # /etc/hosts labeled with the machine's hostname, otherwise we might not ++ # be able to reach our own machine using the hostname. ++ LOOPBACK="yes" + dialog --title "SELECT DHCP TYPE" --default-item "DHCPv4" \ + --cancel-button "Exit" --menu \ + "Please select the type of DHCP to use to configure your networking. diff --git a/patches/source/network-scripts/0003-76218fa6e7c097c875af2a29cc7670995bef2ae4.patch b/patches/source/network-scripts/0003-76218fa6e7c097c875af2a29cc7670995bef2ae4.patch new file mode 100644 index 000000000..7be077718 --- /dev/null +++ b/patches/source/network-scripts/0003-76218fa6e7c097c875af2a29cc7670995bef2ae4.patch @@ -0,0 +1,30 @@ +From 76218fa6e7c097c875af2a29cc7670995bef2ae4 Mon Sep 17 00:00:00 2001 +From: Darren 'Tadgy' Austin <darren@afterdark.org.uk> +Date: Wed, 21 Jun 2023 14:36:55 +0100 +Subject: Re-add support for the DHCP_IPADDR parameter from rc.inet1.conf. + +During the last major updates, somehow the DHCP_IPADDR option +got missed while I re-implemented the options handling. +This commit re-adds the support for that option. + +Note that this commit changes the previously used '-s' dhcpcd +option with the '-r' option as this seems more appropriate. +--- + rc.inet1 | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/rc.inet1 b/rc.inet1 +index dc853fb..f998a21 100644 +--- a/rc.inet1 ++++ b/rc.inet1 +@@ -398,6 +398,7 @@ if_up() { + [ "${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") ++ [ -n "${DHCP_IPADDR[$i]}" ] && DHCP_OPTIONS+=("-r" "${DHCP_IPADDR[$i]}") + [ "${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 +-- +cgit v1.2.3 + diff --git a/patches/source/network-scripts/0004-8f43a741a36e59b8a9560ff2c4f3e5da2b8dd72b.patch b/patches/source/network-scripts/0004-8f43a741a36e59b8a9560ff2c4f3e5da2b8dd72b.patch new file mode 100644 index 000000000..caeaf875d --- /dev/null +++ b/patches/source/network-scripts/0004-8f43a741a36e59b8a9560ff2c4f3e5da2b8dd72b.patch @@ -0,0 +1,26 @@ +From 8f43a741a36e59b8a9560ff2c4f3e5da2b8dd72b Mon Sep 17 00:00:00 2001 +From: Darren 'Tadgy' Austin <darren@afterdark.org.uk> +Date: Wed, 21 Jun 2023 14:50:20 +0100 +Subject: Expand the help text for DHCP_IPADDR in rc.inet1.conf. + +--- + rc.inet1.conf | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/rc.inet1.conf b/rc.inet1.conf +index e952498..54d0d3e 100644 +--- a/rc.inet1.conf ++++ b/rc.inet1.conf +@@ -189,7 +189,8 @@ GATEWAY6="" + #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 ++ # server. There is no guarantee the server ++ # will honour the request for this IP address + #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 +-- +cgit v1.2.3 + diff --git a/patches/source/network-scripts/0005-5925f2bcc500f5198b5c00ab4e635a59bef7a413.patch b/patches/source/network-scripts/0005-5925f2bcc500f5198b5c00ab4e635a59bef7a413.patch new file mode 100644 index 000000000..a2494d885 --- /dev/null +++ b/patches/source/network-scripts/0005-5925f2bcc500f5198b5c00ab4e635a59bef7a413.patch @@ -0,0 +1,48 @@ +From 5925f2bcc500f5198b5c00ab4e635a59bef7a413 Mon Sep 17 00:00:00 2001 +From: Darren 'Tadgy' Austin <darren@afterdark.org.uk> +Date: Wed, 21 Jun 2023 14:55:41 +0100 +Subject: Add support for a DHCP_OPTS parameter. + +This commit allows an interface specific DHCP_OPTS parameter to set +additional dhcpcd command line options where they may be required +on a local network. It is still recommended to use the supported +DHCP_* options in preference to this option, but it is being added +to aid customisations. + +Thanks to ljb643 on LQ for the bug report regarding DHCP_IPADDR +and the suggestion of a DHCP_OPTS parameter. +--- + rc.inet1 | 1 + + rc.inet1.conf | 4 ++++ + 2 files changed, 5 insertions(+) + +diff --git a/rc.inet1 b/rc.inet1 +index f998a21..8b03fb7 100644 +--- a/rc.inet1 ++++ b/rc.inet1 +@@ -400,6 +400,7 @@ if_up() { + [ "${DHCP_KEEPGW[$i]}" = "yes" ] && DHCP_OPTIONS+=("-G") + [ -n "${DHCP_IPADDR[$i]}" ] && DHCP_OPTIONS+=("-r" "${DHCP_IPADDR[$i]}") + [ "${DHCP_DEBUG[$i]}" = "yes" ] && DHCP_OPTIONS+=("-d") ++ [ -n "${DHCP_OPTS[$i]}" ] && DHCP_OPTIONS+=(${DHCP_OPTS[$i]}) + # 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, +diff --git a/rc.inet1.conf b/rc.inet1.conf +index 54d0d3e..b3f7cdd 100644 +--- a/rc.inet1.conf ++++ b/rc.inet1.conf +@@ -196,6 +196,10 @@ GATEWAY6="" + # server is not found (ipv4ll link-local + # adresses in the IP range 169.254.0.0/16 are + # also known as "zeroconf" addresses) ++#DHCP_OPTS[4]="" # Add these options to the dhcpcd command line. ++ # Use this only if extra options are required ++ # on your local network and there is a no more ++ # specific DHCP_* option detailed above + #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. +-- +cgit v1.2.3 + diff --git a/patches/source/network-scripts/README.IPv6 b/patches/source/network-scripts/README.IPv6 new file mode 100644 index 000000000..fe4be5fcf --- /dev/null +++ b/patches/source/network-scripts/README.IPv6 @@ -0,0 +1,182 @@ +IPv6 for Slackware +================== + +Features +-------- +* Dual stack. Interfaces can be configured with an IPv4 address or an IPv6 + address, or both. +* Each interface can have single or multiple v4 and/or v6 IPs. Additional + v4 IPs are added as 'alias' interfaces, whereas v6 IPs are simply added + to the interface. +* Optional StateLess Address Auto Configuration (SLAAC) of v6 IP addresses + (disabled by default). +* DHCPv6 support for server controlled address configuration. +* Fixed IP configuration of IPv6 interfaces. + +Configuration +------------- +v6 IPs can be configured via SLAAC, DHCP6 or statically using the following new +options for rc.inet1.conf: + USE_SLAAC[x]="" Allow StateLess Address Auto Configuration of a + (potentially) globally routable v6 IP. With this option + set to "yes", the interface's v6 IP will ONLY be + configured via SLAAC, even if RA indicates DHCP6 is + available on the network - if SLAAC is not available on + the network, no IPv6 address will be assigned. + + Since dhcpcd is capable of handling SLAAC as well as + DHCP, it is better practice to set USE_DHCP6[x]="yes" to + perform full auto configuration instead. + + USE_DHCP6[x]="" Use dhcpcd to configure the interface. This will bring + up the interface using DHCP6, falling back to SLAAC (if + configured on the network), or will leave the interface + unconfigured after a timeout. When this option is set + to "yes", the USE_SLAAC[x] option is ignored. + + This is the preferred option to configure an interface + dynamically - whether the network is setup for DHCP6 or + SLAAC, dhcpcd will be able to configure the interface. + + IP6ADDRS[x]="" The static v6 IP addresses for the interface. This + option takes a list of v6 IP addresses and prefix + lengths in CIDR notation, in a space delimited list. + For example: IP6ADDRS[x]="a:b:c:d:e::1/48 1:2:3:4::5/64" + + If a prefix length is not given (separated from the IP + address with a /), a length of 64 will be assumed, and + a warning emitted about the unset value. + + When either the USE_DHCP6[x] or USE_SLAAC[x] options are + set to "yes", this setting is ignored - dynamic + configuration takes precedence over fixed IPs in + Slackware. + + GATEWAY6="" The default IPv6 gateway for the network. This is a + IPv6 address in standard format. + +The following lesser used misc options have been added for use in rc.inet1.conf: + USE_RA[x]="" Normally, unless USE_SLAAC[x]="yes" is set, Router + Advertisment (RA) is disabled for the interface as it + can result in extraneous routes being added to the + routing table. With this option set to "yes", RA + packets will be accepted on the interface even when DHCP + or fixed IP addressing is used, and the routes + advertised by the router will be added to the table. + + Conversely, if this option is explicitly set to "no", RA + will be disabled at all times - meaning SLAAC cannot be + performed even when USE_SLAAC[x]="yes" is set. The + default (unset) is to enable RA when SLAAC is in use, + and to disable it otherwise. + + The use of this option should rarely be required as + rc.inet1 will do the right thing. + + SLAAC_TIMEOUT[x]="" The time to wait (in seconds) for an interface to be + configured by SLAAC. When unset, the default is 15. + Some networks may require a longer period for the router + to broadcast an advertisement packet on the network. + + +Disabling IPv6 +-------------- +For some use cases, where IPv6 support is not required at all, disabling IPv6 +may be a better option than leaving the interface unconfigured. + +There are two similar methods which can be used to disable IPv6. Both of the +options involve creating (or replacing the content if it already exists) the +file /etc/modprobe.d/ipv6.conf (which overrides any configuration in the +/lib/modprobe.d/ipv6.conf file), and making the content as follows: + alias ipv6 off + alias net-pf-10 off +Or: + install ipv6 /bin/true + install net-pf-10 /bin/true + +It is important to disable both the 'ipv6' and 'net-pf-10' modules since the +module can be automatically loaded by each name. + + +Changes from previous Slackware versions +---------------------------------------- +* Previously, if the network the host is connecting to is configured for + StateLess Address Auto Configuration (SLAAC), the host would bring up an + interface with a (potentially) globally routable IPv6 address with no + configuration by the user. This has been changed so that all network + configuration must be explicitly enabled. Thus, interfaces will no longer + automatically come up with a valid IPv6 address on networks which support auto + configuration, without enabling the USE_SLAAC[x]="yes" option for the + interface. This is a security enhancement. + +* Unless RA is explicitly enabled using the USE_RA[x]="yes" option, rc.inet1 now + disables RA (via the accept_ra tunable in /proc) for an interface before + trying to add any IPs configured for it. This prevents RA on the network from + automatically adding any routes to the table. When USE_SLAAC[x]="yes" is set, + RA is implicitly re-enabled for the interface (since SLAAC and RA are usually + used together on a network), unless explicitly disabled with USE_RA[x]="no". + This is a change from previous versions of Slackware, which would auto + configure routes. This is a security enhancement in the same vein as above. + +* Interfaces will no longer be brought into the 'up' state unless they are + actually configured with an IP address. In previous versions, no matter + whether the interface was assigned an IP (either via DHCP or a fixed IP) or + not, the interface would be left in the 'up' state after executing 'rc.inet1 + start'. This will no longer happen and is considered a clean-up of the + previous behaviour. + +* If no NETMASK[x] is set for an interface, rc.inet1 will now assume a + prefix/netmask of 24 (and will emit a warning). CIDR notation netmasks are now + recommended (with the leading / as optional), but the old style dotted-quad + notation is still accepted for IPv4. This is a configuration enhancement. + +* In previous versions, the IP aliases configuration for IPv4 assumed a netmask + of /32, making the interface only addressable by itself. Now, a netmask of + /24 is assumed where none is provided in the configuration. This is a bugfix. + +* Sometime during this -current cycle, the call to dhcpcd gained a hard coded -L + (disable use of IPv4LL addresses as last resort) parameter which effectively + rendered the DHCP_NOIPV4LL[x] option redundant - the use of -L was not + contingent upon the value of DHCP_NOIPV4LL[x]. The hard coded -L has been + removed from the dhcpcd command line, restoring the behaviour of 14.2 and the + usefulness of the DHCP_NOIPV4LL[x] option. + + +Known issues +------------ +* When being invoked without the -4 or -6 option (that is, when both USE_DHCP[x] + and USE_DHCP6[x] are set), dhcpcd will only wait until one type of IP is + obtained before backgrounding - it will not wait for both a v4 AND v6 to be + configured. This means there is no way to know if the interface has been + configured for both types of IP, as one type will continue to be sought in the + background; but may ultimately fail. This is an issue with the way dhcpcd + operates and not an issue with rc.inet1. + +* Changes in interface configuration type from DHCP to fixed IP or stateless + will cause an issue where the dhcpcd daemon fails to be stopped during a + restart or stop/start operation because rc.inet1 is unaware of how an + interface was previously configured - it can only stop the interface based + upon its current configuration. This is a by-product of the way the rc.inet1 + script is coded (there is no record kept of the previous configuration type of + an interface) and is present (but doesn't seem to be documented anywhere) on + previous versions of Slackware. This particular issue is not specifically + related to IPv6, but is documented here for completeness. + +* When being killed in if_down(), dhcpcd requires some command line options to + match those which were used to invoke it - not only does the interface name + need to match, but also the use of -4/-6. This can cause a problem during a + restart or stop/start of the interface if the configuration for DHCP has + changed. This manifests itself in the same way as the issue detailed above + and is no more serious. In both cases, the end user must kill the dhcpcd + daemon manually. This issue is caused by the new way dhcpcd is invoked when + using/not using IPv6. + + +Thanks +------ +* Robby Workman, for the original iproute2 version of rc.inet1 and advice. +* David Spencer, for advice, debating, and testing the SLAAC implementation. + +-- +Darren 'Tadgy' Austin. +<darren (at) afterdark.org.uk> diff --git a/patches/source/network-scripts/README.VLANs b/patches/source/network-scripts/README.VLANs new file mode 100644 index 000000000..108c399e1 --- /dev/null +++ b/patches/source/network-scripts/README.VLANs @@ -0,0 +1,52 @@ +VLANs (aka, 802.1q) +=================== + +Features +-------- +* Simple configuration of VLAN interfaces using standard rc.inet1.conf + variables. +* Utilises the new IFOPTS[x]="" paramter, which allows VLAN interface + specific configuration, supporting the use of any option. +* VLAN interfaces can be built on top of bonds and virtual or physical + interfaces. + + +Configuration +------------- +Configuring VLAN bound interfaces utilises the standard Slackware networking +configuration syntax in rc.inet1.conf, with setting up an interface as simple +as changing the IFNAME[x]. + +VLAN interfaces can be configured quite simply in rc.inet1.conf, in the standard +Slackware way of defining an interface. The key to the configuration is to use +the correct IFNAME[x]="" setting for the underlying ethernet (or bond) interface +and the tagged VLAN ID that should be exposed. For example: + IFNAME[0]="eth0.10" + IFOPTS[0]="" + IPADDR[0]="192.168.10.1" + NETMASK[0]="24" + +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 to expose. +The above example would use the physical interface 'eth0', and expose the VLAN +with ID '10'. + +It is also possible to use a bond as the underlying interface, which allows +link aggregated VLAN interfaces to be created for network redundancy. + +The interfaces support IPv4 and IPv6 IP addressing configured in the Slackware +way in rc.inet1.conf. + +IFOPTS[x] is a pipe (|) delimited list of VLAN kernel module specific settings +to be applied to the interface. The ip-link(8) man page contains details of +exactly what settings can be used with this option (search for "VLAN Type +Support"). For example: + VLANOPTS[x]="protocol 802.1ad | reorder_hdr off" + +Under normal circumstances, where a standard VLAN interface is required, no +options should be supplied. + + +-- +Darren 'Tadgy' Austin. +<darren (at) afterdark.org.uk> diff --git a/patches/source/network-scripts/README.bonding b/patches/source/network-scripts/README.bonding new file mode 100644 index 000000000..5f14e50c2 --- /dev/null +++ b/patches/source/network-scripts/README.bonding @@ -0,0 +1,129 @@ +Bonding (link aggregation) +========================== + +Features +-------- +* Full support of features offered by the bonding kernel module. +* Selectable bonding mode using a single parameter in rc.inet1.conf. +* Easy addition of interfaces to the bond using a parameter in rc.inet1.conf. +* Custom bonding module options can be provided using the generic parameter + IFOPTS[x] in the configuration file. + +Configuration +------------- +Bonding interfaces can be configured via two new bond specific parameters in +rc.inet1.conf, plus use of the generic IFOPTS[x] parameter. New parameters +are: + BONDNICS[x]="" The space delimited list of interfaces to add to this + bond. The interfaces will be brought up and configured + while bringing up the interface, so do not need to be + previously defined in rc.inet1.conf. A bond can be + created with only 1 interface, but does not become + useful until at least 2 interfaces are configured. + + BONDMODE[x]="" This parameter sets the bonding mode for this + interface. If not specified when BONDNICS[x] has been + used, the default is 'balance-rr'. See below for a + list of all bonding modes available. + +The following bond modes are available: + balance-rr This mode is also known as round-robin mode. Packets + are sequentially transmitted and received through each + interface one by one. This mode provides load + balancing functionality along with fault tolerance. + active-backup When in this mode only one interface set to active, + while all other interfaces are in the backup state. If + the active interface fails, a backup interface replaces + it as the only active interface in the bond. This mode + only provides fault tolerance, no load balancing. + This mode requires that the 'primary <interface>' + option be configured with the IFOPTS[x] parameter. + balance-xor The source MAC address uses exclusive or (XOR) logic + with the destination MAC address. This calculation + ensures that the same slave interface is selected for + each destination MAC address. This mode provides fault + tolerance and load balancing. + broadcast All packets are sent to all the slaved interfaces. This + mode provides fault tolerance, but may result in + duplicate packets arriving at the destination. + 802.3ad Also known as LACP. This mode creates aggregation + groups that share the same speed and duplex settings, + and it requires a switch that supports an IEEE 802.3ad. + This mode uses all interfaces to form the aggregation + group and provides fault tolerance and load balancing. + balance-tlb This mode ensures that the outgoing traffic + distribution is set according to the load on each + interface and that the current interface receives all + the incoming traffic. If the assigned interface fails + to receive traffic, another interface is assigned to + the receiving role. This provides fault tolerance and + load balancing. + balance-alb The receiving packets are load balanced through Address + Resolution Protocol (ARP) negotiation. This mode + provides fault tolerance and load balancing. + +Module specific interface options can be set using the the IFOPTS[x] paramter, +which takes a pipe (|) delimited list of options for the interface. The +following are the most useful options which can be set with IFOPTS[x]: + miimon Specifies the MII link monitoring frequency in milliseconds. + This determines how often the link state of each slaved + interface is checked for link failures. A value of zero + disables MII link monitoring, but this is NOT advised. A value + of 100 is a good starting point. The default value is 0, so be + sure to set this option with ALL modes. + lacp_rate This option specifies the rate at which the host will ask the + link partner to transmit LACPDU packets in 802.3ad mode. + Possible values are: + slow Transmit LACPDUs every 30 seconds. + fast Transmit LACPDUs every 1 second. + The default is slow, but fast is recommended. + primary The interface (eth0, eth2, ...) selecting which slave is the + primary device. The specified interface will always be the + active slave while it is available. Only when the primary is + off-line will alternate interfaces be used. This is useful + when one interface is preferred over another (e.g. when one + interface has higher throughput than another). This option + is only valid for active-backup, balance-tlb, and balance-alb + modes. + xmit_hash_policy + Selects the transmit hash policy to use for interface selection + in balance-xor, 802.3ad, and balance-tlb modes. Possible + values are: + layer2 Use XOR of source/dest hardware MAC addresses + and packet type ID fields to generate the hash. + This algorithm will place all traffic to a + particular network peer on the same slave. + layer2+3 Use a combination of layer2 and layer3 protocol + information (hardware MAC addresses and IP + addresses) to generate the hash. + This algorithm will place all traffic to a + particular network peer on the same slave. + This policy is intended to provide a more + balanced distribution of traffic than layer2 + alone, especially in environments where a + layer3 gateway device is required to reach most + destinations. + layer3+4 This policy uses upper layer protocol + information, when available, to generate the + hash. This allows for traffic to a particular + network peer to span multiple slave interfaces, + although a single connection will not span + multiple slaves. + The default value is layer2. Additional (lesser used) policies + are available, and documented in kernel source documentation: + /usr/src/linux/Documentation/networking/bonding.txt + +The IFOPTS[x] option should always include the 'miimon' option - 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. + +Full documentation of the bonding layer is available in the kernel source +documentation: /usr/src/linux/Documentation/networking/bonding.txt. + + +-- +Darren 'Tadgy' Austin. +<darren (at) afterdark.org.uk> diff --git a/patches/source/network-scripts/README.networking b/patches/source/network-scripts/README.networking new file mode 100644 index 000000000..835db50aa --- /dev/null +++ b/patches/source/network-scripts/README.networking @@ -0,0 +1,554 @@ +Slackware Network Configuration +=============================== + +Networking in Slackware is configured by the /etc/rc.d/rc.inet1 script, and the +configuration file /etc/rc.d/rc.inet1.conf. Wireless interfaces are configured +just like any network interface, but accept many more configuration parameters. + +The rc.inet1.conf file contains a series of variable array definitions, with +each array index corresponding to a single network interface. This means that +each set of parameters with an index of 0 configure the first interface (since +indexing starts at 0), parameters with an index of 1 configure the second +interface, and so on. Not all parameters need to be set for each type of +interface, or interface number. This is better illustrated with examples, +which you will find in the documentation below. + + +Starting and Stopping Interfaces +-------------------------------- +The way to start networking (configuring all NICs, bringing the interfaces up, +and creating a default route, if required) is by running the command: + /etc/rc.d/rc.inet1 start +This command will configure all networking interfaces which are defined in the +configuration file, and is used at boot time to bring networking up. + +The counterpart to this is the: + /etc/rc.d/rc.inet1 stop +command, which will bring all networking to a stop. It is advised to use this +with caution as it can make your host completely inaccessable from the network. + +Restarting the whole network (all available network interfaces) and resetting +the default gateway (if set) is done in a similar fashion to starting it: + /etc/rc.d/rc.inet1 restart +And will first deconfigure all interfaces, before bringing them back up - which +is functionally equalivant to a 'stop' and 'start' operation. + +More specifically speaking, you can start/stop/restart any network interface on +an individual basis using the commands: + /etc/rc.d/rc.inet1 <interface>_start + /etc/rc.d/rc.inet1 <interface>_stop + /etc/rc.d/rc.inet1 <interface>_restart +where <interface> is the name of an existing network interface (eth0, eth1, +wlan0, etc). + + +Guided Networking Configuration +------------------------------- +The 'netconfig' script is capable of configuring basic networking parameters for +the first ethernet interface of the system, and writing an annotated +/etc/rc.d/rc.inet1.conf configuration file. 'netconfig' is usually invoked +during installation to configure the first ethernet interface of your freshly +installed system. + +'netconfig' is capable of configuring a set of IPv4 and/or IPv6 addresses for an +interface, or setting the interface to be configured using DHCP (both DHCPv4 and +DHCPv6) and IPv6 StateLess Address Auto Configuration (SLAAC). The default +gateways and nameservers can also be configured through the guided interface. + +The option to use NetworkManager for interface configuration (instead of +rc.inet1.conf) is also available. + +For most users with a single ethernet interface, and simple IP configuration +requirements, 'netconfig' can completely configure the networking sub-system for +you. + + +Deprecated and New IPv4 Configuration Syntax +-------------------------------------------- +With the release of Slackware 15.0, several parameters used in older +rc.inet1.conf configurations have become deprecated and are substituted by a +new, singular, IP parameter for v4 addresses. + +Specifically, the following parameters used in previous rc.inet1.conf +configurations to configure IPv4 addresses have become deprecated: + IPADDR[x]="" + NETMASK[x]="" + IPALIASES[x]="" +These parameters should no longer be used in new configurations. + +New configurations should use the updated syntax parameter: + IPADDRS[x]="" +which can hold multiple, space delimited, IPv4 addresses with their CIDR +masks in order to configure an interface. + +The format for the addresses specified in this new parameter is: + IP-address/mask +For example: + IPADDRS[0]="192.168.0.1/24 10.10.10.10/8" +which would be the equilivant of old syntax: + IPADDR[0]="192.168.0.1" + NETMASK[0]="255.255.255.0" + IPALIASES[0]="10.10.10.10/8" + +If a mask (in CIDR notation) is not provided with the IP address in IPADDRS, it +is assumed to be /24 (aka, 255.255.255.0). A warning will also be emitted about +the missing mask. + +rc.inet1 is fully backwards compatible with the older syntax - old configuration +files will contiinue to be accepted for the foreseeable future, but 'netconfig' +has been adjusted to output the new syntax. + +Notes: + * When DHCP or SLAAC is used to dynamically configure the interface, IP + addresses specified in IPADDRS will be added to the interface as alias IPs. + However, any address specified in IPADDR is *not* added to the interface in + order to maintain backwards semantics with the pre 15.0 rc.inet1. + * Should an rc.inet1.conf contain both the IPADDR and IPADDRS parameters + (without DHCP or SLAAC being in use) the addresses listed in IPADDRS will be + added to the interface after the IPADDR address is set. + + +Manual Networking Configuration +------------------------------- +FIXME + + +IPv6 +---- + Overview + ~~~~~~~~ + + With the new IPv4 syntax detailed above, there is the addition of optional + configuration semantics for IPv6. + + The IPv6 capabilities in Slackware 15.0+ are as follows: + * Dual stack. Interfaces can be configured with an IPv4 address or an IPv6 + address, or both. + * Each interface can have single or multiple v4 and/or v6 IPs. + * Optional StateLess Address Auto Configuration (SLAAC) of v6 IP addresses, + for quick and easy IPv6 configuration on supported networks. + * DHCPv6 support for server controlled dynamic address configuration. + * Fixed IPv6 addresses configured interfaces. + + 'netconfig' can be used for guided configuration of all of the above features, + or they can be configured manually using the options below. + + + IPv6 Parameters + ~~~~~~~~~~~~~~~ + v6 IPs can be configured via SLAAC, DHCP6 or statically using the following + new options for rc.inet1.conf: + USE_SLAAC[x]="" Allow StateLess Address Auto Configuration of a + (potentially) globally routable v6 IP. With this + parameter set to "yes", the interface's v6 IP will ONLY + be configured via SLAAC, even if Router Advertisment + indicates DHCPv6 is available on the network - if SLAAC + is not available on the network, no IPv6 address will be + assigned. + + Since 'dhcpcd' is capable of handling SLAAC as well as + DHCPv6, it is better practice to set USE_DHCP6[x]="yes" + to perform full auto configuration instead. + + USE_DHCP6[x]="" Use 'dhcpcd' to configure the interface. This will + bring up the interface using DHCPv6, falling back to + SLAAC (if supported on the network), or will leave the + interface unconfigured after a timeout. When this + parameter is set to "yes", the USE_SLAAC[x] option is + ignored. + + This is the preferred option to configure an interface + dynamically - whether the network is setup for DHCPv6 or + SLAAC, 'dhcpcd' will be able to configure the interface. + + IP6ADDRS[x]="" The static v6 IP addresses for the interface. This + parameter takes a list of v6 IP addresses and prefix + lengths in CIDR notation, in a space delimited list. + For example: IP6ADDRS[x]="a:b:c:d:e::1/48 1:2:3:4::5/64" + + If a prefix length is not given (separated from the IP + address with a /), a length of 64 will be assumed, and + a warning emitted about the unset value. + + When either the USE_DHCP6[x] or USE_SLAAC[x] options are + set to "yes", the IP addresses listed in this parameter + are also added to the interface, but only upon sucessful + assigning of the dynamic IP address. + + A static gateway can be configured using this parameter: + GATEWAY6="" The default IPv6 gateway for the network. This is a + single IPv6 address in standard format, without a + prefix suffix. + + The following lesser used misc options can be used for tailouring of the IPv6 + configuration process: + USE_RA[x]="" Normally, unless USE_SLAAC[x]="yes" is set, Router + Advertisment (RA) is disabled for the interface as it + can result in extraneous routes being added to the + routing table. With this option set to "yes", RA + packets will be accepted on the interface even when DHCP + or fixed IP addressing is used, and the routes + advertised by the router will be added to the table. + + Conversely, if this parameter is explicitly set to "no", + RA will be disabled at all times - meaning SLAAC cannot + be performed even when USE_SLAAC[x]="yes" is set. The + default (unset) is to enable RA when SLAAC is in use, + and to disable it otherwise. + + The use of this parameter should rarely be required as + rc.inet1 will do the right thing. + + SLAAC_TIMEOUT[x]="" The time to wait (in seconds) for an interface to be + configured by SLAAC. When unset, the default is 15. + Some networks may require a longer period for the router + to broadcast an advertisement packet on the network, so + may need to increase this value. + + + Disabling IPv6 + ~~~~~~~~~~~~~~ + For some use cases, where IPv6 support is not required at all, disabling IPv6 + may be a better option than leaving the interface unconfigured. + + There are two similar methods which can be used to disable IPv6. Both of the + options involve creating (or replacing the content if it already exists in) + the file: + /etc/modprobe.d/ipv6.conf + (which overrides any configuration in the /lib/modprobe.d/ipv6.conf file), + with the content: + alias ipv6 off + alias net-pf-10 off + Or: + install ipv6 /bin/true + install net-pf-10 /bin/true + + It is important to disable both the 'ipv6' and 'net-pf-10' modules since the + module can be automatically loaded by either name. + + + Changes From Previous Behaviour + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * Previous to Slackware 15.0, if the network the host is connecting to is set + up for StateLess Address Auto Configuration (SLAAC), the host would bring up + an interface with a (potentially) globally routable IPv6 address with no + configuration by the user. This has been changed so that all network + configuration must be explicitly enabled. Thus, interfaces will no longer + automatically come up with a valid IPv6 address on networks which support + auto configuration, without enabling the USE_SLAAC[x]="yes" parameter for + the interface. This is a security enhancement. + + * Unless RA is explicitly enabled using the USE_RA[x]="yes" option, rc.inet1 + now disables RA (via the accept_ra tunable in /proc) for an interface before + trying to add any IPs configured for it. This prevents RA on the network + from automatically adding any routes to the table. When USE_SLAAC[x]="yes" + is set, RA is implicitly re-enabled for the interface (since SLAAC and RA + are usually used together on a network), unless explicitly disabled with + USE_RA[x]="no". This is a change from previous versions of Slackware, which + would auto configure routes without any user intevention. This is a + security enhancement. + + + Caveats + ~~~~~~~ + * When being configured with the USE_DHCP[x]="yes" and USE_DHCP6[x]="yes" + parameters for an interface (that is, configured to obtain both a v4 and v6 + addresses via DHCP), 'dhcpcd' will only wait until one type of IP is + obtained before backgrounding - it will not wait for both a v4 AND v6 to be + configured. This means there is no way to know if the interface has been + completely configured for both types of IP, as one type will continue to be + sought in the background; but MAY ultimately fail. This is an issue with + the way dhcpcd operates, not an issue with rc.inet1. + + +Bonding / Link Aggregation +-------------------------- + Overview + ~~~~~~~~ + Bonding (or Link Aggregation) is a teccnique for combining two or more + physical interfaces into a single, logical, interface; a logical interface + which has all the capabilities of a single physical interface. + + The Slackware bonding options provide full support for the features offered by + the bonding kernel module, in the familiar Slackware parameter configuration + syntax. Included is the ability to select the bonding mode, easy addition of + interfaces to a bond using a new parameter in rc.inet1.conf, and the setting + of bonding module options via a new, generic, IFOPTS[x] parameter. + + At this time 'netconfig' is unable to configure bonded interfaces, so they + must be configured manually with the parameters detailed below. + + + Bonding Parameters + ~~~~~~~~~~~~~~~~~~ + Bonded interfaces can be configured via two new bond specific parameters for + use in rc.inet1.conf, plus the new, generic, IFOPTS[x] parameter. The new + bonding parameters are: + BONDNICS[x]="" The space delimited list of interfaces to add to this + bond. The interfaces will be brought up and configured + while bringing up the interface, so do not need to be + previously defined in rc.inet1.conf. A bond can be + created with only 1 interface, but does not become + useful until at least 2 interfaces are configured. + + BONDMODE[x]="" This parameter sets the bonding mode for the logical + interface. If not specified when BONDNICS[x] has been + used, the default is 'balance-rr'. See below for a + list of all bonding modes available. + + + Bonding Modes + ~~~~~~~~~~~~~ + When a bonded logical interface is created, it needs to operate in a + particular mode. By default that mode is 'balance-rr'. The following modes, + along with details of their functionallity, are available using the kernel + bonding driver: + 802.3ad Also known as LACP. This mode requires a switch that + supports an IEEE 802.3ad. The physical interfaces must + share the same speed and duplex settings and form a + logical interface which provides fault tolerance and + load balancing. + active-backup When in this mode only one interface set to active, + while all other interfaces are in the backup state. If + the active interface fails, a backup interface replaces + it as the only active interface in the bond. This mode + only provides fault tolerance, no load balancing. + This mode requires that the 'primary <interface>' + option be configured with the IFOPTS[x]="" parameter. + balance-alb The receiving packets are load balanced through Address + Resolution Protocol (ARP) negotiation. This mode + provides fault tolerance and load balancing. + balance-rr This mode is also known as round-robin mode. Packets + are sequentially transmitted and received through each + interface one by one. This mode provides load + balancing functionality along with fault tolerance. + This is the default mode of operation. + balance-tlb This mode ensures that outgoing traffic is distributed + according to the load on each physical interface. If + one interface fails to receive traffic, another + interface is assigned to the receiving role. This mode + provides fault tolerance and load balancing. + balance-xor The source MAC address uses eXclusive OR (XOR) logic + with the destination MAC address in order to determine + which physical interface the packet should be sent via. + This calculation ensures that the same physical (slave) + interface is selected for each destination host. If the + physical interface to be used is in a failed state, one + of the backup interfaces is used instead. This mode + provides fault tolerance and load balancing. + broadcast All packets are sent to all the physical (slaved) + interfaces at once. This mode provides fault tolerence + but may result in duplicate packets arriving at the + destination host, assuming they are not screened out by + networking hardware. + + + Bonding Options + ~~~~~~~~~~~~~~~ + Bonding specific options can be set using the the IFOPTS[x]="" paramter (which + takes a pipe (|) delimited list of options) for the interface being + configured. The following are the most useful options (but not an exhaustive + list - see "Further Reading" below for more information) which can be set: + lacp_rate This option specifies the rate at which the host will + ask the switch to transmit LACPDU packets in 802.3ad + mode. Possible values are: + slow Transmit LACPDUs every 30 seconds. + fast Transmit LACPDUs every 1 second. + The default is slow, but fast is recommended for rapid + recovery after a physical link failure. + miimon Specifies the MII link monitoring frequency in + milliseconds. This determines how often the link state + of each physical (slaved) interface is checked for link + failures. A value of zero disables MII link monitoring, + but this is NOT advised. A value of 100 is a good + starting point. The default value is 0, so be sure to + set this option with ALL bonding modes. + primary The physical (slave) interface (eth0, eth1, etc) which + is to be used as the primary interface. The specified + interface will always be the active slave while it is + available. Only when the primary interface is off-line + will alternate interfaces be used. This is useful when + one interface is preferred over another (e.g. when one + interface has higher throughput than another). This + option is only valid for "active-backup", "balance-tlb", + and "balance-alb" bonding modes. + xmit_hash_policy Selects the transmit hash policy to use for interface + selection in "balance-xor", "802.3ad", and "balance-tlb" + bonding modes. Possible values are: + layer2 Use eXclusive OR (XOR) of source and + destination MAC addresses and packet + type ID fields to generate the hash. + This algorithm will place all traffic + to a particular destination on the + same phydivsl (slave) interface. + layer2+3 Use a combination of layer2 and + layer3 protocol information (MAC + addresses and IP addresses) to + generate the hash. This algorithm + will place all traffic to a particular + destination on the same physical + (slave) interface. This policy is + intended to provide a more balanced + distribution of traffic than layer2 + alone. + layer3+4 This policy uses upper layer protocol + information, when available, to + generate the hash. This allows for + traffic to a particular destination to + span multiple physical (slave) + interfaces, although a single + connection will not span multiple + slaves. + The default value is layer2. Additional (lesser used) + policies are available - see the "Further Reading" + section below for further details. + + + Caveats + ~~~~~~~ + * The IFOPTS[x]="" parameter should always include the 'miimon' option - not + using this option will result in network degradation. + * In "active-backup" mode, the "primary" option should also always 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. + + + Examples + ~~~~~~~~ + FIXME: Add examples. + + + Further Reading + ~~~~~~~~~~~~~~~ + Full documentation of the bonding layer is available in the kernel source + documentation at: /usr/src/linux/Documentation/networking/bonding.txt. + + +VLANs (a.k.a, 802.1q) +--------------------- + Overview + ~~~~~~~~ + Virtual LANs (VLANs) allow the segmentation of physical networks into + multiple, isolated, private virtual networks, whilst using shared network + switches and hardware. + + VLANs work by applying tags to network frames to form virtual private LANs. + In this way, VLANs can keep network applications separate despite being + connected to the same physical network, and without requiring multiple sets of + cabling and networking devices to be deployed. + + In essence, a VLAN is a collection of devices or network hosts that + communicate with one another as if they make up a single LAN, but utilising + shared network hardware. + + Because VLAN frames are tagged with a VLAN ID, it is possible to 'cherry-pick' + those frames from the network by use of a VLAN interface on the host. + + Slackware now allows configuration of such interfaces in order to allow a host + to join a specific VLAN or VLANs. The guided deployment in 'netconfig' has + been updated to support the creation of such VLAN interfaces. + + The configuration in rc.inet1.conf for VLANs is a simple modification of the + existing support for declaration of a network interface using the standard + Slackware IFNAME[x] parameter. As shown in the examples below, VLANs + interfaces can be built on top on top of regular, physical, interfaces, or on + top of a bond interface to allow for link aggregation. + + The new IFOPT[x] generic interface options parameter can be used to customise + the usage and configuration of the VLAN interfaces, but is not required in a + normal configuration setting. + + + Exposing VLANs + ~~~~~~~~~~~~~~ + Configuring VLAN interfaces utilises the standard Slackware networking + configuration syntax in rc.inet1.conf; with setting up an interface as simple + as changing the IFNAME[x]="" parameter. + + VLAN interfaces can be configured quite simply in rc.inet1.conf, in the + standard Slackware way of defining an interface. The key to the configuration + is to use the correct IFNAME[x]="" parameter for the underlying physical (or + bond) interface and the tagged VLAN ID that should be exposed. For example: + IFNAME[0]="eth0.10" + IFOPTS[0]="" + IPADDRS[0]="192.168.10.1/24" + + The VLAN ID is taken from the full interface name, as set in the IFNAME[x] + parameter which is comprised of the underlying physical (or bond) interface + name, a period (.) and the VLAN ID to expose. The above example would use the + physical interface 'eth0', and expose the VLAN with ID 10, and configure the + interface with the IPv4 address 192.168.10.1 with a mask of 24. + + IFOPTS[x]="" is a pipe (|) delimited list of VLAN kernel module specific + settings to be applied to the interface. The ip-link(8) man page contains + details of exactly what settings can be used with this option (search for + "VLAN Type Support"). For example: + IFOPTS[x]="protocol 802.1ad | reorder_hdr off" + Under normal circumstances, where a standard VLAN interface is required, no + options need be supplied. + + + Examples + ~~~~~~~~ + FIXME: Add examples. + + +Bridges +------- + + +Wireless (WiFi) Network Interfaces +---------------------------------- + + +TUN/TAP +------- + + +Advanced networking configuration +--------------------------------- +(stacking interface configs - bond, then VLAN, then bridge) + + It is also possible to use a bond as the underlying interface, which allows + link aggregated VLAN interfaces to be created for network redundancy. For + example: + IFNAME[0]="bond0" + BONDNICS[0]="eth0 eth1" + BONDMODE[0]="active-backup" + IFOPTS[0]="miimon 100 | primary eth0" + IFNAME[1]="bond0.5" + IFNAME[2]="br0" + BRNICS[2]="bond0.5" + IPADDRS[2]="192.168.5.10/24" + IP6ADDRS[2]="a:b:c:d::1/64" + Would create a bond interface using the eth0 and eth1 physical ethernet + interfaces, in an "active-backup" redundancy configuration with the primary + interface being "eth0", exposing VLAN ID 5 and setting an IPv4 address of + "192.168.5.10" mask "24", plus an IPv6 address of "a:b:c:d::1" prefix "64" + for the interface. + + +General Caveats +--------------- + + The network interface definitions are stored in variable arrays. The bash shell has no facilities to retrieve the largest array index used. There- + fore, the rc.inet1 script makes the assumption that array indexes stay below the value of 6. Effectively this means that you can configure up to 6 + network interfaces in rc.inet1.conf by default. + + If you want to configure more than six network interfaces, you will have to edit the file /etc/rc.d/rc.inet1.conf and change the value `6' in the + line: + #MAXNICS="6" + (at the very bottom of the file) to a value that is larger than the largest index value you use, and uncomment the line. + + The /etc/rc.d/rc.wireless script is not meant to be run on its own by the user! + + +rc.inet1 does not keep a record of how an interface was configured. If the +interface config is changed in rc.inet1.conf from, say, DHCP to static IP, +restarting networking may fail because the previous type of interface config +cannot be stopped (because its type is unknown). In this instance, it is easier +to reboot to start from fresh. However, if reboot is not possible, it may be +required to bring the interface down manually (either by deconfiguring the IPs, +or killing dhcpcd) before trying to restart the interface. + diff --git a/patches/source/network-scripts/doinst.sh b/patches/source/network-scripts/doinst.sh new file mode 100644 index 000000000..a9d09b0fa --- /dev/null +++ b/patches/source/network-scripts/doinst.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# Handle the incoming configuration files: +config() { + NEW="$1" + OLD="`dirname $NEW`/`basename $NEW .new`" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} +config etc/rc.d/rc.inet1.new +config etc/rc.d/rc.inet1.conf.new +config etc/rc.d/rc.inet2.new +config etc/rc.d/rc.ip_forward.new +config etc/hosts.new +config etc/hosts.deny.new +config etc/hosts.equiv.new +config etc/networks.new +config etc/nntpserver.new +config etc/resolv.conf.new +config etc/HOSTNAME.new +config etc/host.conf.new +config etc/hosts.allow.new +config etc/protocols.new + +# OK, some of these aren't useful as examples, and have to be +# considered clutter if you've already got the file. +# So out they go. +rm -f etc/HOSTNAME.new +rm -f etc/hosts.new +rm -f etc/resolv.conf.new +rm -f etc/nntpserver.new + diff --git a/patches/source/network-scripts/manpages/rc.inet1.8 b/patches/source/network-scripts/manpages/rc.inet1.8 new file mode 100644 index 000000000..648e0166e --- /dev/null +++ b/patches/source/network-scripts/manpages/rc.inet1.8 @@ -0,0 +1,120 @@ +.\" -*- nroff -*- +.ds g \" empty +.ds G \" empty +.\" Like TP, but if specified indent is more than half +.\" the current line-length - indent, use the default indent. +.de Tp +.ie \\n(.$=0:((0\\$1)*2u>(\\n(.lu-\\n(.iu)) .TP +.el .TP "\\$1" +.. +.TH RC.INET1 8 "1 Oct 2018" "Slackware Version 15.0" +.SH NAME +rc.inet1 \- Slackware network configuration script. +.SH DESCRIPTION +.BR rc.inet1 . +This script configures network interfaces. +Wireless interfaces are configured just like any network device +but accept many more configuration parameters. +.LP +rc.inet1 reads its configuration parameters from a file +.IR /etc/rc.d/rc.inet1.conf . +The +.I rc.inet1.conf +file contains a series of variable array definitions, +with each array index corresponding to a single network interface. +.SH OPTIONS +The way to start your network (configuring your nics and +bringing the interfaces up, and creating a default route if required) +is by running the command: +.LP +.B /etc/rc.d/rc.inet1 start +.LP +Restarting the whole network (all available network interfaces) +is done in a similar fashion: +.LP +.B /etc/rc.d/rc.inet1 restart +.LP +More generally speaking, you can start/stop/restart any network +interface by running one of the commands: +.LP +.B /etc/rc.d/rc.inet1 INTERFACE_start +.LP +.B /etc/rc.d/rc.inet1 INTERFACE_stop +.LP +.B /etc/rc.d/rc.inet1 INTERFACE_restart +.LP +where +.B INTERFACE +is the name of an existing network interface (eth0, wlan0, ...) +.SH WIRELESS +The script +.I rc.wireless +takes care of configuring the wireless parameters for a network +interface. This script does not run independently. Instead, it is executed +by the generic network configuration script +.IR rc.inet1 . +.LP +If a wireless interface is detected, +.I rc.wireless +will use +.IR iwconfig , +.I iwpriv +and possibly +.I wpa_supplicant +to associate the card with an access point (in managed mode) or peer it with +another computer (in ad-hoc mode), and enable an encryption modus like WPA. +.SH FILES +.TP 25 +.I /etc/rc.d/rc.inet1 +network configuration script +.TP +.I /etc/rc.d/rc.inet1.conf +parameter definition file (is being read by rc.inet1 and rc.wireless) +.TP +.I /etc/rc.d/rc.wireless +wireless configuration script +.TP +.I /etc/rc.d/rc.wireless.conf +parameter definition file ( +.B deprecated +) +.SH DIAGNOSTICS +If you remove the executable bit from the +.I rc.wireless +script, it will never be executed. This can be beneficial if you have +written your own wireless script and don't want Slackware to mess it up. +.SH CAVEATS +The network interface definitions are stored in variable +.I arrays. +The bash shell has no facilities to retrieve the largest array index used. +Therefore, the +.I rc.inet1 +script makes the assumption that array indexes stay below the value of +.BR 6 . +Effectively this means that you can configure up to 6 network interfaces in +rc.inet1.conf by default. +.LP +If you want to configure more than six network interfaces, you will +have to edit the file +.I /etc/rc.d/rc.inet1.conf +and change the value `6' in the line: +.br +.B \ \ #MAXNICS="6" +.br +(at the very bottom of the file) to a value that is larger than the largest +index value you use, and uncomment the line. +.LP +The /etc/rc.d/rc.wireless script is not meant to be run on its own by the user! +.SH AUTHORS +Patrick J. Volkerding <volkerdi@slackware.com> +.br +Eric Hameleers <alien@slackware.com> +.br +Robby Workman <rworkman@slackware.com> +.br +Darren 'Tadgy' Austin <darren@slackware.uk> +.SH "SEE ALSO" +.BR rc.inet1.conf(5), +.BR ip(8), +.BR iwconfig(8), +.BR route(8) diff --git a/patches/source/network-scripts/manpages/rc.inet1.conf.5 b/patches/source/network-scripts/manpages/rc.inet1.conf.5 new file mode 100644 index 000000000..8152b3494 --- /dev/null +++ b/patches/source/network-scripts/manpages/rc.inet1.conf.5 @@ -0,0 +1,388 @@ +.\" -*- nroff -*- +.ds g \" empty +.ds G \" empty +.\" Like TP, but if specified indent is more than half +.\" the current line-length - indent, use the default indent. +.de Tp +.ie \\n(.$=0:((0\\$1)*2u>(\\n(.lu-\\n(.iu)) .TP +.el .TP "\\$1" +.. +.TH RC.INET1.CONF 5 "16 Nov 2019" "Slackware Version 15.0" +.SH NAME +rc.inet1.conf \- Slackware network configuration file. +.SH DESCRIPTION +This file contains the configuration settings for network interfaces. +It consists of a series of shell variable array definitions. The +convention in this man page is to refer to these shell variable array +definitions as "parameters". +.LP +Parameters with the same index number will all belong to the same network +interface. By default, index number `0' is used for the configuration of +interface +.IR eth0 , +index number `1' is used for +.I eth1 +and so forth. The default interface name can be overruled by the use of +the parameter +.B IFNAME. +.LP +This is what a typical section of the file looks like for an interface, +showing all parameters with the index number `0': +.LP +.br +# IPv4 config options for eth0: +.br +IPADDRS[0]="" +.br +USE_DHCP[0]="" +.br +# IPv6 config options for eth0: +.br +IP6ADDRS[0]="" +.br +USE_SLAAC[0]="" +.br +USE_DHCP6[0]="" +.br +# Generic options for eth0: +.br +DHCP_HOSTNAME[0]="" +.LP +Alternatively, here is an example for an interface that uses static +IPv4 addresses, an autoconfigured IPv6 address, and a non-default name +.RI ( ath0 +instead of +.IR eth1 ). +The parameter index is `1' in this case. +.LP +.br +IFNAME[1]="ath0" +.br +# IPv4 config options for ath0: +.br +IPADDRS[1]="192.168.1.10/24 10.0.0.10/8" +.br +USE_DHCP[1]="" +.br +# IPv6 config options for ath0 +.br +IP6ADDRS[1]="" +.br +USE_SLAAC[1]="yes" +.br +USE_DHCP6[1]="" +.br +# Generic options for ath0: +.br +DHCP_HOSTNAME[1]="" + +.br +# Gateway IP addresses: +.br +GATEWAY="192.168.1.1" +.br +GATEWAY6="" +.br +.SH EXAMPLE VIRTUAL INTERFACE CREATION AND SETUP +Virtual interfaces 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 as +needed. +.LP +# Virtual tap interface example +.br +VIRTIFNAME[0]="tap0" +.br +VIRTIFTYPE[0]="tap" +.br +VIRTIFUSER[0]="root" +.br +VIRTIFGROUP[0]="root" +.br +.SH EXAMPLE BONDING INTERFACE CREATION +Link aggregation (bond) interfaces can be configured with the use of 3 new +parameters for use in rc.inet1.conf. The BONDNICS parameter should contain +the (space delimited) list of interfaces to include in the bond. The type +of bond is configured with the BONDMODE parameter, which can be any of the +supported mode types as found in the bonding kernel documentation found at +/usr/src/linux/Documentation/networking/bonding.txt. +.LP +The final parameter is a new generic IFOPTS parameter, which takes a list +of interface specific configuration options in a pipe (|) delimited list. +There are several module specific options which can be set with this +parameter, and they can be found in the kernel source documentation from +above. Note: it is +.B highly +recommended that you use at least the +.B miimon +option. Certain bonding modes will require other options to operate correctly. +.LP +Here is a complete configuration for a load balancing, fault tolerant +interface, with two ethernet devices: +.LP +IFNAME[0]="bond0" +.br +BONDNICS[0]="eth0 eth1" +.br +BONDMODE[0]="balance-rr" +.br +IFOPTS[0]="xmit_hash_policy layer2+3 | miimon 100" +.br +IPADDRS[0]="192.168.0.10/24" +.br +IP6ADDRS[0]="e1ff:fec8:ae47:d9ab::abc1/64" +.br +GATEWAY="192.168.0.1" +.br +GATEWAY6="e1ff:fec8:ae47:d9ab::1" +.LP +.SH EXAMPLE VLAN INTERFACE CREATION +VLAN interfaces can be configured in rc.inet1.conf, in the standard Slackware +way of defining an interface. The key to the configuration is to use the +correct IFNAME setting for the underlying ethernet (or bond) interface and the +tagged VLAN ID that should be exposed. +.LP +Here are the basic settings to expose a VLAN with ID 100 on the eth0 +interface, configured with a static IPv4 address: +.LP +IFNAME[0]="eth0.100" +.br +IFOPTS[0]="" +.br +IPADDRS[0]="192.168.100.10/24" +.LP +The IFNAME of the interface contains the underlying ethernet device name +(eth0), a period (.), and the VLAN ID to be exposed. +.LP +Note that the underlying ethernet (or bond) interface does not need to have an +IP address to be used with the VLAN, but it can have an IP address if you are +also using an untagged VLAN. +.LP +The new generic IFOPTS parameter takes a pipe (|) delimited list of interface +type specific options, but does not need any options in order for a VLAN +interface to be configured. However, there are several VLAN specific options +which can be configured if required - these are documented in the ip-link(8) +man page (search for "VLAN Type Support"). +.br +.SH EXAMPLE BRIDGE CREATION AND SETUP +Note the added BRNICS parameter which contains a space-separated list +of the physical or virtual network interfaces you want to add to the bridge. +Note that the parameter index can not be a duplicate of that defined for some +other interface (e.g. eth0 will be index 0 by default). +.LP +IFNAME[5]="br0" +.br +BRNICS[5]="eth0 eth1 tun0" +.br +IFOPTS[5]="" +.br +IPADDRS[5]="192.168.0.10/24" +.LP +The new generic IFOPTS parameter takes a pipe (|) delimited list of interface +type specific options, but does not need any options in order for a bridge +interface to be configured. However, there are several bridge specific options +which can be configured if required - these are documented in the ip-link(8) +man page (search for "BRIDGE Type Support"). +.br + +.SH GENERAL PARAMETERS +This is a list of parameters you can set for any interface. +The example section is for `eth0' by default, i.e. +the parameters all have the array index `0': +.LP +# Config information for eth0: +.TP 25 +IPADDRS[0]="" +# Set this parameter to a space delimited list of IPv4 addresses and netmasks +to bind to the interface, The netmask should be in CIDR style separated from +the IP address with a /. E.g. "192.168.1.10/24 10.0.0.10/8". If the netmask +is not provided, "/24" is assumed. +.TP +USE_DHCP[0]="" +# If set to "yes", we will run a DHCP client and have the IPv4 address +dynamically assigned. +.TP +DHCP_HOSTNAME[0]="" +# Tell the DHCP server what hostname to register, e.g. "darkstar". +.TP +DHCP_TIMEOUT[0]="" +# The default timeout for the DHCP client to wait for server response is +15 seconds, but you might want a shorter or longer wait. +.TP +IP6ADDRS[0]="" +# The static IPv6 addresses for the interface. This option takes a list of +IPv6 addresses and prefix lengths in CIDR notation, in a space delimited +list. For example: IP6ADDRS[0]="a:b:c:d::1/48 1:2:3:4::5/64". +If a prefix length is not given (separated from the IP address with a /), a +length of 64 will be assumed. +.TP +USE_SLAAC[0]="" +# With this parameter set to "yes", the interface's IPv6 address will be +configured via SLAAC (also known as autoconfig), even if RA indicates +DHCP6 is available on the network. If SLAAC is not available on the +network, no IPv6 address will be assigned. If this parameter is unset or +empty, the interface will not be autoconfigured -- note that this is +changed behaviour from Slackware 14.2 and earlier. +.TP +USE_DHCP6[0]="" +# When set to "yes", use DHCP6 to configure the interface. This will +bring up the interface using DHCP6 if RA indicates DHCP6 support is +available on the network, falling back to SLAAC (if available on the +network), or will leave the interface unconfigured after a timeout. When +this parameter is set to "yes", USE_SLAAC[0] is ignored. +.TP +SLAAC_TIMEOUT[0]="" +# The default timeout for autoconfiguration to wait for the interface +to come up is 15 sec. Increase the timeout if a longer period is required +on your network. +.TP +USE_RA[0]="" +# If set to "yes", accept Router Advertisements even when SLAAC is disabled +on the interface. This parameter should almost never be required. +.TP +IFNAME[0]="" +# Use this to define configuration blocks for interfaces with non-standard +names. +.TP +HWADDR[0]="" +# Overrule the hardware MAC address (if supported by the network card) by +setting a new value here, e.g. "00:01:23:45:67:89". +.TP +MTU[0]="" +# The default MTU is 1500, but you might need 1360 when you use NAT'ed +IPSec traffic. +.TP +PROMISCUOUS[0]="" +# If set to "yes", enable promiscuous mode on the interface. +.TP +DHCP_KEEPRESOLV[0]="" +# If you do +.B not +want +.I /etc/resolv.conf +overwritten by the DHCP client, set this parameter to "yes". +.TP +DHCP_KEEPNTP[0]="" +# If you do +.B not +want +.I /etc/ntp.conf +overwritten by the DHCP client, set this parameter to "yes". +.TP +DHCP_KEEPGW[0]="" +# If you do +.B not +want the DHCP client to change your default gateway, set this parameter +to "yes". +.TP +DHCP_NOIPV4LL[0]="" +# When set to "yes", do +.B not +assign an IPv4 Link Local (IPv4LL) address when a DHCP server is not found. +IPv4LL addresses are in the range 169.254.0.0/16, and is also known as +.I `zeroconf' +address assignment. +.TP +DHCP_IPADDR[0]="" +# Request a specific IPv4 address from the DHCP server. Note that this is only +a request - the DHCP server may offer a completely different address. +.TP +DHCP_DEBUG[0]="yes" +# Make dhcpcd show verbose diagnostics. +.SH WIRELESS PARAMETERS +For wireless interfaces, several additional parameter definitions are available. +All these parameters start with the prefix +.B WLAN_ . +.LP +.TP 25 +WLAN_ESSID[4]="" +# Your Wireless Access Point's name, e.g. "darkstar". +.TP +WLAN_MODE[4]="" +# Set to "Managed" for use with Access Points. For a peer-to-peer connection +set this parameter to "Ad-Hoc". +.TP +WLAN_RATE[4]="" +# The transmission rates you want the driver to try, e.g. "54M auto". +("auto" means that bandwidth can be variable). +.TP +WLAN_CHANNEL[4]="" +# The channel to which the Access Point is tuned, or "auto" to let the +driver find the correct channel. +.TP +WLAN_KEY[4]="" +# Definition of a WEP key, e.g. "D5A31F54ACF0487C2D0B1C10D2". +.TP +WLAN_IWPRIV[4]="" +# Some drivers require a private ioctl to be set through the iwpriv command. e.g. +"set AuthMode=WPAPSK | set EncrypType=TKIP | set WPAPSK=the_64_character_key". +If more than one is required, you can place them in the +.I WLAN_IWPRIV +parameter separated with the pipe (|) character. Ssee the example. +.TP +WLAN_WPA[4]="" +# The name of the application that should be executed for WPA support. This +will usually be "wpa_supplicant". +.TP +WLAN_WPADRIVER[4]="" +# Tell wpa_supplicant to specifically use this driver, e.g. "ndiswrapper". +If you leave this empty the "wext" driver is used by default - most modern +wireless drivers use wext. +.TP +WLAN_WPAWAIT[4]=30 +# In case it takes long for the WPA association to finish, you can +use this parameter to increase the wait time before rc.wireless decides +that association failed. The default is 10 seconds. +.SH DEFAULT GATEWAY PARAMETERS +These parameters, to set an IPv4 and IPv6 default gateway, are not +interface-specific and must not have an index number. +.TP 25 +GATEWAY="" +# The IPv4 default gateway, e.g. "192.168.1.1". This parameter should be left +empty when interfaces are configured via DHCP. +.TP +GATEWAY6="" +# The IPv6 default gateway, e.g. "fe80::1". This parameter should be left +empty when interfaces are configured via DHCP6 or SLAAC. +.SH FILES +.TP 25 +.I /etc/rc.d/rc.inet1 +network configuration script. +.TP +.I /etc/rc.d/rc.inet1.conf +configuration parameter file (read by rc.inet1 and rc.wireless). +.TP +.I /etc/rc.d/rc.wireless +wireless configuration script. +.TP +.I /etc/rc.d/rc.wireless.conf +wireless configuration parameter file +.B (deprecated) +\. +.SH CAVEATS +The network interface definitions are stored in shell variable +.I arrays +\. +The bash shell has no facilities to retrieve the largest array index used. +Therefore, the +.I rc.inet1 +script makes the assumption that array indexes stay below the value of +.B 6 +\. +.LP +If you want to configure more than six network interfaces, you will +have to edit the file +.I /etc/rc.d/rc.inet1.conf +and uncomment, and change the value `6' in the line +.B #MAXNICS="6" +(at the very bottom of the file) to the number of network interfaces you wish to use. +.SH AUTHORS +Patrick J. Volkerding <volkerdi@slackware.com> +.br +Eric Hameleers <alien@slackware.com> +.br +Robby Workman <rworkman@slackware.com> +.br +Darren 'Tadgy' Austin <darren@slackware.uk> +.SH "SEE ALSO" +.BR rc.inet1(8) diff --git a/patches/source/network-scripts/modprobe.d/bonding.conf b/patches/source/network-scripts/modprobe.d/bonding.conf new file mode 100644 index 000000000..c33faf65b --- /dev/null +++ b/patches/source/network-scripts/modprobe.d/bonding.conf @@ -0,0 +1,9 @@ +############################################################################## +# Do not edit this file; instead, copy it to /etc/modprobe.d/ and edit that +############################################################################## +# +# Disable the automatic creation of a bond0 interface when module is loaded +# Otherwise, /etc/rc.d/rc.inet1 will not be able to configure it +# +options bonding max_bonds=0 +options rtnl-link-bond max_bonds=0 diff --git a/patches/source/network-scripts/modprobe.d/ipv6.conf b/patches/source/network-scripts/modprobe.d/ipv6.conf new file mode 100644 index 000000000..a0395a5ad --- /dev/null +++ b/patches/source/network-scripts/modprobe.d/ipv6.conf @@ -0,0 +1,8 @@ +############################################################################## +# Do not edit this file; instead, copy it to /etc/modprobe.d/ and edit that +############################################################################## +# +# Disable IPv6 auto configuration (SLAAC) by default +# +options ipv6 autoconf=0 +options net-pf-10 autoconf=0 diff --git a/patches/source/network-scripts/network-scripts.SlackBuild b/patches/source/network-scripts/network-scripts.SlackBuild new file mode 100755 index 000000000..ee4f54bf3 --- /dev/null +++ b/patches/source/network-scripts/network-scripts.SlackBuild @@ -0,0 +1,134 @@ +#!/bin/bash + +# Copyright 2006, 2007, 2008, 2009, 2010, 2012, 2013, 2015, 2017, 2018, 2021, 2022 Patrick J. Volkerding, Sebeka, MN, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PKGNAM=network-scripts +VERSION=${VERSION:-15.0} +ARCH=noarch +BUILD=${BUILD:-19_slack15.0} + +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz" + exit 0 +fi + +TMP=${TMP:-/tmp} +PKG=$TMP/package-${PKGNAM} + +rm -rf $PKG +mkdir -p $TMP $PKG/etc/rc.d +( cd $PKG/etc/rc.d + for file in rc.inet1.conf rc.inet1 rc.inet2 rc.ip_forward ; do + cp -a $CWD/scripts/$file ${file}.new + done + chown root:root * + chmod 755 rc.inet1.new rc.inet2.new + chmod 600 rc.inet1.conf.new +) +( cd $PKG/etc + for file in HOSTNAME host.conf hosts.allow hosts.deny hosts.equiv hosts networks nntpserver protocols resolv.conf ; do + cp -a $CWD/scripts/$file ${file}.new + chmod 644 ${file}.new + done + chown root:root * +) +mkdir -p $PKG/sbin +cp -a $CWD/scripts/netconfig $PKG/sbin/netconfig +chown root:root $PKG/sbin/netconfig +chmod 755 $PKG/sbin/netconfig +mkdir -p $PKG/var/log/setup +cp -a $CWD/scripts/setup.netconfig $PKG/var/log/setup +chown root:root $PKG/var/log/setup/setup.netconfig +chmod 755 $PKG/var/log/setup/setup.netconfig + +# Add manpages: +mkdir -p $PKG/usr/man/man{5,8} +cat $CWD/manpages/rc.inet1.conf.5 | gzip -9c > $PKG/usr/man/man5/rc.inet1.conf.5.gz +cat $CWD/manpages/rc.inet1.8 | gzip -9c > $PKG/usr/man/man8/rc.inet1.8.gz + +# Add default module configs for bonding and ipv6 +mkdir -p $PKG/lib/modprobe.d/ +cat $CWD/modprobe.d/bonding.conf > $PKG/lib/modprobe.d/bonding.conf +cat $CWD/modprobe.d/ipv6.conf > $PKG/lib/modprobe.d/ipv6.conf + +# Drop the documentation in /usr/doc/network-scripts-$VERSION: +mkdir -p $PKG/usr/doc/network-scripts-$VERSION +cp -a $CWD/README* $PKG/usr/doc/network-scripts-$VERSION +chown -R root:root $PKG/usr/doc/network-scripts-$VERSION +chmod 644 $PKG/usr/doc/network-scripts-$VERSION/* + +mkdir -p $PKG/install +zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh +cat $CWD/slack-desc > $PKG/install/slack-desc + +# Patch to fix rc.inet1.new for LXC: +( cd $PKG + cat $CWD/0000-rc.inet1.new-lxc-additions.patch | patch -p1 --verbose || exit 1 + rm -f etc/rc.d/rc.inet1.new.orig +) || exit 1 + +# Patch netconfig to fix leaving a previously enabled rc.networkmanager +# executable even if networkmanager is no longer selected: +( cd $PKG + cat $CWD/0001-netconfig-turn-off-rc.networkmanager-if-networkmanager-is-not-selected.patch | patch -p1 --verbose || exit 1 + rm -f sbin/netconfig.orig +) || exit 1 + +# Patch netconfig to add hostname-labeled loopback entries when DHCP +# is selected: +( cd $PKG + cat $CWD/0002-add-hostname-loopback-entries-in-etc-hosts-for-dhcp.patch | patch -p1 --verbose || exit 1 + rm -f sbin/netconfig.orig +) || exit 1 + +# Temporarily rename these files so that we can patch them: +mv $PKG/etc/rc.d/rc.inet1.new $PKG/etc/rc.d/rc.inet1 +mv $PKG/etc/rc.d/rc.inet1.conf.new $PKG/etc/rc.d/rc.inet1.conf + +# Re-add support for the DHCP_IPADDR parameter from rc.inet1.conf: +( cd $PKG/etc/rc.d + cat $CWD/0003-76218fa6e7c097c875af2a29cc7670995bef2ae4.patch | patch -p1 --verbose || exit 1 + rm -f etc/rc.d/rc.inet1.orig +) || exit 1 + +# Expand the help text for DHCP_IPADDR in rc.inet1.conf: +( cd $PKG/etc/rc.d + cat $CWD/0004-8f43a741a36e59b8a9560ff2c4f3e5da2b8dd72b.patch | patch -p1 --verbose || exit 1 + rm -f etc/rc.d/rc.inet1.conf.orig +) || exit 1 + +# Add support for a DHCP_OPTS parameter: +( cd $PKG/etc/rc.d + cat $CWD/0005-5925f2bcc500f5198b5c00ab4e635a59bef7a413.patch | patch -p1 --verbose || exit 1 + rm -f etc/rc.d/rc.inet1.orig +) || exit 1 + +# Rename the files back to .new: +mv $PKG/etc/rc.d/rc.inet1 $PKG/etc/rc.d/rc.inet1.new +mv $PKG/etc/rc.d/rc.inet1.conf $PKG/etc/rc.d/rc.inet1.conf.new + +cd $PKG +/sbin/makepkg -l y -c n $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz 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 diff --git a/patches/source/network-scripts/slack-desc b/patches/source/network-scripts/slack-desc new file mode 100644 index 000000000..981b43606 --- /dev/null +++ b/patches/source/network-scripts/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +network-scripts: network-scripts (Scripts to configure a network) +network-scripts: +network-scripts: These are the basic scripts and files used to define a network and +network-scripts: configure network interfaces on Linux. Most of the original +network-scripts: /etc files were written by Fred N. van Kempen, or borrowed from BSD. +network-scripts: The rc.inet1 and rc.inet2 scripts were mostly written by Patrick +network-scripts: Volkerding, with suggestions and fixes from hundreds of contributors +network-scripts: over the years. +network-scripts: +network-scripts: +network-scripts: |