Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support other UPnP IGDs #20

Open
Beanow opened this issue Aug 27, 2020 · 0 comments
Open

Support other UPnP IGDs #20

Beanow opened this issue Aug 27, 2020 · 0 comments

Comments

@Beanow
Copy link

Beanow commented Aug 27, 2020

TL;DR, I think the current implementation can support non-fritzbox modems fairly quickly.
Sharing some info that I have.

Scrolling through the code, most of it uses UPnP's intended workflow to gather data.
However one main issue stops it from being generic: hardcoding /igddesc.xml and /tr64desc.xml for the device descriptors.

response, err := http.Get(fmt.Sprintf("%s/igddesc.xml", r.BaseURL))

igddesc, err := http.Get(fmt.Sprintf("%s/tr64desc.xml", r.BaseURL))

SSDP

The typical UPnP approach would be to do an SSDP query, matching
ST urn:schemas-upnp-org:device:InternetGatewayDevice:1.

My ARRIS modem then reports http://192.168.178.1:5000/rootDesc.xml.
Be sure to try it yourself, ssdp-query urn:schemas-upnp-org:device:InternetGatewayDevice:1.

Afaik, service discovery is not normally the job of an exporter.
Rather I would suggest to accept the URLs of a device descriptor, instead of separate host + port + hardcoded path.

Users could set their target to:

  • http://fritz.box:49000/igddesc.xml
  • http://fritz.box:49000/tr64desc.xml
  • http://192.168.178.1:5000/rootDesc.xml

Or whatever else their SSDP query returns. Very similar to the http blackbox exporter.

Service base URL

SCDP and Control URLs are used here, which are typically relative. According to the UPnP spec, they follow RFC3986 section 5. In short that means it's the same as webpages, /something.xml is a resource from the root and something.xml is a sibling to the current path.

For compatibility we shouldn't use sprintf for this, as we have func (*URL) ResolveReference. (Note the mention of the same RFC)

Available metrics

The upnp.org services are outlined here: https://openconnectivity.org/developer/specifications/upnp-resources/upnp/internet-gateway-device-igd-v-2-0/

The Arris modem supports:

There's other worthwhile data in these specs. Such as WANIPConnection.ExternalIPAddress (required) or that WANCommonInterfaceConfig.GetAddonInfos is non-standard and other devices may need individual GetTotalBytesSent, GetTotalBytesReceived, etc. actions to fetch this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant