Skip to content

Commit

Permalink
Merge branch 'l2tp-replace-custom-logging-code-with-tracepoints'
Browse files Browse the repository at this point in the history
Tom Parkin says:

====================
l2tp: replace custom logging code with tracepoints

The l2tp subsystem implemented custom logging macros for debugging
purposes which were controlled using a set of debugging flags in each
tunnel and session structure.

A more standard and easier-to-use approach is to use tracepoints.

This patchset refactors l2tp to:

 * remove excessive logging
 * tweak useful log messages to use the standard pr_* calls for logging
   rather than the l2tp wrappers
 * replace debug-level logging with tracepoints
 * add tracepoints for capturing tunnel and session lifetime events

I note that checkpatch.pl warns about the layout of code in the
newly-added 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.

v1 -> v2

 * Fix up a build warning found by the kernel test robot
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Aug 22, 2020
2 parents 1aecbf1 + 9d048e5 commit d7223aa
Show file tree
Hide file tree
Showing 13 changed files with 302 additions and 287 deletions.
37 changes: 14 additions & 23 deletions Documentation/networking/l2tp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -455,31 +455,16 @@ l2tp help`` for more information.
Debugging
---------

The L2TP subsystem offers a debug scheme where kernel trace messages
may be optionally enabled per tunnel and per session. Care is needed
when debugging a live system since the messages are not rate-limited
and a busy system could be swamped. Userspace uses setsockopt on the
PPPoX socket to set a debug mask, or ``L2TP_ATTR_DEBUG`` in netlink
Create and Modify commands.
The L2TP subsystem offers a range of debugging interfaces through the
debugfs filesystem.

The following debug mask bits are defined:-

================ ==============================
L2TP_MSG_DEBUG verbose debug (if compiled in)
L2TP_MSG_CONTROL userspace - kernel interface
L2TP_MSG_SEQ sequence numbers handling
L2TP_MSG_DATA data packets
================ ==============================

Sessions inherit default debug flags from the parent tunnel.

If enabled, files under a l2tp debugfs directory can be used to dump
kernel state about L2TP tunnels and sessions. To access it, the
debugfs filesystem must first be mounted::
To access these interfaces, the debugfs filesystem must first be mounted::

# mount -t debugfs debugfs /debug

Files under the l2tp directory can then be accessed::
Files under the l2tp directory can then be accessed, providing a summary
of the current population of tunnel and session contexts existing in the
kernel::

# cat /debug/l2tp/tunnels

Expand All @@ -488,8 +473,14 @@ state information because the file format is subject to change. It is
implemented to provide extra debug information to help diagnose
problems. Applications should instead use the netlink API.

/proc/net/pppol2tp is also provided for backwards compatibility with
the original pppol2tp code. It lists information about L2TPv2
In addition the L2TP subsystem implements tracepoints using the standard
kernel event tracing API. The available L2TP events can be reviewed as
follows::

# find /debug/tracing/events/l2tp

Finally, /proc/net/pppol2tp is also provided for backwards compatibility
with the original pppol2tp code. It lists information about L2TPv2
tunnels and sessions only. Its use is discouraged.

Internal Implementation
Expand Down
2 changes: 1 addition & 1 deletion include/uapi/linux/if_pppol2tp.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct pppol2tpv3in6_addr {
};

/* Socket options:
* DEBUG - bitmask of debug message categories
* DEBUG - bitmask of debug message categories (not used)
* SENDSEQ - 0 => don't send packets with sequence numbers
* 1 => send packets with sequence numbers
* RECVSEQ - 0 => receive packet sequence numbers are optional
Expand Down
6 changes: 4 additions & 2 deletions include/uapi/linux/l2tp.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ enum {
L2TP_ATTR_VLAN_ID, /* u16 (not used) */
L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */
L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */
L2TP_ATTR_DEBUG, /* u32, enum l2tp_debug_flags */
L2TP_ATTR_DEBUG, /* u32, enum l2tp_debug_flags (not used) */
L2TP_ATTR_RECV_SEQ, /* u8 */
L2TP_ATTR_SEND_SEQ, /* u8 */
L2TP_ATTR_LNS_MODE, /* u8 */
Expand Down Expand Up @@ -177,7 +177,9 @@ enum l2tp_seqmode {
};

/**
* enum l2tp_debug_flags - debug message categories for L2TP tunnels/sessions
* enum l2tp_debug_flags - debug message categories for L2TP tunnels/sessions.
*
* Unused.
*
* @L2TP_MSG_DEBUG: verbose debug (if compiled in)
* @L2TP_MSG_CONTROL: userspace - kernel interface
Expand Down
2 changes: 2 additions & 0 deletions net/l2tp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

obj-$(CONFIG_L2TP) += l2tp_core.o

CFLAGS_l2tp_core.o += -I$(src)

# Build l2tp as modules if L2TP is M
obj-$(subst y,$(CONFIG_L2TP),$(CONFIG_PPPOL2TP)) += l2tp_ppp.o
obj-$(subst y,$(CONFIG_L2TP),$(CONFIG_L2TP_IP)) += l2tp_ip.o
Expand Down
Loading

0 comments on commit d7223aa

Please sign in to comment.