From fc161f8e3e35883637ef12b27bfb1eacbfce6277 Mon Sep 17 00:00:00 2001 From: Gonéri Le Bouder Date: Tue, 25 May 2021 15:48:07 -0400 Subject: 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. --- cloudinit/net/openbsd.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cloudinit/net') 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): -- cgit v1.2.3