]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
FreeBSD: Use the "dhclient" command to renew a DHCP IP address.
authorOliver Kurth <okurth@vmware.com>
Wed, 7 Jun 2017 00:17:04 +0000 (17:17 -0700)
committerOliver Kurth <okurth@vmware.com>
Wed, 7 Jun 2017 00:17:04 +0000 (17:17 -0700)
On FreeBSD, "/etc/rc.d/netif" is sufficient to stop a network interface
when suspending a VM.  When resuming a VM, DHCP configured interfaces
must be restarted with "/etc/rc.d/dhclient".

This fix is courtesy of Steve Wills, maintainer of open-vm-tools on
FreeBSD, and Shuai Wang.

Pull request: https://github.com/vmware/open-vm-tools/pull/142

open-vm-tools/scripts/freebsd/network

index 47a98fd66a52cb02c1ffdcc85fde32e2fe816c3d..0c70526173fbdf0219026b838addf4bdf2fa75dd 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/sh
 ##########################################################
-# Copyright (C) 2010-2016 VMware, Inc. All rights reserved.
+# Copyright (C) 2010-2017 VMware, Inc. All rights reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License as published
@@ -59,6 +59,7 @@ ToggleNetwork() {
 
       for intf in `list_net_interfaces dhcp`; do
          /etc/rc.d/netif $1 $intf
+         /etc/rc.d/dhclient $1 $intf
          ec=$?
 
          # Failure to stop an interface should not interfere with suspend.
@@ -85,7 +86,9 @@ main() {
 
    [ -r /etc/rc.subr ] || Panic "Cannot read /etc/rc.subr."
    [ -r /etc/network.subr ] || Panic "Cannot read /etc/network.subr"
-   [ -x /etc/rc.d/netif ] || Panic "Cannot read /etc/rc.d/netif"
+   [ -x /etc/rc.d/netif ] || Panic "Cannot find an executable /etc/rc.d/netif"
+   [ -x /etc/rc.d/dhclient ] || \
+      Panic "Cannot find an executable /etc/rc.d/dhclient"
 
    case "$1" in
       suspend-vm)