Re: A concurrency bug between l2tp_tunnel_register() and l2tp_xmit_core()

2021-04-14 Thread Tom Parkin
On Tue, Apr 13, 2021 at 17:30:17 +, Gong, Sishuai wrote: > Hi, > > We found a concurrency bug in linux 5.12-rc3 and we are able to reproduce it > under x86. This bug happens when two l2tp functions l2tp_tunnel_register() > and l2tp_xmit_core() are running in parallel. In general, > l2tp_tu

Re: Re: [BUG] net/ppp: A use after free in ppp_unregister_channe

2021-03-15 Thread Tom Parkin
On Mon, Mar 15, 2021 at 13:18:24 +0100, Guillaume Nault wrote: > On Fri, Mar 12, 2021 at 10:47:53PM +0800, lyl2...@mail.ustc.edu.cn wrote: > > > > > > > > > -原始邮件- > > > 发件人: "Tom Parkin" > > > 发送时间: 2021-03-12 18:12:

Re: Re: [BUG] net/ppp: A use after free in ppp_unregister_channe

2021-03-15 Thread Tom Parkin
On Fri, Mar 12, 2021 at 22:47:53 +0800, lyl2...@mail.ustc.edu.cn wrote: > > > > > -原始邮件----- > > 发件人: "Tom Parkin" > > 发送时间: 2021-03-12 18:12:58 (星期五) > > 收件人: lyl2...@mail.ustc.edu.cn > > 抄送: pau...@samba.org, da...@davemloft.net, linux

Re: [BUG] net/ppp: A use after free in ppp_unregister_channe

2021-03-12 Thread Tom Parkin
Thanks for the report! On Thu, Mar 11, 2021 at 20:34:44 +0800, lyl2...@mail.ustc.edu.cn wrote: > File: drivers/net/ppp/ppp_generic.c > > In ppp_unregister_channel, pch could be freed in ppp_unbridge_channels() > but after that pch is still in use. Inside the function ppp_unbridge_channels, > if

Re: [PATCH net v2] net: l2tp: reduce log level of messages in receive path, add counter instead

2021-03-03 Thread Tom Parkin
On Wed, Mar 03, 2021 at 16:50:49 +0100, Matthias Schiffer wrote: > Commit 5ee759cda51b ("l2tp: use standard API for warning log messages") > changed a number of warnings about invalid packets in the receive path > so that they are always shown, instead of only when a special L2TP debug > flag is s

Re: [PATCH net] net: l2tp: reduce log level when passing up invalid packets

2021-02-23 Thread Tom Parkin
On Mon, Feb 22, 2021 at 14:31:38 -0800, Jakub Kicinski wrote: > On Mon, 22 Feb 2021 17:40:16 +0100 Matthias Schiffer wrote: > > >> This will not be sufficient for my usecase: To stay compatible with older > > >> versions of fastd, I can't set the T flag in the first packet of the > > >> handshake,

Re: [PATCH net] net: l2tp: reduce log level when passing up invalid packets

2021-02-23 Thread Tom Parkin
On Mon, Feb 22, 2021 at 17:40:16 +0100, Matthias Schiffer wrote: > On 2/22/21 12:49 PM, Tom Parkin wrote: > > On Sat, Feb 20, 2021 at 10:56:33 +0100, Matthias Schiffer wrote: > > > On 2/19/21 9:12 PM, Tom Parkin wrote: > > > > On Fri, Feb 19, 2021 at 20:06:15

Re: [PATCH net] net: l2tp: reduce log level when passing up invalid packets

2021-02-22 Thread Tom Parkin
On Sat, Feb 20, 2021 at 10:56:33 +0100, Matthias Schiffer wrote: > On 2/19/21 9:12 PM, Tom Parkin wrote: > > On Fri, Feb 19, 2021 at 20:06:15 +0100, Matthias Schiffer wrote: > > > Before commit 5ee759cda51b ("l2tp: use standard API for warning log > > > messages&

Re: [PATCH net] net: l2tp: reduce log level when passing up invalid packets

2021-02-19 Thread Tom Parkin
Hi Matthias, Thanks for your patch! On Fri, Feb 19, 2021 at 20:06:15 +0100, Matthias Schiffer wrote: > Before commit 5ee759cda51b ("l2tp: use standard API for warning log > messages"), it was possible for userspace applications to use their own > control protocols on the backing sockets of an L2

Re: [PATCH v3 net-next 02/21] net: Introduce direct data placement tcp offload

2021-02-02 Thread Tom Parkin
t;ddp_crc != nskb->ddp_crc) > + goto end; > #endif > } > } > diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c > index 777306b5bc22..b114fc870513 100644 > --- a/net/ipv4/tcp_ipv4.c > +++ b/net/ipv4/tcp_ipv4.c > @@ -1810,6 +1810,9 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff > *skb) > TCP_SKB_CB(skb)->tcp_flags) & (TCPHDR_ECE | TCPHDR_CWR)) || > #ifdef CONFIG_TLS_DEVICE > tail->decrypted != skb->decrypted || > +#endif > +#ifdef CONFIG_TCP_DDP > + tail->ddp_crc != skb->ddp_crc || > #endif > thtail->doff != th->doff || > memcmp(thtail + 1, th + 1, hdrlen - sizeof(*th))) > diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c > index e09147ac9a99..3ce196375d94 100644 > --- a/net/ipv4/tcp_offload.c > +++ b/net/ipv4/tcp_offload.c > @@ -262,6 +262,9 @@ struct sk_buff *tcp_gro_receive(struct list_head *head, > struct sk_buff *skb) > #ifdef CONFIG_TLS_DEVICE > flush |= p->decrypted ^ skb->decrypted; > #endif > +#ifdef CONFIG_TCP_DDP > + flush |= p->ddp_crc ^ skb->ddp_crc; > +#endif > > if (flush || skb_gro_receive(p, skb)) { > mss = 1; > -- > 2.24.1 > -- Tom Parkin Katalix Systems Ltd https://katalix.com Catalysts for your Embedded Linux software development signature.asc Description: PGP signature

Re: [PATCH net v3] ppp: fix refcount underflow on channel unbridge

2021-01-11 Thread Tom Parkin
On Fri, Jan 08, 2021 at 21:57:50 +0100, Guillaume Nault wrote: > On Thu, Jan 07, 2021 at 06:13:15PM +0000, Tom Parkin wrote: > > When setting up a channel bridge, ppp_bridge_channels sets the > > pch->bridge field before taking the associated reference on the bridge

[PATCH net v3] ppp: fix refcount underflow on channel unbridge

2021-01-07 Thread Tom Parkin
before it is unset by the error path, it will erroneously drop the reference on the bridged channel and cause a refcount underflow. To avoid this, ensure that ppp_bridge_channels holds a reference on each channel in advance of setting the bridge pointers. Signed-off-by: Tom Parkin Fixes: 4cf4

[PATCH] ppp: fix refcount underflow on channel unbridge

2021-01-05 Thread Tom Parkin
When setting up a channel bridge, ppp_bridge_channels sets the pch->bridge field before taking the associated reference on the bridge file instance. This opens up a refcount underflow bug if ppp_bridge_channels called via. iotcl runs concurrently with ppp_unbridge_channels executing via. file rele

Re: [PATCH net] ppp: hold mutex when unbridging channels in unregister path

2020-12-24 Thread Tom Parkin
On Thu, Dec 24, 2020 at 11:28:18 +0100, Guillaume Nault wrote: > On Wed, Dec 23, 2020 at 06:47:30PM +0000, Tom Parkin wrote: > > Channels are bridged using the PPPIOCBRIDGECHAN ioctl, which executes > > with the ppp_mutex held. > > > > Unbridging may occur in two code

[PATCH net] ppp: hold mutex when unbridging channels in unregister path

2020-12-23 Thread Tom Parkin
underflow. To avoid this, hold the ppp_mutex while calling ppp_unbridge_channels in the shutdown path. This serialises the unbridge operation with any concurrently executing ioctl. Signed-off-by: Tom Parkin --- drivers/net/ppp/ppp_generic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/driv

Re: [PATCH v4 net-next 0/2] add ppp_generic ioctl(s) to bridge channels

2020-12-11 Thread Tom Parkin
On Thu, Dec 10, 2020 at 14:21:34 -0800, David Miller wrote: > From: Tom Parkin > Date: Thu, 10 Dec 2020 17:16:45 + > > > On Thu, Dec 10, 2020 at 18:13:09 +0100, Guillaume Nault wrote: > >> On Thu, Dec 10, 2020 at 03:50:56PM +, Tom Parkin wrote: > >> &g

Re: [PATCH v4 net-next 0/2] add ppp_generic ioctl(s) to bridge channels

2020-12-10 Thread Tom Parkin
On Thu, Dec 10, 2020 at 18:13:09 +0100, Guillaume Nault wrote: > On Thu, Dec 10, 2020 at 03:50:56PM +0000, Tom Parkin wrote: > > Following on from my previous RFC[1], this series adds two ioctl calls > > to the ppp code to implement "channel bridging". > > > &

[PATCH v4 net-next 1/2] ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls

2020-12-10 Thread Tom Parkin
rather than adding a new lock. The 'upl' lock is used to protect the existing unit pointer. Since the bridge effectively replaces the unit (they're mutually exclusive for a channel) it makes coding easier to use the same lock to cover them both. Signed-off-by: Tom Park

[PATCH v4 net-next 2/2] docs: update ppp_generic.rst to document new ioctls

2020-12-10 Thread Tom Parkin
Add documentation of the newly-added PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls. Signed-off-by: Tom Parkin --- Documentation/networking/ppp_generic.rst | 16 1 file changed, 16 insertions(+) diff --git a/Documentation/networking/ppp_generic.rst b/Documentation/networking

[PATCH v4 net-next 0/2] add ppp_generic ioctl(s) to bridge channels

2020-12-10 Thread Tom Parkin
ppp_disconnect_channel. * Improve docs update by including information on ioctl arguments and error return codes. Tom Parkin (2): ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls docs: update ppp_generic.rst to document new ioctls Documentation/networking/ppp_generi

Re: [PATCH v3 net-next 1/2] ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls

2020-12-10 Thread Tom Parkin
On Mon, Dec 07, 2020 at 17:22:28 +0100, Guillaume Nault wrote: > On Fri, Dec 04, 2020 at 04:36:55PM +0000, Tom Parkin wrote: > > + case PPPIOCBRIDGECHAN: > > + if (get_user(unit, p)) > > + break; > > +

[PATCH v3 net-next 1/2] ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls

2020-12-04 Thread Tom Parkin
rather than adding a new lock. The 'upl' lock is used to protect the existing unit pointer. Since the bridge effectively replaces the unit (they're mutually exclusive for a channel) it makes coding easier to use the same lock to cover them both. Signed-off-by: Tom Park

[PATCH v3 net-next 2/2] docs: update ppp_generic.rst to document new ioctls

2020-12-04 Thread Tom Parkin
Add documentation of the newly-added PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls. Signed-off-by: Tom Parkin --- Documentation/networking/ppp_generic.rst | 16 1 file changed, 16 insertions(+) diff --git a/Documentation/networking/ppp_generic.rst b/Documentation/networking

[PATCH v3 net-next 0/2] add ppp_generic ioctl(s) to bridge channels

2020-12-04 Thread Tom Parkin
part of a bridge: this better aligns with the return code from ppp_disconnect_channel. * Improve docs update by including information on ioctl arguments and error return codes. Tom Parkin (2): ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls docs: update ppp_gen

Re: [PATCH v2 net-next 1/2] ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls

2020-12-03 Thread Tom Parkin
On Thu, Dec 03, 2020 at 01:23:18 +0100, Guillaume Nault wrote: > On Tue, Dec 01, 2020 at 11:52:49AM +0000, Tom Parkin wrote: > > +static int ppp_bridge_channels(struct channel *pch, struct channel *pchb) > > +{ > > + write_lock_bh(&pch->upl); > > + if (pch

[PATCH v2 net-next 2/2] docs: update ppp_generic.rst to document new ioctls

2020-12-01 Thread Tom Parkin
Add documentation of the newly-added PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls. Signed-off-by: Tom Parkin --- Documentation/networking/ppp_generic.rst | 16 1 file changed, 16 insertions(+) diff --git a/Documentation/networking/ppp_generic.rst b/Documentation/networking

[PATCH v2 net-next 1/2] ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls

2020-12-01 Thread Tom Parkin
rather than adding a new lock. The 'upl' lock is used to protect the existing unit pointer. Since the bridge effectively replaces the unit (they're mutually exclusive for a channel) it makes coding easier to use the same lock to cover them both. Signed-off-by: Tom Park

[PATCH v2 net-next 0/2] add ppp_generic ioctl(s) to bridge channels

2020-12-01 Thread Tom Parkin
27;t part of a bridge: this better aligns with the return code from ppp_disconnect_channel. * Improve docs update by including information on ioctl arguments and error return codes. Tom Parkin (2): ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls docs: update ppp_g

Re: [PATCH net-next 1/2] ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls

2020-11-30 Thread Tom Parkin
On Fri, Nov 27, 2020 at 20:31:34 +0100, Guillaume Nault wrote: > On Thu, Nov 26, 2020 at 12:24:25PM +0000, Tom Parkin wrote: > > This new ioctl pair allows two ppp channels to be bridged together: > > frames arriving in one channel are transmitted in the other channel >

[PATCH net-next 2/2] docs: update ppp_generic.rst to document new ioctls

2020-11-26 Thread Tom Parkin
Add documentation of the newly-added PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls. Signed-off-by: Tom Parkin --- Documentation/networking/ppp_generic.rst | 9 + 1 file changed, 9 insertions(+) diff --git a/Documentation/networking/ppp_generic.rst b/Documentation/networking

[PATCH net-next 1/2] ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls

2020-11-26 Thread Tom Parkin
(rather than adding a new lock). Order of lock acquisition is maintained: i.e. the channel 'upl' lock is always acquired before 'downl' in code paths that need to hold both. Signed-off-by: Tom Parkin --- drivers/net/ppp/ppp_generic.c | 147 - inclu

[PATCH net-next 0/2] add ppp_generic ioctl(s) to bridge channels

2020-11-26 Thread Tom Parkin
p_ac_pppoe_tests_2 Tom Parkin (2): ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls docs: update ppp_generic.rst to document new ioctls Documentation/networking/ppp_generic.rst | 9 ++ drivers/net/ppp/ppp_generic.c| 143 ++- include/uapi

Re: [PATCH] Documentation: networking: Fix Column span alignment warnings in l2tp.rst

2020-11-19 Thread Tom Parkin
On Wed, Nov 18, 2020 at 16:44:11 +0530, siddhant gupta wrote: > On Wed, 18 Nov 2020 at 15:53, Tom Parkin wrote: > > > > On Tue, Nov 17, 2020 at 15:22:07 +0530, Siddhant Gupta wrote: > > > Fix Column span alignment problem warnings in the file > > > >

Re: [PATCH] Documentation: networking: Fix Column span alignment warnings in l2tp.rst

2020-11-18 Thread Tom Parkin
On Tue, Nov 17, 2020 at 15:22:07 +0530, Siddhant Gupta wrote: > Fix Column span alignment problem warnings in the file > Thanks for the patch, Siddhant. Could you provide some information on how these warnings were triggered? Using Sphinx 2.4.4 I can't reproduce any warnings for l2tp.rst using

Re: [RFC PATCH 0/2] add ppp_generic ioctl to bridge channels

2020-11-17 Thread Tom Parkin
On Tue, Nov 10, 2020 at 08:47:40 -0800, Jakub Kicinski wrote: > On Tue, 10 Nov 2020 10:28:34 +0100 Guillaume Nault wrote: > > On Mon, Nov 09, 2020 at 03:52:37PM -0800, Jakub Kicinski wrote: > > > On Fri, 6 Nov 2020 18:16:45 + Tom Parkin wrote: > > > > This

Re: [RFC PATCH 1/2] ppp: add PPPIOCBRIDGECHAN ioctl

2020-11-17 Thread Tom Parkin
On Sun, Nov 15, 2020 at 17:28:38 +0100, Guillaume Nault wrote: > On Tue, Nov 10, 2020 at 12:04:29PM +0000, Tom Parkin wrote: > > On Tue, Nov 10, 2020 at 00:24:01 +0100, Guillaume Nault wrote: > > > On Fri, Nov 06, 2020 at 06:16:46PM +

Re: [RFC PATCH 0/2] add ppp_generic ioctl to bridge channels

2020-11-17 Thread Tom Parkin
On Sun, Nov 15, 2020 at 12:59:59 +0100, Guillaume Nault wrote: > On Tue, Nov 10, 2020 at 11:54:07AM +0000, Tom Parkin wrote: > > On Mon, Nov 09, 2020 at 23:51:53 +0100, Guillaume Nault wrote: > > > BTW, shouldn't we have an "UNBRIDGE" command to remove the

Re: [RFC PATCH 0/2] add ppp_generic ioctl to bridge channels

2020-11-10 Thread Tom Parkin
On Tue, Nov 10, 2020 at 10:28:34 +0100, Guillaume Nault wrote: > On Mon, Nov 09, 2020 at 03:52:37PM -0800, Jakub Kicinski wrote: > > On Fri, 6 Nov 2020 18:16:45 + Tom Parkin wrote: > > > This small RFC series implements a suggestion from Guillaume Nault in > > &

Re: [RFC PATCH 1/2] ppp: add PPPIOCBRIDGECHAN ioctl

2020-11-10 Thread Tom Parkin
On Tue, Nov 10, 2020 at 00:24:01 +0100, Guillaume Nault wrote: > On Fri, Nov 06, 2020 at 06:16:46PM +0000, Tom Parkin wrote: > > + case PPPIOCBRIDGECHAN: > > + if (get_user(unit, p)) > > + break; > > +

Re: [RFC PATCH 0/2] add ppp_generic ioctl to bridge channels

2020-11-10 Thread Tom Parkin
On Mon, Nov 09, 2020 at 23:51:53 +0100, Guillaume Nault wrote: > > * I believe that the fact we're not explicitly locking anything in the > >ppp_input path for access to the channel bridge field is OK since: > > > > - ppp_input is called from the socket backlog recv > > > > - ppp

[RFC PATCH 2/2] docs: update ppp_generic.rst to describe ioctl PPPIOCBRIDGECHAN

2020-11-06 Thread Tom Parkin
--- Documentation/networking/ppp_generic.rst | 5 + 1 file changed, 5 insertions(+) diff --git a/Documentation/networking/ppp_generic.rst b/Documentation/networking/ppp_generic.rst index e60504377900..aea950ce953f 100644 --- a/Documentation/networking/ppp_generic.rst +++ b/Documentation/netw

[RFC PATCH 1/2] ppp: add PPPIOCBRIDGECHAN ioctl

2020-11-06 Thread Tom Parkin
This new ioctl allows two ppp channels to be bridged together: frames arriving in one channel are transmitted in the other channel and vice versa. The practical use for this is primarily to support the L2TP Access Concentrator use-case. The end-user session is presented as a ppp channel (typicall

[RFC PATCH 0/2] add ppp_generic ioctl to bridge channels

2020-11-06 Thread Tom Parkin
branch: https://github.com/katalix/go-l2tp/tree/tp_002_pppoe_2 [3]. l2tp-ktest: a test suite for the Linux Kernel L2TP subsystem https://github.com/katalix/l2tp-ktest Tom Parkin (2): ppp: add PPPIOCBRIDGECHAN ioctl docs: update ppp_generic.rst to describe ioctl PPPIOCBRIDGECHAN Documentation/netwo

Re: [PATCH net-next 5/6] l2tp: add ac_pppoe pseudowire driver

2020-10-01 Thread Tom Parkin
On Thu, Oct 01, 2020 at 07:56:40 -0700, Jakub Kicinski wrote: > On Wed, 30 Sep 2020 22:07:06 +0100 Tom Parkin wrote: > > The AC/PPPoE driver implements pseudowire type L2TP_PWTYPE_PPP_AC, for > > use in a PPPoE Access Concentrator configuration. Rather than > > termin

Re: [PATCH net-next 0/6] l2tp: add ac/pppoe driver

2020-10-01 Thread Tom Parkin
On Thu, Oct 01, 2020 at 14:26:17 +0200, Guillaume Nault wrote: > On Wed, Sep 30, 2020 at 10:07:01PM +0100, Tom Parkin wrote: > > L2TPv2 tunnels are often used as a part of a home broadband connection, > > using a PPP link to connect the subscriber network into the Internet > &g

[PATCH net-next 3/6] l2tp: allow v2 netlink session create to pass ifname attribute

2020-09-30 Thread Tom Parkin
handled by l2tp_netlink for L2TPv2 sessions. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_netlink.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c index 8ef1a579a2b1..2abfea82203d 100644 --- a/net/l2tp/l2tp_netlink.c +++ b

[PATCH net-next 6/6] docs: networking: update l2tp.rst to document PPP_AC pseudowires

2020-09-30 Thread Tom Parkin
Alongside this, add a bit more of a description of the PPP and ETH pseudowire types. Signed-off-by: Tom Parkin --- Documentation/networking/l2tp.rst | 69 ++- 1 file changed, 49 insertions(+), 20 deletions(-) diff --git a/Documentation/networking/l2tp.rst b

[PATCH net-next 2/6] l2tp: tweak netlink session create to allow L2TPv2 ac_pppoe

2020-09-30 Thread Tom Parkin
in L2TPv2 tunnels. Extend the l2tp_netlink sanity check to support PPP_AC. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_netlink.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c index 7045eb105e6a..8ef1a579a2b1 100644

[PATCH net-next 1/6] l2tp: add netlink info to session create callback

2020-09-30 Thread Tom Parkin
ff-by: Tom Parkin --- net/l2tp/l2tp_core.h| 4 +++- net/l2tp/l2tp_eth.c | 3 ++- net/l2tp/l2tp_netlink.c | 3 ++- net/l2tp/l2tp_ppp.c | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h index cb21d906343e..bd62a3e2c98d 100644

[PATCH net-next 0/6] l2tp: add ac/pppoe driver

2020-09-30 Thread Tom Parkin
ks it into the kernel configuration and build system. * Patch 6 updates the l2tp documentation under Documentation/ to include information about the new driver. Tom Parkin (6): l2tp: add netlink info to session create callback l2tp: tweak netlink session create to allow L2TPv2 ac_pp

[PATCH net-next 4/6] l2tp: add netlink attributes for ac_ppp session creation

2020-09-30 Thread Tom Parkin
The AC PPPoE driver will require userspace to pass in both the PPPoE session ID and the PPPoE peer's MAC address. Add netlink attributes to allow this to be conveyed in the session create command. Signed-off-by: Tom Parkin --- include/uapi/linux/l2tp.h | 2 ++ net/l2tp/l2tp_netlink.c

[PATCH net-next 5/6] l2tp: add ac_pppoe pseudowire driver

2020-09-30 Thread Tom Parkin
, to specify the name of the interface associated with the PPPoE session; * L2TP_ATTR_PPPOE_SESSION_ID, to specify the PPPoE session ID assigned to the session; * L2TP_ATTR_PPPOE_PEER_MAC_ADDR, to specify the MAC address of the PPPoE peer Signed-off-by: Tom Parkin --- net/l2tp/Kconfig

[PATCH net-next 1/1] l2tp: report rx cookie discards in netlink get

2020-09-29 Thread Tom Parkin
instances. Include the statistic in the netlink get response. Signed-off-by: Tom Parkin --- include/uapi/linux/l2tp.h | 1 + net/l2tp/l2tp_netlink.c | 6 ++ 2 files changed, 7 insertions(+) diff --git a/include/uapi/linux/l2tp.h b/include/uapi/linux/l2tp.h index 88a0d32b8c07..30c80d5ba4bf 100644

Re: [PATCH net-next 1/1] l2tp: report rx cookie discards in netlink get

2020-09-29 Thread Tom Parkin
On Mon, Sep 28, 2020 at 18:46:25 -0700, David Miller wrote: > From: Tom Parkin > Date: Mon, 28 Sep 2020 13:46:34 +0100 > > > --- a/include/uapi/linux/l2tp.h > > +++ b/include/uapi/linux/l2tp.h > > @@ -143,6 +143,7 @@ enum { > > L2TP_

[PATCH net-next 1/1] l2tp: report rx cookie discards in netlink get

2020-09-28 Thread Tom Parkin
instances. Include the statistic in the netlink get response. Signed-off-by: Tom Parkin --- include/uapi/linux/l2tp.h | 1 + net/l2tp/l2tp_netlink.c | 6 ++ 2 files changed, 7 insertions(+) diff --git a/include/uapi/linux/l2tp.h b/include/uapi/linux/l2tp.h index 88a0d32b8c07..7bf92e0606af 100644

[PATCH net-next 1/1] l2tp: fix up inconsistent rx/tx statistics

2020-09-18 Thread Tom Parkin
updated correctly. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 7de05be4fc33..7be5103ff2a8 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c @@ -1006,7

[PATCH net-next 3/6] l2tp: drop net argument from l2tp_tunnel_create

2020-09-03 Thread Tom Parkin
The argument is unused, so remove it. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c| 2 +- net/l2tp/l2tp_core.h| 2 +- net/l2tp/l2tp_netlink.c | 2 +- net/l2tp/l2tp_ppp.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp

[PATCH net-next 5/6] l2tp: make magic feather checks more useful

2020-09-03 Thread Tom Parkin
rence count sanity checking * Add session magic validation in pppol2tp_ioctl. On failure return -EBADF, which mirrors the approach in pppol2tp_[sg]etsockopt. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 40 ++-- net/l2tp/l2tp_core.h | 5 + net

[PATCH net-next 2/6] l2tp: drop data_len argument from l2tp_xmit_core

2020-09-03 Thread Tom Parkin
The data_len argument passed to l2tp_xmit_core is no longer used, so remove it. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index c95b58b2ab3c..4a8fb285fada 100644 --- a

[PATCH net-next 6/6] l2tp: avoid duplicated code in l2tp_tunnel_closeall

2020-09-03 Thread Tom Parkin
is very minor potential loss of efficiency to avoid duplication of the session delete code. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 14 +- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index b02b3cc67df0..7de05be4fc33

[PATCH net-next 1/6] l2tp: remove header length param from l2tp_xmit_skb

2020-09-03 Thread Tom Parkin
All callers pass the session structure's hdr_len field as the header length parameter to l2tp_xmit_skb. Since we're passing a pointer to the session structure to l2tp_xmit_skb anyway, there's not much point breaking the header length out as a separate argument. Signed-off

[PATCH net-next 0/6] l2tp: miscellaneous cleanups

2020-09-03 Thread Tom Parkin
magic feather" validation in l2tp to check for sk_user_data (ab)use as opposed to refcount debugging * remove some duplicated code Tom Parkin (6): l2tp: remove header length param from l2tp_xmit_skb l2tp: drop data_len argument from l2tp_xmit_core l2tp: drop net argument from l2tp_tun

[PATCH net-next 4/6] l2tp: capture more tx errors in data plane stats

2020-09-03 Thread Tom Parkin
error paths. l2tp_xmit_skb now leaves all the actual work of transmission to l2tp_xmit_core, and updates the statistics based on l2tp_xmit_core's return code. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 71 +++- 1 file changed, 37 inser

[PATCH net-next v2 8/9] l2tp: remove tunnel and session debug flags field

2020-08-22 Thread Tom Parkin
messages handle the getting and setting of debug flags. To avoid userspace breakage don't modify the API of these calls; simply ignore set requests, and send dummy data for get requests. Signed-off-by: Tom Parkin --- include/uapi/linux/if_pppol2tp.h | 2 +- include/uapi/linux/l2tp.h

[PATCH net-next v2 9/9] docs: networking: add tracepoint info to l2tp.rst

2020-08-22 Thread Tom Parkin
Update l2tp.rst to: * remove information about the obsolete debug flags and their use * include information about tracepoints for l2tp Signed-off-by: Tom Parkin --- Documentation/networking/l2tp.rst | 37 --- 1 file changed, 14 insertions(+), 23 deletions(-) diff

[PATCH net-next v2 5/9] l2tp: add tracepoint definitions in trace.h

2020-08-22 Thread Tom Parkin
. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.h | 6 +- net/l2tp/trace.h | 196 +++ 2 files changed, 200 insertions(+), 2 deletions(-) diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h index 3468d6b177a0..835c4645a0ec 100644 --- a/net/l2tp

[PATCH net-next v2 6/9] l2tp: add tracepoints to l2tp_core.c

2020-08-22 Thread Tom Parkin
Add lifetime event tracing for tunnel and session instances, tracking tunnel and session registration, deletion, and eventual freeing. Port the data path sequence number debug logging to use trace points rather than custom debug macros. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 83

[PATCH net-next v2 1/9] l2tp: don't log data frames

2020-08-22 Thread Tom Parkin
l2tp had logging to trace data frame receipt and transmission, including code to dump packet contents. This was originally intended to aid debugging of core l2tp packet handling, but is of limited use now that code is stable. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 58

[PATCH net-next v2 3/9] l2tp: use standard API for warning log messages

2020-08-22 Thread Tom Parkin
apath warnings without needing to tweak the debug flags setting for a given tunnel or session instance. Modify l2tp_warn callsites to use pr_warn_ratelimited instead for unconditional output of warning messages. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c

[PATCH net-next v2 0/9] l2tp: replace custom logging code with tracepoints

2020-08-22 Thread Tom Parkin
v1 -> v2 * Fix up a build warning found by the kernel test robot Tom Parkin (9): l2tp: don't log data frames l2tp: remove noisy logging, use appropriate log levels l2tp: use standard API for warning log messages l2tp: add tracepoint infrastructure to core l2tp: add tracepoint defi

[PATCH net-next v2 7/9] l2tp: remove custom logging macros

2020-08-22 Thread Tom Parkin
All l2tp's informational and warning logging is now carried out using standard kernel APIs. Debugging information is now handled using tracepoints. Now that no code is using the custom logging macros, remove them from l2tp_core.h. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.h

[PATCH net-next v2 2/9] l2tp: remove noisy logging, use appropriate log levels

2020-08-22 Thread Tom Parkin
l2tp_ppp in particular had a lot of log messages for tracing [get|set]sockopt calls. These aren't especially useful, so remove these messages. Several log messages flagging error conditions were logged using l2tp_info: they're better off as l2tp_warn. Signed-off-by: Tom Parkin ---

[PATCH net-next v2 4/9] l2tp: add tracepoint infrastructure to core

2020-08-22 Thread Tom Parkin
The l2tp subsystem doesn't currently make use of tracepoints. As a starting point for adding tracepoints, add skeleton infrastructure for defining tracepoints for the subsystem, and for having them build appropriately whether compiled into the kernel or built as a module. Signed-off-by

Re: [PATCH 1/9] l2tp: don't log data frames

2020-08-21 Thread Tom Parkin
On Fri, Aug 21, 2020 at 20:28:59 +0800, kernel test robot wrote: > Hi Tom, > > Thank you for the patch! Perhaps something to improve: > [snip] > >net/l2tp/l2tp_core.c: In function 'l2tp_recv_common': > >> net/l2tp/l2tp_core.c:663:14: warning: variable 'nr' set but not used > >> [-Wunused-b

[PATCH 3/9] l2tp: use standard API for warning log messages

2020-08-21 Thread Tom Parkin
apath warnings without needing to tweak the debug flags setting for a given tunnel or session instance. Modify l2tp_warn callsites to use pr_warn_ratelimited instead for unconditional output of warning messages. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c

[PATCH 7/9] l2tp: remove custom logging macros

2020-08-21 Thread Tom Parkin
All l2tp's informational and warning logging is now carried out using standard kernel APIs. Debugging information is now handled using tracepoints. Now that no code is using the custom logging macros, remove them from l2tp_core.h. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.h

[PATCH 8/9] l2tp: remove tunnel and session debug flags field

2020-08-21 Thread Tom Parkin
messages handle the getting and setting of debug flags. To avoid userspace breakage don't modify the API of these calls; simply ignore set requests, and send dummy data for get requests. Signed-off-by: Tom Parkin --- include/uapi/linux/if_pppol2tp.h | 2 +- include/uapi/linux/l2tp.h

[PATCH 4/9] l2tp: add tracepoint infrastructure to core

2020-08-21 Thread Tom Parkin
The l2tp subsystem doesn't currently make use of tracepoints. As a starting point for adding tracepoints, add skeleton infrastructure for defining tracepoints for the subsystem, and for having them build appropriately whether compiled into the kernel or built as a module. Signed-off-by

[PATCH 5/9] l2tp: add tracepoint definitions in trace.h

2020-08-21 Thread Tom Parkin
. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.h | 6 +- net/l2tp/trace.h | 196 +++ 2 files changed, 200 insertions(+), 2 deletions(-) diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h index 3468d6b177a0..835c4645a0ec 100644 --- a/net/l2tp

[PATCH 2/9] l2tp: remove noisy logging, use appropriate log levels

2020-08-21 Thread Tom Parkin
l2tp_ppp in particular had a lot of log messages for tracing [get|set]sockopt calls. These aren't especially useful, so remove these messages. Several log messages flagging error conditions were logged using l2tp_info: they're better off as l2tp_warn. Signed-off-by: Tom Parkin ---

[PATCH 6/9] l2tp: add tracepoints to l2tp_core.c

2020-08-21 Thread Tom Parkin
Add lifetime event tracing for tunnel and session instances, tracking tunnel and session registration, deletion, and eventual freeing. Port the data path sequence number debug logging to use trace points rather than custom debug macros. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 83

[PATCH 9/9] docs: networking: add tracepoint info to l2tp.rst

2020-08-21 Thread Tom Parkin
Update l2tp.rst to: * remove information about the obsolete debug flags and their use * include information about tracepoints for l2tp Signed-off-by: Tom Parkin --- Documentation/networking/l2tp.rst | 37 --- 1 file changed, 14 insertions(+), 23 deletions(-) diff

[PATCH 1/9] l2tp: don't log data frames

2020-08-21 Thread Tom Parkin
l2tp had logging to trace data frame receipt and transmission, including code to dump packet contents. This was originally intended to aid debugging of core l2tp packet handling, but is of limited use now that code is stable. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 44

[PATCH net-next 0/9] l2tp: replace custom logging code with tracepoints

2020-08-21 Thread Tom Parkin
file net/l2tp/trace.h. When adding this file I followed the example(s) of other tracepoint files in the net/ subtree since it seemed preferable to adhere to the prevailing style rather than follow checkpatch.pl's advice in this instance. If that's the wrong approach please let me know. Tom

Re: [PATCH 17/29] l2tp: avoid precidence issues in L2TP_SKB_CB macro

2020-07-28 Thread Tom Parkin
On Tue, Jul 28, 2020 at 11:08:45 -0700, Joe Perches wrote: > On Tue, 2020-07-28 at 09:21 -0700, Joe Perches wrote: > > On Tue, 2020-07-21 at 18:32 +0100, Tom Parkin wrote: > > > checkpatch warned about the L2TP_SKB_CB macro's use of its argument: add > >

Re: [PATCH 0/6] l2tp: tidy up l2tp core API

2020-07-28 Thread Tom Parkin
On Tue, Jul 28, 2020 at 18:20:27 +0100, Tom Parkin wrote: > This short series makes some minor tidyup changes to the L2TP core API. I'm sorry, I forgot the "net-next" prefix in the subject line. Please let me know if I should resubmit. signature.asc Description: PGP signature

[PATCH 0/6] l2tp: tidy up l2tp core API

2020-07-28 Thread Tom Parkin
This short series makes some minor tidyup changes to the L2TP core API. Tom Parkin (6): l2tp: don't export __l2tp_session_unhash l2tp: don't export tunnel and session free functions l2tp: return void from l2tp_session_delete l2tp: remove build_header callback in struct l2tp_sess

[PATCH 3/6] l2tp: return void from l2tp_session_delete

2020-07-28 Thread Tom Parkin
pseudowires currently use l2tp_session_delete for their implementation of that operation. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c| 9 ++--- net/l2tp/l2tp_core.h| 4 ++-- net/l2tp/l2tp_netlink.c | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/net/l2tp

[PATCH 2/6] l2tp: don't export tunnel and session free functions

2020-07-28 Thread Tom Parkin
ot be declared as inline. Since the codepaths which take and drop tunnel and session references are not directly in the datapath this shouldn't cause performance issues. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 60 ++-- net/l2tp/l2tp_c

[PATCH 5/6] l2tp: tweak exports for l2tp_recv_common and l2tp_ioctl

2020-07-28 Thread Tom Parkin
ort policy. Change these exports to use EXPORT_SYMBOL_GPL for consistency with the rest of l2tp. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 2 +- net/l2tp/l2tp_ip.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 39

[PATCH 6/6] l2tp: improve API documentation in l2tp_core.h

2020-07-28 Thread Tom Parkin
* Improve the description of the key l2tp subsystem data structures. * Add high-level description of the main APIs for interacting with l2tp core. * Add documentation for the l2tp netlink session command callbacks. * Document the session pseudowire callbacks. Signed-off-by: Tom Parkin

[PATCH 1/6] l2tp: don't export __l2tp_session_unhash

2020-07-28 Thread Tom Parkin
Since the function is no longer used outside l2tp_core.c, remove the "__" prefix since we don't need to indicate anything special about its expected use to callers. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 57 net/l2tp/l2

[PATCH 4/6] l2tp: remove build_header callback in struct l2tp_session

2020-07-28 Thread Tom Parkin
nd we save on the function pointer in the session structure). This approach does mean dereferencing the parent tunnel structure in order to determine the tunnel version, but we're doing that in the transmit path in any case. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 10 --

[PATCH 4/9] l2tp: remove BUG_ON in l2tp_tunnel_closeall

2020-07-24 Thread Tom Parkin
emove it to avoid the warning. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index a1ed8baa5aaa..6be3f2e69efd 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c @@ -1188,8 +1188,6 @@ s

[PATCH net-next 0/9] l2tp: avoid multiple assignment, remove BUG_ON

2020-07-24 Thread Tom Parkin
l2tp hasn't been kept up to date with the static analysis checks offered by checkpatch.pl. This patchset builds on the series: "l2tp: cleanup checkpatch.pl warnings" and "l2tp: further checkpatch.pl cleanups" to resolve some of the remaining checkpatch warnings in l2tp

[PATCH 2/9] l2tp: WARN_ON rather than BUG_ON in l2tp_dfs_seq_start

2020-07-24 Thread Tom Parkin
l2tp_dfs_seq_start had a BUG_ON to catch a possible programming error in l2tp_dfs_seq_open. Since we can easily bail out of l2tp_dfs_seq_start, prefer to do that and flag the error with a WARN_ON rather than crashing the kernel. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_debugfs.c | 5

[PATCH 6/9] l2tp: don't BUG_ON seqfile checks in l2tp_ppp

2020-07-24 Thread Tom Parkin
eturn NULL in order to terminate the seq file processing in much the same way as we do when reaching the end of tunnel/session instances to render. Retain a WARN_ON to help trace possible bugs in this area. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_ppp.c | 6 +- 1 file changed, 5 inser

[PATCH 9/9] l2tp: WARN_ON rather than BUG_ON in l2tp_session_free

2020-07-24 Thread Tom Parkin
ption, we can avoid doing more damage by simply leaving the tunnel structure alone. If the tunnel refcount isn't dropped when it should be, the tunnel instance will remain in the kernel, resulting in the tunnel structure and socket leaking. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_

[PATCH 7/9] l2tp: WARN_ON rather than BUG_ON in l2tp_session_queue_purge

2020-07-24 Thread Tom Parkin
t; flag to protect against shutdown races. While we're here, have l2tp_session_queue_purge return void rather than an integer, since neither of the callsites checked the return value. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 7 --- 1 file changed, 4 insertions(+), 3 del

[PATCH 1/9] l2tp: avoid multiple assignments

2020-07-24 Thread Tom Parkin
checkpatch warns about multiple assignments. Update l2tp accordingly. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 6 +++--- net/l2tp/l2tp_ip.c | 12 net/l2tp/l2tp_ip6.c | 6 -- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/net/l2tp/l2tp_core.c b

  1   2   >