diff options
author | Christian Breunig <christian@breunig.cc> | 2025-04-23 22:26:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-23 22:26:36 +0200 |
commit | 88e8a1e5c8b29d3795c097c4a3988b0ab0e98f89 (patch) | |
tree | 7ea4087e98ff861342bd83b25ab4fe7d2633bb1d /src | |
parent | 7cbaefe575331f28a5b6009f841bb0299576af13 (diff) | |
parent | 2ff0981bfe1231fc430507b4b5f8031c05005db1 (diff) | |
download | vyos-1x-88e8a1e5c8b29d3795c097c4a3988b0ab0e98f89.tar.gz vyos-1x-88e8a1e5c8b29d3795c097c4a3988b0ab0e98f89.zip |
Merge pull request #4465 from MattKobayashi/T6253
dhclient: T6253: Respect `no-default-route`
Diffstat (limited to 'src')
-rw-r--r-- | src/etc/dhcp/dhclient-enter-hooks.d/06-vyos-nodefaultroute | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/etc/dhcp/dhclient-enter-hooks.d/06-vyos-nodefaultroute b/src/etc/dhcp/dhclient-enter-hooks.d/06-vyos-nodefaultroute new file mode 100644 index 000000000..38f674276 --- /dev/null +++ b/src/etc/dhcp/dhclient-enter-hooks.d/06-vyos-nodefaultroute @@ -0,0 +1,20 @@ +# Don't add default route if no-default-route is configured for interface + +# As configuration is not available to cli-shell-api at the first boot, we must use vyos.config, which contains a workaround for this +function get_no_default_route { +python3 - <<PYEND +from vyos.config import Config +import os + +config = Config() +if config.exists('interfaces'): + iface_types = config.list_nodes('interfaces') + for iface_type in iface_types: + if config.exists("interfaces {} {} dhcp-options no-default-route".format(iface_type, os.environ['interface'])): + print("True") +PYEND +} + +if [[ "$(get_no_default_route)" == 'True' ]]; then + new_routers="" +fi |