shill: DHCPConfig: Optionally use minimal config

Add another argument to the DHCPConfig constructor to specify
whether a cut-down minimal set of options should be requested
from the DHCP server.  This adds a command line argument to
the startup of the DHCP client.  Propagate this upwards to the
Device, and add a placeholder Device::ShouldUseMinimalConfig()
method which will decide whether to enable this feature in the
DHCPConfig in a later CL.

A few ancillary changes went into this CL:

  - The DHCPProvider needed another argument to CreateConfig
    since it constructs DHCPConfig objects.
  - Added a unit test for the Device::ShouldUseArpGateway()
    superclass function next to Device::ShouldUseMinimalConfig()
    test.
  - Fixed the DHCPConfigTest::Start* tests to use the IsDHCPCDArgs
    matcher.  For some reason that matcher sat unused and
    atrophied.  Added a new test that exercises the minimal config
    flag.

BUG=chromium:297607
TEST=Unit tests.  Run network_DhcpNegotiationSuccess autotest.

Change-Id: If0dcaf328ca6dfac7127a6badd409a4138c95760
Reviewed-on: https://chromium-review.googlesource.com/174531
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/cellular_unittest.cc b/cellular_unittest.cc
index ae1d46d..8a6b98b 100644
--- a/cellular_unittest.cc
+++ b/cellular_unittest.cc
@@ -705,7 +705,7 @@
   device_->set_modem_state(Cellular::kModemStateConnected);
   GetCapabilityClassic()->meid_ = kMEID;
   ExpectCdmaStartModem(kNetworkTechnologyEvdo);
-  EXPECT_CALL(dhcp_provider_, CreateConfig(kTestDeviceName, _, _, _))
+  EXPECT_CALL(dhcp_provider_, CreateConfig(kTestDeviceName, _, _, _, _))
       .WillOnce(Return(dhcp_config_));
   EXPECT_CALL(*dhcp_config_, RequestIP()).WillOnce(Return(true));
   EXPECT_CALL(*modem_info_.mock_manager(), UpdateService(_)).Times(3);
@@ -892,7 +892,7 @@
 }
 
 TEST_F(CellularTest, UseNoArpGateway) {
-  EXPECT_CALL(dhcp_provider_, CreateConfig(kTestDeviceName, _, _, false))
+  EXPECT_CALL(dhcp_provider_, CreateConfig(kTestDeviceName, _, _, false, false))
       .WillOnce(Return(dhcp_config_));
   device_->AcquireIPConfig();
 }
@@ -1117,7 +1117,7 @@
   EXPECT_CALL(*mock_task, OnDelete()).Times(AnyNumber());
   device_->ppp_task_ = mock_task.Pass();
   device_->state_ = Cellular::kStateConnected;
-  EXPECT_CALL(dhcp_provider_, CreateConfig(kTestDeviceName, _, _, _))
+  EXPECT_CALL(dhcp_provider_, CreateConfig(kTestDeviceName, _, _, _, _))
       .Times(0);
   EXPECT_CALL(*dhcp_config_, RequestIP()).Times(0);
   device_->LinkEvent(IFF_UP, 0);
@@ -1126,7 +1126,7 @@
 TEST_F(CellularTest, LinkEventUpWithoutPPP) {
   // If PPP is not running, fire up DHCP.
   device_->state_ = Cellular::kStateConnected;
-  EXPECT_CALL(dhcp_provider_, CreateConfig(kTestDeviceName, _, _, _))
+  EXPECT_CALL(dhcp_provider_, CreateConfig(kTestDeviceName, _, _, _, _))
       .WillOnce(Return(dhcp_config_));
   EXPECT_CALL(*dhcp_config_, RequestIP());
   EXPECT_CALL(*dhcp_config_, ReleaseIP(_)).Times(AnyNumber());
diff --git a/device.cc b/device.cc
index cfd20bf..d6145dd 100644
--- a/device.cc
+++ b/device.cc
@@ -381,6 +381,10 @@
   return false;
 }
 
+bool Device::ShouldUseMinimalDHCPConfig() const {
+  return false;
+}
+
 bool Device::AcquireIPConfig() {
   return AcquireIPConfigWithLeaseName(string());
 }
