mbox series

[net-next,0/8] l2tp: rework pppol2tp ioctl handling

Message ID cover.1533895306.git.g.nault@alphalink.fr
Headers show
Series l2tp: rework pppol2tp ioctl handling | expand

Message

Guillaume Nault Aug. 10, 2018, 11:21 a.m. UTC
The current ioctl() handling code can be simplified. It tests for
non-relevant conditions and uselessly holds sockets. Once useless
code is removed, it becomes even simpler to let pppol2tp_ioctl() handle
commands directly, rather than dispatch them to pppol2tp_tunnel_ioctl()
or pppol2tp_session_ioctl(). That is the approach taken by this series.

Patch #1 and #2 define helper functions aimed at simplifying the rest
of the patch set.

Patch #3 drops useless tests in pppol2p_ioctl() and avoid holding a
refcount on the socket.

Patches #4, #5 and #6 are the core of the series. They let
pppol2tp_ioctl() handle all ioctls and drop the tunnel and session
specific functions.

Then patch #6 brings a little bit of consolidation.

Finally, patch #7 takes advantage of the simplified code to make
pppol2tp sockets compatible with dev_ioctl(). Certainly not a killer
feature, but it is trivial and it is always nice to see l2tp getting
better integration with the rest of the stack.

Guillaume Nault (8):
  l2tp: define l2tp_tunnel_uses_xfrm()
  l2tp: split l2tp_session_get()
  l2tp: simplify pppol2tp_ioctl()
  l2tp: handle PPPIOC[GS]MRU and PPPIOC[GS]FLAGS in pppol2tp_ioctl()
  l2tp: remove pppol2tp_tunnel_ioctl()
  l2tp: remove pppol2tp_session_ioctl()
  l2tp: zero out stats in pppol2tp_copy_stats()
  l2tp: let pppol2tp_ioctl() fallback to dev_ioctl()

 include/uapi/linux/ppp-ioctl.h |   2 +-
 net/l2tp/l2tp_core.c           |  50 +++----
 net/l2tp/l2tp_core.h           |  25 +++-
 net/l2tp/l2tp_ip.c             |   2 +-
 net/l2tp/l2tp_ip6.c            |   2 +-
 net/l2tp/l2tp_netlink.c        |  11 +-
 net/l2tp/l2tp_ppp.c            | 240 +++++++++++----------------------
 7 files changed, 133 insertions(+), 199 deletions(-)

Comments

David Miller Aug. 11, 2018, 7:19 p.m. UTC | #1
From: Guillaume Nault <g.nault@alphalink.fr>
Date: Fri, 10 Aug 2018 13:21:54 +0200

> The current ioctl() handling code can be simplified. It tests for
> non-relevant conditions and uselessly holds sockets. Once useless
> code is removed, it becomes even simpler to let pppol2tp_ioctl() handle
> commands directly, rather than dispatch them to pppol2tp_tunnel_ioctl()
> or pppol2tp_session_ioctl(). That is the approach taken by this series.
> 
> Patch #1 and #2 define helper functions aimed at simplifying the rest
> of the patch set.
> 
> Patch #3 drops useless tests in pppol2p_ioctl() and avoid holding a
> refcount on the socket.
> 
> Patches #4, #5 and #6 are the core of the series. They let
> pppol2tp_ioctl() handle all ioctls and drop the tunnel and session
> specific functions.
> 
> Then patch #6 brings a little bit of consolidation.
> 
> Finally, patch #7 takes advantage of the simplified code to make
> pppol2tp sockets compatible with dev_ioctl(). Certainly not a killer
> feature, but it is trivial and it is always nice to see l2tp getting
> better integration with the rest of the stack.

Very nice cleanups.

Let's leave the -ENOSYS stuff there for now, changing error return
codes seems to always break something :-/

Series applied, thanks!