From 278bd49cc83b35338aa406f0a889ce9679d3c78a Mon Sep 17 00:00:00 2001 From: "David E. O'Brien" Date: Sun, 12 Dec 1999 01:58:30 +0000 Subject: [PATCH] Suport multiple ``ifconfig_*?="DHCP"'' configurations. Currently we have a problem in that `dhclient' bails when configuring the second interface as port 68 is already in use (by the `dhclient' started for the first interface). PR: 14810 Submitted by: n_hibma --- etc/network.subr | 30 +++++++++++++++++++----------- etc/rc.d/netoptions | 30 +++++++++++++++++++----------- etc/rc.d/network1 | 30 +++++++++++++++++++----------- etc/rc.d/network2 | 30 +++++++++++++++++++----------- etc/rc.d/network3 | 30 +++++++++++++++++++----------- etc/rc.d/routing | 30 +++++++++++++++++++----------- etc/rc.network | 30 +++++++++++++++++++----------- 7 files changed, 133 insertions(+), 77 deletions(-) diff --git a/etc/network.subr b/etc/network.subr index 72c72979c5c8..6985fd9aaef2 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -77,11 +77,11 @@ network_pass1() { ;; esac + dhcp_interfaces="" for ifn in ${network_interfaces}; do - showstat=false if [ -r /etc/start_if.${ifn} ]; then . /etc/start_if.${ifn} - showstat=true + eval showstat_$ifn=1 fi # Do the primary ifconfig if specified @@ -92,15 +92,22 @@ network_pass1() { '') ;; [Dd][Hh][Cc][Pp]) - ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${ifn} - showstat=true + # DHCP inits are done all in one go below + dhcp_interfaces="$dhcp_interfaces $ifn" + eval showstat_$ifn=1 ;; *) ifconfig ${ifn} ${ifconfig_args} - showstat=true + eval showstat_$ifn=1 ;; esac + done + if [ ! -z "${dhcp_interfaces}" ]; then + ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${dhcp_interfaces} + fi + + for ifn in ${network_interfaces}; do # Check to see if aliases need to be added # alias=0 @@ -108,7 +115,7 @@ network_pass1() { eval ifconfig_args=\$ifconfig_${ifn}_alias${alias} if [ -n "${ifconfig_args}" ]; then ifconfig ${ifn} ${ifconfig_args} alias - showstat=true + eval showstat_$ifn=1 alias=`expr ${alias} + 1` else break; @@ -120,14 +127,15 @@ network_pass1() { eval ifconfig_args=\$ifconfig_${ifn}_ipx if [ -n "${ifconfig_args}" ]; then ifconfig ${ifn} ${ifconfig_args} - showstat=true + eval showstat_$ifn=1 fi + done - case ${showstat} in - true) + for ifn in ${network_interfaces}; do + eval showstat=\$showstat_${ifn} + if [ ! -z ${showstat} ]; then ifconfig ${ifn} - ;; - esac + fi done # Warm up user ppp if required, must happen before natd. diff --git a/etc/rc.d/netoptions b/etc/rc.d/netoptions index 72c72979c5c8..6985fd9aaef2 100644 --- a/etc/rc.d/netoptions +++ b/etc/rc.d/netoptions @@ -77,11 +77,11 @@ network_pass1() { ;; esac + dhcp_interfaces="" for ifn in ${network_interfaces}; do - showstat=false if [ -r /etc/start_if.${ifn} ]; then . /etc/start_if.${ifn} - showstat=true + eval showstat_$ifn=1 fi # Do the primary ifconfig if specified @@ -92,15 +92,22 @@ network_pass1() { '') ;; [Dd][Hh][Cc][Pp]) - ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${ifn} - showstat=true + # DHCP inits are done all in one go below + dhcp_interfaces="$dhcp_interfaces $ifn" + eval showstat_$ifn=1 ;; *) ifconfig ${ifn} ${ifconfig_args} - showstat=true + eval showstat_$ifn=1 ;; esac + done + if [ ! -z "${dhcp_interfaces}" ]; then + ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${dhcp_interfaces} + fi + + for ifn in ${network_interfaces}; do # Check to see if aliases need to be added # alias=0 @@ -108,7 +115,7 @@ network_pass1() { eval ifconfig_args=\$ifconfig_${ifn}_alias${alias} if [ -n "${ifconfig_args}" ]; then ifconfig ${ifn} ${ifconfig_args} alias - showstat=true + eval showstat_$ifn=1 alias=`expr ${alias} + 1` else break; @@ -120,14 +127,15 @@ network_pass1() { eval ifconfig_args=\$ifconfig_${ifn}_ipx if [ -n "${ifconfig_args}" ]; then ifconfig ${ifn} ${ifconfig_args} - showstat=true + eval showstat_$ifn=1 fi + done - case ${showstat} in - true) + for ifn in ${network_interfaces}; do + eval showstat=\$showstat_${ifn} + if [ ! -z ${showstat} ]; then ifconfig ${ifn} - ;; - esac + fi done # Warm up user ppp if required, must happen before natd. diff --git a/etc/rc.d/network1 b/etc/rc.d/network1 index 72c72979c5c8..6985fd9aaef2 100644 --- a/etc/rc.d/network1 +++ b/etc/rc.d/network1 @@ -77,11 +77,11 @@ network_pass1() { ;; esac + dhcp_interfaces="" for ifn in ${network_interfaces}; do - showstat=false if [ -r /etc/start_if.${ifn} ]; then . /etc/start_if.${ifn} - showstat=true + eval showstat_$ifn=1 fi # Do the primary ifconfig if specified @@ -92,15 +92,22 @@ network_pass1() { '') ;; [Dd][Hh][Cc][Pp]) - ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${ifn} - showstat=true + # DHCP inits are done all in one go below + dhcp_interfaces="$dhcp_interfaces $ifn" + eval showstat_$ifn=1 ;; *) ifconfig ${ifn} ${ifconfig_args} - showstat=true + eval showstat_$ifn=1 ;; esac + done + if [ ! -z "${dhcp_interfaces}" ]; then + ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${dhcp_interfaces} + fi + + for ifn in ${network_interfaces}; do # Check to see if aliases need to be added # alias=0 @@ -108,7 +115,7 @@ network_pass1() { eval ifconfig_args=\$ifconfig_${ifn}_alias${alias} if [ -n "${ifconfig_args}" ]; then ifconfig ${ifn} ${ifconfig_args} alias - showstat=true + eval showstat_$ifn=1 alias=`expr ${alias} + 1` else break; @@ -120,14 +127,15 @@ network_pass1() { eval ifconfig_args=\$ifconfig_${ifn}_ipx if [ -n "${ifconfig_args}" ]; then ifconfig ${ifn} ${ifconfig_args} - showstat=true + eval showstat_$ifn=1 fi + done - case ${showstat} in - true) + for ifn in ${network_interfaces}; do + eval showstat=\$showstat_${ifn} + if [ ! -z ${showstat} ]; then ifconfig ${ifn} - ;; - esac + fi done # Warm up user ppp if required, must happen before natd. diff --git a/etc/rc.d/network2 b/etc/rc.d/network2 index 72c72979c5c8..6985fd9aaef2 100644 --- a/etc/rc.d/network2 +++ b/etc/rc.d/network2 @@ -77,11 +77,11 @@ network_pass1() { ;; esac + dhcp_interfaces="" for ifn in ${network_interfaces}; do - showstat=false if [ -r /etc/start_if.${ifn} ]; then . /etc/start_if.${ifn} - showstat=true + eval showstat_$ifn=1 fi # Do the primary ifconfig if specified @@ -92,15 +92,22 @@ network_pass1() { '') ;; [Dd][Hh][Cc][Pp]) - ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${ifn} - showstat=true + # DHCP inits are done all in one go below + dhcp_interfaces="$dhcp_interfaces $ifn" + eval showstat_$ifn=1 ;; *) ifconfig ${ifn} ${ifconfig_args} - showstat=true + eval showstat_$ifn=1 ;; esac + done + if [ ! -z "${dhcp_interfaces}" ]; then + ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${dhcp_interfaces} + fi + + for ifn in ${network_interfaces}; do # Check to see if aliases need to be added # alias=0 @@ -108,7 +115,7 @@ network_pass1() { eval ifconfig_args=\$ifconfig_${ifn}_alias${alias} if [ -n "${ifconfig_args}" ]; then ifconfig ${ifn} ${ifconfig_args} alias - showstat=true + eval showstat_$ifn=1 alias=`expr ${alias} + 1` else break; @@ -120,14 +127,15 @@ network_pass1() { eval ifconfig_args=\$ifconfig_${ifn}_ipx if [ -n "${ifconfig_args}" ]; then ifconfig ${ifn} ${ifconfig_args} - showstat=true + eval showstat_$ifn=1 fi + done - case ${showstat} in - true) + for ifn in ${network_interfaces}; do + eval showstat=\$showstat_${ifn} + if [ ! -z ${showstat} ]; then ifconfig ${ifn} - ;; - esac + fi done # Warm up user ppp if required, must happen before natd. diff --git a/etc/rc.d/network3 b/etc/rc.d/network3 index 72c72979c5c8..6985fd9aaef2 100644 --- a/etc/rc.d/network3 +++ b/etc/rc.d/network3 @@ -77,11 +77,11 @@ network_pass1() { ;; esac + dhcp_interfaces="" for ifn in ${network_interfaces}; do - showstat=false if [ -r /etc/start_if.${ifn} ]; then . /etc/start_if.${ifn} - showstat=true + eval showstat_$ifn=1 fi # Do the primary ifconfig if specified @@ -92,15 +92,22 @@ network_pass1() { '') ;; [Dd][Hh][Cc][Pp]) - ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${ifn} - showstat=true + # DHCP inits are done all in one go below + dhcp_interfaces="$dhcp_interfaces $ifn" + eval showstat_$ifn=1 ;; *) ifconfig ${ifn} ${ifconfig_args} - showstat=true + eval showstat_$ifn=1 ;; esac + done + if [ ! -z "${dhcp_interfaces}" ]; then + ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${dhcp_interfaces} + fi + + for ifn in ${network_interfaces}; do # Check to see if aliases need to be added # alias=0 @@ -108,7 +115,7 @@ network_pass1() { eval ifconfig_args=\$ifconfig_${ifn}_alias${alias} if [ -n "${ifconfig_args}" ]; then ifconfig ${ifn} ${ifconfig_args} alias - showstat=true + eval showstat_$ifn=1 alias=`expr ${alias} + 1` else break; @@ -120,14 +127,15 @@ network_pass1() { eval ifconfig_args=\$ifconfig_${ifn}_ipx if [ -n "${ifconfig_args}" ]; then ifconfig ${ifn} ${ifconfig_args} - showstat=true + eval showstat_$ifn=1 fi + done - case ${showstat} in - true) + for ifn in ${network_interfaces}; do + eval showstat=\$showstat_${ifn} + if [ ! -z ${showstat} ]; then ifconfig ${ifn} - ;; - esac + fi done # Warm up user ppp if required, must happen before natd. diff --git a/etc/rc.d/routing b/etc/rc.d/routing index 72c72979c5c8..6985fd9aaef2 100644 --- a/etc/rc.d/routing +++ b/etc/rc.d/routing @@ -77,11 +77,11 @@ network_pass1() { ;; esac + dhcp_interfaces="" for ifn in ${network_interfaces}; do - showstat=false if [ -r /etc/start_if.${ifn} ]; then . /etc/start_if.${ifn} - showstat=true + eval showstat_$ifn=1 fi # Do the primary ifconfig if specified @@ -92,15 +92,22 @@ network_pass1() { '') ;; [Dd][Hh][Cc][Pp]) - ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${ifn} - showstat=true + # DHCP inits are done all in one go below + dhcp_interfaces="$dhcp_interfaces $ifn" + eval showstat_$ifn=1 ;; *) ifconfig ${ifn} ${ifconfig_args} - showstat=true + eval showstat_$ifn=1 ;; esac + done + if [ ! -z "${dhcp_interfaces}" ]; then + ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${dhcp_interfaces} + fi + + for ifn in ${network_interfaces}; do # Check to see if aliases need to be added # alias=0 @@ -108,7 +115,7 @@ network_pass1() { eval ifconfig_args=\$ifconfig_${ifn}_alias${alias} if [ -n "${ifconfig_args}" ]; then ifconfig ${ifn} ${ifconfig_args} alias - showstat=true + eval showstat_$ifn=1 alias=`expr ${alias} + 1` else break; @@ -120,14 +127,15 @@ network_pass1() { eval ifconfig_args=\$ifconfig_${ifn}_ipx if [ -n "${ifconfig_args}" ]; then ifconfig ${ifn} ${ifconfig_args} - showstat=true + eval showstat_$ifn=1 fi + done - case ${showstat} in - true) + for ifn in ${network_interfaces}; do + eval showstat=\$showstat_${ifn} + if [ ! -z ${showstat} ]; then ifconfig ${ifn} - ;; - esac + fi done # Warm up user ppp if required, must happen before natd. diff --git a/etc/rc.network b/etc/rc.network index 72c72979c5c8..6985fd9aaef2 100644 --- a/etc/rc.network +++ b/etc/rc.network @@ -77,11 +77,11 @@ network_pass1() { ;; esac + dhcp_interfaces="" for ifn in ${network_interfaces}; do - showstat=false if [ -r /etc/start_if.${ifn} ]; then . /etc/start_if.${ifn} - showstat=true + eval showstat_$ifn=1 fi # Do the primary ifconfig if specified @@ -92,15 +92,22 @@ network_pass1() { '') ;; [Dd][Hh][Cc][Pp]) - ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${ifn} - showstat=true + # DHCP inits are done all in one go below + dhcp_interfaces="$dhcp_interfaces $ifn" + eval showstat_$ifn=1 ;; *) ifconfig ${ifn} ${ifconfig_args} - showstat=true + eval showstat_$ifn=1 ;; esac + done + if [ ! -z "${dhcp_interfaces}" ]; then + ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${dhcp_interfaces} + fi + + for ifn in ${network_interfaces}; do # Check to see if aliases need to be added # alias=0 @@ -108,7 +115,7 @@ network_pass1() { eval ifconfig_args=\$ifconfig_${ifn}_alias${alias} if [ -n "${ifconfig_args}" ]; then ifconfig ${ifn} ${ifconfig_args} alias - showstat=true + eval showstat_$ifn=1 alias=`expr ${alias} + 1` else break; @@ -120,14 +127,15 @@ network_pass1() { eval ifconfig_args=\$ifconfig_${ifn}_ipx if [ -n "${ifconfig_args}" ]; then ifconfig ${ifn} ${ifconfig_args} - showstat=true + eval showstat_$ifn=1 fi + done - case ${showstat} in - true) + for ifn in ${network_interfaces}; do + eval showstat=\$showstat_${ifn} + if [ ! -z ${showstat} ]; then ifconfig ${ifn} - ;; - esac + fi done # Warm up user ppp if required, must happen before natd.