@@ -392,7 +396,8 @@
   ipconfig_ = dhcp_provider_->CreateConfig(link_name_,
                                            manager_->GetHostName(),
                                            lease_name,
-                                           arp_gateway);
+                                           arp_gateway,
+                                           ShouldUseMinimalDHCPConfig());
   ipconfig_->RegisterUpdateCallback(Bind(&Device::OnIPConfigUpdated,
                                          weak_ptr_factory_.GetWeakPtr()));
   dispatcher_->PostTask(Bind(&Device::ConfigureStaticIPTask,
diff --git a/device.h b/device.h
index d6f89ca..5f8c119 100644
--- a/device.h
+++ b/device.h
@@ -264,6 +264,8 @@
   FRIEND_TEST(DeviceTest, SetEnabledNonPersistent);
   FRIEND_TEST(DeviceTest, SetEnabledPersistent);
   FRIEND_TEST(DeviceTest, SetServiceConnectedState);
+  FRIEND_TEST(DeviceTest, ShouldUseArpGateway);
+  FRIEND_TEST(DeviceTest, ShouldUseMinimalDHCPConfig);
   FRIEND_TEST(DeviceTest, Start);
   FRIEND_TEST(DeviceTest, StartTrafficMonitor);
   FRIEND_TEST(DeviceTest, Stop);
@@ -422,6 +424,11 @@
   // device technology.
   virtual bool ShouldUseArpGateway() const;
 
+  // Specifies whether DHCP replies have not been succeeding or we have
+  // previously noticed that requesting a minimal DHCP response seems
+  // to alleviate issues with receiving a reply.
+  bool ShouldUseMinimalDHCPConfig() const;
+
   const ServiceRefPtr &selected_service() const { return selected_service_; }
 
   void HelpRegisterConstDerivedString(
diff --git a/device_unittest.cc b/device_unittest.cc
index b6f921e..ebb4b75 100644
--- a/device_unittest.cc
+++ b/device_unittest.cc
@@ -242,7 +242,7 @@
   scoped_refptr<MockDHCPConfig> dhcp_config(new MockDHCPConfig(
                                                     control_interface(),
                                                     kDeviceName));
-  EXPECT_CALL(*dhcp_provider, CreateConfig(_, _, _, _))
+  EXPECT_CALL(*dhcp_provider, CreateConfig(_, _, _, _, _))
       .WillOnce(Return(dhcp_config));
   EXPECT_CALL(*dhcp_config, RequestIP())
       .WillOnce(Return(false));
@@ -681,6 +681,14 @@
   EXPECT_FALSE(device_->traffic_monitor_.get());
 }
 
+TEST_F(DeviceTest, ShouldUseArpGateway) {
+  EXPECT_FALSE(device_->ShouldUseArpGateway());
+}
+
+TEST_F(DeviceTest, ShouldUseMinimalDHCPConfig) {
+  EXPECT_FALSE(device_->ShouldUseMinimalDHCPConfig());
+}
+
 class DevicePortalDetectionTest : public DeviceTest {
  public:
   DevicePortalDetectionTest()
diff --git a/dhcp_config.cc b/dhcp_config.cc
index ff2d3b1..0c11115 100644
--- a/dhcp_config.cc
+++ b/dhcp_config.cc
@@ -42,6 +42,7 @@
     "WebProxyAutoDiscoveryUrl";
 const int DHCPConfig::kDHCPCDExitPollMilliseconds = 50;
 const int DHCPConfig::kDHCPCDExitWaitMilliseconds = 3000;
+const char DHCPConfig::kDHCPCDMinimalConfig[] = "/etc/dhcpcd-minimal.conf";
 const char DHCPConfig::kDHCPCDPath[] = "/sbin/dhcpcd";
 const char DHCPConfig::kDHCPCDPathFormatPID[] =
     "var/run/dhcpcd/dhcpcd-%s.pid";
@@ -66,6 +67,7 @@
                        const string &request_hostname,
                        const string &lease_file_suffix,
                        bool arp_gateway,
+                       bool is_minimal_config,
                        GLib *glib)
     : IPConfig(control_interface, device_name, kType),
       proxy_factory_(ProxyFactory::GetInstance()),
@@ -73,6 +75,7 @@
       request_hostname_(request_hostname),
       lease_file_suffix_(lease_file_suffix),
       arp_gateway_(arp_gateway),
+      is_minimal_config_(is_minimal_config),
       pid_(0),
       child_watch_tag_(0),
       is_lease_active_(false),
@@ -219,6 +222,10 @@
     args.push_back(const_cast<char *>("-R"));  // ARP for default gateway.
     args.push_back(const_cast<char *>("-U"));  // Enable unicast ARP on renew.
   }
+  if (is_minimal_config_) {
+    args.push_back(const_cast<char *>("-f"));  // Supply a configuration file.
+    args.push_back(const_cast<char *>(kDHCPCDMinimalConfig));
+  }
   string interface_arg(device_name());
   if (lease_file_suffix_ != device_name()) {
     interface_arg = base::StringPrintf("%s=%s", device_name().c_str(),
diff --git a/dhcp_config.h b/dhcp_config.h
index 354dfa2..276469e 100644
--- a/dhcp_config.h
+++ b/dhcp_config.h
@@ -48,6 +48,7 @@
              const std::string &request_hostname,
              const std::string &lease_file_suffix,
              bool arp_gateway,
+             bool is_minimal_config,
              GLib *glib);
   virtual ~DHCPConfig();
 
@@ -91,6 +92,7 @@
   FRIEND_TEST(DHCPConfigTest, StartFail);
   FRIEND_TEST(DHCPConfigTest, StartTimeout);
   FRIEND_TEST(DHCPConfigTest, StartWithHostname);
+  FRIEND_TEST(DHCPConfigTest, StartWithMinimalConfig);
   FRIEND_TEST(DHCPConfigTest, StartWithoutArpGateway);
   FRIEND_TEST(DHCPConfigTest, StartWithoutHostname);
   FRIEND_TEST(DHCPConfigTest, StartWithoutLeaseSuffix);
@@ -115,6 +117,7 @@
   static const char kDHCPCDPathFormatPID[];
   static const int kDHCPTimeoutSeconds;
   static const char kDHCPCDUser[];
+  static const char kDHCPCDMinimalConfig[];
 
   static const char kReasonBound[];
   static const char kReasonFail[];
@@ -189,6 +192,11 @@
   // the acquired IP address using an ARP request to the gateway IP address.
   bool arp_gateway_;
 
+  // Specifies whether to configure the the DHCP client to request the bare
+  // minimum of options in order to escape any MTU issues with the packet size
+  // of the DHCP server's reply.
+  bool is_minimal_config_;
+
   // The PID of the spawned DHCP client. May be 0 if no client has been spawned
   // yet or the client has died.
   int pid_;
diff --git a/dhcp_config_unittest.cc b/dhcp_config_unittest.cc
index 0b2272d..312530d 100644
--- a/dhcp_config_unittest.cc
+++ b/dhcp_config_unittest.cc
@@ -42,6 +42,9 @@
 const char kHostName[] = "hostname";
 const char kLeaseFileSuffix[] = "leasefilesuffix";
 const bool kArpGateway = true;
+const bool kHasHostname = true;
+const bool kHasLeaseSuffix = true;
+const bool kMinimalConfig = true;
 }  // namespace {}
 
 class DHCPConfigTest : public PropertyStoreTest {
@@ -57,6 +60,7 @@
                                kHostName,
                                kLeaseFileSuffix,
                                kArpGateway,
+                               !kMinimalConfig,
                                glib())) {}
 
   virtual void SetUp() {
@@ -70,11 +74,13 @@
   }
 
   DHCPConfigRefPtr CreateMockMinijailConfig(const string &hostname,
-                                       const string &lease_suffix,
-                                       bool arp_gateway);
+                                            const string &lease_suffix,
+                                            bool arp_gateway,
+                                            bool minimal_config);
   DHCPConfigRefPtr CreateRunningConfig(const string &hostname,
                                        const string &lease_suffix,
-                                       bool arp_gateway);
+                                       bool arp_gateway,
+                                       bool minimal_config);
   void StopRunningConfigAndExpect(DHCPConfigRefPtr config,
                                   bool lease_file_exists);
 
