Turn off dnsmasq's DNS forwarding on public interfaces
authorAndy Bavier <acb@cs.princeton.edu>
Mon, 7 Oct 2013 18:30:14 +0000 (14:30 -0400)
committerAndy Bavier <acb@cs.princeton.edu>
Mon, 7 Oct 2013 18:30:14 +0000 (14:30 -0400)
plugins/planetstack-net.py

index 5ef2853..0fc0bf6 100644 (file)
@@ -157,7 +157,7 @@ def dnsmasq_sighup(dev):
 # Enable dnsmasq for this interface.
 # It's possible that we could get by with a single instance of dnsmasq running on
 # all devices but I haven't tried it.
-def start_dnsmasq(dev, interface):
+def start_dnsmasq(dev, interface, forward_dns=True):
     if not dnsmasq_running(dev):
         # The '--dhcp-range=<IP addr>,static' argument to dnsmasq ensures that it only
         # hands out IP addresses to clients listed in the hostsfile
@@ -175,6 +175,10 @@ def start_dnsmasq(dev, interface):
                '--dhcp-no-override',
                '--dhcp-range=%s,static' % interface['ip']]
 
+        # Turn off forwarding DNS queries, only do DHCP
+        if forward_dns == False:
+            cmd.append('--port=0')
+
         try:
             logger.log('%s: starting dnsmasq on device %s' % (plugin, dev))
             subprocess.check_call(cmd)
@@ -345,5 +349,5 @@ def GetSlivers(data, config=None, plc=None):
             if 'OVS_BRIDGE' in tags:
                 dev = tags['OVS_BRIDGE']
             write_dnsmasq_hostsfile(dev, ports, site_net_id)
-            start_dnsmasq(dev, interface)
+            start_dnsmasq(dev, interface, forward_dns=False)