netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Varghese <martinvarghesenokia@gmail.com>
To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	jbenc@redhat.com, gnault@redhat.com
Cc: Martin Varghese <martin.varghese@nokia.com>
Subject: [PATCH net] bareudp: Disallow udp port 0.
Date: Thu, 30 Jul 2020 22:33:51 +0530	[thread overview]
Message-ID: <1596128631-3404-1-git-send-email-martinvarghesenokia@gmail.com> (raw)

From: Martin Varghese <martin.varghese@nokia.com>

Kernel does not support udp destination port 0 on wire. Hence
bareudp device with udp destination port 0 must be disallowed.

Fixes: 571912c69f0e ("net: UDP tunnel encapsulation module for tunnelling different protocols like MPLS, IP, NSH etc.")
Signed-off-by: Martin Varghese <martin.varghese@nokia.com>
---
 drivers/net/bareudp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c
index 88e7900853db..08b195d32cbe 100644
--- a/drivers/net/bareudp.c
+++ b/drivers/net/bareudp.c
@@ -578,8 +578,13 @@ static int bareudp2info(struct nlattr *data[], struct bareudp_conf *conf,
 		return -EINVAL;
 	}
 
-	if (data[IFLA_BAREUDP_PORT])
+	if (data[IFLA_BAREUDP_PORT]) {
 		conf->port =  nla_get_u16(data[IFLA_BAREUDP_PORT]);
+		if (!conf->port) {
+			NL_SET_ERR_MSG(extack, "udp port 0 not supported");
+			return -EINVAL;
+		}
+	}
 
 	if (data[IFLA_BAREUDP_ETHERTYPE])
 		conf->ethertype =  nla_get_u16(data[IFLA_BAREUDP_ETHERTYPE]);
-- 
2.18.4


             reply	other threads:[~2020-07-30 17:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-30 17:03 Martin Varghese [this message]
2020-07-30 23:20 ` [PATCH net] bareudp: Disallow udp port 0 Jakub Kicinski
2020-07-31  2:50   ` Martin Varghese

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=1596128631-3404-1-git-send-email-martinvarghesenokia@gmail.com \
    --to=martinvarghesenokia@gmail.com \
    --cc=davem@davemloft.net \
    --cc=gnault@redhat.com \
    --cc=jbenc@redhat.com \
    --cc=kuba@kernel.org \
    --cc=martin.varghese@nokia.com \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).