@@ -108,9 +114,10 @@
 const unsigned int DHCPConfigTest::kTag = 77;
 
 DHCPConfigRefPtr DHCPConfigTest::CreateMockMinijailConfig(
-                                     const string &hostname,
-                                     const string &lease_suffix,
-                                     bool arp_gateway) {
+    const string &hostname,
+    const string &lease_suffix,
+    bool arp_gateway,
+    bool minimal_config) {
   DHCPConfigRefPtr config(new DHCPConfig(&control_,
                                          dispatcher(),
                                          DHCPProvider::GetInstance(),
@@ -118,16 +125,18 @@
                                          hostname,
                                          lease_suffix,
                                          arp_gateway,
+                                         minimal_config,
                                          glib()));
   config->minijail_ = minijail_.get();
-  EXPECT_CALL(*minijail_, RunAndDestroy(_, _, _)).WillOnce(Return(false));
 
   return config;
 }
 
-DHCPConfigRefPtr DHCPConfigTest::CreateRunningConfig(const string &hostname,
-                                                     const string &lease_suffix,
-                                                     bool arp_gateway) {
+DHCPConfigRefPtr DHCPConfigTest::CreateRunningConfig(
+    const string &hostname,
+    const string &lease_suffix,
+    bool arp_gateway,
+    bool minimal_config) {
   DHCPConfigRefPtr config(new DHCPConfig(&control_,
                                          dispatcher(),
                                          DHCPProvider::GetInstance(),
@@ -135,6 +144,7 @@
                                          hostname,
                                          lease_suffix,
                                          arp_gateway,
+                                         minimal_config,
                                          glib()));
   config->minijail_ = minijail_.get();
   EXPECT_CALL(*minijail_, RunAndDestroy(_, _, _))
@@ -304,13 +314,15 @@
   EXPECT_EQ(0, config_->pid_);
 }
 
-MATCHER_P3(IsDHCPCDArgs, has_hostname, has_arp_gateway, has_lease_suffix, "") {
+MATCHER_P4(IsDHCPCDArgs, has_hostname, has_arp_gateway, has_lease_suffix,
+           has_minimal_config, "") {
   if (string(arg[0]) != "/sbin/dhcpcd" ||
-      string(arg[1]) != "-B") {
+      string(arg[1]) != "-B" ||
+      string(arg[2]) != "-q") {
     return false;
   }
 
-  int end_offset = 2;
+  int end_offset = 3;
   if (has_hostname) {
     if (string(arg[end_offset]) != "-h" ||
         string(arg[end_offset + 1]) != kHostName) {
@@ -320,9 +332,19 @@
   }
 
   if (has_arp_gateway) {
-    if (string(arg[end_offset]) != "-R")
+    if (string(arg[end_offset]) != "-R" ||
+        string(arg[end_offset + 1]) != "-U") {
       return false;
-    ++end_offset;
+    }
+    end_offset += 2;
+  }
+
+  if (has_minimal_config) {
+    if (string(arg[end_offset]) != "-f" ||
+        string(arg[end_offset + 1]) != "/etc/dhcpcd-minimal.conf") {
+      return false;
+    }
+    end_offset += 2;
   }
 
   string device_arg = has_lease_suffix ?
@@ -331,28 +353,63 @@
 }
 
 TEST_F(DHCPConfigTest, StartWithHostname) {
-  EXPECT_CALL(*minijail_, RunAndDestroy(_, _, _)).WillOnce(Return(false));
+  EXPECT_CALL(*minijail_, RunAndDestroy(_, IsDHCPCDArgs(kHasHostname,
+                                                        kArpGateway,
+                                                        kHasLeaseSuffix,
+                                                        !kMinimalConfig), _))
+      .WillOnce(Return(false));
   EXPECT_FALSE(config_->Start());
 }
 
 TEST_F(DHCPConfigTest, StartWithoutHostname) {
   DHCPConfigRefPtr config = CreateMockMinijailConfig("",
                                                      kLeaseFileSuffix,
-                                                     kArpGateway);
+                                                     kArpGateway,
+                                                     !kMinimalConfig);
+  EXPECT_CALL(*minijail_, RunAndDestroy(_, IsDHCPCDArgs(!kHasHostname,
+                                                        kArpGateway,
+                                                        kHasLeaseSuffix,
+                                                        !kMinimalConfig), _))
+      .WillOnce(Return(false));
   EXPECT_FALSE(config->Start());
 }
 
 TEST_F(DHCPConfigTest, StartWithoutArpGateway) {
   DHCPConfigRefPtr config = CreateMockMinijailConfig(kHostName,
                                                      kLeaseFileSuffix,
-                                                     false);
+                                                     !kArpGateway,
+                                                     !kMinimalConfig);
+  EXPECT_CALL(*minijail_, RunAndDestroy(_, IsDHCPCDArgs(kHasHostname,
+                                                        !kArpGateway,
+                                                        kHasLeaseSuffix,
+                                                        !kMinimalConfig), _))
+      .WillOnce(Return(false));
   EXPECT_FALSE(config->Start());
 }
 
 TEST_F(DHCPConfigTest, StartWithoutLeaseSuffix) {
   DHCPConfigRefPtr config = CreateMockMinijailConfig(kHostName,
                                                      kDeviceName,
-                                                     kArpGateway);
+                                                     kArpGateway,
+                                                     !kMinimalConfig);
+  EXPECT_CALL(*minijail_, RunAndDestroy(_, IsDHCPCDArgs(kHasHostname,
+                                                        kArpGateway,
+                                                        !kHasLeaseSuffix,
+                                                        !kMinimalConfig), _))
+      .WillOnce(Return(false));
+  EXPECT_FALSE(config->Start());
+}
+
+TEST_F(DHCPConfigTest, StartWithMinimalConfig) {
+  DHCPConfigRefPtr config = CreateMockMinijailConfig(kHostName,
+                                                     kLeaseFileSuffix,
+                                                     kArpGateway,
+                                                     kMinimalConfig);
+  EXPECT_CALL(*minijail_, RunAndDestroy(_, IsDHCPCDArgs(kHasHostname,
+                                                        kArpGateway,
+                                                        kHasLeaseSuffix,
+                                                        kMinimalConfig), _))
+      .WillOnce(Return(false));
   EXPECT_FALSE(config->Start());
 }
 
