Subject: [DNSOP] some implementation notes: binding to all IP addresses

From: bert hubert <[email-masked]>
Date: Mon, 8 Oct 2012 21:53:04 +0200

Hi,

This message is slightly offtopic, but this is the best list for reaching
all DNS implementors I think.  And I need your help!

After ten years of nagging, PowerDNS Authoritative Server implemented
'automatic binding to ALL IPv4 and IPv6 addresses'. We do so using the
setsockopt/sendmsg/recvmsg flags that allow for the capturing of the 'real'
destination address of a packet received in 0.0.0.0 or ::.

In attempting to implement this, we found missing documentation, wrong
documentation and odd #defines that are required on some platforms.

I've bundled the whole story in a blogpost on
http://bert-hubert.blogspot.com/2012/10/on-binding-datagram-udp-sockets-to-any.html

My question is: do any of the implementors have anything to add to this
page? Especially DNS relevant things. 

The post is currently short on details for Solaris and Windows. If you have
clues, please share!

Thanks.

-- 
PowerDNS Website: http://www.powerdns.com/
PowerDNS Community Website: http://wiki.powerdns.com/
PowerDNS is supported and developed by Netherlabs: http://www.netherlabs.nl

---

From: Paul Wouters <[email-masked]>
Date: Mon, 8 Oct 2012 16:05:26 -0400 (EDT)

> page? Especially DNS relevant things.

It seems you implemented pretty much what openswan has been doing for
a long time, which was based on work done for freeradius by Miquel van
Smoorenburg.

http://git.openswan.org/cgi-bin/cgit/openswan/tree/lib/libopenswan/udpfromto.c

but perhaps read through the code to compare? Perhaps this code should
be put into a library we can all use independantly, as people seem to
copy this functionality over and over again.

I did not know about __APPLE_USE_RFC_3542, which I've just added to my tree.

Thanks for sharing,

Paul

---

From: Mark Andrews <[email-masked]>
Date: Tue, 09 Oct 2012 08:57:59 +1100

In message <[email-masked]>, Paul Wouters w
> I did not know about __APPLE_USE_RFC_3542, which I've just added to my tree.

It tells the compiler which version of the advanced API to use as
of Lion from memory.  You also have similar magic on Linux as the
advanced socket API is not available by default.

Named has been using it for years.

> Thanks for sharing,
> 
> Paul
> _______________________________________________
> DNSOP mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/dnsop
-- 
Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: [email-masked]

---

From: JINMEI Tatuya / 神明達哉 <[email-masked]>
Date: Mon, 08 Oct 2012 23:01:46 -0700

At Mon, 8 Oct 2012 21:53:04 +0200,

> The post is currently short on details for Solaris and Windows. If you have

As far as I know Windows doesn't support RFC 3542.

---
JINMEI, Tatuya
Internet Systems Consortium, Inc.

---

From: bert hubert <[email-masked]>
Date: Tue, 9 Oct 2012 09:33:15 +0200

> advanced socket API is not available by default.

These days it is, it appears? I did not have to do a #define at least on the
platforms I compile on.

Paul, the MiquelS sample you mentioned no longer compiles (or at least
doesn't work), which is why I decided to do a writeup.  I know I did not
invent anything, I only wanted to document it all in one place.

Regarding RFCs, there is also http://www.ietf.org/rfc/rfc5014.txt which
provides an API for selecting temporary IPv6 addresses etc, this might
be interesting for resolvers.

Regarding Windows, it has been noted here that they don't implement RFC
3542, but they do have IP_PKTINFO since Windows 2003 it appears:
http://msdn.microsoft.com/en-us/library/windows/desktop/hh285668(v=vs.85).aspx

Regarding Solaris, I find that 'recent versions' do have IP_PKTINFO. I also
see people mention that it supports RFC 3542, but have not checked.

If anyone can confirm that it works well in production, please let me know
and I'll update the blog post.

Thanks!