diff options
author | Gonéri Le Bouder <goneri@lebouder.net> | 2021-05-25 15:48:07 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-25 14:48:07 -0500 |
commit | fc161f8e3e35883637ef12b27bfb1eacbfce6277 (patch) | |
tree | 4eefc9f726dae9b0490547932a65ba6a3d62a3c6 /cloudinit/net/openbsd.py | |
parent | 7c1d27b8836c266f6db1e179b98ef32effeb750e (diff) | |
download | vyos-cloud-init-fc161f8e3e35883637ef12b27bfb1eacbfce6277.tar.gz vyos-cloud-init-fc161f8e3e35883637ef12b27bfb1eacbfce6277.zip |
openbsd/net: flush the route table on net restart (#908)
Ensure we've got a clean environment before we restart the network.
In some cases, the `sh /etc/netstart` is not enough to restart the
network. A previous default route remains in the route table and
as a result the network is broken.
Also `sh /netstart` does not kill `dhclient`.
The problen happens for instance with OVH OpenStack SBG3.
Diffstat (limited to 'cloudinit/net/openbsd.py')
-rw-r--r-- | cloudinit/net/openbsd.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/cloudinit/net/openbsd.py b/cloudinit/net/openbsd.py index 9ec7ee9e..d87d8a4f 100644 --- a/cloudinit/net/openbsd.py +++ b/cloudinit/net/openbsd.py @@ -36,6 +36,9 @@ class Renderer(cloudinit.net.bsd.BSDRenderer): if not self._postcmds: LOG.debug("openbsd generate postcmd disabled") return + subp.subp(['pkill', 'dhclient'], capture=True, rcs=[0, 1]) + subp.subp(['route', 'del', 'default'], capture=True, rcs=[0, 1]) + subp.subp(['route', 'flush', 'default'], capture=True, rcs=[0, 1]) subp.subp(['sh', '/etc/netstart'], capture=True) def set_route(self, network, netmask, gateway): |