Throw InvalidArgument on bad Default Gateway

If the Default Gateway parameter is not valid, throw the
InvalidArgument error.

Resolves openbmc/openbmc#3261

Tested: See the InvalidArgument error on values such as
        "blah" or "1.0.8".
Change-Id: Ieeb0da7e3c3806144634cda6cd069758dba92a47
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/system_configuration.cpp b/system_configuration.cpp
index a957ded..da5140a 100644
--- a/system_configuration.cpp
+++ b/system_configuration.cpp
@@ -23,6 +23,7 @@
 
 using namespace phosphor::logging;
 using namespace sdbusplus::xyz::openbmc_project::Common::Error;
+using InvalidArgumentMetadata = xyz::openbmc_project::Common::InvalidArgument;
 
 using SystemConfigIntf =
     sdbusplus::xyz::openbmc_project::Network::server::SystemConfiguration;
@@ -106,7 +107,9 @@
     {
         log<level::ERR>("Not a valid Gateway",
             entry("GATEWAY=%s", gateway.c_str()));
-        return gw;
+        elog<InvalidArgument>(InvalidArgumentMetadata::ARGUMENT_NAME("GATEWAY"),
+                              InvalidArgumentMetadata::ARGUMENT_VALUE(
+                                  gateway.c_str()));
     }
     gw = SystemConfigIntf::defaultGateway(gateway);
     manager.writeToConfigurationFile();