summaryrefslogtreecommitdiffstats
path: root/source/ap/lxc/scripts/rc.inet1.lxc
diff options
context:
space:
mode:
author Patrick J Volkerding <volkerdi@slackware.com>2019-07-19 18:26:45 +0000
committer Eric Hameleers <alien@slackware.com>2019-07-20 08:59:50 +0200
commit3db41f6c7650f0cff2bb0010c9db60bfb74e6b02 (patch)
tree9281976b0f7db8ddbea01190471bcbfa939bc4df /source/ap/lxc/scripts/rc.inet1.lxc
parent612d5685be4b6dc368aa4d02e96ead63bdb6e904 (diff)
downloadcurrent-3db41f6c7650f0cff2bb0010c9db60bfb74e6b02.tar.gz
current-3db41f6c7650f0cff2bb0010c9db60bfb74e6b02.tar.xz
Fri Jul 19 18:26:45 UTC 201920190719182645
a/aaa_elflibs-15.0-x86_64-9.txz: Rebuilt. Upgraded: libbz2.so.1.0.8, libexpat.so.1.6.9, libglib-2.0.so.0.6000.5, libgmodule-2.0.so.0.6000.5, libgobject-2.0.so.0.6000.5, libgthread-2.0.so.0.6000.5, libidn2.so.0.3.6. Removed: libicudata.so.63.1, libicui18n.so.63.1, libicuio.so.63.1, libicutest.so.63.1, libicutu.so.63.1, libicuuc.so.63.1. Added: libpcre2-8.so.0.8.0, libpsl.so.5.3.2. These are needed by wget which is used by slackpkg, so they should be in here. Thanks to OutSiderBR. ap/lxc-2.0.11_fad08f383-x86_64-1.txz: Upgraded. Updated from 2.0 git branch. Ported init script updates from sysvinit-scripts. d/ccache-3.7.2-x86_64-1.txz: Upgraded. l/libsigc++-2.10.2-x86_64-1.txz: Upgraded. n/curl-7.65.3-x86_64-1.txz: Upgraded. This is a bugfix release: Fix a regression that caused the progress meter not to appear. For more information, see: https://curl.haxx.se/changes.html n/iputils-20190709-x86_64-1.txz: Upgraded.
Diffstat (limited to 'source/ap/lxc/scripts/rc.inet1.lxc')
-rw-r--r--source/ap/lxc/scripts/rc.inet1.lxc40
1 files changed, 29 insertions, 11 deletions
diff --git a/source/ap/lxc/scripts/rc.inet1.lxc b/source/ap/lxc/scripts/rc.inet1.lxc
index 58213a7c0..2ae9bbb58 100644
--- a/source/ap/lxc/scripts/rc.inet1.lxc
+++ b/source/ap/lxc/scripts/rc.inet1.lxc
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/bash
# /etc/rc.d/rc.inet1
# This script is used to bring up the various network interfaces.
#
@@ -215,19 +215,28 @@ if_up() {
# 15 seconds should be a reasonable default DHCP timeout. 30 was too much.
echo "/etc/rc.d/rc.inet1: /sbin/dhcpcd -L -t ${DHCP_TIMEOUT[$i]:-15} ${DHCP_OPTIONS} ${1}" | $LOGGER
/sbin/dhcpcd -L -t ${DHCP_TIMEOUT[$i]:-15} ${DHCP_OPTIONS} ${1}
- # If the dhcpcd call succeeds, add extra IP addresses, if defined, to interface
- if [ "$?" == "0" ] && [ -n "${IPALIASES[$i]}" ]; then
- num=0
- for ipalias in ${IPALIASES[$i]}; do
- /sbin/ip address add ${ipalias}/32 dev ${1} label ${1}:${num} ;
- num=$(($num + 1))
- done
+ if [ "$?" == "0" ]; then # the dhcp call has succeeded
+ if [ -n "${IPALIASES[$i]}" ]; then
+ # Add extra IP addresses, if defined, to interface
+ num=0
+ for ipalias in ${IPALIASES[$i]}; do
+ ip="${ipalias%/*}"
+ nm="${ipalias#*/}"
+ [ -z "$nm" ] || [ "$ip" == "$nm" ] && nm="32"
+ /sbin/ip address add ${ip}/${nm} dev ${1} label ${1}:${num}
+ num=$(($num + 1))
+ done
+ fi
+ if [ "${PROMISCUOUS[$i]}" = "yes" ]; then
+ # Set promiscuous mode on the interface
+ /sbin/ip link set dev ${1} promisc on
+ fi
fi
else # bring up interface using a static IP address
if [ -n "${IPADDR[$i]}" ]; then # skip unconfigured interfaces
# Set up the network card:
- echo "/etc/rc.d/rc.inet1: /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} dev ${1}" | $LOGGER
- /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} dev ${1}
+ echo "/etc/rc.d/rc.inet1: /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} broadcast + dev ${1}" | $LOGGER
+ /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} broadcast + dev ${1}
if /sbin/ip link show dev ${1} | grep -wq "state DOWN" ; then
/sbin/ip link set dev ${1} up # Bring up interface
fi
@@ -235,10 +244,17 @@ if_up() {
if [ -n "${IPALIASES[$i]}" ]; then
num=0
for ipalias in ${IPALIASES[$i]}; do
- /sbin/ip address add ${ipalias}/32 dev ${1} label ${1}:${num} ;
+ ip="${ipalias%/*}"
+ nm="${ipalias#*/}"
+ [ -z "$nm" ] || [ "$ip" == "$nm" ] && nm="32"
+ /sbin/ip address add ${ip}/${nm} dev ${1} label ${1}:${num}
num=$(($num + 1))
done
fi
+ if [ "${PROMISCUOUS[$i]}" = "yes" ]; then
+ # Set promiscuous mode on the interface
+ /sbin/ip link set dev ${1} promisc on
+ fi
else
debug_log "${1} interface is not configured in /etc/rc.d/rc.inet1.conf"
fi
@@ -279,6 +295,8 @@ if_down() {
if [ -n "${BRNICS[$i]}" ]; then
br_close $i
fi
+ # Flush the address from the interface:
+ ip address flush dev ${1}
fi
}