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 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

[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 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

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". > > > &

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 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 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

[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

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 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

[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

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: [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 > > > >

[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

[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 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

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

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 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 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 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 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

[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 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] 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

[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

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

[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

[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 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

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 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-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-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: 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: [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 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: [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: 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: 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:

[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

[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 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 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

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 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

[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 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 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

Re: [PATCH net] l2tp: fix l2tp_eth module loading

2017-09-28 Thread Tom Parkin
egister_ops(L2TP_PWTYPE_ETH, &l2tp_eth_nl_cmd_ops); > if (err) > - goto out; > - > - err = register_pernet_device(&l2tp_eth_net_ops); > - if (err) > - goto out_unreg; > + goto err; > > pr_info("L2TP ethernet pseudowire support (L2TPv3)\n"); > > return 0; > > -out_unreg: > - l2tp_nl_unregister_ops(L2TP_PWTYPE_ETH); > -out: > +err: > return err; > } > > static void __exit l2tp_eth_exit(void) > { > - unregister_pernet_device(&l2tp_eth_net_ops); > l2tp_nl_unregister_ops(L2TP_PWTYPE_ETH); > } > > -- > 2.14.2 > -- Tom Parkin Katalix Systems Ltd http://www.katalix.com Catalysts for your Embedded Linux software development signature.asc Description: Digital signature

[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 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 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 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 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

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

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 > >

[PATCH 24/29] l2tp: remove BUG_ON in l2tp_tunnel_closeall

2020-07-21 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 29/29] l2tp: WARN_ON rather than BUG_ON in l2tp_session_free

2020-07-21 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 10/29] l2tp: cleanup comparisons to NULL

2020-07-21 Thread Tom Parkin
pdate l2tp accordingly. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c| 20 ++-- net/l2tp/l2tp_debugfs.c | 12 ++-- net/l2tp/l2tp_ip.c | 2 +- net/l2tp/l2tp_ip6.c | 2 +- net/l2tp/l2tp_netlink.c | 23 +++ net/l2tp/l2tp_ppp.

[PATCH 20/29] l2tp: cleanup netlink send of tunnel address information

2020-07-21 Thread Tom Parkin
. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_netlink.c | 126 ++-- 1 file changed, 70 insertions(+), 56 deletions(-) diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c index ac5769ef8e20..8e03f2e367a0 100644 --- a/net/l2tp/l2tp_netlink.c +++ b/net

[PATCH 22/29] l2tp: cleanup kzalloc calls

2020-07-21 Thread Tom Parkin
Passing "sizeof(struct blah)" in kzalloc calls is less readable, potentially prone to future bugs if the type of the pointer is changed, and triggers checkpatch warnings. Tweak the kzalloc calls in l2tp which use this form to avoid the warning. Signed-off-by: Tom Parkin ---

[PATCH 26/29] l2tp: don't BUG_ON seqfile checks in l2tp_ppp

2020-07-21 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 | 7 ++- 1 file changed, 6 inser

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

2020-07-21 Thread Tom Parkin
checkpatch warned about the L2TP_SKB_CB macro's use of its argument: add braces to avoid the problem. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 177accb

[PATCH 06/29] l2tp: cleanup wonky alignment of line-broken function calls

2020-07-21 Thread Tom Parkin
Arguments should be aligned with the function call open parenthesis as per checkpatch. Tweak some function calls which were not aligned correctly. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c| 12 ++-- net/l2tp/l2tp_debugfs.c | 2 +- net/l2tp/l2tp_ppp.c | 2 +- 3 files

[PATCH 04/29] l2tp: cleanup excessive blank lines

2020-07-21 Thread Tom Parkin
checkpatch doesn't like multiple blank lines, or trailing blank lines at the end of functions. They serve no useful purpose, so remove these from the l2tp code. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c| 2 -- net/l2tp/l2tp_debugfs.c | 2 -- net/l2tp/l2tp_eth.c | 3 ---

[PATCH 27/29] l2tp: WARN_ON rather than BUG_ON in l2tp_session_queue_purge

2020-07-21 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 | 9 ++--- 1 file changed, 6 insertions(+), 3 del

[PATCH 07/29] l2tp: cleanup suspect code indent

2020-07-21 Thread Tom Parkin
l2tp_core has conditionally compiled code in l2tp_xmit_skb for IPv6 support. The structure of this code triggered a checkpatch warning due to incorrect indentation. Fix up the indentation to address the checkpatch warning. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 4 ++-- 1 file

[PATCH 12/29] l2tp: prefer seq_puts for unformatted output

2020-07-21 Thread Tom Parkin
checkpatch warns about use of seq_printf where seq_puts would do. Modify l2tp_debugfs accordingly. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/l2tp/l2tp_debugfs.c b/net/l2tp/l2tp_debugfs.c index 70759acf2ae9

[PATCH 21/29] l2tp: cleanup netlink tunnel create address handling

2020-07-21 Thread Tom Parkin
has conditionally compiled blocks to support IPv6. Rather than embedding these directly into l2tp_nl_cmd_tunnel_create (where it makes the code difficult to read and confuses checkpatch to boot) split the handling of address-related attributes into a separate function. Signed-off-by: Tom Parkin

[PATCH net-next 00/29] l2tp: cleanup checkpatch.pl warnings

2020-07-21 Thread Tom Parkin
ing returned in this scenario, but again, I prefer not to make such a change in this patchset. Tom Parkin (29): l2tp: cleanup whitespace around operators l2tp: tweak comment style for consistency l2tp: add a blank line following declarations l2tp: cleanup excessive blank lines l2tp: clean

[PATCH 13/29] l2tp: avoid multiple assignments

2020-07-21 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

[PATCH 19/29] l2tp: use a function to render tunnel address in l2tp_debugfs

2020-07-21 Thread Tom Parkin
ional compilation can be handled more cleanly. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_debugfs.c | 38 +- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/net/l2tp/l2tp_debugfs.c b/net/l2tp/l2tp_debugfs.c index 800a17b988be..d8cddc82da4b 100644 ---

[PATCH 25/29] l2tp: don't BUG_ON session magic checks in l2tp_ppp

2020-07-21 Thread Tom Parkin
he reference count on the suspect session structure. In the worst case scenario this results in a memory leak, which is preferable to a crash. Convert these uses of BUG_ON to WARN_ON accordingly. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_ppp.c | 13 + 1 file changed, 9 insertions

[PATCH 18/29] l2tp: WARN_ON rather than BUG_ON in l2tp_debugfs.c

2020-07-21 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 | 9

[PATCH 14/29] l2tp: line-break long function prototypes

2020-07-21 Thread Tom Parkin
-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 7218925edbf2..ef393604e66e 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c @@ -1398,7 +1398,8 @@ static int

[PATCH 09/29] l2tp: prefer using BIT macro

2020-07-21 Thread Tom Parkin
Use BIT(x) rather than (1< --- net/l2tp/l2tp_core.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h index f23b3ff7..2d2dd219a176 100644 --- a/net/l2tp/l2tp_core.h +++ b/net/l2tp/l2tp_core.h @@ -21,11 +21,11 @@ /* Per tunnel

[PATCH 08/29] l2tp: add identifier name in function pointer prototype

2020-07-21 Thread Tom Parkin
Reported by checkpatch: "WARNING: function definition argument 'struct sock *' should also have an identifier name" Add an identifier name to help document the prototype. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.h | 2 +- 1 file changed, 1 inse

[PATCH 16/29] l2tp: fix up incorrect comment in l2tp_recv_common

2020-07-21 Thread Tom Parkin
e code was incorrect and confusing. Fix up the comment accordingly. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 182386ad20e2..177accb01993 100644 --- a/net/l2tp/l2tp_core.c +++

[PATCH 05/29] l2tp: cleanup difficult-to-read line breaks

2020-07-21 Thread Tom Parkin
exceed 80 characters in width in some places. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_netlink.c | 71 + net/l2tp/l2tp_ppp.c | 6 ++-- 2 files changed, 32 insertions(+), 45 deletions(-) diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c

[PATCH 03/29] l2tp: add a blank line following declarations

2020-07-21 Thread Tom Parkin
checkpatch likes an empty line following declarations, which gives a visual prompt for where logic begins in a given block. Add blank lines in l2tp code to adhere to this guideline. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c| 2 ++ net/l2tp/l2tp_ip.c | 2 ++ net/l2tp

[PATCH 28/29] l2tp: remove BUG_ON refcount value in l2tp_session_free

2020-07-21 Thread Tom Parkin
l2tp_session_free is only called by l2tp_session_dec_refcount when the reference count reaches zero, so it's of limited value to validate the reference count value in l2tp_session_free itself. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 2 -- 1 file changed, 2 deletions(-) diff

[PATCH 11/29] l2tp: cleanup unnecessary braces in if statements

2020-07-21 Thread Tom Parkin
These checks are all simple and don't benefit from extra braces to clarify intent. Remove them for easier-reading code. Signed-off-by: Tom Parkin --- net/l2tp/l2tp_core.c | 6 +++--- net/l2tp/l2tp_ppp.c | 23 +-- 2 files changed, 12 insertions(+), 17 deletions(-)

  1   2   >