From: Marcela Maslanova <mmaslano@redhat.com>
To: netdev@vger.kernel.org
Subject: [PATCH] /sbin/ifcfg assumes ip, arping and rdisc are in $PATH
Date: Fri, 25 Apr 2008 12:05:26 +0200 [thread overview]
Message-ID: <4811ACE6.7020908@redhat.com> (raw)
[-- 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
next reply other threads:[~2008-04-25 10:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-25 10:05 Marcela Maslanova [this message]
2008-04-25 10:14 ` [PATCH] /sbin/ifcfg assumes ip, arping and rdisc are in $PATH David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4811ACE6.7020908@redhat.com \
--to=mmaslano@redhat.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).