From nobody Thu Aug 11 09:38:31 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M3MF365Ktz4YnV5; Thu, 11 Aug 2022 09:38:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M3MF35ZnTz3hdW; Thu, 11 Aug 2022 09:38:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660210711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=//o8lXNquDIthylxIZxMJ7XiMZuPRfj63ME2bbJhpC4=; b=Fqo5W/+Cxa/5QQsY7TpX/kE//m5gOCXVqnJiP5OiR0b5GgY9iZeZDABK36rI6Z7IhFbw82 FP4ufdbrdoM6b38OWzS5FlDYnYmNjpo0BS8QhHYNL6J8MXF3u4DvIlTv83SqboGYG4ljGz zrQDNDVAy5ejhtq4xTNKWX61aHGuG2/Z5X5Z8hjQeZL/07c3RcTJgKB2jsSeGFBK7EbTb0 smvtn1s/FURiuifpMxHl9vmSDjRNNAG5QDHcDA7iet+kK22a8z0mZMX6c2NduFqeNJWp14 em6SKGfVTQJu5ZnByfVWp+aQRgjDJiGR+g8lJtd0uRr3X0MylklbftjHHQksaw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4M3MF34b93zmh6; Thu, 11 Aug 2022 09:38:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27B9cVXe097907; Thu, 11 Aug 2022 09:38:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27B9cVTJ097906; Thu, 11 Aug 2022 09:38:31 GMT (envelope-from git) Date: Thu, 11 Aug 2022 09:38:31 GMT Message-Id: <202208110938.27B9cVTJ097906@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: fd6b3bede5a5 - main - if_ovpn: reject non-UDP sockets List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fd6b3bede5a5c210f327e5c9bd3e415ee905048b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660210711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=//o8lXNquDIthylxIZxMJ7XiMZuPRfj63ME2bbJhpC4=; b=Cj/d5bDT0+xg8MhnA7ggvMZNuh26GPghfUF8FEN6fXIZV7XjvswTnb1bFa6nw7CZS6D0Ns AUwRBj+MgaPbgzG+5KltsE2iLT8EjN2haf+sy3I2z7tpSVpz6NzLX14mtUkNFg0WetxbKg AF8dqxo+624TgaTdtOnuKQ3Rx54tE3pQfeZif7S25nwJgwBMg0Td5rUzi/JlaG7VUm6x8n b6QDQ+Y+BA+0JZHqh2x/LK03Lm4OhlnvADbUdXu9mT7Kly1YXwYz8K6L2OeJRR5C65Dfvg 3WHUvjMzfPZenNruQm4NsTuImm/m9PagT2zVFMH9jnrAyCbsqLYjKgLFFP8ahQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660210711; a=rsa-sha256; cv=none; b=e23qve+ATW6I2oYuT821vg/cO828XFvLKDaWI+2U2zei/Q8XvhFxOWDlv8a8yoFTlnCH0q 8Ki7grtQ7khQsN9WPALDYev2iogTAde8iHXBgMz71BlBBP4BoXtJj9SWlRNBypboxzG6D7 CzRia5JZJAe1+fnZtUVBq+9WqQkQsabXJRuDH2ZDwYaBEVRmE3KB59Cls4Py88hA5r1oMP gXwnQk7/sFI7rNn8RjqX3cjO4+aFzHXxBbdkteR4HB/i4VUt9Llx7hBNjhQKXuGuzdeMqo 53RQ359kHSR1Y1TQ5Z10DuC1xE6+0sUSAKkS+ynQ3fGL0VfrJvynpDjk52n+aA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fd6b3bede5a5c210f327e5c9bd3e415ee905048b commit fd6b3bede5a5c210f327e5c9bd3e415ee905048b Author: Kristof Provost AuthorDate: 2022-08-11 08:30:39 +0000 Commit: Kristof Provost CommitDate: 2022-08-11 08:40:03 +0000 if_ovpn: reject non-UDP sockets We must ensure that the fd provided by userspace is really for a UDP socket. If it's not we'll panic in udp_set_kernel_tunneling(). Reported by: Gert Doering Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/if_ovpn.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/net/if_ovpn.c b/sys/net/if_ovpn.c index 37814783fe3f..7d5d384a6f75 100644 --- a/sys/net/if_ovpn.c +++ b/sys/net/if_ovpn.c @@ -559,6 +559,12 @@ ovpn_new_peer(struct ifnet *ifp, const nvlist_t *nvl) goto error_locked; } + /* Make sure this is really a UDP socket. */ + if (so->so_type != SOCK_DGRAM || so->so_proto->pr_type != SOCK_DGRAM) { + ret = EPROTOTYPE; + goto error_locked; + } + /* Must be the same socket as for other peers on this interface. */ if (sc->so != NULL && so != sc->so) goto error_locked;