diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
index 91e5ed5..a38e7c8 100644
--- a/src/ethernet_interface.cpp
+++ b/src/ethernet_interface.cpp
@@ -104,11 +104,11 @@
 
     if (info.defgw4)
     {
-        EthernetInterface::defaultGateway(std::to_string(*info.defgw4), true);
+        EthernetInterface::defaultGateway(stdplus::toStr(*info.defgw4), true);
     }
     if (info.defgw6)
     {
-        EthernetInterface::defaultGateway6(std::to_string(*info.defgw6), true);
+        EthernetInterface::defaultGateway6(stdplus::toStr(*info.defgw6), true);
     }
     emit_object_added();
 
@@ -217,16 +217,16 @@
 ObjectPath EthernetInterface::ip(IP::Protocol protType, std::string ipaddress,
                                  uint8_t prefixLength, std::string)
 {
-    InAddrAny addr;
+    std::optional<stdplus::InAnyAddr> addr;
     try
     {
         switch (protType)
         {
             case IP::Protocol::IPv4:
-                addr = ToAddr<in_addr>{}(ipaddress);
+                addr.emplace(stdplus::fromStr<stdplus::In4Addr>(ipaddress));
                 break;
             case IP::Protocol::IPv6:
-                addr = ToAddr<in6_addr>{}(ipaddress);
+                addr.emplace(stdplus::fromStr<stdplus::In6Addr>(ipaddress));
                 break;
             default:
                 throw std::logic_error("Exhausted protocols");
@@ -239,10 +239,10 @@
         elog<InvalidArgument>(Argument::ARGUMENT_NAME("ipaddress"),
                               Argument::ARGUMENT_VALUE(ipaddress.c_str()));
     }
-    IfAddr ifaddr;
+    std::optional<stdplus::SubnetAny> ifaddr;
     try
     {
-        ifaddr = {addr, prefixLength};
+        ifaddr.emplace(*addr, prefixLength);
     }
     catch (const std::exception& e)
     {
@@ -250,16 +250,16 @@
                    prefixLength, "ERROR", e);
         elog<InvalidArgument>(
             Argument::ARGUMENT_NAME("prefixLength"),
-            Argument::ARGUMENT_VALUE(std::to_string(prefixLength).c_str()));
+            Argument::ARGUMENT_VALUE(stdplus::toStr(prefixLength).c_str()));
     }
 
-    auto it = addrs.find(ifaddr);
+    auto it = addrs.find(*ifaddr);
     if (it == addrs.end())
     {
         it = std::get<0>(addrs.emplace(
-            ifaddr,
+            *ifaddr,
             std::make_unique<IPAddress>(bus, std::string_view(objPath), *this,
-                                        ifaddr, IP::AddressOrigin::Static)));
+                                        *ifaddr, IP::AddressOrigin::Static)));
     }
     else
     {
@@ -279,10 +279,10 @@
 ObjectPath EthernetInterface::neighbor(std::string ipAddress,
                                        std::string macAddress)
 {
-    InAddrAny addr;
+    std::optional<stdplus::InAnyAddr> addr;
     try
     {
-        addr = ToAddr<InAddrAny>{}(ipAddress);
+        addr.emplace(stdplus::fromStr<stdplus::InAnyAddr>(ipAddress));
     }
     catch (const std::exception& e)
     {
@@ -292,10 +292,10 @@
                               Argument::ARGUMENT_VALUE(ipAddress.c_str()));
     }
 
-    stdplus::EtherAddr lladdr;
+    std::optional<stdplus::EtherAddr> lladdr;
     try
     {
-        lladdr = stdplus::fromStr<stdplus::EtherAddr>(macAddress);
+        lladdr.emplace(stdplus::fromStr<stdplus::EtherAddr>(macAddress));
     }
     catch (const std::exception& e)
     {
@@ -305,17 +305,17 @@
                               Argument::ARGUMENT_VALUE(macAddress.c_str()));
     }
 
