Edward Haas has uploaded a new change for review.

Change subject: net: dhclient - Use request options to control the default route
......................................................................

net: dhclient - Use request options to control the default route

When using ip.dhclient, the definition of the default route has been
controlled by adding an environment variable using '-e' (DEFROUTE).
This method has limitations and is limited to initscript and friends.

This patch uses an aproach of not requesting the route by explicitly
setting the requested options using '-R'.

Change-Id: I5698c905992028980f28ba3e9eecfcdfdbfd51ef
Signed-off-by: Edward Haas <edwa...@redhat.com>
---
M lib/vdsm/network/ip/dhclient.py
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/63085/1

diff --git a/lib/vdsm/network/ip/dhclient.py b/lib/vdsm/network/ip/dhclient.py
index 3fc5b33..65679d9 100644
--- a/lib/vdsm/network/ip/dhclient.py
+++ b/lib/vdsm/network/ip/dhclient.py
@@ -40,6 +40,10 @@
 
 class DhcpClient(object):
     PID_FILE = '/var/run/dhclient%s-%s.pid'
+    DEFAULT_REQ_OPTIONS = 'subnet-mask,broadcast-address,time-offset,' \
+                          'domain-search,domain-name,domain-name-servers,' \
+                          'host-name,nis-domain,nis-servers,ntp-servers,' \
+                          'interface-mtu'
 
     def __init__(self, iface, family=4, default_route=False, duid_source=None,
                  cgroup=DHCLIENT_CGROUP):
@@ -61,9 +65,9 @@
             kill(self.iface, self.family)
         cmd = [DHCLIENT_BINARY.cmd, '-%s' % self.family, '-1', '-pf',
                self.pidFile, '-lf', self.leaseFile]
-        if not self.default_route:
-            # Instruct Fedora/EL's dhclient-script not to set gateway on iface
-            cmd += ['-e', 'DEFROUTE=no']
+        cmd += ['-R', DhcpClient.DEFAULT_REQ_OPTIONS]
+        if self.default_route:
+            cmd[-1] += ',routers'
         if self.duid_source_file and supports_duid_file():
             cmd += ['-df', self.duid_source_file]
         cmd += [self.iface]


-- 
To view, visit https://gerrit.ovirt.org/63085
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5698c905992028980f28ba3e9eecfcdfdbfd51ef
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Edward Haas <edwa...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org

Reply via email to