From nobody Mon May 16 03:12:50 2022 X-Original-To: dev-commits-src-branches@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 2D8411AEB6BC; Mon, 16 May 2022 03:12:51 +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 4L1kpC0DDWz4bZ2; Mon, 16 May 2022 03:12:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652670771; 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=MlcnnC2st0pi+w5Up+5a0npQMgRlp49e0Cmpj6yvCQo=; b=uM3ujuvhUdAUfkUok1UbREGYBL0wPKT3v39nNiaK1PU+EcNEA5spcdbLfwT3bDozJPrYOH Pqz59Kz4VexeWu4lf2O4wVIlWIPEYvfk8wpCVHwTbnHhscB9qnG9qw2iTvMONJ1E4hVQ5Z 9r3eXTipEh6ZlCoH6pHdkXUIWozpVO5EYQZdKf1NHqIqZaavJb9f1d3IUXhzTJUSux8ppu eUgfB5aPKiNuLUCpYv2M/EW2pQeZiU0llS0QNLK0gBiiukvVcF7jf1ctPuylfQLu0OEl5C MUYSA9kFFN6V4eIdT/9RzkTx6+VAdAOQFrpOLby+gE7TNXkrEsIAJgWnHcIAHw== 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 DC4651881E; Mon, 16 May 2022 03:12:50 +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 24G3CoVY010887; Mon, 16 May 2022 03:12:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24G3Co3Z010886; Mon, 16 May 2022 03:12:50 GMT (envelope-from git) Date: Mon, 16 May 2022 03:12:50 GMT Message-Id: <202205160312.24G3Co3Z010886@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: 14601708d59b - stable/12 - ng_pppoe: MFC: introduce new sysctl net.graph.pppoe.lcp_pcp List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 14601708d59b97ab8cd834cd1124982ea5e7dc81 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652670771; 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=MlcnnC2st0pi+w5Up+5a0npQMgRlp49e0Cmpj6yvCQo=; b=VvUTrLk0D11iiFeWCNUmCGN40pDqmeFL+Yzr62LP5KsVYlGHrtkXU6XCjQzv06QlxZxtfZ 9gsla6oGxHooT76LoKCn/ldiIb7jYEv78eFME8bgGGX593XvS9THjHHrQbL5xP1/bzE/vy OTV6qCpawyjRYeKb9kpUzPwu04VlXpoceputaJbAchCjaPvxHQeCvEa7/irbWOjspNepwH 3Pvp4rwsdwpTzQV4TgE3TdxnAkt6C0YmbR4+LgU/gHVikguBGDjBkS4CeKgiqv+I4Q3Yc0 Y/1zS9xHlgUkfM+LgBASUo1FWp3El/ZZBqnZ5dkasg+DZiC5IjtEn0T2ywRiug== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652670771; a=rsa-sha256; cv=none; b=pEckW5gEjuyWu6jD0bn7nwJolOMlo//Iv6jbQiaJztIoTkCLAE5Q3sII6Y9TUghYQkyXWl fuppJMfJTfa6yqtIZhwe9oJcI4K6gfKbL4t1c/Mvy6dsr9EuedzFqq+Q4UvtUjPJc00I4W 1Uu/vq+4NLTtDAxiWL3Mk7Nd8LO/+cu6wsdccpYqWTU3coxLpOIpM53wYlkyNOP4R5AZBj EtbKuI4K5zTB1jtpjEyRAFMW8LsI5rcOFWUxUGvo+EQfC/75T3CrXAPBuokaKSaXS/oyNi N/ugo8S64mlH9kwPAZcSjc9pfnFsJbNXkaJZRo05qFGqErsGMsHEw+wpHOpWvw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=14601708d59b97ab8cd834cd1124982ea5e7dc81 commit 14601708d59b97ab8cd834cd1124982ea5e7dc81 Author: Eugene Grosbein AuthorDate: 2022-05-01 16:34:08 +0000 Commit: Eugene Grosbein CommitDate: 2022-05-16 03:11:26 +0000 ng_pppoe: MFC: introduce new sysctl net.graph.pppoe.lcp_pcp New sysctl allows to mark transmitted PPPoE LCP Control ethernet frames with needed 3-bit Priority Code Point (PCP) value. Confirming driver like if_vlan(4) uses the value to fill IEEE 802.1p class of service field. This is similar to Cisco IOS "control-packets vlan cos priority" command. It helps to avoid premature disconnection of user sessions due to control frame drops (LCP Echo etc.) if network infrastructure has a botteleck at a switch or the xdsl DSLAM. See also: https://sourceforge.net/p/mpd/discussion/44692/thread/c7abe70e3a/ Tested by: Klaus Fokuhl at SourceForge (cherry picked from commit 2e547442ab3822d3d7c46a68f152032ef5fe337c) (cherry picked from commit 28903f396af4b151e16ea606cda66a9244fb179f) --- share/man/man4/ng_pppoe.4 | 17 +++++++++++++++-- sys/netgraph/ng_pppoe.c | 23 +++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/share/man/man4/ng_pppoe.4 b/share/man/man4/ng_pppoe.4 index 7b0aee78a6cf..fa967832a4cb 100644 --- a/share/man/man4/ng_pppoe.4 +++ b/share/man/man4/ng_pppoe.4 @@ -35,7 +35,7 @@ .\" $FreeBSD$ .\" $Whistle: ng_pppoe.8,v 1.1 1999/01/25 23:46:27 archie Exp $ .\" -.Dd February 14, 2018 +.Dd May 1, 2022 .Dt NG_PPPOE 4 .Os .Sh NAME @@ -320,6 +320,18 @@ This node shuts down upon receipt of a control message, when all session have been disconnected or when the .Dv ethernet hook is disconnected. +.Sh SYSCTL VARIABLES +The node can mark transmitted LCP Ethernet packets (protocol 0xc021) +with 3-bit Priority Code Point (PCP) referring to IEEE 802.1p +class of service with following +.Xr sysctl 8 +variable. +.Bl -tag -width indent +.It Va net.graph.pppoe.lcp_pcp: 0..7 (default: 0) +Set it to non-zero value to be used by parent network interface driver +like +.Xr vlan 4 +.El .Sh EXAMPLES The following code uses .Dv libnetgraph @@ -556,7 +568,8 @@ setup(char *ethername, char *service, char *sessname, .Xr ng_ppp 4 , .Xr ng_socket 4 , .Xr ngctl 8 , -.Xr ppp 8 +.Xr ppp 8 , +.Xr vlan 4 .Rs .%A L. Mamakos .%A K. Lidl diff --git a/sys/netgraph/ng_pppoe.c b/sys/netgraph/ng_pppoe.c index b15208217281..f0f4cc741e3b 100644 --- a/sys/netgraph/ng_pppoe.c +++ b/sys/netgraph/ng_pppoe.c @@ -48,8 +48,14 @@ #include #include #include +#include +#include +#include #include #include +#include +#include +#include #include #include @@ -63,8 +69,19 @@ static MALLOC_DEFINE(M_NETGRAPH_PPPOE, "netgraph_pppoe", "netgraph pppoe node"); #define M_NETGRAPH_PPPOE M_NETGRAPH #endif +/* Some PPP protocol numbers we're interested in */ +#define PROT_LCP 0xc021 + #define SIGNOFF "session closed" +VNET_DEFINE_STATIC(u_int32_t, ng_pppoe_lcp_pcp) = 0; +#define V_ng_pppoe_lcp_pcp VNET(ng_pppoe_lcp_pcp) + +SYSCTL_NODE(_net_graph, OID_AUTO, pppoe, CTLFLAG_RW, 0, "PPPoE"); +SYSCTL_UINT(_net_graph_pppoe, OID_AUTO, lcp_pcp, + CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ng_pppoe_lcp_pcp), 0, + "Set PCP for LCP"); + /* * This section contains the netgraph method declarations for the * pppoe node. These methods define the netgraph pppoe 'type'. @@ -1432,6 +1449,12 @@ ng_pppoe_rcvdata(hook_p hook, item_p item) mtod(m, u_char *)[1] == 0x03) m_adj(m, 2); } + + if (V_ng_pppoe_lcp_pcp && m->m_pkthdr.len >= 2 && + m->m_len >= 2 && (m = m_pullup(m, 2)) && + mtod(m, uint16_t *)[0] == htons(PROT_LCP)) + EVL_APPLY_PRI(m, (uint8_t)(V_ng_pppoe_lcp_pcp & 0x7)); + /* * Bang in a pre-made header, and set the length up * to be correct. Then send it to the ethernet driver.