From 38edd98bc9701f317c43fddafcbf2e808c969293 Mon Sep 17 00:00:00 2001 From: Darren Austin Date: Sun, 18 Mar 2018 03:57:18 -0500 Subject: rc.inet1*: Allow setting an interface in promiscuous mode This is needed for container networking - the bridge for it must be in promiscuous mode. Signed-off-by: Robby Workman --- rc.inet1 | 24 +++++++++++++++++------- rc.inet1.conf | 1 + 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/rc.inet1 b/rc.inet1 index 29bd97d..1f3cb60 100644 --- a/rc.inet1 +++ b/rc.inet1 @@ -204,13 +204,19 @@ 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 + /sbin/ip address add ${ipalias}/32 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 @@ -228,6 +234,10 @@ if_up() { 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 diff --git a/rc.inet1.conf b/rc.inet1.conf index 58766d2..cde99a9 100644 --- a/rc.inet1.conf +++ b/rc.inet1.conf @@ -108,6 +108,7 @@ DEBUG_ETH_UP="no" #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. -- cgit v1.2.3