Michael Olbrich wrote:
> On Sat, May 29, 2010 at 11:08:39PM +0200, Remy Bohmer wrote:
>> Use full path in dhclient-script
>>
>> If the dhclient-script is executed by the init.d scripts the PATH is not
>> yet set so use the full path for ip, ifconfig and route tools
>>
>> Signed-off-by: Bart vdr. Meulen <bartvdrmeu...@gmail.com>
>> Signed-off-by: Remy Bohmer <li...@bohmer.net>
>> ---
>>  generic/etc/dhclient-script |   56 
>> ++++++++++++++++++++++--------------------
>>  1 files changed, 29 insertions(+), 27 deletions(-)
>>
>> diff --git a/generic/etc/dhclient-script b/generic/etc/dhclient-script
>> index 8b4d7a4..0beaea2 100644
>> --- a/generic/etc/dhclient-script
>> +++ b/generic/etc/dhclient-script
>> @@ -22,8 +22,10 @@
>>  # 4. TIMEOUT not tested. ping has a flag I don't know, and I'm suspicious
>>  # of the $1 in its args.
>>  
>> -# 'ip' just looks too weird.  /sbin/ip looks less weird.
>> -ip=/sbin/ip
>> +# 'ip' just looks too weird.  /bin/ip looks less weird.
>> +ip=/bin/ip
> 
> Not good. busybox installs /bin/ip but iproute2 installs /sbin/ip.
> How do we handle this? Maybe we should set PATH instead?
> Marc?

an explicitly set PATH sounds good.

MArc

> 
>> +ifconfig=/sbin/ifconfig
>> +route=/sbin/route
>>  
>>  make_resolv_conf() {
>>    if [ x"$new_domain_name_servers" != x ]; then
>> @@ -111,16 +113,16 @@ fi
>>  if [ x$reason = xPREINIT ]; then
>>    if [ x$alias_ip_address != x ]; then
>>      # Bring down alias interface. Its routes will disappear too.
>> -    ifconfig $interface:0- inet 0
>> +    ${ifconfig} $interface:0- inet 0
>>    fi
>>    if [ $relmajor -lt 2 ] || ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] )
>>     then
>> -    ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
>> +    ${ifconfig} $interface inet 0.0.0.0 netmask 0.0.0.0 \
>>              broadcast 255.255.255.255 up
>>      # Add route to make broadcast work. Do not omit netmask.
>> -    route add default dev $interface netmask 0.0.0.0
>> +    ${route} add default dev $interface netmask 0.0.0.0
>>    else
>> -    ifconfig $interface 0 up
>> +    ${ifconfig} $interface 0 up
>>    fi
>>  
>>    # We need to give the kernel some time to get the interface up.
>> @@ -147,36 +149,36 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
>>    if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
>>              [ x$alias_ip_address != x$old_ip_address ]; then
>>      # Possible new alias. Remove old alias.
>> -    ifconfig $interface:0- inet 0
>> +    ${ifconfig} $interface:0- inet 0
>>    fi
>>    if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; 
>> then
>>      # IP address changed. Bringing down the interface will delete all 
>> routes,
>>      # and clear the ARP cache.
>> -    ifconfig $interface inet 0 down
>> +    ${ifconfig} $interface inet 0 down
>>  
>>    fi
>>    if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] 
>> || \
>>       [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
>>  
>> -    ifconfig $interface inet $new_ip_address $new_subnet_arg \
>> +    ${ifconfig} $interface inet $new_ip_address $new_subnet_arg \
>>                                                      $new_broadcast_arg
>>      # Add a network route to the computed network address.
>>      if [ $relmajor -lt 2 ] || \
>>              ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
>> -      route add -net $new_network_number $new_subnet_arg dev $interface
>> +      ${route} add -net $new_network_number $new_subnet_arg dev $interface
>>      fi
>>      for router in $new_routers; do
>>        if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
>> -    route add -host $router dev $interface
>> +    ${route} add -host $router dev $interface
>>        fi
>> -      route add default gw $router
>> +      ${route} add default gw $router
>>      done
>>    fi
>>    if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != 
>> x ];
>>     then
>> -    ifconfig $interface:0- inet 0
>> -    ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
>> -    route add -host $alias_ip_address $interface:0
>> +    ${ifconfig} $interface:0- inet 0
>> +    ${ifconfig} $interface:0 inet $alias_ip_address $alias_subnet_arg
>> +    ${route} add -host $alias_ip_address $interface:0
>>    fi
>>    make_resolv_conf
>>    exit_with_hooks 0
>> @@ -186,46 +188,46 @@ if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ 
>> x$reason = xRELEASE ] \
>>     || [ x$reason = xSTOP ]; then
>>    if [ x$alias_ip_address != x ]; then
>>      # Turn off alias interface.
>> -    ifconfig $interface:0- inet 0
>> +    ${ifconfig} $interface:0- inet 0
>>    fi
>>    if [ x$old_ip_address != x ]; then
>>      # Shut down interface, which will delete routes and clear arp cache.
>> -    ifconfig $interface inet 0 down
>> +    ${ifconfig} $interface inet 0 down
>>    fi
>>    if [ x$alias_ip_address != x ]; then
>> -    ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
>> -    route add -host $alias_ip_address $interface:0
>> +    ${ifconfig} $interface:0 inet $alias_ip_address $alias_subnet_arg
>> +    ${route} add -host $alias_ip_address $interface:0
>>    fi
>>    exit_with_hooks 0
>>  fi
>>  
>>  if [ x$reason = xTIMEOUT ]; then
>>    if [ x$alias_ip_address != x ]; then
>> -    ifconfig $interface:0- inet 0
>> +    ${ifconfig} $interface:0- inet 0
>>    fi
>> -  ifconfig $interface inet $new_ip_address $new_subnet_arg \
>> +  ${ifconfig} $interface inet $new_ip_address $new_subnet_arg \
>>                                      $new_broadcast_arg
>>    set $new_routers
>>    if ping -q -c 1 $1; then
>>      if [ x$new_ip_address != x$alias_ip_address ] && \
>>                      [ x$alias_ip_address != x ]; then
>> -      ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
>> -      route add -host $alias_ip_address dev $interface:0
>> +      ${ifconfig} $interface:0 inet $alias_ip_address $alias_subnet_arg
>> +      ${route} add -host $alias_ip_address dev $interface:0
>>      fi
>>      if [ $relmajor -lt 2 ] || \
>>              ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
>> -      route add -net $new_network_number
>> +      ${route} add -net $new_network_number
>>      fi
>>      for router in $new_routers; do
>>        if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
>> -    route add -host $router dev $interface
>> +    ${route} add -host $router dev $interface
>>        fi
>> -      route add default gw $router
>> +      ${route} add default gw $router
>>      done
>>      make_resolv_conf
>>      exit_with_hooks 0
>>    fi
>> -  ifconfig $interface inet 0 down
>> +  ${ifconfig} $interface inet 0 down
>>    exit_with_hooks 1
>>  fi
>>  
>> -- 
>> 1.7.0.4
>>
>>
>> -- 
>> ptxdist mailing list
>> ptxdist@pengutronix.de
>>
> 


-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to