@@ -620,13 +677,14 @@
 
 TEST_F(DHCPConfigTest, StartSuccessEphemeral) {
   DHCPConfigRefPtr config =
-      CreateRunningConfig(kHostName, kDeviceName, kArpGateway);
+      CreateRunningConfig(kHostName, kDeviceName, kArpGateway, !kMinimalConfig);
   StopRunningConfigAndExpect(config, false);
 }
 
 TEST_F(DHCPConfigTest, StartSuccessPersistent) {
   DHCPConfigRefPtr config =
-      CreateRunningConfig(kHostName, kLeaseFileSuffix, kArpGateway);
+      CreateRunningConfig(kHostName, kLeaseFileSuffix, kArpGateway,
+                          !kMinimalConfig);
   StopRunningConfigAndExpect(config, true);
 }
 
diff --git a/dhcp_provider.cc b/dhcp_provider.cc
index 10ddd64..7a9cf96 100644
--- a/dhcp_provider.cc
+++ b/dhcp_provider.cc
@@ -55,7 +55,8 @@
 DHCPConfigRefPtr DHCPProvider::CreateConfig(const string &device_name,
                                             const string &host_name,
                                             const string &lease_file_suffix,
-                                            bool arp_gateway) {
+                                            bool arp_gateway,
+                                            bool minimal_config) {
   SLOG(DHCP, 2) << __func__ << " device: " << device_name;
   return new DHCPConfig(control_interface_,
                         dispatcher_,
@@ -64,6 +65,7 @@
                         host_name,
                         lease_file_suffix,
                         arp_gateway,
+                        minimal_config,
                         glib_);
 }
 
