From owner-dev-commits-src-main@freebsd.org Mon Apr 19 12:10:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A5635EFBA4; Mon, 19 Apr 2021 12:10: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 4FP5HW0Jbcz3r2G; Mon, 19 Apr 2021 12:10:31 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 F170D1EF91; Mon, 19 Apr 2021 12:10:30 +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 13JCAU6R034139; Mon, 19 Apr 2021 12:10:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JCAUI5034138; Mon, 19 Apr 2021 12:10:30 GMT (envelope-from git) Date: Mon, 19 Apr 2021 12:10:30 GMT Message-Id: <202104191210.13JCAUI5034138@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: 0e4025bffa2b - main - bridgestp: validate timer values in config BPDU 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: 0e4025bffa2bab3461b72b40d0b1468722ff76e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 12:10:31 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0e4025bffa2bab3461b72b40d0b1468722ff76e6 commit 0e4025bffa2bab3461b72b40d0b1468722ff76e6 Author: Jonah Caplan AuthorDate: 2021-04-15 09:28:42 +0000 Commit: Kristof Provost CommitDate: 2021-04-19 10:09:18 +0000 bridgestp: validate timer values in config BPDU IEEE Std 802.1D-2004 Section 17.14 defines permitted ranges for timers. Incoming BPDU messages should be checked against the permitted ranges. The rest of 17.14 appears to be enforced already. PR: 254924 Reviewed by: kp, donner Differential Revision: https://reviews.freebsd.org/D29782 --- sys/net/bridgestp.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index 9e3a3e14ecda..cf182d2efe7b 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -597,6 +597,23 @@ bstp_received_bpdu(struct bstp_state *bs, struct bstp_port *bp, return; } + /* range checks */ + if (cu->cu_message_age >= cu->cu_max_age) { + return; + } + if (cu->cu_max_age < BSTP_MIN_MAX_AGE || + cu->cu_max_age > BSTP_MAX_MAX_AGE) { + return; + } + if (cu->cu_forward_delay < BSTP_MIN_FORWARD_DELAY || + cu->cu_forward_delay > BSTP_MAX_FORWARD_DELAY) { + return; + } + if (cu->cu_hello_time < BSTP_MIN_HELLO_TIME || + cu->cu_hello_time > BSTP_MAX_HELLO_TIME) { + return; + } + type = bstp_pdu_rcvtype(bp, cu); switch (type) {