From 715b71ad6a647d99559bf19cda2e3df9b56e0090 Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Sat, 28 Jul 2018 00:01:15 +0100 Subject: Set autoconf to 0 for dhcp/fixed IP, 1 for stateless autoconfig Signed-off-by: Robby Workman --- rc.inet1 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/rc.inet1 b/rc.inet1 index ae37ff6..8701c9f 100644 --- a/rc.inet1 +++ b/rc.inet1 @@ -157,12 +157,6 @@ if_up() { if [ -e /sys/class/net/${1%%:*} ]; then # interface exists if ! /sbin/ip address show permanent 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 - # Enable/disable v6 IP auto configuration. - if [ "${USE_STATELESS[$i]}" = "yes" ]; then - echo "1" >/proc/sys/net/ipv6/conf/$1/autoconf - else - echo "0" >/proc/sys/net/ipv6/conf/$1/autoconf - fi if [ -n "${HWADDR[$i]}" ]; then # Set hardware address _before_ the interface goes up: echo "/etc/rc.d/rc.inet1: /sbin/ip link set dev ${1} address ${HWADDR[$i]}" | $LOGGER /sbin/ip link set dev ${1} address ${HWADDR[$i]} @@ -175,6 +169,8 @@ if_up() { . /etc/rc.d/rc.wireless ${1} start # Initialize any wireless parameters fi if [ "${USE_DHCP[$i]}" = "yes" ] || [ "${USE_DHCP6[$i]}" = "yes" ]; then # use dhcpcd to bring interface up + # Disable v6 IP auto configuration. + echo "0" >/proc/sys/net/ipv6/conf/$1/autoconf # Clear DHCP_OPTIONS before adding new options to it: unset DHCP_OPTIONS # Set DHCP_OPTIONS for this interface: @@ -225,6 +221,8 @@ if_up() { fi fi elif [ -n "${IPADDR[$i]}" ] || [ -n "${IPADDR6[$i]}" ]; then # use a fixed IP to bring interface up + # Disable v6 IP auto configuration. + echo "0" >/proc/sys/net/ipv6/conf/$1/autoconf 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]} broadcast + dev ${1}" | $LOGGER @@ -252,6 +250,7 @@ if_up() { fi elif [ "${USE_STATELESS[$i]}" = "yes" ]; then # interface should configure itself via stateless RA auto config echo "/etc/rc.d/rc.inet1: using stateless Router Advertisement auto configuration for ${1}" | $LOGGER + echo "1" >/proc/sys/net/ipv6/conf/$1/autoconf else # interface is unconfigured debug_log "${1} interface is not configured in /etc/rc.d/rc.inet1.conf" fi -- cgit v1.2.3