transporthandler: Let phosphor-networkd do field validation

We can leverage networkd error handling for validating our fields.

Change-Id: I880d6dd9a6418e55dfe821f84bfcb8cb4d2eb618
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/transporthandler.cpp b/transporthandler.cpp
index 1ffe911..d54fac8 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -734,30 +734,6 @@
 {
     return response(ccParamNotSupported);
 }
-/**
- * @brief is MAC address valid.
- *
- * This function checks whether the MAC address is valid or not.
- *
- * @param[in] mac - MAC address.
- * @return true if MAC address is valid else retun false.
- **/
-bool isValidMACAddress(const ether_addr& mac)
-{
-    // check if mac address is empty
-    if (stdplus::raw::equal(mac, ether_addr{}))
-    {
-        return false;
-    }
-    // we accept only unicast MAC addresses and  same thing has been checked in
-    // phosphor-network layer. If the least significant bit of the first octet
-    // is set to 1, it is multicast MAC else it is unicast MAC address.
-    if (mac.ether_addr_octet[0] & 1)
-    {
-        return false;
-    }
-    return true;
-}
 
 /**
  * @brief is a valid LAN channel.
@@ -898,10 +874,6 @@
         {
             auto mac = unpackT<ether_addr>(req);
             unpackFinal(req);
-            if (!isValidMACAddress(mac))
-            {
-                return responseInvalidFieldRequest();
-            }
             channelCall<setMACProperty>(channel, mac);
             return responseSuccess();
         }
@@ -913,12 +885,8 @@
             }
             auto netmask = unpackT<in_addr>(req);
             unpackFinal(req);
-            uint8_t prefix = netmaskToPrefix(netmask);
-            if (prefix < MIN_IPV4_PREFIX_LENGTH)
-            {
-                return responseInvalidFieldRequest();
-            }
-            channelCall<reconfigureIfAddr4>(channel, std::nullopt, prefix);
+            channelCall<reconfigureIfAddr4>(channel, std::nullopt,
+                                            netmaskToPrefix(netmask));
             return responseSuccess();
         }
         case LanParam::Gateway1:
@@ -963,10 +931,6 @@
                 lastDisabledVlan[channel] = vlan;
                 vlan = 0;
             }
-            else if (vlan == 0 || vlan == VLAN_VALUE_MASK)
-            {
-                return responseInvalidFieldRequest();
-            }
 
             channelCall<reconfigureVLAN>(channel, vlan);
             return responseSuccess();