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

-- 
2.18.0

Reply via email to