-    auto it = staticNeighbors.find(addr);
+    auto it = staticNeighbors.find(*addr);
     if (it == staticNeighbors.end())
     {
         it = std::get<0>(staticNeighbors.emplace(
-            addr, std::make_unique<Neighbor>(bus, std::string_view(objPath),
-                                             *this, addr, lladdr,
-                                             Neighbor::State::Permanent)));
+            *addr, std::make_unique<Neighbor>(bus, std::string_view(objPath),
+                                              *this, *addr, *lladdr,
+                                              Neighbor::State::Permanent)));
     }
     else
     {
-        auto str = stdplus::toStr(lladdr);
+        auto str = stdplus::toStr(*lladdr);
         if (it->second->macAddress() == str)
         {
             return it->second->getObjPath();
@@ -435,7 +435,7 @@
     {
         try
         {
-            ip = std::to_string(ToAddr<InAddrAny>{}(ip));
+            ip = stdplus::toStr(stdplus::fromStr<stdplus::InAnyAddr>(ip));
         }
         catch (const std::exception& e)
         {
@@ -538,7 +538,7 @@
     {
         int addressFamily = std::get<0>(*i);
         std::vector<uint8_t>& ipaddress = std::get<1>(*i);
-        servers.push_back(std::to_string(
+        servers.push_back(stdplus::toStr(
             addrFromBuf(addressFamily, stdplus::raw::asView<char>(ipaddress))));
     }
     return servers;
@@ -546,8 +546,8 @@
 
 ObjectPath EthernetInterface::createVLAN(uint16_t id)
 {
-    auto intfName = fmt::format(FMT_COMPILE("{}.{}"), interfaceName(), id);
-    auto idStr = std::to_string(id);
+    auto idStr = stdplus::toStr(id);
+    auto intfName = fmt::format(FMT_COMPILE("{}.{}"), interfaceName(), idStr);
     if (manager.get().interfaces.find(intfName) !=
         manager.get().interfaces.end())
     {
@@ -817,7 +817,8 @@
     {
         if (!gateway.empty())
         {
-            gateway = std::to_string(ToAddr<in_addr>{}(gateway));
+            gateway =
+                stdplus::toStr(stdplus::fromStr<stdplus::In4Addr>(gateway));
         }
     }
     catch (const std::exception& e)
@@ -846,7 +847,8 @@
     {
         if (!gateway.empty())
         {
-            gateway = std::to_string(ToAddr<in6_addr>{}(gateway));
+            gateway =
+                stdplus::toStr(stdplus::fromStr<stdplus::In6Addr>(gateway));
         }
     }
     catch (const std::exception& e)
diff --git a/src/ethernet_interface.hpp b/src/ethernet_interface.hpp
index 87cfd68..0b6e21a 100644
--- a/src/ethernet_interface.hpp
+++ b/src/ethernet_interface.hpp
@@ -86,10 +86,11 @@
     stdplus::PinnedRef<Manager> manager;
 
     /** @brief Persistent map of IPAddress dbus objects and their names */
-    std::unordered_map<IfAddr, std::unique_ptr<IPAddress>> addrs;
+    std::unordered_map<stdplus::SubnetAny, std::unique_ptr<IPAddress>> addrs;
 
     /** @brief Persistent map of Neighbor dbus objects and their names */
-    std::unordered_map<InAddrAny, std::unique_ptr<Neighbor>> staticNeighbors;
+    std::unordered_map<stdplus::InAnyAddr, std::unique_ptr<Neighbor>>
+        staticNeighbors;
 
     void addAddr(const AddressInfo& info);
     void addStaticNeigh(const NeighborInfo& info);
@@ -128,15 +129,15 @@
     using EthernetInterfaceIntf::dhcp6;
     bool dhcp6(bool value) override;
 
-    inline bool dhcpIsEnabled(in_addr) const
+    inline bool dhcpIsEnabled(stdplus::In4Addr) const
     {
         return dhcp4();
     }
-    inline bool dhcpIsEnabled(in6_addr) const
+    inline bool dhcpIsEnabled(stdplus::In6Addr) const
     {
         return dhcp6();
     }
-    inline bool dhcpIsEnabled(InAddrAny addr) const
+    inline bool dhcpIsEnabled(stdplus::InAnyAddr addr) const
     {
         return std::visit([&](auto v) { return dhcpIsEnabled(v); }, addr);
     }
diff --git a/src/ipaddress.cpp b/src/ipaddress.cpp
index 32c9462..e678725 100644
--- a/src/ipaddress.cpp
+++ b/src/ipaddress.cpp
@@ -22,10 +22,11 @@
 using NotAllowed = sdbusplus::xyz::openbmc_project::Common::Error::NotAllowed;
 using Reason = xyz::openbmc_project::Common::NotAllowed::REASON;
 
-static auto makeObjPath(std::string_view root, IfAddr addr)
+static auto makeObjPath(std::string_view root, stdplus::SubnetAny addr)
 {
     auto ret = sdbusplus::message::object_path(std::string(root));
-    ret /= std::to_string(addr);
+    stdplus::ToStrHandle<stdplus::ToStr<stdplus::SubnetAny>> tsh;
+    ret /= tsh(addr);
     return ret;
 }
 
@@ -34,31 +35,31 @@
 {};
 
 template <>
-struct Proto<in_addr>
+struct Proto<stdplus::In4Addr>
 {
     static inline constexpr auto value = IP::Protocol::IPv4;
 };
 
 template <>
-struct Proto<in6_addr>
+struct Proto<stdplus::In6Addr>
 {
     static inline constexpr auto value = IP::Protocol::IPv6;
 };
 
 IPAddress::IPAddress(sdbusplus::bus_t& bus, std::string_view objRoot,
-                     stdplus::PinnedRef<EthernetInterface> parent, IfAddr addr,
-                     AddressOrigin origin) :
+                     stdplus::PinnedRef<EthernetInterface> parent,
+                     stdplus::SubnetAny addr, AddressOrigin origin) :
     IPAddress(bus, makeObjPath(objRoot, addr), parent, addr, origin)
 {}
 
 IPAddress::IPAddress(sdbusplus::bus_t& bus,
                      sdbusplus::message::object_path objPath,
-                     stdplus::PinnedRef<EthernetInterface> parent, IfAddr addr,
-                     AddressOrigin origin) :
+                     stdplus::PinnedRef<EthernetInterface> parent,
+                     stdplus::SubnetAny addr, AddressOrigin origin) :
     IPIfaces(bus, objPath.str.c_str(), IPIfaces::action::defer_emit),
     parent(parent), objPath(std::move(objPath))
 {
-    IP::address(std::to_string(addr.getAddr()), true);
+    IP::address(stdplus::toStr(addr.getAddr()), true);
     IP::prefixLength(addr.getPfx(), true);
     IP::type(std::visit([](auto v) { return Proto<decltype(v)>::value; },
                         addr.getAddr()),
diff --git a/src/ipaddress.hpp b/src/ipaddress.hpp
index 1785e06..13ab94f 100644
--- a/src/ipaddress.hpp
+++ b/src/ipaddress.hpp
@@ -40,8 +40,8 @@
      *  @param[in] origin - origin of ipaddress(dhcp/static/SLAAC/LinkLocal).
      */
     IPAddress(sdbusplus::bus_t& bus, std::string_view objRoot,
-              stdplus::PinnedRef<EthernetInterface> parent, IfAddr addr,
-              IP::AddressOrigin origin);
+              stdplus::PinnedRef<EthernetInterface> parent,
+              stdplus::SubnetAny addr, IP::AddressOrigin origin);
 
     std::string address(std::string ipAddress) override;
     uint8_t prefixLength(uint8_t) override;
@@ -72,8 +72,8 @@
     sdbusplus::message::object_path objPath;
 
     IPAddress(sdbusplus::bus_t& bus, sdbusplus::message::object_path objPath,
-              stdplus::PinnedRef<EthernetInterface> parent, IfAddr addr,
-              IP::AddressOrigin origin);
+              stdplus::PinnedRef<EthernetInterface> parent,
+              stdplus::SubnetAny addr, IP::AddressOrigin origin);
 };
 
 } // namespace network
diff --git a/src/neighbor.cpp b/src/neighbor.cpp
index afbc062..4d899c4 100644
--- a/src/neighbor.cpp
+++ b/src/neighbor.cpp
@@ -14,27 +14,30 @@
 namespace network
 {
 
-static auto makeObjPath(std::string_view root, InAddrAny addr)
+static auto makeObjPath(std::string_view root, stdplus::InAnyAddr addr)
 {
     auto ret = sdbusplus::message::object_path(std::string(root));
-    ret /= std::to_string(addr);
+    stdplus::ToStrHandle<stdplus::ToStr<stdplus::InAnyAddr>> tsh;
+    ret /= tsh(addr);
     return ret;
 }
 
 Neighbor::Neighbor(sdbusplus::bus_t& bus, std::string_view objRoot,
-                   stdplus::PinnedRef<EthernetInterface> parent, InAddrAny addr,
-                   stdplus::EtherAddr lladdr, State state) :
+                   stdplus::PinnedRef<EthernetInterface> parent,
+                   stdplus::InAnyAddr addr, stdplus::EtherAddr lladdr,
+                   State state) :
     Neighbor(bus, makeObjPath(objRoot, addr), parent, addr, lladdr, state)
 {}
 
 Neighbor::Neighbor(sdbusplus::bus_t& bus,
                    sdbusplus::message::object_path objPath,
-                   stdplus::PinnedRef<EthernetInterface> parent, InAddrAny addr,
-                   stdplus::EtherAddr lladdr, State state) :
+                   stdplus::PinnedRef<EthernetInterface> parent,
+                   stdplus::InAnyAddr addr, stdplus::EtherAddr lladdr,
+                   State state) :
     NeighborObj(bus, objPath.str.c_str(), NeighborObj::action::defer_emit),
     parent(parent), objPath(std::move(objPath))
 {
-    NeighborObj::ipAddress(std::to_string(addr), true);
+    NeighborObj::ipAddress(stdplus::toStr(addr), true);
     NeighborObj::macAddress(stdplus::toStr(lladdr), true);
     NeighborObj::state(state, true);
     emit_object_added();
diff --git a/src/neighbor.hpp b/src/neighbor.hpp
index 9f964e8..5072afe 100644
--- a/src/neighbor.hpp
+++ b/src/neighbor.hpp
@@ -39,8 +39,8 @@
      *  @param[in] state - The state of the neighbor entry.
      */
     Neighbor(sdbusplus::bus_t& bus, std::string_view objRoot,
-             stdplus::PinnedRef<EthernetInterface> parent, InAddrAny addr,
-             stdplus::EtherAddr lladdr, State state);
+             stdplus::PinnedRef<EthernetInterface> parent,
+             stdplus::InAnyAddr addr, stdplus::EtherAddr lladdr, State state);
 
     /** @brief Delete this d-bus object.
      */
@@ -66,8 +66,8 @@
     sdbusplus::message::object_path objPath;
 
     Neighbor(sdbusplus::bus_t& bus, sdbusplus::message::object_path objPath,
-             stdplus::PinnedRef<EthernetInterface> parent, InAddrAny addr,
-             stdplus::EtherAddr lladdr, State state);
+             stdplus::PinnedRef<EthernetInterface> parent,
+             stdplus::InAnyAddr addr, stdplus::EtherAddr lladdr, State state);
 };
 
 } // namespace network