diff --git a/dhcp_provider.h b/dhcp_provider.h
index 62534f2..da9c46e 100644
--- a/dhcp_provider.h
+++ b/dhcp_provider.h
@@ -31,7 +31,8 @@
 // DHCPProvider::GetInstance()->CreateConfig(device_name,
 //                                           host_name,
 //                                           lease_file_suffix,
-//                                           arp_gateway)->Request();
+//                                           arp_gateway,
+//                                           minimal_config)->Request();
 class DHCPProvider {
  public:
   static const char kDHCPCDPathFormatLease[];
@@ -56,11 +57,14 @@
   // in |lease_file_suffix| if non-empty, otherwise |device_name|.  If
   // |arp_gateway| is true, the DHCP client will ARP for the gateway IP
   // address as an additional safeguard against the issued IP address being
-  // in-use by another station.
+  // in-use by another station.  If |minimal_config| is true, the DHCP client
+  // will request the bare minimum set of options in order to gain,
+  // connectivity, to maximize the potential for a successful received reply.
   virtual DHCPConfigRefPtr CreateConfig(const std::string &device_name,
                                         const std::string &host_name,
                                         const std::string &lease_file_suffix,
-                                        bool arp_gateway);
+                                        bool arp_gateway,
+                                        bool minimal_config);
 
   // Returns the DHCP configuration associated with DHCP client |pid|. Return
   // NULL if |pid| is not bound to a configuration.
