Descriptionthomas.bartschies
2022-01-24 07:55:39 UTC
Description of problem:
network-scripts 10.13 Update changed the handling of routes from a route-<interface> file. Now any route coming from such a file triggers the ip route add
Error: any valid prefix is expected rather than "..."
Reason is, that the ip route add command in ifup-routes handle_file function
now encloses the $line variable in double quotes. In v10.11 the route was
added without them. The ip command now interpretes the complete route as
it's first command line parameter, which is incorrect
Here are the problematic changes:
--- ifup-routes.R 2021-08-27 09:55:06.000000000 +0200
+++ ifup-routes 2022-01-13 09:08:43.000000000 +0100
@@ -2,6 +2,8 @@
#
# adds static routes which go through device $1
+. /etc/sysconfig/network-scripts/network-functions
+
if [ -z "$1" ]; then
echo $"usage: ifup-routes <net-device> [<nickname>]"
exit 1
@@ -19,7 +21,12 @@
line="$line via $(eval echo '$'GATEWAY$routenum)"
fi
line="$line dev $2"
- /sbin/ip route add $line
+
+ /sbin/ip route add "$line" || {
+ net_log $"Failed to add route ${line}, using ip route replace instead." warning
+ /sbin/ip route replace "$line"
+ }
+
routenum=$(($routenum+1))
done
}
@@ -34,7 +41,10 @@
fi
{ cat "$file" ; echo ; } | while read line; do
if [[ ! "$line" =~ $MATCH ]]; then
- /sbin/ip $proto $type add $line
+ /sbin/ip $proto "$type" add "$line" || {
+ net_log $"Failed to add ${type} ${line}, using ip ${type} replace instead." warning
+ /sbin/ip $proto "$type" replace "$line"
+ }
fi
done
}
Version-Release number of selected component (if applicable):
network-scripts 10.13
How reproducible:
ifup-routes <interface>
Steps to Reproduce:
1. add routes via ifup-routes
2. or restart system
3.
Actual results:
No static routes are added at all.
Expected results:
Static routes are added.
Additional info:
Hi, I'm aware of this issue and I'm working on solution.
Comment 2thomas.bartschies
2022-01-24 08:38:04 UTC
The fix is simple. Just remove the double quotes around the $line variable. This restores the previous behaviour from v10.11.
I've already done this in my installation and tested it successfully.
Comment 3Fedora Update System
2022-01-24 12:15:23 UTC
Description of problem: network-scripts 10.13 Update changed the handling of routes from a route-<interface> file. Now any route coming from such a file triggers the ip route add Error: any valid prefix is expected rather than "..." Reason is, that the ip route add command in ifup-routes handle_file function now encloses the $line variable in double quotes. In v10.11 the route was added without them. The ip command now interpretes the complete route as it's first command line parameter, which is incorrect Here are the problematic changes: --- ifup-routes.R 2021-08-27 09:55:06.000000000 +0200 +++ ifup-routes 2022-01-13 09:08:43.000000000 +0100 @@ -2,6 +2,8 @@ # # adds static routes which go through device $1 +. /etc/sysconfig/network-scripts/network-functions + if [ -z "$1" ]; then echo $"usage: ifup-routes <net-device> [<nickname>]" exit 1 @@ -19,7 +21,12 @@ line="$line via $(eval echo '$'GATEWAY$routenum)" fi line="$line dev $2" - /sbin/ip route add $line + + /sbin/ip route add "$line" || { + net_log $"Failed to add route ${line}, using ip route replace instead." warning + /sbin/ip route replace "$line" + } + routenum=$(($routenum+1)) done } @@ -34,7 +41,10 @@ fi { cat "$file" ; echo ; } | while read line; do if [[ ! "$line" =~ $MATCH ]]; then - /sbin/ip $proto $type add $line + /sbin/ip $proto "$type" add "$line" || { + net_log $"Failed to add ${type} ${line}, using ip ${type} replace instead." warning + /sbin/ip $proto "$type" replace "$line" + } fi done } Version-Release number of selected component (if applicable): network-scripts 10.13 How reproducible: ifup-routes <interface> Steps to Reproduce: 1. add routes via ifup-routes 2. or restart system 3. Actual results: No static routes are added at all. Expected results: Static routes are added. Additional info: