From nobody Mon May 02 14:57:19 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 044451AABC23; Mon, 2 May 2022 14:57:20 +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 4KsR5W6dC4z4X2Q; Mon, 2 May 2022 14:57:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651503439; 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=K5vXM785zC501PfUVSq6XuSxBkUFeMQ6MI6pazGRKOM=; b=BrCYuLBdzhe4EU4ju/KI8Z51rlPMx08Mf3DT+pEClqAysWFqsRAx+0KWDCohWsSvHq+k20 bdssEK/cfp6dH9Jc88oo+gkjhXsSgE3bWhryHCjZyR4ldMJonIuOYkBOZDH0LupMPfHsJY 9pbVDys6m/HmrCDJuIRIZBVil9yaXKvl2Xiwms8hv1gP4HBiVf1YPHJ3nOKDrL4l13PL2f LBLrYuOW9qPxd8HLBAgprhf8nxBvaHEXHVZWyp1Jc7P26ZtSzgwJsuKP39ZY+2X08a0468 0Sedbtwcl/ZvVdZeXHIV/J9vnEPrwrcWv+J0UpQMtTs769ziZvUEjLHams/rlA== 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 C36A53DBF; Mon, 2 May 2022 14:57:19 +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 242EvJS9003357; Mon, 2 May 2022 14:57:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 242EvJnm003356; Mon, 2 May 2022 14:57:19 GMT (envelope-from git) Date: Mon, 2 May 2022 14:57:19 GMT Message-Id: <202205021457.242EvJnm003356@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eugene Grosbein Subject: git: 28903f396af4 - main - ng_pppoe: introduce new sysctl net.graph.pppoe.lcp_pcp 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: eugen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28903f396af4b151e16ea606cda66a9244fb179f Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651503439; 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=K5vXM785zC501PfUVSq6XuSxBkUFeMQ6MI6pazGRKOM=; b=MOuDigLMugYgEf5EyDKnNFhBARW646KaUbUzlJlem8bFcrFJ0/AKwIc4e2VXKVD2bV5RRl r/xCS5hmn5/YZuFTS4B60VskipIg/4IaliuDXOyJc7q4f5uyH500Bluzga5aHMcA7CCr/t yXXIeLdM7ZyZ7qOs8lGGStTQ8Sj8A9dJlQ45NhP/7EVMsriVRuqb9sQGK850EUOJpT1Voe XypmlyOjAApNEBLwZwBux0wvJHCnM/oQ4HmTt2DOhCWFRjK0vViXmhRwe/mrDq2sqonnd+ vfaZROUtwcBWUIvlegTyvLB6iy9oklH5bfBU2zxxhA3aLFttoJtq0M0AkaDF7w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651503439; a=rsa-sha256; cv=none; b=Qm0ybZYg42U5oj8JsVZBT9oGB2pQzbtl901UQbt+uNbm0Qe7ibMN5qmY2ocOCgv68RHhQG PpMDQVHpe/K4nq3dVAhLH9w/o5amUX0QOFH1N7PNVs2TFJH6GnSFmrJyVSvsLur3fPRQGN QJ6VxrDGeYLQqUxUVBRLl2p9QPloqSPPyGzpFaDBchq9CQu4naLKIDbtCvHk/xHVadHLXz RPlTz95mMmTH0pr1gfSQj/Q0QAZ6k7TK2RpcSHXUoclvhRytHxXcJbJwa8FCxFqIXcsMaL selJGyA/dehhifipdY9ZlHveAdZu7dblqIEDijFOCmMLBmkJzahdGLyyd9zkRQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=28903f396af4b151e16ea606cda66a9244fb179f commit 28903f396af4b151e16ea606cda66a9244fb179f Author: Eugene Grosbein AuthorDate: 2022-05-02 14:55:24 +0000 Commit: Eugene Grosbein CommitDate: 2022-05-02 14:57:12 +0000 ng_pppoe: introduce new sysctl net.graph.pppoe.lcp_pcp This fixes incomplete commit 2e547442ab3822d3d7c46a68f152032ef5fe337c 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 MFC after: 2 weeks --- share/man/man4/ng_pppoe.4 | 2 +- sys/netgraph/ng_pppoe.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/share/man/man4/ng_pppoe.4 b/share/man/man4/ng_pppoe.4 index d9853a746512..ff53d4ef3a95 100644 --- a/share/man/man4/ng_pppoe.4 +++ b/share/man/man4/ng_pppoe.4 @@ -322,7 +322,7 @@ control message, when all session have been disconnected or when the 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 +with 3-bit Priority Code Point (PCP) referring to IEEE 802.1p class of service with following .Xr sysctl 8 variable. diff --git a/sys/netgraph/ng_pppoe.c b/sys/netgraph/ng_pppoe.c index 8bc44e160044..5a327f95b930 100644 --- a/sys/netgraph/ng_pppoe.c +++ b/sys/netgraph/ng_pppoe.c @@ -49,8 +49,13 @@ #include #include #include +#include +#include #include #include +#include +#include +#include #include #include @@ -64,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'. @@ -1438,6 +1454,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.