diff --git a/src/network_manager.cpp b/src/network_manager.cpp
index ca3b517..26d3496 100644
--- a/src/network_manager.cpp
+++ b/src/network_manager.cpp
@@ -14,6 +14,7 @@
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/lg2.hpp>
 #include <sdbusplus/message.hpp>
+#include <stdplus/numeric/str.hpp>
 #include <stdplus/pinned.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
 
@@ -66,7 +67,7 @@
         {
             throw std::invalid_argument("Invalid obj path");
         }
-        auto ifidx = DecodeInt<unsigned, 10>{}(obj.substr(sep + 3));
+        auto ifidx = stdplus::StrToInt<10, uint16_t>{}(obj.substr(sep + 3));
         const auto& state = std::get<std::string>(it->second);
         man.get().handleAdminState(state, ifidx);
     }
@@ -356,23 +357,20 @@
     }
 }
 
-void Manager::addDefGw(unsigned ifidx, InAddrAny addr)
+void Manager::addDefGw(unsigned ifidx, stdplus::InAnyAddr addr)
 {
     if (auto it = intfInfo.find(ifidx); it != intfInfo.end())
     {
         std::visit(
             [&](auto addr) {
-            if constexpr (std::is_same_v<in_addr, decltype(addr)>)
+            if constexpr (std::is_same_v<stdplus::In4Addr, decltype(addr)>)
             {
                 it->second.defgw4.emplace(addr);
             }
-            else if constexpr (std::is_same_v<in6_addr, decltype(addr)>)
-            {
-                it->second.defgw6.emplace(addr);
-            }
             else
             {
-                static_assert(!std::is_same_v<void, decltype(addr)>);
+                static_assert(std::is_same_v<stdplus::In6Addr, decltype(addr)>);
+                it->second.defgw6.emplace(addr);
             }
             },
             addr);
@@ -380,19 +378,17 @@
         {
             std::visit(
                 [&](auto addr) {
-                if constexpr (std::is_same_v<in_addr, decltype(addr)>)
+                if constexpr (std::is_same_v<stdplus::In4Addr, decltype(addr)>)
                 {
                     it->second->EthernetInterfaceIntf::defaultGateway(
-                        std::to_string(addr));
-                }
-                else if constexpr (std::is_same_v<in6_addr, decltype(addr)>)
-                {
-                    it->second->EthernetInterfaceIntf::defaultGateway6(
-                        std::to_string(addr));
+                        stdplus::toStr(addr));
                 }
                 else
                 {
-                    static_assert(!std::is_same_v<void, decltype(addr)>);
+                    static_assert(
+                        std::is_same_v<stdplus::In6Addr, decltype(addr)>);
+                    it->second->EthernetInterfaceIntf::defaultGateway6(
+                        stdplus::toStr(addr));
                 }
                 },
                 addr);
@@ -404,54 +400,51 @@
     }
 }
 
