Blame SOURCES/0003-rh1160013-rules.patch

386167
From 3d9e09a4a0abbaab69c716365dc3a9ba2b717f53 Mon Sep 17 00:00:00 2001
386167
From: Dan Winship <danw@redhat.com>
386167
Date: Tue, 27 Jan 2015 12:35:11 -0500
386167
Subject: [PATCH] dispatcher: fix ifcfg-rh example dispatcher script (rh
386167
 #1160013)
386167
386167
Routing table entries for a device get flushed when the device is
386167
deactivated, but rules table entries don't, so we have to flush them
386167
by hand.
386167
---
386167
 contrib/fedora/rpm/NetworkManager.spec    |  3 ++-
386167
 examples/dispatcher/10-ifcfg-rh-routes.sh | 21 +++++++++++++++++----
386167
 2 files changed, 19 insertions(+), 5 deletions(-)
386167
386167
diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec
386167
index 70884ff..cf95985 100644
386167
--- a/examples/dispatcher/10-ifcfg-rh-routes.sh
386167
+++ b/examples/dispatcher/10-ifcfg-rh-routes.sh
386167
@@ -5,7 +5,12 @@
386167
 # interfaces that have routing rules associated with them that can't
386167
 # be expressed by NMSettingIPConfig. (Eg, policy-based routing.)
386167
 
386167
-# This should be installed in dispatcher.d/pre-up.d/
386167
+# This should be installed in both dispatcher.d/ and
386167
+# dispatcher.d/pre-up.d/
386167
+
386167
+if [ "$2" != "pre-up" -a "$2" != "down" ]; then
386167
+    exit 0
386167
+fi
386167
 
386167
 dir=$(dirname "$CONNECTION_FILENAME")
386167
 if [ "$dir" != "/etc/sysconfig/network-scripts" ]; then
386167
@@ -15,7 +20,15 @@ profile=$(basename "$CONNECTION_FILENAME" | sed -ne 's/^ifcfg-//p')
386167
 if [ -z "$profile" ]; then
386167
     exit 0
386167
 fi
386167
-
386167
-if [ -f "$dir/rule-$profile" -o -f "$dir/rule6-$profile" ]; then
386167
-    /etc/sysconfig/network-scripts/ifup-routes "$DEVICE_IP_IFACE" "$profile"
386167
+if ! [ -f "$dir/rule-$profile" -o -f "$dir/rule6-$profile" ]; then
386167
+    exit 0
386167
 fi
386167
+
386167
+case "$2" in
386167
+    pre-up)
386167
+        /etc/sysconfig/network-scripts/ifup-routes "$DEVICE_IP_IFACE" "$profile"
386167
+        ;;
386167
+    down)
386167
+        /etc/sysconfig/network-scripts/ifdown-routes "$DEVICE_IP_IFACE" "$profile"
386167
+        ;;
386167
+esac
386167
-- 
386167
1.9.3
386167