diff --git a/dhcp_provider_unittest.cc b/dhcp_provider_unittest.cc
index a9ae06c..87353d0 100644
--- a/dhcp_provider_unittest.cc
+++ b/dhcp_provider_unittest.cc
@@ -23,6 +23,7 @@
 const char kHostName[] = "testhostname";
 const char kStorageIdentifier[] = "teststorageidentifier";
 const bool kArpGateway = false;
+const bool kMinimalConfig = false;
 }  // namespace {}
 
 class DHCPProviderTest : public Test {
@@ -46,7 +47,8 @@
   DHCPConfigRefPtr config = provider_->CreateConfig(kDeviceName,
                                                     kHostName,
                                                     kStorageIdentifier,
-                                                    kArpGateway);
+                                                    kArpGateway,
+                                                    kMinimalConfig);
   EXPECT_TRUE(config.get());
   EXPECT_EQ(&glib_, config->glib_);
   EXPECT_EQ(kDeviceName, config->device_name());
diff --git a/ethernet_unittest.cc b/ethernet_unittest.cc
index 6c6f6ac..8a31f59 100644
--- a/ethernet_unittest.cc
+++ b/ethernet_unittest.cc
@@ -285,7 +285,7 @@
   StartEthernet();
   SetService(mock_service_);
   EXPECT_EQ(NULL, GetSelectedService().get());
-  EXPECT_CALL(dhcp_provider_, CreateConfig(_, _, _, _)).
+  EXPECT_CALL(dhcp_provider_, CreateConfig(_, _, _, _, _)).
       WillOnce(Return(dhcp_config_));
   EXPECT_CALL(*dhcp_config_.get(), RequestIP()).WillOnce(Return(false));
   EXPECT_CALL(dispatcher_, PostTask(_));  // Posts ConfigureStaticIPTask.
@@ -299,7 +299,7 @@
   StartEthernet();
   SetService(mock_service_);
   EXPECT_EQ(NULL, GetSelectedService().get());
-  EXPECT_CALL(dhcp_provider_, CreateConfig(_, _, _, _)).
+  EXPECT_CALL(dhcp_provider_, CreateConfig(_, _, _, _, _)).
       WillOnce(Return(dhcp_config_));
   EXPECT_CALL(*dhcp_config_.get(), RequestIP()).WillOnce(Return(true));
   EXPECT_CALL(dispatcher_, PostTask(_));  // Posts ConfigureStaticIPTask.
diff --git a/mock_dhcp_config.cc b/mock_dhcp_config.cc
index 94648e5..1097dae 100644
--- a/mock_dhcp_config.cc
+++ b/mock_dhcp_config.cc
@@ -17,6 +17,7 @@
                  string(),
                  string(),
                  false,
+                 false,
                  NULL) {}
 
 MockDHCPConfig::~MockDHCPConfig() {}
diff --git a/mock_dhcp_provider.h b/mock_dhcp_provider.h
index b0b8179..213cfcc 100644
--- a/mock_dhcp_provider.h
+++ b/mock_dhcp_provider.h
@@ -22,11 +22,12 @@
   virtual ~MockDHCPProvider();
 
   MOCK_METHOD3(Init, void(ControlInterface *, EventDispatcher *, GLib *));
