diff options
author | Dan Winship <danw@redhat.com> | 2015-01-27 12:35:11 -0500 |
---|---|---|
committer | Dan Winship <danw@redhat.com> | 2015-01-27 13:51:45 -0500 |
commit | 8de1bec8032a733fa697832fcf85badeb3e102be (patch) | |
tree | 0d9a80f36643fa954c5dbeaa516c405dd2921aef | |
parent | 11ccf949a331c77e14a0d4115c7242e8732878c8 (diff) | |
download | NetworkManager-8de1bec8032a733fa697832fcf85badeb3e102be.tar.gz |
dispatcher: fix ifcfg-rh example dispatcher script (rh #1160013)
Routing table entries for a device get flushed when the device is
deactivated, but rules table entries don't, so we have to flush them
by hand.
-rw-r--r-- | contrib/fedora/rpm/NetworkManager.spec | 3 | ||||
-rwxr-xr-x | examples/dispatcher/10-ifcfg-rh-routes.sh | 21 |
2 files changed, 19 insertions, 5 deletions
diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index 70884ffa0d..cf95985c5e 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -454,7 +454,8 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/conf.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/dispatcher.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/dispatcher.d/pre-up.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/dispatcher.d/pre-down.d -%{__cp} examples/dispatcher/10-ifcfg-rh-routes.sh $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/dispatcher.d/pre-up.d +%{__cp} examples/dispatcher/10-ifcfg-rh-routes.sh $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/dispatcher.d/ +%{__ln_s} ../10-ifcfg-rh-routes.sh $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/dispatcher.d/pre-up.d/ %{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/gnome-vpn-properties diff --git a/examples/dispatcher/10-ifcfg-rh-routes.sh b/examples/dispatcher/10-ifcfg-rh-routes.sh index 78f009ef67..75b8c5e5e9 100755 --- a/examples/dispatcher/10-ifcfg-rh-routes.sh +++ b/examples/dispatcher/10-ifcfg-rh-routes.sh @@ -5,7 +5,12 @@ # interfaces that have routing rules associated with them that can't # be expressed by NMSettingIPConfig. (Eg, policy-based routing.) -# This should be installed in dispatcher.d/pre-up.d/ +# This should be installed in both dispatcher.d/ and +# dispatcher.d/pre-up.d/ + +if [ "$2" != "pre-up" -a "$2" != "down" ]; then + exit 0 +fi dir=$(dirname "$CONNECTION_FILENAME") if [ "$dir" != "/etc/sysconfig/network-scripts" ]; then @@ -15,7 +20,15 @@ profile=$(basename "$CONNECTION_FILENAME" | sed -ne 's/^ifcfg-//p') if [ -z "$profile" ]; then exit 0 fi - -if [ -f "$dir/rule-$profile" -o -f "$dir/rule6-$profile" ]; then - /etc/sysconfig/network-scripts/ifup-routes "$DEVICE_IP_IFACE" "$profile" +if ! [ -f "$dir/rule-$profile" -o -f "$dir/rule6-$profile" ]; then + exit 0 fi + +case "$2" in + pre-up) + /etc/sysconfig/network-scripts/ifup-routes "$DEVICE_IP_IFACE" "$profile" + ;; + down) + /etc/sysconfig/network-scripts/ifdown-routes "$DEVICE_IP_IFACE" "$profile" + ;; +esac |