Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
The ISO/IEC 29341-26-2 standard specifies the WANConnectionDevice:1 template, a sub-device of the WANDevice that models a single logical WAN connection context. Each WANConnectionDevice instance corresponds to one active or configurable connection session — such as a PPPoE tunnel, a direct IP connection via DHCP, or a pure bridging mode. This template enables UPnP control points to enumerate, configure, and monitor individual WAN connections independently.
Each WANConnectionDevice embeds one or more WAN connection services, the most important being WANIPConnection (for IP-routed connections) or WANPPPConnection (for PPP-tunneled connections). The device type URN is urn:schemas-upnp-org:device:WANConnectionDevice:1. The device description includes the standard UPnP fields (friendly name, manufacturer, model description) plus links to the embedded service descriptions.
The WANConnectionDevice:1 template defines a flexible architecture that accommodates three fundamental WAN connection types. Each type maps to a specific service that implements the connection protocol:
| Connection Type | Service | Typical Use Case | Layer |
|---|---|---|---|
| IP Routed | WANIPConnection:1 | Cable modem, fibre (DHCP-assigned IP) | Layer 3 (IP) |
| PPP Tunneled | WANPPPConnection:1 | DSL (PPPoE or PPPoA) | Layer 2 (PPP over Ethernet/ATM) |
| Bridged | WANIPConnection (Bridge) | Modem passthrough, transparent bridging | Layer 2 (Ethernet bridging) |
The WANConnectionDevice itself provides a hosting container for these services. It also includes the WANCommonInterfaceConfig service (inherited from the parent WANDevice context) to expose physical-layer parameters specific to this connection’s interface. The state variables exported by these services include ConnectionStatus (Connected, Disconnected, Connecting), Uptime (seconds since connection established), and AutoDisconnectTime (idle timeout threshold).
ConnectionType state variable. Some gateways allow changing the connection type at runtime (e.g., switching from PPPoE to IP routing), but this requires tearing down the existing connection and reinitialising the entire network stack. Implementations must ensure that all active port mappings and NAT sessions are gracefully terminated before switching connection types.In practice, the WANConnectionDevice:1 implementation varies significantly across hardware platforms. On high-end routers running Linux-based firmware, the UPnP daemon (such as miniupnpd or linux-igd) directly interacts with the kernel’s netlink interface to query connection state and configure NAT rules. On embedded systems with limited resources, the UPnP stack may run in a separate lightweight process that communicates with the main routing daemon via Unix domain sockets or shared memory.
One of the most important engineering considerations is the eventing performance for connection state changes. When a WAN connection drops and reconnects, the WANConnectionDevice must generate GENA event notifications for all subscribed control points. If the event payload is large (including updated port mapping tables, DNS server addresses, and connection metrics), the XML serialisation overhead can delay the notification by hundreds of milliseconds. Engineers should implement incremental eventing where only changed state variables are included in the event payload.
GetGenericPortMappingEntry action, although technically part of the WANIPConnection service, is often cached at the WANConnectionDevice level to provide atomic port-mapping enumeration across multiple connections. Leading implementations maintain a hash table keyed by (RemoteHost, ExternalPort, Protocol) tuples, enabling O(1) lookup for incoming connection matching and O(n) enumeration of all mappings.Another critical design decision is the handling of DNS server information. The WANConnectionDevice exposes DNSServers as a comma-separated string of IP addresses. Some residential gateways forward the DNS servers received from the ISP via DHCP or PPP IPCP, while others run a local DNS proxy (e.g., dnsmasq) and advertise the gateway’s LAN IP as the DNS server. The former approach is simpler but exposes the client to ISP DNS provider changes; the latter improves performance through caching but requires additional configuration.
SetConnectionType) should be protected by appropriate access controls. The UPnP specification does not mandate authentication for device control, so implementations must rely on network-layer filtering to restrict UPnP SOAP requests to trusted LAN interfaces. Exposing the WANConnectionDevice control endpoint on the WAN interface is a severe security risk that has been exploited in several large-scale botnet attacks, including Mirai variants targeting UPnP-enabled routers.PortMappingEnabled variable for each mapping is typically set to 0, or the entire mapping table is cleared depending on implementation. Most gateways persist mappings in non-volatile storage and reapply them when the connection is re-established.