summaryrefslogtreecommitdiff
path: root/cloudinit/net/freebsd.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/net/freebsd.py')
-rw-r--r--cloudinit/net/freebsd.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/cloudinit/net/freebsd.py b/cloudinit/net/freebsd.py
index c843d792..f8faf240 100644
--- a/cloudinit/net/freebsd.py
+++ b/cloudinit/net/freebsd.py
@@ -32,6 +32,13 @@ class Renderer(cloudinit.net.bsd.BSDRenderer):
LOG.debug("freebsd generate postcmd disabled")
return
+ for dhcp_interface in self.dhcp_interfaces():
+ # Observed on DragonFlyBSD 6. If we use the "restart" parameter,
+ # the routes are not recreated.
+ subp.subp(['service', 'dhclient', 'stop', dhcp_interface],
+ rcs=[0, 1],
+ capture=True)
+
subp.subp(['service', 'netif', 'restart'], capture=True)
# On FreeBSD 10, the restart of routing and dhclient is likely to fail
# because
@@ -42,7 +49,7 @@ class Renderer(cloudinit.net.bsd.BSDRenderer):
subp.subp(['service', 'routing', 'restart'], capture=True, rcs=[0, 1])
for dhcp_interface in self.dhcp_interfaces():
- subp.subp(['service', 'dhclient', 'restart', dhcp_interface],
+ subp.subp(['service', 'dhclient', 'start', dhcp_interface],
rcs=[0, 1],
capture=True)
@@ -57,4 +64,4 @@ class Renderer(cloudinit.net.bsd.BSDRenderer):
def available(target=None):
- return util.is_FreeBSD()
+ return util.is_FreeBSD() or util.is_DragonFlyBSD()