From nobody Mon May 02 20:53: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 E41DC1ABFE53; Mon, 2 May 2022 20:53:33 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (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 (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ksb0Y0rdrz4sNL; Mon, 2 May 2022 20:53:33 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 242KrVo2099024 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 2 May 2022 13:53:32 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 242KrV77099023; Mon, 2 May 2022 13:53:31 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Mon, 2 May 2022 13:53:31 -0700 From: Gleb Smirnoff To: Eugene Grosbein Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 28903f396af4 - main - ng_pppoe: introduce new sysctl net.graph.pppoe.lcp_pcp Message-ID: References: <202205021457.242EvJnm003356@gitrepo.freebsd.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <202205021457.242EvJnm003356@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4Ksb0Y0rdrz4sNL X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=softfail (mx1.freebsd.org: 162.251.186.162 is neither permitted nor denied by domain of glebius@freebsd.org) smtp.mailfrom=glebius@freebsd.org X-Spamd-Result: default: False [-0.80 / 15.00]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; FREEFALL_USER(0.00)[glebius]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; DMARC_NA(0.00)[freebsd.org]; R_SPF_SOFTFAIL(0.00)[~all]; NEURAL_SPAM_MEDIUM(0.26)[0.261]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_SPAM_SHORT(0.04)[0.043]; MLMMJ_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N Eugene, On Mon, May 02, 2022 at 02:57:19PM +0000, Eugene Grosbein wrote: E> commit 28903f396af4b151e16ea606cda66a9244fb179f E> Author: Eugene Grosbein E> AuthorDate: 2022-05-02 14:55:24 +0000 E> Commit: Eugene Grosbein E> CommitDate: 2022-05-02 14:57:12 +0000 E> E> ng_pppoe: introduce new sysctl net.graph.pppoe.lcp_pcp E> E> This fixes incomplete commit 2e547442ab3822d3d7c46a68f152032ef5fe337c E> E> New sysctl allows to mark transmitted PPPoE LCP Control E> ethernet frames with needed 3-bit Priority Code Point (PCP) value. E> Confirming driver like if_vlan(4) uses the value to fill E> IEEE 802.1p class of service field. E> E> This is similar to Cisco IOS "control-packets vlan cos priority" E> command. E> E> It helps to avoid premature disconnection of user sessions E> due to control frame drops (LCP Echo etc.) E> if network infrastructure has a botteleck at a switch E> or the xdsl DSLAM. E> E> See also: E> https://sourceforge.net/p/mpd/discussion/44692/thread/c7abe70e3a/ E> E> Tested by: Klaus Fokuhl at SourceForge E> MFC after: 2 weeks E> --- E> share/man/man4/ng_pppoe.4 | 2 +- E> sys/netgraph/ng_pppoe.c | 22 ++++++++++++++++++++++ E> 2 files changed, 23 insertions(+), 1 deletion(-) E> E> diff --git a/share/man/man4/ng_pppoe.4 b/share/man/man4/ng_pppoe.4 E> index d9853a746512..ff53d4ef3a95 100644 E> --- a/share/man/man4/ng_pppoe.4 E> +++ b/share/man/man4/ng_pppoe.4 E> @@ -322,7 +322,7 @@ control message, when all session have been disconnected or when the E> hook is disconnected. E> .Sh SYSCTL VARIABLES E> The node can mark transmitted LCP Ethernet packets (protocol 0xc021) E> -with 3-bit Priority code point (PCP) referring to IEEE 802.1p E> +with 3-bit Priority Code Point (PCP) referring to IEEE 802.1p E> class of service with following E> .Xr sysctl 8 E> variable. E> diff --git a/sys/netgraph/ng_pppoe.c b/sys/netgraph/ng_pppoe.c E> index 8bc44e160044..5a327f95b930 100644 E> --- a/sys/netgraph/ng_pppoe.c E> +++ b/sys/netgraph/ng_pppoe.c E> @@ -49,8 +49,13 @@ E> #include E> #include E> #include E> +#include E> +#include E> #include E> #include E> +#include E> +#include E> +#include E> E> #include E> #include E> @@ -64,8 +69,19 @@ static MALLOC_DEFINE(M_NETGRAPH_PPPOE, "netgraph_pppoe", "netgraph pppoe node"); E> #define M_NETGRAPH_PPPOE M_NETGRAPH E> #endif E> E> +/* Some PPP protocol numbers we're interested in */ E> +#define PROT_LCP 0xc021 E> + E> #define SIGNOFF "session closed" E> E> +VNET_DEFINE_STATIC(u_int32_t, ng_pppoe_lcp_pcp) = 0; E> +#define V_ng_pppoe_lcp_pcp VNET(ng_pppoe_lcp_pcp) E> + E> +SYSCTL_NODE(_net_graph, OID_AUTO, pppoe, CTLFLAG_RW, 0, "PPPoE"); E> +SYSCTL_UINT(_net_graph_pppoe, OID_AUTO, lcp_pcp, E> + CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ng_pppoe_lcp_pcp), 0, E> + "Set PCP for LCP"); E> + E> /* E> * This section contains the netgraph method declarations for the E> * pppoe node. These methods define the netgraph pppoe 'type'. E> @@ -1438,6 +1454,12 @@ ng_pppoe_rcvdata(hook_p hook, item_p item) E> mtod(m, u_char *)[1] == 0x03) E> m_adj(m, 2); E> } E> + E> + if (V_ng_pppoe_lcp_pcp && m->m_pkthdr.len >= 2 && E> + m->m_len >= 2 && (m = m_pullup(m, 2)) && E> + mtod(m, uint16_t *)[0] == htons(PROT_LCP)) E> + EVL_APPLY_PRI(m, (uint8_t)(V_ng_pppoe_lcp_pcp & 0x7)); E> + E> /* E> * Bang in a pre-made header, and set the length up E> * to be correct. Then send it to the ethernet driver. So some packets sent by ng_ppp(4) need to be specially tagged so that vlan(4) understands them. Why do we make this tagging in ng_pppoe(4) rather than in ng_ppp(4)? -- Gleb Smirnoff