diff options
author | Dan Winship <danw@redhat.com> | 2014-12-17 08:50:05 -0500 |
---|---|---|
committer | Dan Winship <danw@redhat.com> | 2015-01-12 09:53:24 -0500 |
commit | f79d62692ec4fe5ba21bbeab26286b2a3b250fdd (patch) | |
tree | 7b8b40f65f576ec3c61b2cc5fa05aa2eec3c54fc /examples | |
parent | 5a229741cc1e5c19341628445af80915155cd18e (diff) | |
download | NetworkManager-f79d62692ec4fe5ba21bbeab26286b2a3b250fdd.tar.gz |
ifcfg-rh: allow handling complex routing rules via dispatcher (rh #1160013)
If a connection has an associated "rule-NAME" or "rule6-NAME" file,
don't try to read in the routes, since NetworkManager won't be able to
parse them correctly. Instead, log a warning that they will need to be
applied via a dispatcher script, and provide a script that would do
that in examples/dispatcher/.
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/dispatcher/10-ifcfg-rh-routes.sh | 21 | ||||
-rw-r--r-- | examples/dispatcher/Makefile.am | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/examples/dispatcher/10-ifcfg-rh-routes.sh b/examples/dispatcher/10-ifcfg-rh-routes.sh new file mode 100755 index 0000000000..78f009ef67 --- /dev/null +++ b/examples/dispatcher/10-ifcfg-rh-routes.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# This ifcfg-rh-specific script runs +# /etc/sysconfig/network-scripts/ifup-routes when bringing up +# 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/ + +dir=$(dirname "$CONNECTION_FILENAME") +if [ "$dir" != "/etc/sysconfig/network-scripts" ]; then + exit 0 +fi +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" +fi diff --git a/examples/dispatcher/Makefile.am b/examples/dispatcher/Makefile.am index 0db71a0d4f..0089d5fe7b 100644 --- a/examples/dispatcher/Makefile.am +++ b/examples/dispatcher/Makefile.am @@ -1,3 +1,4 @@ EXTRA_DIST = \ + 10-ifcfg-rh-routes.sh \ 70-wifi-wired-exclusive.sh |