-void Manager::removeDefGw(unsigned ifidx, InAddrAny addr)
+void Manager::removeDefGw(unsigned ifidx, stdplus::InAnyAddr addr)
 {
     if (auto it = intfInfo.find(ifidx); it != intfInfo.end())
     {
         std::visit(
             [&](auto addr) {
-            if constexpr (std::is_same_v<in_addr, decltype(addr)>)
+            if constexpr (std::is_same_v<stdplus::In4Addr, decltype(addr)>)
             {
                 if (it->second.defgw4 == addr)
                 {
                     it->second.defgw4.reset();
                 }
             }
-            else if constexpr (std::is_same_v<in6_addr, decltype(addr)>)
+            else
             {
+                static_assert(std::is_same_v<stdplus::In6Addr, decltype(addr)>);
                 if (it->second.defgw6 == addr)
                 {
                     it->second.defgw6.reset();
                 }
             }
-            else
-            {
-                static_assert(!std::is_same_v<void, decltype(addr)>);
-            }
             },
             addr);
         if (auto it = interfacesByIdx.find(ifidx); it != interfacesByIdx.end())
         {
             std::visit(
                 [&](auto addr) {
-                if constexpr (std::is_same_v<in_addr, decltype(addr)>)
+                if constexpr (std::is_same_v<stdplus::In4Addr, decltype(addr)>)
                 {
-                    if (it->second->defaultGateway() == std::to_string(addr))
+                    stdplus::ToStrHandle<stdplus::ToStr<stdplus::In4Addr>> tsh;
+                    if (it->second->defaultGateway() == tsh(addr))
                     {
                         it->second->EthernetInterfaceIntf::defaultGateway("");
                     }
                 }
-                else if constexpr (std::is_same_v<in6_addr, decltype(addr)>)
+                else
                 {
-                    if (it->second->defaultGateway6() == std::to_string(addr))
+                    static_assert(
+                        std::is_same_v<stdplus::In6Addr, decltype(addr)>);
+                    stdplus::ToStrHandle<stdplus::ToStr<stdplus::In6Addr>> tsh;
+                    if (it->second->defaultGateway6() == tsh(addr))
                     {
                         it->second->EthernetInterfaceIntf::defaultGateway6("");
                     }
                 }
-                else
-                {
-                    static_assert(!std::is_same_v<void, decltype(addr)>);
-                }
                 },
                 addr);
         }
diff --git a/src/network_manager.hpp b/src/network_manager.hpp
index f37234c..0ea8f2b 100644
--- a/src/network_manager.hpp
+++ b/src/network_manager.hpp
@@ -76,8 +76,8 @@
     void removeNeighbor(const NeighborInfo& info);
 
     /** @brief Add / remove default gateway for interface */
-    void addDefGw(unsigned ifidx, InAddrAny addr);
-    void removeDefGw(unsigned ifidx, InAddrAny addr);
+    void addDefGw(unsigned ifidx, stdplus::InAnyAddr addr);
+    void removeDefGw(unsigned ifidx, stdplus::InAnyAddr addr);
 
     /** @brief gets the network conf directory.
      */
diff --git a/src/rtnetlink.cpp b/src/rtnetlink.cpp
index 4308d23..5229c94 100644
--- a/src/rtnetlink.cpp
+++ b/src/rtnetlink.cpp
@@ -88,11 +88,11 @@
 }
 
 template <typename Addr>
-static std::optional<std::tuple<unsigned, InAddrAny>>
+static std::optional<std::tuple<unsigned, stdplus::InAnyAddr>>
     parse(std::string_view msg)
 {
     std::optional<unsigned> ifIdx;
-    std::optional<InAddrAny> gw;
+    std::optional<stdplus::InAnyAddr> gw;
     while (!msg.empty())
     {
         auto [hdr, data] = extractRtAttr(msg);
@@ -113,7 +113,7 @@
     return std::nullopt;
 }
 
-std::optional<std::tuple<unsigned, InAddrAny>>
+std::optional<std::tuple<unsigned, stdplus::InAnyAddr>>
     gatewayFromRtm(std::string_view msg)
 {
     const auto& rtm = extractRtData<rtmsg>(msg);
@@ -124,9 +124,9 @@
     switch (rtm.rtm_family)
     {
         case AF_INET:
-            return parse<in_addr>(msg);
+            return parse<stdplus::In4Addr>(msg);
         case AF_INET6:
-            return parse<in6_addr>(msg);
+            return parse<stdplus::In6Addr>(msg);
     }
     return std::nullopt;
 }
@@ -135,11 +135,8 @@
 {
     const auto& ifa = extractRtData<ifaddrmsg>(msg);
 
-    AddressInfo ret;
-    ret.ifidx = ifa.ifa_index;
-    ret.flags = ifa.ifa_flags;
-    ret.scope = ifa.ifa_scope;
-    std::optional<InAddrAny> addr;
+    uint32_t flags = ifa.ifa_flags;
+    std::optional<stdplus::InAnyAddr> addr;
     while (!msg.empty())
     {
         auto [hdr, data] = extractRtAttr(msg);
@@ -149,15 +146,17 @@
         }
         else if (hdr.rta_type == IFA_FLAGS)
         {
-            ret.flags = stdplus::raw::copyFromStrict<uint32_t>(data);
+            flags = stdplus::raw::copyFromStrict<uint32_t>(data);
         }
     }
     if (!addr)
     {
         throw std::runtime_error("Missing address");
     }
-    ret.ifaddr = {*addr, ifa.ifa_prefixlen};
-    return ret;
+    return AddressInfo{.ifidx = ifa.ifa_index,
+                       .ifaddr = stdplus::SubnetAny{*addr, ifa.ifa_prefixlen},
+                       .scope = ifa.ifa_scope,
+                       .flags = flags};
 }
 
 NeighborInfo neighFromRtm(std::string_view msg)
diff --git a/src/rtnetlink.hpp b/src/rtnetlink.hpp
index 5436e9d..f35c25f 100644
--- a/src/rtnetlink.hpp
+++ b/src/rtnetlink.hpp
@@ -10,7 +10,7 @@
 
 InterfaceInfo intfFromRtm(std::string_view msg);
 
-std::optional<std::tuple<unsigned, InAddrAny>>
+std::optional<std::tuple<unsigned, stdplus::InAnyAddr>>
     gatewayFromRtm(std::string_view msg);
 
 AddressInfo addrFromRtm(std::string_view msg);
diff --git a/src/rtnetlink_server.cpp b/src/rtnetlink_server.cpp
index cfa0b2c..4a211d5 100644
--- a/src/rtnetlink_server.cpp
+++ b/src/rtnetlink_server.cpp
@@ -21,7 +21,7 @@
     {
         return;
     }
-    cb(std::get<unsigned>(*ret), std::get<InAddrAny>(*ret));
+    cb(std::get<unsigned>(*ret), std::get<stdplus::InAnyAddr>(*ret));
 }
 
 static unsigned getIfIdx(const nlmsghdr& hdr, std::string_view data)
