Subject: [DNSOP] port 0 requests leading to errors

From: bert hubert <[email-masked]>
Date: Sat, 22 Mar 2014 12:26:55 +0100

Hi everybody,

This is mostly a note to implementors, but it may also be helpful to
operators.

Periodically, PowerDNS users would tell us about odd errors in their logs
about 'Invalid arguments' from sendmsg or sendto. We spent a lot of time
investigating these messages, as they usually point to subtle memory
corruption. But we didn't find anything.

Yesterday, an AS112 operator reported seeing an increased number of these
issues, and we decided to consult the Linux kernel source code to see under
what conditions UDP sendmsg/sendto generate EINVAL.  One cause jumped out:
trying to send packets to port 0.

On a hunch, we asked the operator to tcpdump for port 0 packets, and lo,
these turned out to be frequent.

43.504115 IP x.y.117.10.0 > 192.175.48.6.53: 6365+ SOA? 168.192.in-addr.arpa. (38)
45.504152 IP x.y.117.10.0 > 192.175.48.6.53: 6365+ SOA? 168.192.in-addr.arpa. (38)
49.505124 IP x.y.117.10.0 > 192.175.48.6.53: 6365+ SOA? 168.192.in-addr.arpa. (38)

PowerDNS now refuses to attempt to answer such packets, which silences the
error messages.

If anyone else was chasing odd errors on UDP sendmsg/sendto, this may have
been the reason. I think it may be wise to drop port 0 packets as soon as
feasible with UDP software, as no good can come from them.

Original ticket:
https://github.com/PowerDNS/pdns/issues/844

Commit in:
https://github.com/PowerDNS/pdns/commit/81859ba591d7de51d45e48b4fe499b08e08c221b

Kind regards,

Bert

-- 
PowerDNS Website: http://www.powerdns.com/
Contact us by phone on +31-15-7850372

---

From: Paul Vixie <[email-masked]>
Date: Sat, 22 Mar 2014 10:23:51 -0700

bert hubert wrote:
> ...

mark andrews sent me a similar patch to bind 4.9 back in 1992, which
made no sense to me but i put it in anyway. thanks for explaining.

---

From: Christopher Morrow <[email-masked]>
Date: Sun, 23 Mar 2014 20:59:24 -0400

If I have a patch which makes no sense, will you also add it?
On Mar 22, 2014 1:25 PM, "Paul Vixie" <[email-masked]> wrote:

> _______________________________________________
> DNSOP mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/dnsop
>

---

From: Paul Vixie <[email-masked]>
Date: Sun, 23 Mar 2014 19:27:50 -0700

> If I have a patch which makes no sense, will you also add it?

nope. not for you anyway. only mark andrews.

---

From: Olafur Gudmundsson <[email-masked]>
Date: Tue, 25 Mar 2014 10:14:29 -0400

> If I have a patch which makes no sense, will you also add it?

Speaking for Paul, 
Paul used value judgement based on the persons reputation. 
If Mark thought it was important enough to submit a patch then there must be a reason, even if
Paul was not clueful enough to understand in the few minutes he thought about it. 

	Olafur