OpenHome Forum
Can I use the MAC address as the UDN? - Printable Version

+- OpenHome Forum (
+-- Forum: OpenHome (/forumdisplay.php?fid=1)
+--- Forum: Net (/forumdisplay.php?fid=5)
+--- Thread: Can I use the MAC address as the UDN? (/showthread.php?tid=1039)

Can I use the MAC address as the UDN? - dough - 30-07-2012 09:35 AM

I have tried to implement the UDN of my Upnp device as the first eth0's MAC address. This means my UDN is a string in the following format:


I have just discovered that this renders my device undiscoverable to ohNet's Control Point stack. I can, however, discover the device with Device Spy...

Is this a totally invalid UDN as per the Upnp standard or is it valid, but unexpected by ohNet?


RE: Can I use the MAC address as the UDN? - simonc - 30-07-2012 10:10 AM

You can choose any string which is unique for your network as a udn. I believe mac addresses are often used as part/all of a udn so your approach should work fine. [Note that one possible exception to this is that you should not include nul ('\0') in your udn as this will truncate the string in many language bindings.]

To confirm this I edited TestDvDeviceC to use the udn you listed. This test publishes a device then uses a device list to search for it before invoking actions and checking for evented updates. The test passes with your "AA ..." udn.

ohNet includes some logging which may help determine the reason your device cannot be discoverable. You can add

#include <OpenHome/Private/Debug.h>
Debug::SetLevel(Debug::kDevice | Debug::kXmlFetch);

anywhere after OhNetLibraryInitialise to generate logging about which devices respond to a msearch and whether their device xml can be retrieved/parsed.

You could also check whether Intel Device Spy manages to identify your device on the network. If it does, check that its device xml lists the udn you expect.

RE: Can I use the MAC address as the UDN? - simonc - 30-07-2012 11:12 AM

Looking into this further, it turns out that ohNet discards leading/trailing spaces in values from device xml so is losing the trailing space in your example.

I will fix this but there are a number of other items on my todo list so this one may have to wait a while. Can you work around this for now by using something other that spaces (e.g. '-' or '_') in your generated udns please?

RE: Can I use the MAC address as the UDN? - simoncn - 30-07-2012 03:43 PM

According to the UPnP Device Architecture 1.1 specification, the UDN must start with "uuid:" and this must be followed by a UUID in the format stated in section 1.1.4 (example: 2fac1234-31f8-11b4-a222-08002b34c003).

Here's the relevant text from section 2.3:

REQUIRED. Unique Device Name. Universally-unique identifier for the device, whether root or embedded.
MUST be the same over time for a specific device instance (i.e., MUST survive reboots). MUST match the
field value of the NT header field in device discovery messages. MUST match the prefix of the USN
header field in all discovery messages. (Section 1, “Discovery” explains the NT and USN header fields.)
MUST begin with “uuid:” followed by a UUID suffix specified by a UPnP vendor. See section 1.1.4, “UUID
format and RECOMMENDED generation algorithms” for the MANDATORY UUID format.