From 93c7cc7b5949d00a944d3e7cd6cbc9fa2cfabbb1 Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Tue, 31 Jul 2018 15:27:50 +0100 Subject: USE_STATELESS->USE_STATELESS6 - D'oh. Some bugfixes also Signed-off-by: Robby Workman --- rc.inet1 | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'rc.inet1') diff --git a/rc.inet1 b/rc.inet1 index 61be5b8..6c494d2 100644 --- a/rc.inet1 +++ b/rc.inet1 @@ -144,7 +144,7 @@ if_up() { [ -n "${BRNICS[$i]}" ] && br_open $i # Skip unconfigured interfaces: if [ -z "${IPADDR[$i]}" ] && [ "${USE_DHCP[$i]}" != "yes" ] && [ -z "${IPADDR6[$i]}" ] && \ - [ "${USE_DHCP6[$i]}" != "yes" ] && [ "${USE_STATELESS[$i]}" != "yes" ]; then + [ "${USE_DHCP6[$i]}" != "yes" ] && [ "${USE_STATELESS6[$i]}" != "yes" ]; then debug_log "skipping ${1} early, interface is not configured in /etc/rc.d/rc.inet1.conf" return 0 fi @@ -198,14 +198,13 @@ if_up() { fi fi if [ "${USE_DHCP[$i]}" != "yes" ] && [ -n "${IPADDR[$i]}" ]; then # use a fixed v4 IP to bring interface up - if [ -z "${NETMASK[$i]}"; then + if [ -z "${NETMASK[$i]}" ]; then echo "/etc/rc.d/rc.inet1: no NETMASK set for ${1} - assuming /24 (aka, 255.255.255.0)" | $LOGGER NETMASK[$i]="24" fi echo "/etc/rc.d/rc.inet1: /sbin/ip -4 address add ${IPADDR[$i]}/${NETMASK[$i]##/} broadcast + dev ${1}" | $LOGGER - /sbin/ip -4 address add ${IPADDR[$i]}/${NETMASK[$i]##/} broadcast + dev ${1} && \ - /sbin/ip link set dev ${1} up - if (($? == 0)); then + if /sbin/ip -4 address add ${IPADDR[$i]}/${NETMASK[$i]##/} broadcast + dev ${1} && \ + /sbin/ip link set dev ${1} up; then IF_UP=1 else echo "/etc/rc.d/rc.inet1: failed to a set IP ${IPADDR[$i]} for ${1}" | $LOGGER @@ -214,21 +213,20 @@ if_up() { if [ "${USE_DHCP6[$i]}" != "yes" ] && [ -n "${IPADDR6[$i]}" ]; then # use a fixed v6 IP to bring up/add to the interface # Disable v6 IP auto configuration before trying to configure with a fixed IP: echo "0" >/proc/sys/net/ipv6/conf/$1/autoconf - if [ -z "${NETMASK6[$i]}"; then + if [ -z "${NETMASK6[$i]}" ]; then echo "/etc/rc.d/rc.inet1: no NETMASK6 set for ${1} - assuming /64" | $LOGGER NETMASK6[$i]="64" fi echo "/etc/rc.d/rc.inet1: /sbin/ip -6 address add ${IPADDR6[$i]}/${NETMASK6[$i]##/} dev ${1}" | $LOGGER - /sbin/ip -6 address add ${IPADDR6[$i]}/${NETMASK6[$i]##/} dev ${1} && \ - /sbin/ip link set dev ${1} up - if (($? == 0)); then + if /sbin/ip -6 address add ${IPADDR6[$i]}/${NETMASK6[$i]##/} dev ${1} && \ + /sbin/ip link set dev ${1} up; then IF_UP=1 else echo "/etc/rc.d/rc.inet1: failed to a set IP ${IPADDR6[$i]} for ${1}" | $LOGGER fi fi if [ "${USE_DHCP6[$i]}" != "yes" ] && [ -z "${IPADDR6[$i]}" ] && \ - [ "${USE_STATELESS[$i]}" = "yes" ]; then # interface should configure itself via stateless RA auto config: + [ "${USE_STATELESS6[$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 # Enable accepting of router advertisment packets, and auto configuration of interfaces: echo "1" >/proc/sys/net/ipv6/conf/$1/accept_ra @@ -247,6 +245,7 @@ if_up() { fi # Don't continue on to alias configuration. return + fi if [ "${USE_DHCP[$i]}" != "yes" ] && [ "${USE_DHCP6[$i]}" != "yes" ] && [ -n "${IPADDR6[$i]}" ] && \ [ -z "${IPADDR6[$i]}" ]; then # interface is unconfigured debug_log "${1} interface is not configured in /etc/rc.d/rc.inet1.conf" @@ -322,7 +321,7 @@ if_down() { echo "/etc/rc.d/rc.inet1: /sbin/ip address flush dev ${1}" | $LOGGER /sbin/ip address flush dev ${1} fi - if [ "${USE_STATELESS[$i]}" = "yes" ]; then # disable stateless RA auto config + if [ "${USE_STATELESS6[$i]}" = "yes" ]; then # disable stateless RA auto config # Disable auto configuration of the interface: echo "/etc/rc.d/rc.inet1: disabling stateless Router Advertisement auto configuration on ${1}" | $LOGGER echo "0" >/proc/sys/net/ipv6/conf/$1/autoconf -- cgit v1.2.3