diff --git a/src/system_queries.cpp b/src/system_queries.cpp
index e922504..f58493a 100644
--- a/src/system_queries.cpp
+++ b/src/system_queries.cpp
@@ -17,6 +17,7 @@
 #include <optional>
 #include <stdexcept>
 #include <string_view>
+#include <unordered_set>
 
 namespace phosphor::network::system
 {
diff --git a/src/types.cpp b/src/types.cpp
index 901d77a..0be9e32 100644
--- a/src/types.cpp
+++ b/src/types.cpp
@@ -1,46 +1 @@
 #include "types.hpp"
-
-#include <fmt/format.h>
-
-#include <stdplus/hash.hpp>
-
-void phosphor::network::IfAddr::invalidPfx(uint8_t pfx)
-{
-    throw std::invalid_argument(fmt::format("Invalid prefix {}", pfx));
-}
-
-std::size_t std::hash<in_addr>::operator()(in_addr addr) const noexcept
-{
-    return stdplus::hashMulti(addr.s_addr);
-}
-
-std::size_t std::hash<in6_addr>::operator()(in6_addr addr) const noexcept
-{
-    return stdplus::hashMulti(addr.s6_addr32);
-}
-
-std::size_t std::hash<phosphor::network::IfAddr>::operator()(
-    phosphor::network::IfAddr addr) const noexcept
-{
-    return stdplus::hashMulti(addr.getAddr(), addr.getPfx());
-}
-
-std::string std::to_string(in_addr value)
-{
-    return string(phosphor::network::detail::ToStrBuf<in_addr>{}(value));
-}
-std::string std::to_string(in6_addr value)
-{
-    return string(phosphor::network::detail::ToStrBuf<in6_addr>{}(value));
-}
-std::string std::to_string(phosphor::network::InAddrAny value)
-{
-    phosphor::network::detail::ToStrBuf<phosphor::network::InAddrAny> tsb;
-    return string(tsb(value));
-}
-
-std::string std::to_string(phosphor::network::IfAddr value)
-{
-    phosphor::network::detail::ToStrBuf<phosphor::network::IfAddr> tsb;
-    return string(tsb(value));
-}
diff --git a/src/types.hpp b/src/types.hpp
index 7db6a37..14de360 100644
--- a/src/types.hpp
+++ b/src/types.hpp
@@ -1,76 +1,15 @@
 #pragma once
-#include <fmt/core.h>
-#include <netinet/in.h>
-
 #include <stdplus/net/addr/ether.hpp>
-#include <stdplus/numeric/endian.hpp>
+#include <stdplus/net/addr/ip.hpp>
+#include <stdplus/net/addr/subnet.hpp>
 
-#include <algorithm>
 #include <array>
-#include <numeric>
 #include <optional>
 #include <string>
-#include <string_view>
-#include <type_traits>
 #include <unordered_map>
-#include <unordered_set>
-#include <variant>
 
-constexpr bool operator==(in_addr lhs, in_addr rhs) noexcept
+namespace phosphor::network
 {
-    return lhs.s_addr == rhs.s_addr;
-}
-
-constexpr bool operator==(in6_addr lhs, in6_addr rhs) noexcept
-{
-    return std::equal(lhs.s6_addr32, lhs.s6_addr32 + 4, rhs.s6_addr32);
-}
-
-namespace phosphor
-{
-namespace network
-{
-
-// Byte representations for common address types in network byte order
-using InAddrAny = std::variant<in_addr, in6_addr>;
-class IfAddr
-{
-  private:
-    InAddrAny addr;
-    uint8_t pfx;
-
-    static void invalidPfx(uint8_t pfx);
-
-  public:
-    constexpr IfAddr() : addr({}), pfx(0) {}
-
-    constexpr IfAddr(InAddrAny addr, uint8_t pfx) : addr(addr), pfx(pfx)
-    {
-        std::visit(
-            [pfx](auto v) {
-            if (sizeof(v) * 8 < pfx)
-            {
-                invalidPfx(pfx);
-            }
-            },
-            addr);
-    }
-
-    constexpr auto getAddr() const
-    {
-        return addr;
-    }
-
-    constexpr auto getPfx() const
-    {
-        return pfx;
-    }
-
-    constexpr bool operator==(phosphor::network::IfAddr rhs) const noexcept
-    {
-        return addr == rhs.addr && pfx == rhs.pfx;
-    }
-};
 
 /** @class InterfaceInfo
  *  @brief Information about interfaces from the kernel
@@ -102,7 +41,7 @@
 struct AddressInfo
 {
     unsigned ifidx;
-    IfAddr ifaddr;
+    stdplus::SubnetAny ifaddr;
     uint8_t scope;
     uint32_t flags;
 
@@ -120,7 +59,7 @@
 {
     unsigned ifidx;
     uint16_t state;
-    std::optional<InAddrAny> addr;
+    std::optional<stdplus::InAnyAddr> addr;
     std::optional<stdplus::EtherAddr> mac;
 
     constexpr bool operator==(const NeighborInfo& rhs) const noexcept
@@ -130,538 +69,14 @@
     }
 };
 
-namespace detail
-{
-inline constexpr auto charLookup = []() {
-    std::array<int8_t, 256> ret;
-    std::fill(ret.begin(), ret.end(), -1);
-    for (int8_t i = 0; i < 10; ++i)
-    {
-        ret[i + '0'] = i;
-    }
-    for (int8_t i = 0; i < 26; ++i)
-    {
-        ret[i + 'A'] = i + 10;
-        ret[i + 'a'] = i + 10;
-    }
-    return ret;
-}();
-inline constexpr auto intLookup = []() {
-    std::array<char, 36> ret;
-    for (int8_t i = 0; i < 10; ++i)
-    {
-        ret[i] = i + '0';
-    }
-    for (int8_t i = 0; i < 26; ++i)
-    {
-        ret[i + 10] = i + 'a';
-    }
-    return ret;
-}();
-} // namespace detail
-
-template <typename T, uint8_t base>
-struct DecodeInt
-{
-    static_assert(base > 1 && base <= 36);
-    static_assert(std::is_unsigned_v<T>);
-
-    constexpr T operator()(std::string_view str) const
-    {
-        if (str.empty())
-        {
-            throw std::invalid_argument("Empty Str");
-        }
-        constexpr auto max = std::numeric_limits<T>::max();
-        auto ret = std::accumulate(str.begin(), str.end(), T{},
-                                   [&](T r, char c) {
-            auto v = detail::charLookup[c];
-            if (v < 0 || v >= base)
-            {
-                throw std::invalid_argument("Invalid numeral");
-            }
-            if constexpr (std::popcount(base) == 1)
-            {
-                constexpr auto shift = std::countr_zero(base);
-                constexpr auto maxshift = max >> shift;
-                if (r > maxshift)
-                {
-                    throw std::overflow_error("Integer Decode");
-                }
-                return (r << shift) | v;
-            }
-            else
-            {
-                constexpr auto maxbase = max / base;
-                if (r > maxbase)
-                {
-                    throw std::overflow_error("Integer Decode");
-                }
-                r *= base;
-                if (max - v < r)
-                {
-                    throw std::overflow_error("Integer Decode");
-                }
-                return r + v;
-            }
-        });
-        return ret;
-    }
-};
-
-template <typename T, uint8_t base>
-struct EncodeInt
-{
-    static_assert(base > 1 && base <= 36);
-    static_assert(std::is_unsigned_v<T>);
-
-    static constexpr uint8_t buf_size = []() {
-        T v = std::numeric_limits<T>::max();
-        uint8_t i = 0;
-        for (; v != 0; ++i)
-        {
-            v /= base;
-        }
-        return i;
-    }();
-    using buf_type = std::array<char, buf_size>;
-
-    constexpr uint8_t reverseFill(char* buf, T v) const noexcept
-    {
-        uint8_t i = 0;
-        do
-        {
-            if constexpr (std::popcount(base) == 1)
-            {
-                buf[i++] = detail::intLookup[v & 0xf];
-                v >>= 4;
-            }
-            else
-            {
-                buf[i++] = detail::intLookup[v % base];
-                v /= base;
-            }
-        } while (v > 0);
-        return i;
-    }
-
-    constexpr char* operator()(char* buf, T v) const noexcept
-    {
-        uint8_t i = reverseFill(buf, v);
-        std::reverse(buf, buf + i);
-        return buf + i;
-    }
-
-    constexpr char* operator()(char* buf, T v, uint8_t min_width) const noexcept
-    {
-        uint8_t i = reverseFill(buf, v);
-        auto end = buf + std::max(i, min_width);
-        std::fill(buf + i, end, '0');
-        std::reverse(buf, end);
-        return end;
-    }
-};
-
-template <typename T>
-struct ToAddr
-{};
-
-template <>
-struct ToAddr<in_addr>
-{
-    constexpr in_addr operator()(std::string_view str) const
-    {
-        constexpr DecodeInt<uint8_t, 10> di;
-        uint32_t addr = {};
-        for (size_t i = 0; i < 3; ++i)
-        {
-            auto loc = str.find(".");
-            addr |= di(str.substr(0, loc));
-            addr <<= 8;
-            str.remove_prefix(loc == str.npos ? str.size() : loc + 1);
-            if (str.empty())
-            {
-                throw std::invalid_argument("Missing addr data");
-            }
-        }
-        addr |= di(str);
-        return {stdplus::hton(addr)};
-    }
-};
-
-template <>
-struct ToAddr<in6_addr>
-{
-    constexpr in6_addr operator()(std::string_view str) const
-    {
-        constexpr DecodeInt<uint16_t, 16> di;
-        in6_addr ret = {};
-        size_t i = 0;
-        while (i < 8)
-        {
-            auto loc = str.find(':');
-            if (i == 6 && loc == str.npos)
-            {
-                ret.s6_addr32[3] = ToAddr<in_addr>{}(str).s_addr;
-                return ret;
-            }
-            if (loc != 0 && !str.empty())
-            {
-                ret.s6_addr16[i++] = stdplus::hton(di(str.substr(0, loc)));
-            }
-            if (i < 8 && str.size() > loc + 1 && str[loc + 1] == ':')
-            {
-                str.remove_prefix(loc + 2);
-                break;
-            }
-            else if (str.empty())
-            {
-                throw std::invalid_argument("IPv6 Data");
-            }
-            str.remove_prefix(loc == str.npos ? str.size() : loc + 1);
-        }
-        if (str.starts_with(':'))
-        {
-            throw std::invalid_argument("Extra separator");
-        }
-        size_t j = 7;
-        if (!str.empty() && i < 6 && str.find('.') != str.npos)
-        {
-            auto loc = str.rfind(':');
-            ret.s6_addr32[3] =
-                ToAddr<in_addr>{}(str.substr(loc == str.npos ? 0 : loc + 1))
-                    .s_addr;
-            str.remove_suffix(loc == str.npos ? str.size() : str.size() - loc);
-            j -= 2;
-        }
-        while (!str.empty() && j > i)
-        {
-            auto loc = str.rfind(':');
-            ret.s6_addr16[j--] =
-                stdplus::hton(di(str.substr(loc == str.npos ? 0 : loc + 1)));
-            str.remove_suffix(loc == str.npos ? str.size() : str.size() - loc);
-        }
-        if (!str.empty())
-        {
-            throw std::invalid_argument("Too much data");
-        }
-        return ret;
-    }
-};
-
-template <>
-struct ToAddr<InAddrAny>
-{
-    constexpr InAddrAny operator()(std::string_view str) const
-    {
-        if (str.find(':') == str.npos)
-        {
-            return ToAddr<in_addr>{}(str);
-        }
-        return ToAddr<in6_addr>{}(str);
-    }
-};
-
-template <>
-struct ToAddr<IfAddr>
-{
-    constexpr IfAddr operator()(std::string_view str) const
-    {
-        auto pos = str.rfind('/');
-        if (pos == str.npos)
-        {
-            throw std::invalid_argument("Invalid IfAddr");
-        }
-        return {ToAddr<InAddrAny>{}(str.substr(0, pos)),
-                DecodeInt<uint8_t, 10>{}(str.substr(pos + 1))};
-    }
-};
-
-template <typename T>
-struct ToStr
-{};
-
-template <>
-struct ToStr<char>
-{
-    static constexpr uint8_t buf_size = 1;
-    using buf_type = std::array<char, buf_size>;
-
-    constexpr char* operator()(char* buf, char v) const noexcept
-    {
-        buf[0] = v;
-        return buf + 1;
-    }
-};
-
-template <>
-struct ToStr<in_addr>
-{
-    // 4 octets * 3 dec chars + 3 separators
-    static constexpr uint8_t buf_size = 15;
-    using buf_type = std::array<char, buf_size>;
-
-    constexpr char* operator()(char* buf, in_addr v) const noexcept
-    {
-        auto n = stdplus::bswap(stdplus::ntoh(v.s_addr));
-        for (size_t i = 0; i < 3; ++i)
-        {
-            buf = ToStr<char>{}(EncodeInt<uint8_t, 10>{}(buf, n & 0xff), '.');
-            n >>= 8;
-        }
-        return EncodeInt<uint8_t, 10>{}(buf, n & 0xff);
-    }
-};
-
-template <>
-struct ToStr<in6_addr>
-{
-    // 8 hextets * 4 hex chars + 7 separators
-    static constexpr uint8_t buf_size = 39;
-    using buf_type = std::array<char, buf_size>;
-
-    constexpr char* operator()(char* buf, in6_addr v) const noexcept
-    {
-        // IPv4 in IPv6 Addr
-        if (v.s6_addr32[0] == 0 && v.s6_addr32[1] == 0 &&
-            v.s6_addr32[2] == stdplus::hton(uint32_t(0xffff)))
-        {
-            constexpr auto prefix = std::string_view("::ffff:");
-            return ToStr<in_addr>{}(
-                std::copy(prefix.begin(), prefix.end(), buf), {v.s6_addr32[3]});
-        }
-
-        size_t skip_start = 0;
-        size_t skip_size = 0;
-        {
-            size_t new_start = 0;
-            size_t new_size = 0;
-            for (size_t i = 0; i < 9; ++i)
-            {
-                if (i < 8 && v.s6_addr16[i] == 0)
-                {
-                    if (new_start + new_size == i)
-                    {
-                        new_size++;
-                    }
-                    else
-                    {
-                        new_start = i;
-                        new_size = 1;
-                    }
-                }
-                else if (new_start + new_size == i && new_size > skip_size)
-                {
-                    skip_start = new_start;
-                    skip_size = new_size;
-                }
-            }
-        }
-        for (size_t i = 0; i < 8; ++i)
-        {
-            if (i == skip_start && skip_size > 1)
-            {
-                if (i == 0)
-                {
-                    *(buf++) = ':';
-                }
-                *(buf++) = ':';
-                i += skip_size - 1;
-                continue;
-            }
-            buf = EncodeInt<uint16_t, 16>{}(buf, stdplus::ntoh(v.s6_addr16[i]));
-            if (i < 7)
-            {
-                *(buf++) = ':';
-            }
-        }
-        return buf;
-    }
-};
-
-template <>
-struct ToStr<InAddrAny>
-{
-    // IPv6 is the bigger of the addrs
-    static constexpr uint8_t buf_size = ToStr<in6_addr>::buf_size;
-    using buf_type = std::array<char, buf_size>;
-
-    constexpr char* operator()(char* buf, InAddrAny v) const noexcept
-    {
-        return std::visit([=](auto v) { return ToStr<decltype(v)>{}(buf, v); },
-                          v);
-    }
-};
-
-template <>
-struct ToStr<IfAddr>
-{
-    // InAddrAny + sep + 3 prefix chars
-    static constexpr uint8_t buf_size = ToStr<InAddrAny>::buf_size + 4;
-    using buf_type = std::array<char, buf_size>;
-
-    constexpr char* operator()(char* buf, IfAddr v) const noexcept
-    {
-        buf = ToStr<InAddrAny>{}(buf, v.getAddr());
-        buf = ToStr<char>{}(buf, '/');
-        return EncodeInt<uint8_t, 10>{}(buf, v.getPfx());
-    }
-};
-
-namespace detail
-{
-
-template <typename T>
-constexpr bool vcontains() noexcept
-{
-    return false;
-}
-
-template <typename T, typename V, typename... Vs>
-constexpr bool vcontains() noexcept
-{
-    return vcontains<T, Vs...>() || std::is_same_v<T, V>;
-}
-
-template <typename T, typename... Types>
-constexpr std::enable_if_t<vcontains<T, Types...>(), bool>
-    veq(T t, std::variant<Types...> v) noexcept
-{
-    return std::visit(
-        [t](auto v) {
-        if constexpr (std::is_same_v<T, decltype(v)>)
-        {
-            return v == t;
-        }
-        else
-        {
-            return false;
-        }
-        },
-        v);
-}
-
-template <typename T>
-struct ToStrBuf
-{
-  public:
-    constexpr std::string_view operator()(T v) noexcept
-    {
-        return {buf.data(), ToStr<T>{}(buf.data(), v)};
-    }
-
-  private:
-    typename ToStr<T>::buf_type buf;
-};
-
-template <typename T>
-struct Format
-{
-  private:
-    fmt::formatter<std::string_view> formatter;
-
-  public:
-    template <typename ParseContext>
-    constexpr auto parse(ParseContext& ctx)
-    {
-        return ctx.begin();
-    }
-
-    template <typename FormatContext>
-    auto format(auto v, FormatContext& ctx) const
-    {
-        return formatter.format(ToStrBuf<T>{}(v), ctx);
-    }
-};
-} // namespace detail
-} // namespace network
-} // namespace phosphor
-
-template <>
-struct std::hash<in_addr>
-{
-    std::size_t operator()(in_addr addr) const noexcept;
-};
-
-template <>
-struct std::hash<in6_addr>
-{
-    std::size_t operator()(in6_addr addr) const noexcept;
-};
-
-template <>
-struct std::hash<phosphor::network::IfAddr>
-{
-    std::size_t operator()(phosphor::network::IfAddr addr) const noexcept;
-};
-
-namespace fmt
-{
-template <>
-struct formatter<in_addr> : phosphor::network::detail::Format<in_addr>
-{};
-template <>
-struct formatter<in6_addr> : phosphor::network::detail::Format<in6_addr>
-{};
-template <>
-struct formatter<phosphor::network::InAddrAny> :
-    phosphor::network::detail::Format<phosphor::network::InAddrAny>
-{};
-template <>
-struct formatter<phosphor::network::IfAddr> :
-    phosphor::network::detail::Format<phosphor::network::IfAddr>
-{};
-} // namespace fmt
-
-namespace std
-{
-string to_string(in_addr value);
-string to_string(in6_addr value);
-string to_string(phosphor::network::InAddrAny value);
-string to_string(phosphor::network::IfAddr value);
-} // namespace std
-
-template <typename T>
-constexpr std::enable_if_t<!std::is_same_v<phosphor::network::InAddrAny, T>,
-                           bool>
-    operator==(phosphor::network::InAddrAny lhs, T rhs) noexcept
-{
-    return phosphor::network::detail::veq(rhs, lhs);
-}
-
-auto& operator<<(auto& os, in_addr v)
-{
-    return os << phosphor::network::detail::ToStrBuf<in_addr>{}(v);
-}
-
-auto& operator<<(auto& os, in6_addr v)
-{
-    return os << phosphor::network::detail::ToStrBuf<in6_addr>{}(v);
-}
-
-auto& operator<<(auto& os, phosphor::network::InAddrAny v)
-{
-    phosphor::network::detail::ToStrBuf<phosphor::network::InAddrAny> tsb;
-    return os << tsb(v);
-}
-
-auto& operator<<(auto& os, phosphor::network::IfAddr v)
-{
-    phosphor::network::detail::ToStrBuf<phosphor::network::IfAddr> tsb;
-    return os << tsb(v);
-}
-
-namespace phosphor::network
-{
-
 /** @brief Contains all of the object information about the interface */
 struct AllIntfInfo
 {
     InterfaceInfo intf;
-    std::optional<in_addr> defgw4 = std::nullopt;
-    std::optional<in6_addr> defgw6 = std::nullopt;
-    std::unordered_map<IfAddr, AddressInfo> addrs = {};
-    std::unordered_map<InAddrAny, NeighborInfo> staticNeighs = {};
+    std::optional<stdplus::In4Addr> defgw4 = std::nullopt;
+    std::optional<stdplus::In6Addr> defgw6 = std::nullopt;
+    std::unordered_map<stdplus::SubnetAny, AddressInfo> addrs = {};
+    std::unordered_map<stdplus::InAnyAddr, NeighborInfo> staticNeighs = {};
 };
 
 } // namespace phosphor::network
diff --git a/src/util.cpp b/src/util.cpp
index 7102372..b04cfd6 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -11,6 +11,7 @@
 
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/lg2.hpp>
+#include <stdplus/numeric/str.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
 
 #include <cctype>
@@ -134,7 +135,7 @@
     unsigned idx;
     try
     {
-        idx = DecodeInt<unsigned, 10>{}(intf);
+        idx = stdplus::StrToInt<10, unsigned>{}(intf);
     }
     catch (...)
     {
diff --git a/src/util.hpp b/src/util.hpp
index 7736f67..abfd8eb 100644
--- a/src/util.hpp
+++ b/src/util.hpp
@@ -23,14 +23,14 @@
  * @param[in] family - The address family of the buf
  * @param[in] buf - The network byte order address
  */
-constexpr InAddrAny addrFromBuf(int family, std::string_view buf)
+constexpr stdplus::InAnyAddr addrFromBuf(int family, std::string_view buf)
 {
     switch (family)
     {
         case AF_INET:
-            return stdplus::raw::copyFromStrict<in_addr>(buf);
+            return stdplus::raw::copyFromStrict<stdplus::In4Addr>(buf);
         case AF_INET6:
-            return stdplus::raw::copyFromStrict<in6_addr>(buf);
+            return stdplus::raw::copyFromStrict<stdplus::In6Addr>(buf);
     }
     throw std::invalid_argument("Unrecognized family");
 }
