mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	Bart Groeneveld <avi@bartavi.nl>
Cc: linux-kernel@vger.kernel.org,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	netdev@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v3] net: Use standardized (IANA) local port range
Date: Mon, 31 Aug 2020 10:07:19 +0200	[thread overview]
Message-ID: <bf42f6fd-cd06-02d6-d7b6-233a0602c437@gmail.com> (raw)
In-Reply-To: <20200828145203.65395ad8@hermes.lan>



On 8/28/20 2:52 PM, Stephen Hemminger wrote:
> On Fri, 28 Aug 2020 22:44:47 +0200
> Bart Groeneveld <avi@bartavi.nl> wrote:
> 
>> IANA specifies User ports as 1024-49151,
>> and Private ports (local/ephemeral/dynamic/w/e) as 49152-65535 [1].
>>
>> This means Linux uses 32768-49151 'illegally'.
>> This is not just a matter of following specifications:
>> IANA actually assigns numbers in this range [1].
>>
>> I understand that Linux uses 61000-65535 for masquarading/NAT [2],
>> so I left the high value at 60999.
>> This means the high value still does not follow the specification,
>> but it also doesn't conflict with it.
>>
>> This change will effectively halve the available ephemeral ports,
>> increasing the risk of port exhaustion. But:
>> a) I don't think that warrants ignoring standards.
>> 	Consider for example setting up a (corporate) firewall blocking
>> 	all unknown external services.
>> 	It will only allow outgoing trafiic at port 80,443 and 49152-65535.
>> 	A Linux computer behind such a firewall will not be able to connect
>> 	to *any* external service *half of the time*.
>> 	Of course, the firewall can be adjusted to also allow 32768-49151,
>> 	but that allows computers to use some services against the policy.
>> b) It is only an issue with more than 11848 *outgoing* connections.
>> 	I think that is a niche case (I know, citation needed, but still).
>> 	If someone finds themselves in such a niche case,
>> 	they can still modify ip_local_port_range.
>>
>> This patch keeps the low and high value at different parity,
>> as to optimize port assignment [3].
>>
>> [1]: https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt
>> [2]: https://marc.info/?l=linux-kernel&m=117900026927289
>> [3]: See for example commit 1580ab63fc9a03593072cc5656167a75c4f1d173 ("tcp/dccp: better use of ephemeral ports in connect()")
>>
>> Signed-off-by: Bart Groeneveld <avi@bartavi.nl>
> 
> Changing the default range impacts existing users. Since Linux has been doing
> this for so long, I don't think just because a standards body decided to reserve
> some space is sufficient justification to do this.
> 

Agreed.

There is a sysctl, allowing admins/distros to opt-in to whatever IANA values of the days
if they really want.

We have already many issues caused by ephemeral range being too small.

For instance I often have to debug issues caused by some distros
changing sysctl_tcp_rfc1337 to 1, hurting some real applications.


  parent reply	other threads:[~2020-08-31  8:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200821142533.45694-1-avi@bartavi.nl>
2020-08-28 20:39 ` [PATCH v2] " Bart Groeneveld
2020-08-28 20:44   ` [PATCH v3] " Bart Groeneveld
2020-08-28 21:52     ` Stephen Hemminger
2020-08-28 23:14       ` David Miller
2020-08-31  8:07       ` Eric Dumazet [this message]
2020-08-29 10:37     ` Michal Kubecek
2020-08-29 13:37   ` [PATCH v2] " David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf42f6fd-cd06-02d6-d7b6-233a0602c437@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=avi@bartavi.nl \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®