-  MOCK_METHOD4(CreateConfig,
+  MOCK_METHOD5(CreateConfig,
                DHCPConfigRefPtr(const std::string &device_name,
                                 const std::string &host_name,
                                 const std::string &storage_identifier,
-                                bool arp_gateway));
+                                bool arp_gateway,
+                                bool minimal_configuration));
 
  private:
   DISALLOW_COPY_AND_ASSIGN(MockDHCPProvider);
diff --git a/wifi_unittest.cc b/wifi_unittest.cc
index 5519ac5..125704d 100644
--- a/wifi_unittest.cc
+++ b/wifi_unittest.cc
@@ -242,7 +242,7 @@
     InstallMockScanSession();
     ::testing::DefaultValue< ::DBus::Path>::Set("/default/path");
 
-    ON_CALL(dhcp_provider_, CreateConfig(_, _, _, _)).
+    ON_CALL(dhcp_provider_, CreateConfig(_, _, _, _, _)).
         WillByDefault(Return(dhcp_config_));
     ON_CALL(*dhcp_config_.get(), RequestIP()).
         WillByDefault(Return(true));
@@ -577,7 +577,8 @@
 
     EXPECT_CALL(*service, SetState(Service::kStateConfiguring));
     EXPECT_CALL(*service, ResetSuspectedCredentialFailures());
-    EXPECT_CALL(*dhcp_provider(), CreateConfig(_, _, _, _)).Times(AnyNumber());
+    EXPECT_CALL(*dhcp_provider(), CreateConfig(_, _, _, _, _))
+        .Times(AnyNumber());
     EXPECT_CALL(*dhcp_config_.get(), RequestIP()).Times(AnyNumber());
     EXPECT_CALL(wifi_provider_, IncrementConnectCount(_));
     ReportStateChanged(WPASupplicant::kInterfaceStateCompleted);
@@ -1179,7 +1180,7 @@
 }
 
 TEST_F(WiFiMainTest, UseArpGateway) {
-  EXPECT_CALL(dhcp_provider_, CreateConfig(kDeviceName, _, _, true))
+  EXPECT_CALL(dhcp_provider_, CreateConfig(kDeviceName, _, _, true, false))
       .WillOnce(Return(dhcp_config_));
   const_cast<WiFi *>(wifi().get())->AcquireIPConfig();
 }
@@ -1976,7 +1977,7 @@
 TEST_F(WiFiMainTest, StateChangeBackwardsWithService) {
   // Some backwards transitions should not trigger a Service state change.
   // Supplicant state should still be updated, however.
-  EXPECT_CALL(*dhcp_provider(), CreateConfig(_, _, _, _)).Times(AnyNumber());
+  EXPECT_CALL(*dhcp_provider(), CreateConfig(_, _, _, _, _)).Times(AnyNumber());
   EXPECT_CALL(*dhcp_config_.get(), RequestIP()).Times(AnyNumber());
   StartWiFi();
   dispatcher_.DispatchPendingEvents();
@@ -2461,7 +2462,7 @@
   // on the service just because supplicant entered the Completed state.
   EXPECT_CALL(*service, SetState(Service::kStateConfiguring));
   EXPECT_CALL(*service, ResetSuspectedCredentialFailures()).Times(0);
-  EXPECT_CALL(*dhcp_provider(), CreateConfig(_, _, _, _)).Times(AnyNumber());
+  EXPECT_CALL(*dhcp_provider(), CreateConfig(_, _, _, _, _)).Times(AnyNumber());
   EXPECT_CALL(*dhcp_config_.get(), RequestIP()).Times(AnyNumber());
   EXPECT_CALL(*manager(), device_info()).WillRepeatedly(Return(device_info()));
   EXPECT_CALL(*device_info(), GetByteCounts(_, _, _))
diff --git a/wimax_unittest.cc b/wimax_unittest.cc
index 1a08091..7c89ed8 100644
--- a/wimax_unittest.cc
+++ b/wimax_unittest.cc
@@ -219,7 +219,7 @@
 }
 
 TEST_F(WiMaxTest, UseNoArpGateway) {
-  EXPECT_CALL(dhcp_provider_, CreateConfig(kTestLinkName, _, _, false))
+  EXPECT_CALL(dhcp_provider_, CreateConfig(kTestLinkName, _, _, false, false))
       .WillOnce(Return(dhcp_config_));
   device_->AcquireIPConfig();
 }