Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 42062 Details for
Bug 67934
enhancement, dhcp to support ldap, update ntp and nis and fixes same problems
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for update net.eth0
net.eth0.patch (text/plain), 5.13 KB, created by
INODE64 Sistemas
on 2004-10-17 14:42:21 UTC
(
hide
)
Description:
patch for update net.eth0
Filename:
MIME Type:
Creator:
INODE64 Sistemas
Created:
2004-10-17 14:42:21 UTC
Size:
5.13 KB
patch
obsolete
>--- net.eth0.old 2004-07-19 21:46:18.000000000 +0200 >+++ net.eth0 2004-10-17 03:08:45.890953840 +0200 >@@ -18,6 +18,11 @@ > use hotplug pcmcia > } > >+# Kill running dhcp client if present >+dhcp_client_pids() { >+ ps xw | egrep 'dhcpcd|pump|dhcpxd|dhclient|zcip' | grep ${IFACE} | awk '{print $1;}' >+} >+ > checkconfig() { > if [[ -z "${ifconfig_IFACE}" ]]; then > eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set" >@@ -55,6 +60,7 @@ > eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\" > eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" ) > eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\" >+ eval dhclient_IFACE=\"\$\{dhclient_$iface\}\" > eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" ) > eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" ) > eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" ) >@@ -88,25 +94,44 @@ > local IFACE=${1} i x retval > checkconfig || return 1 > >- if [[ ${ifconfig_IFACE} != dhcp ]]; then >- # Show the address, but catch if this interface will be inet6 only >- i=${ifconfig_IFACE%% *} >- if [[ ${i} == *.*.*.* ]]; then >- ebegin "Bringing ${IFACE} up (${i})" >+ if [[ ${ifconfig_IFACE} == dhcp ]]; then >+ # Check that eth0 was not brought up by the kernel ... >+ if [[ ${status_IFACE} == up ]]; then >+ einfo "Keeping kernel configuration for ${IFACE}" > else >- ebegin "Bringing ${IFACE} up" >+ ebegin "Bringing ${IFACE} up via DHCP" >+ /sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE} >+ retval=$? >+ eend $retval >+ if [[ $retval == 0 ]]; then >+ # DHCP succeeded, show address retrieved >+ i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' | >+ cut -d: -f2) >+ [[ -n ${i} ]] && einfo " ${IFACE} received address ${i}" >+ elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then >+ # DHCP failed, try fallback. >+ # Show the address, but catch if this interface will be inet6 only >+ i=${ifconfig_fallback_IFACE%% *} >+ if [[ ${i} == *.*.*.* ]]; then >+ ebegin "Using fallback configuration (${i}) for ${IFACE}" >+ else >+ ebegin "Using fallback configuration for ${IFACE}" >+ fi >+ ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \ >+ ifconfig ${IFACE} up &>${devnull} >+ eend $? || return $? >+ else >+ return $retval >+ fi > fi >- # ifconfig does not always return failure .. >- ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \ >- ifconfig ${IFACE} up &>${devnull} >- eend $? || return $? >- else >+ elif [[ ${ifconfig_IFACE} == dhclient ]]; then > # Check that eth0 was not brought up by the kernel ... > if [[ ${status_IFACE} == up ]]; then > einfo "Keeping kernel configuration for ${IFACE}" > else > ebegin "Bringing ${IFACE} up via DHCP" >- /sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE} >+ ifconfig ${IFACE} up >+ /sbin/dhclient ${dhclient_IFACE} ${IFACE} > retval=$? > eend $retval > if [[ $retval == 0 ]]; then >@@ -130,6 +155,18 @@ > return $retval > fi > fi >+ else >+ # Show the address, but catch if this interface will be inet6 only >+ i=${ifconfig_IFACE%% *} >+ if [[ ${i} == *.*.*.* ]]; then >+ ebegin "Bringing ${IFACE} up (${i})" >+ else >+ ebegin "Bringing ${IFACE} up" >+ fi >+ # ifconfig does not always return failure .. >+ ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \ >+ ifconfig ${IFACE} up &>${devnull} >+ eend $? || return $? > fi > > if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then >@@ -205,18 +242,33 @@ > # iface_start ran. Instead query for current configuration and bring > # down the interface. > iface_stop() { >- local IFACE=${1} i x aliases inet6 count >+ local IFACE=${1} i x aliases inet6 count retcode pids waited > > # Try to do a simple down (no aliases, no inet6, no dhcp) > aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)" > inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')" >- if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then >+ if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid && ! -e /var/run/dhcp/dhclient.pid ]]; then > ebegin "Bringing ${IFACE} down" > ifconfig ${IFACE} down &>/dev/null > eend 0 > return 0 > fi > >+ einfo "Bringing down dhcp client" >+ >+ retcode=0 >+ pids=`dhcp_client_pids` >+ if [ -n "$pids" ]; then >+ kill $pids >+ retcode=$? >+ waited=0 >+ while ! dhcp_client_pids > /dev/null && [ "$waited" -lt 50 ] ; do >+ usleep 10000 >+ waited=$(($waited+1)) >+ done >+ fi >+ eend $retcode "Timed out" >+ > einfo "Bringing ${IFACE} down" > > # Stop aliases before primary interface. >@@ -236,17 +288,6 @@ > done > fi > >- # Stop DHCP (should be N/A for aliases) >- # Don't trust current configuration... investigate ourselves >- if /sbin/dhcpcd -z ${i} &>${devnull}; then >- ebegin " Releasing DHCP lease for ${IFACE}" >- for ((count = 0; count < 9; count = count + 1)); do >- /sbin/dhcpcd -z ${i} &>${devnull} || break >- sleep 1 >- done >- [[ ${count} -lt 9 ]] >- eend $? "Timed out" >- fi > ebegin " Stopping ${i}" > ifconfig ${i} down &>${devnull} > eend 0 >@@ -257,7 +298,7 @@ > > start() { > # These variables are set by setup_vars >- local status_IFACE vlans_IFACE dhcpcd_IFACE >+ local status_IFACE vlans_IFACE dhcpcd_IFACE dhclient_IFACE > local -a ifconfig_IFACE routes_IFACE inet6_IFACE > > # Call user-defined preup function if it exists
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 67934
:
42061
| 42062 |
42063
|
45533