netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] /sbin/ifcfg assumes ip, arping and rdisc are in $PATH
@ 2008-04-25 10:05 Marcela Maslanova
  2008-04-25 10:14 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Marcela Maslanova @ 2008-04-25 10:05 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: Type: text/plain, Size: 192 bytes --]

Patch from Ville Skyttä.
/sbin/ifcfg assumes that ip, arping, and rdisc are in $PATH which is not the
case eg. after "sudo -s" from a non-root user.  

-- 
Marcela Mašláňová
BaseOS team Brno


[-- Attachment #2: paths.patch --]
[-- Type: text/x-patch, Size: 3341 bytes --]

diff -up iproute2-2.6.23/ip/routel~ iproute2-2.6.23/ip/routel
--- iproute2-2.6.23/ip/routel~	2007-10-17 00:27:42.000000000 +0300
+++ iproute2-2.6.23/ip/routel	2008-04-24 20:22:50.000000000 +0300
@@ -14,7 +14,7 @@ test "X-h" = "X$1" && echo "Usage: $0 [t
 
 test -z "$*" && set 0
 
-ip route list table "$@" |
+/sbin/ip route list table "$@" |
  while read network rest
  do set xx $rest
     shift
diff -up iproute2-2.6.23/ip/ifcfg~ iproute2-2.6.23/ip/ifcfg
--- iproute2-2.6.23/ip/ifcfg~	2007-10-17 00:27:42.000000000 +0300
+++ iproute2-2.6.23/ip/ifcfg	2008-04-24 20:25:39.000000000 +0300
@@ -15,7 +15,7 @@ CheckForwarding () {
 }
 
 RestartRDISC () {
-  killall -HUP rdisc || rdisc -fs
+  killall -HUP rdisc || /sbin/rdisc -fs
 }
 
 ABCMaskLen () {
@@ -56,7 +56,7 @@ stop)
     echo "Cannot stop alias $ldev" 1>&2
     exit 1;
   fi
-  ip -4 addr flush dev $dev $label || exit 1
+  /sbin/ip -4 addr flush dev $dev $label || exit 1
   if [ $fwd -eq 0 ]; then RestartRDISC; fi
   exit 0 ;;
 del*)
@@ -102,45 +102,45 @@ if [ "$ldev" = "$dev" -a "$ipaddr" != ""
 fi
 
 if [ $deleting -ne 0 ]; then
-  ip addr del $pfx dev $dev $label || exit 1
+  /sbin/ip addr del $pfx dev $dev $label || exit 1
   if [ $fwd -eq 0 ]; then RestartRDISC; fi
   exit 0
 fi
 
 
-if ! ip link set up dev $dev ; then
+if ! /sbin/ip link set up dev $dev ; then
   echo "Error: cannot enable interface $dev." 1>&2
   exit 1
 fi
 if [ "$ipaddr" = "" ]; then exit 0; fi
 
-if ! arping -q -c 2 -w 3 -D -I $dev $ipaddr ; then
+if ! /sbin/arping -q -c 2 -w 3 -D -I $dev $ipaddr ; then
   echo "Error: some host already uses address $ipaddr on $dev." 1>&2
   exit 1
 fi
 
-if ! ip address add $pfx brd + dev $dev $label; then
+if ! /sbin/ip address add $pfx brd + dev $dev $label; then
   echo "Error: failed to add $pfx on $dev." 1>&2
   exit 1
 fi
 
-arping -q -A -c 1 -I $dev $ipaddr
+/sbin/arping -q -A -c 1 -I $dev $ipaddr
 noarp=$?
 ( sleep 2 ;
-  arping -q -U -c 1 -I $dev $ipaddr ) >& /dev/null </dev/null &
+  /sbin/arping -q -U -c 1 -I $dev $ipaddr ) >& /dev/null </dev/null &
 
-ip route add unreachable 224.0.0.0/24 >& /dev/null
-ip route add unreachable 255.255.255.255 >& /dev/null
-if [ `ip link ls $dev | grep -c MULTICAST` -ge 1 ]; then
-  ip route add 224.0.0.0/4 dev $dev scope global >& /dev/null
+/sbin/ip route add unreachable 224.0.0.0/24 >& /dev/null
+/sbin/ip route add unreachable 255.255.255.255 >& /dev/null
+if [ `/sbin/ip link ls $dev | grep -c MULTICAST` -ge 1 ]; then
+  /sbin/ip route add 224.0.0.0/4 dev $dev scope global >& /dev/null
 fi
 
 if [ $fwd -eq 0 ]; then
   if [ $noarp -eq 0 ]; then
-    ip ro append default dev $dev metric 30000 scope global
+    /sbin/ip ro append default dev $dev metric 30000 scope global
   elif [ "$peer" != "" ]; then
     if ping -q -c 2 -w 4 $peer ; then
-      ip ro append default via $peer dev $dev metric 30001
+      /sbin/ip ro append default via $peer dev $dev metric 30001
     fi
   fi
   RestartRDISC
diff -up iproute2-2.6.23/ip/routef~ iproute2-2.6.23/ip/routef
--- iproute2-2.6.23/ip/routef~	2007-10-17 00:27:42.000000000 +0300
+++ iproute2-2.6.23/ip/routef	2008-04-24 20:23:20.000000000 +0300
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 if [ -z "$*" ] ; then
-	exec ip -4 ro flush  scope global  type unicast
+	exec /sbin/ip -4 ro flush  scope global  type unicast
 else
 	echo "Usage: routef"
 	echo

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] /sbin/ifcfg assumes ip, arping and rdisc are in $PATH
  2008-04-25 10:05 [PATCH] /sbin/ifcfg assumes ip, arping and rdisc are in $PATH Marcela Maslanova
@ 2008-04-25 10:14 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-04-25 10:14 UTC (permalink / raw)
  To: mmaslano; +Cc: netdev

From: Marcela Maslanova <mmaslano@redhat.com>
Date: Fri, 25 Apr 2008 12:05:26 +0200

> Patch from Ville Skyttä.
> /sbin/ifcfg assumes that ip, arping, and rdisc are in $PATH which is not the
> case eg. after "sudo -s" from a non-root user.  

You patch assumes 'ip' was installed in /sbin :-)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-25 10:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-25 10:05 [PATCH] /sbin/ifcfg assumes ip, arping and rdisc are in $PATH Marcela Maslanova
2008-04-25 10:14 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).