Message ID | 20200821104728.23530-2-tparkin@katalix.com |
---|---|
State | Changes Requested |
Delegated to: | David Miller |
Headers | show |
Series | l2tp: replace custom logging code with tracepoints | expand |
Hi Tom,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Tom-Parkin/l2tp-replace-custom-logging-code-with-tracepoints/20200821-184919
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git d0a84e1f38d9d6ae2dfab0b6c2407d667a265aa5
config: riscv-randconfig-r035-20200820 (attached as .config)
compiler: riscv32-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
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-but-set-variable]
663 | u32 ns = 0, nr = 0;
| ^~
# https://github.com/0day-ci/linux/commit/5b9d9c3057638c81876e600aa2210e4a3e35fa8d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tom-Parkin/l2tp-replace-custom-logging-code-with-tracepoints/20200821-184919
git checkout 5b9d9c3057638c81876e600aa2210e4a3e35fa8d
vim +/nr +663 net/l2tp/l2tp_core.c
b6dc01a43aaca24 James Chapman 2013-07-02 598
f7faffa3ff8ef6a James Chapman 2010-04-02 599 /* Do receive processing of L2TP data frames. We handle both L2TPv2
f7faffa3ff8ef6a James Chapman 2010-04-02 600 * and L2TPv3 data frames here.
f7faffa3ff8ef6a James Chapman 2010-04-02 601 *
f7faffa3ff8ef6a James Chapman 2010-04-02 602 * L2TPv2 Data Message Header
f7faffa3ff8ef6a James Chapman 2010-04-02 603 *
f7faffa3ff8ef6a James Chapman 2010-04-02 604 * 0 1 2 3
f7faffa3ff8ef6a James Chapman 2010-04-02 605 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
f7faffa3ff8ef6a James Chapman 2010-04-02 606 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
f7faffa3ff8ef6a James Chapman 2010-04-02 607 * |T|L|x|x|S|x|O|P|x|x|x|x| Ver | Length (opt) |
f7faffa3ff8ef6a James Chapman 2010-04-02 608 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
f7faffa3ff8ef6a James Chapman 2010-04-02 609 * | Tunnel ID | Session ID |
f7faffa3ff8ef6a James Chapman 2010-04-02 610 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
f7faffa3ff8ef6a James Chapman 2010-04-02 611 * | Ns (opt) | Nr (opt) |
f7faffa3ff8ef6a James Chapman 2010-04-02 612 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
f7faffa3ff8ef6a James Chapman 2010-04-02 613 * | Offset Size (opt) | Offset pad... (opt)
f7faffa3ff8ef6a James Chapman 2010-04-02 614 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
f7faffa3ff8ef6a James Chapman 2010-04-02 615 *
f7faffa3ff8ef6a James Chapman 2010-04-02 616 * Data frames are marked by T=0. All other fields are the same as
f7faffa3ff8ef6a James Chapman 2010-04-02 617 * those in L2TP control frames.
f7faffa3ff8ef6a James Chapman 2010-04-02 618 *
f7faffa3ff8ef6a James Chapman 2010-04-02 619 * L2TPv3 Data Message Header
f7faffa3ff8ef6a James Chapman 2010-04-02 620 *
f7faffa3ff8ef6a James Chapman 2010-04-02 621 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
f7faffa3ff8ef6a James Chapman 2010-04-02 622 * | L2TP Session Header |
f7faffa3ff8ef6a James Chapman 2010-04-02 623 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
f7faffa3ff8ef6a James Chapman 2010-04-02 624 * | L2-Specific Sublayer |
f7faffa3ff8ef6a James Chapman 2010-04-02 625 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
f7faffa3ff8ef6a James Chapman 2010-04-02 626 * | Tunnel Payload ...
f7faffa3ff8ef6a James Chapman 2010-04-02 627 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
f7faffa3ff8ef6a James Chapman 2010-04-02 628 *
f7faffa3ff8ef6a James Chapman 2010-04-02 629 * L2TPv3 Session Header Over IP
f7faffa3ff8ef6a James Chapman 2010-04-02 630 *
f7faffa3ff8ef6a James Chapman 2010-04-02 631 * 0 1 2 3
f7faffa3ff8ef6a James Chapman 2010-04-02 632 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
f7faffa3ff8ef6a James Chapman 2010-04-02 633 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
f7faffa3ff8ef6a James Chapman 2010-04-02 634 * | Session ID |
f7faffa3ff8ef6a James Chapman 2010-04-02 635 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
f7faffa3ff8ef6a James Chapman 2010-04-02 636 * | Cookie (optional, maximum 64 bits)...
f7faffa3ff8ef6a James Chapman 2010-04-02 637 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
f7faffa3ff8ef6a James Chapman 2010-04-02 638 * |
f7faffa3ff8ef6a James Chapman 2010-04-02 639 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
f7faffa3ff8ef6a James Chapman 2010-04-02 640 *
f7faffa3ff8ef6a James Chapman 2010-04-02 641 * L2TPv3 L2-Specific Sublayer Format
f7faffa3ff8ef6a James Chapman 2010-04-02 642 *
f7faffa3ff8ef6a James Chapman 2010-04-02 643 * 0 1 2 3
f7faffa3ff8ef6a James Chapman 2010-04-02 644 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
f7faffa3ff8ef6a James Chapman 2010-04-02 645 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
f7faffa3ff8ef6a James Chapman 2010-04-02 646 * |x|S|x|x|x|x|x|x| Sequence Number |
f7faffa3ff8ef6a James Chapman 2010-04-02 647 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
f7faffa3ff8ef6a James Chapman 2010-04-02 648 *
23fe846f9a48d53 Guillaume Nault 2018-01-05 649 * Cookie value and sublayer format are negotiated with the peer when
23fe846f9a48d53 Guillaume Nault 2018-01-05 650 * the session is set up. Unlike L2TPv2, we do not need to parse the
23fe846f9a48d53 Guillaume Nault 2018-01-05 651 * packet header to determine if optional fields are present.
f7faffa3ff8ef6a James Chapman 2010-04-02 652 *
f7faffa3ff8ef6a James Chapman 2010-04-02 653 * Caller must already have parsed the frame and determined that it is
f7faffa3ff8ef6a James Chapman 2010-04-02 654 * a data (not control) frame before coming here. Fields up to the
f7faffa3ff8ef6a James Chapman 2010-04-02 655 * session-id have already been parsed and ptr points to the data
f7faffa3ff8ef6a James Chapman 2010-04-02 656 * after the session-id.
fd558d186df2c13 James Chapman 2010-04-02 657 */
f7faffa3ff8ef6a James Chapman 2010-04-02 658 void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb,
f7faffa3ff8ef6a James Chapman 2010-04-02 659 unsigned char *ptr, unsigned char *optr, u16 hdrflags,
2b139e6b1ec86e1 Guillaume Nault 2018-07-25 660 int length)
fd558d186df2c13 James Chapman 2010-04-02 661 {
f7faffa3ff8ef6a James Chapman 2010-04-02 662 struct l2tp_tunnel *tunnel = session->tunnel;
95075150d0bdaa7 Tom Parkin 2020-07-24 @663 u32 ns = 0, nr = 0;
fd558d186df2c13 James Chapman 2010-04-02 664 int offset;
fd558d186df2c13 James Chapman 2010-04-02 665
f7faffa3ff8ef6a James Chapman 2010-04-02 666 /* Parse and check optional cookie */
f7faffa3ff8ef6a James Chapman 2010-04-02 667 if (session->peer_cookie_len > 0) {
f7faffa3ff8ef6a James Chapman 2010-04-02 668 if (memcmp(ptr, &session->peer_cookie[0], session->peer_cookie_len)) {
a4ca44fa578c7c7 Joe Perches 2012-05-16 669 l2tp_info(tunnel, L2TP_MSG_DATA,
f7faffa3ff8ef6a James Chapman 2010-04-02 670 "%s: cookie mismatch (%u/%u). Discarding.\n",
a4ca44fa578c7c7 Joe Perches 2012-05-16 671 tunnel->name, tunnel->tunnel_id,
a4ca44fa578c7c7 Joe Perches 2012-05-16 672 session->session_id);
7b7c0719cd7afee Tom Parkin 2013-03-19 673 atomic_long_inc(&session->stats.rx_cookie_discards);
f7faffa3ff8ef6a James Chapman 2010-04-02 674 goto discard;
f7faffa3ff8ef6a James Chapman 2010-04-02 675 }
f7faffa3ff8ef6a James Chapman 2010-04-02 676 ptr += session->peer_cookie_len;
f7faffa3ff8ef6a James Chapman 2010-04-02 677 }
f7faffa3ff8ef6a James Chapman 2010-04-02 678
fd558d186df2c13 James Chapman 2010-04-02 679 /* Handle the optional sequence numbers. Sequence numbers are
fd558d186df2c13 James Chapman 2010-04-02 680 * in different places for L2TPv2 and L2TPv3.
fd558d186df2c13 James Chapman 2010-04-02 681 *
fd558d186df2c13 James Chapman 2010-04-02 682 * If we are the LAC, enable/disable sequence numbers under
fd558d186df2c13 James Chapman 2010-04-02 683 * the control of the LNS. If no sequence numbers present but
fd558d186df2c13 James Chapman 2010-04-02 684 * we were expecting them, discard frame.
fd558d186df2c13 James Chapman 2010-04-02 685 */
fd558d186df2c13 James Chapman 2010-04-02 686 L2TP_SKB_CB(skb)->has_seq = 0;
f7faffa3ff8ef6a James Chapman 2010-04-02 687 if (tunnel->version == L2TP_HDR_VER_2) {
fd558d186df2c13 James Chapman 2010-04-02 688 if (hdrflags & L2TP_HDRFLAG_S) {
f7faffa3ff8ef6a James Chapman 2010-04-02 689 ns = ntohs(*(__be16 *)ptr);
fd558d186df2c13 James Chapman 2010-04-02 690 ptr += 2;
fd558d186df2c13 James Chapman 2010-04-02 691 nr = ntohs(*(__be16 *)ptr);
fd558d186df2c13 James Chapman 2010-04-02 692 ptr += 2;
fd558d186df2c13 James Chapman 2010-04-02 693
fd558d186df2c13 James Chapman 2010-04-02 694 /* Store L2TP info in the skb */
fd558d186df2c13 James Chapman 2010-04-02 695 L2TP_SKB_CB(skb)->ns = ns;
fd558d186df2c13 James Chapman 2010-04-02 696 L2TP_SKB_CB(skb)->has_seq = 1;
fd558d186df2c13 James Chapman 2010-04-02 697 }
f7faffa3ff8ef6a James Chapman 2010-04-02 698 } else if (session->l2specific_type == L2TP_L2SPECTYPE_DEFAULT) {
f7faffa3ff8ef6a James Chapman 2010-04-02 699 u32 l2h = ntohl(*(__be32 *)ptr);
f7faffa3ff8ef6a James Chapman 2010-04-02 700
f7faffa3ff8ef6a James Chapman 2010-04-02 701 if (l2h & 0x40000000) {
f7faffa3ff8ef6a James Chapman 2010-04-02 702 ns = l2h & 0x00ffffff;
f7faffa3ff8ef6a James Chapman 2010-04-02 703
f7faffa3ff8ef6a James Chapman 2010-04-02 704 /* Store L2TP info in the skb */
f7faffa3ff8ef6a James Chapman 2010-04-02 705 L2TP_SKB_CB(skb)->ns = ns;
f7faffa3ff8ef6a James Chapman 2010-04-02 706 L2TP_SKB_CB(skb)->has_seq = 1;
f7faffa3ff8ef6a James Chapman 2010-04-02 707 }
62e7b6a57c7b9bf Lorenzo Bianconi 2018-01-16 708 ptr += 4;
f7faffa3ff8ef6a James Chapman 2010-04-02 709 }
f7faffa3ff8ef6a James Chapman 2010-04-02 710
fd558d186df2c13 James Chapman 2010-04-02 711 if (L2TP_SKB_CB(skb)->has_seq) {
20dcb1107ab1a34 Tom Parkin 2020-07-22 712 /* Received a packet with sequence numbers. If we're the LAC,
fd558d186df2c13 James Chapman 2010-04-02 713 * check if we sre sending sequence numbers and if not,
fd558d186df2c13 James Chapman 2010-04-02 714 * configure it so.
fd558d186df2c13 James Chapman 2010-04-02 715 */
6c0ec37b8283463 Tom Parkin 2020-07-23 716 if (!session->lns_mode && !session->send_seq) {
a4ca44fa578c7c7 Joe Perches 2012-05-16 717 l2tp_info(session, L2TP_MSG_SEQ,
fd558d186df2c13 James Chapman 2010-04-02 718 "%s: requested to enable seq numbers by LNS\n",
fd558d186df2c13 James Chapman 2010-04-02 719 session->name);
3f9b9770b479986 Asbjørn Sloth Tønnesen 2016-11-07 720 session->send_seq = 1;
f7faffa3ff8ef6a James Chapman 2010-04-02 721 l2tp_session_set_header_len(session, tunnel->version);
fd558d186df2c13 James Chapman 2010-04-02 722 }
fd558d186df2c13 James Chapman 2010-04-02 723 } else {
fd558d186df2c13 James Chapman 2010-04-02 724 /* No sequence numbers.
fd558d186df2c13 James Chapman 2010-04-02 725 * If user has configured mandatory sequence numbers, discard.
fd558d186df2c13 James Chapman 2010-04-02 726 */
fd558d186df2c13 James Chapman 2010-04-02 727 if (session->recv_seq) {
a4ca44fa578c7c7 Joe Perches 2012-05-16 728 l2tp_warn(session, L2TP_MSG_SEQ,
a4ca44fa578c7c7 Joe Perches 2012-05-16 729 "%s: recv data has no seq numbers when required. Discarding.\n",
a4ca44fa578c7c7 Joe Perches 2012-05-16 730 session->name);
7b7c0719cd7afee Tom Parkin 2013-03-19 731 atomic_long_inc(&session->stats.rx_seq_discards);
fd558d186df2c13 James Chapman 2010-04-02 732 goto discard;
fd558d186df2c13 James Chapman 2010-04-02 733 }
fd558d186df2c13 James Chapman 2010-04-02 734
fd558d186df2c13 James Chapman 2010-04-02 735 /* If we're the LAC and we're sending sequence numbers, the
fd558d186df2c13 James Chapman 2010-04-02 736 * LNS has requested that we no longer send sequence numbers.
fd558d186df2c13 James Chapman 2010-04-02 737 * If we're the LNS and we're sending sequence numbers, the
fd558d186df2c13 James Chapman 2010-04-02 738 * LAC is broken. Discard the frame.
fd558d186df2c13 James Chapman 2010-04-02 739 */
6c0ec37b8283463 Tom Parkin 2020-07-23 740 if (!session->lns_mode && session->send_seq) {
a4ca44fa578c7c7 Joe Perches 2012-05-16 741 l2tp_info(session, L2TP_MSG_SEQ,
fd558d186df2c13 James Chapman 2010-04-02 742 "%s: requested to disable seq numbers by LNS\n",
fd558d186df2c13 James Chapman 2010-04-02 743 session->name);
fd558d186df2c13 James Chapman 2010-04-02 744 session->send_seq = 0;
f7faffa3ff8ef6a James Chapman 2010-04-02 745 l2tp_session_set_header_len(session, tunnel->version);
fd558d186df2c13 James Chapman 2010-04-02 746 } else if (session->send_seq) {
a4ca44fa578c7c7 Joe Perches 2012-05-16 747 l2tp_warn(session, L2TP_MSG_SEQ,
a4ca44fa578c7c7 Joe Perches 2012-05-16 748 "%s: recv data has no seq numbers when required. Discarding.\n",
a4ca44fa578c7c7 Joe Perches 2012-05-16 749 session->name);
7b7c0719cd7afee Tom Parkin 2013-03-19 750 atomic_long_inc(&session->stats.rx_seq_discards);
fd558d186df2c13 James Chapman 2010-04-02 751 goto discard;
fd558d186df2c13 James Chapman 2010-04-02 752 }
fd558d186df2c13 James Chapman 2010-04-02 753 }
fd558d186df2c13 James Chapman 2010-04-02 754
900631ee6a2651d James Chapman 2018-01-03 755 /* Session data offset is defined only for L2TPv2 and is
900631ee6a2651d James Chapman 2018-01-03 756 * indicated by an optional 16-bit value in the header.
f7faffa3ff8ef6a James Chapman 2010-04-02 757 */
f7faffa3ff8ef6a James Chapman 2010-04-02 758 if (tunnel->version == L2TP_HDR_VER_2) {
fd558d186df2c13 James Chapman 2010-04-02 759 /* If offset bit set, skip it. */
fd558d186df2c13 James Chapman 2010-04-02 760 if (hdrflags & L2TP_HDRFLAG_O) {
fd558d186df2c13 James Chapman 2010-04-02 761 offset = ntohs(*(__be16 *)ptr);
fd558d186df2c13 James Chapman 2010-04-02 762 ptr += 2 + offset;
fd558d186df2c13 James Chapman 2010-04-02 763 }
900631ee6a2651d James Chapman 2018-01-03 764 }
fd558d186df2c13 James Chapman 2010-04-02 765
fd558d186df2c13 James Chapman 2010-04-02 766 offset = ptr - optr;
fd558d186df2c13 James Chapman 2010-04-02 767 if (!pskb_may_pull(skb, offset))
fd558d186df2c13 James Chapman 2010-04-02 768 goto discard;
fd558d186df2c13 James Chapman 2010-04-02 769
fd558d186df2c13 James Chapman 2010-04-02 770 __skb_pull(skb, offset);
fd558d186df2c13 James Chapman 2010-04-02 771
fd558d186df2c13 James Chapman 2010-04-02 772 /* Prepare skb for adding to the session's reorder_q. Hold
fd558d186df2c13 James Chapman 2010-04-02 773 * packets for max reorder_timeout or 1 second if not
fd558d186df2c13 James Chapman 2010-04-02 774 * reordering.
fd558d186df2c13 James Chapman 2010-04-02 775 */
fd558d186df2c13 James Chapman 2010-04-02 776 L2TP_SKB_CB(skb)->length = length;
fd558d186df2c13 James Chapman 2010-04-02 777 L2TP_SKB_CB(skb)->expires = jiffies +
fd558d186df2c13 James Chapman 2010-04-02 778 (session->reorder_timeout ? session->reorder_timeout : HZ);
fd558d186df2c13 James Chapman 2010-04-02 779
fd558d186df2c13 James Chapman 2010-04-02 780 /* Add packet to the session's receive queue. Reordering is done here, if
fd558d186df2c13 James Chapman 2010-04-02 781 * enabled. Saved L2TP protocol info is stored in skb->sb[].
fd558d186df2c13 James Chapman 2010-04-02 782 */
fd558d186df2c13 James Chapman 2010-04-02 783 if (L2TP_SKB_CB(skb)->has_seq) {
b6dc01a43aaca24 James Chapman 2013-07-02 784 if (l2tp_recv_data_seq(session, skb))
fd558d186df2c13 James Chapman 2010-04-02 785 goto discard;
fd558d186df2c13 James Chapman 2010-04-02 786 } else {
fd558d186df2c13 James Chapman 2010-04-02 787 /* No sequence numbers. Add the skb to the tail of the
fd558d186df2c13 James Chapman 2010-04-02 788 * reorder queue. This ensures that it will be
fd558d186df2c13 James Chapman 2010-04-02 789 * delivered after all previous sequenced skbs.
fd558d186df2c13 James Chapman 2010-04-02 790 */
fd558d186df2c13 James Chapman 2010-04-02 791 skb_queue_tail(&session->reorder_q, skb);
fd558d186df2c13 James Chapman 2010-04-02 792 }
fd558d186df2c13 James Chapman 2010-04-02 793
fd558d186df2c13 James Chapman 2010-04-02 794 /* Try to dequeue as many skbs from reorder_q as we can. */
fd558d186df2c13 James Chapman 2010-04-02 795 l2tp_recv_dequeue(session);
fd558d186df2c13 James Chapman 2010-04-02 796
f7faffa3ff8ef6a James Chapman 2010-04-02 797 return;
fd558d186df2c13 James Chapman 2010-04-02 798
fd558d186df2c13 James Chapman 2010-04-02 799 discard:
7b7c0719cd7afee Tom Parkin 2013-03-19 800 atomic_long_inc(&session->stats.rx_errors);
fd558d186df2c13 James Chapman 2010-04-02 801 kfree_skb(skb);
f7faffa3ff8ef6a James Chapman 2010-04-02 802 }
ca7885dbcd899e6 Tom Parkin 2020-07-28 803 EXPORT_SYMBOL_GPL(l2tp_recv_common);
f7faffa3ff8ef6a James Chapman 2010-04-02 804
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
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-but-set-variable] > 663 | u32 ns = 0, nr = 0; > | ^ Thank you kernel test robot! I will incorporate a fix for this in a v2 patchset, but I'll wait a little while for any further review comments.
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 701fc72ad9f4..ce647816da61 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c @@ -694,10 +694,6 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, /* Store L2TP info in the skb */ L2TP_SKB_CB(skb)->ns = ns; L2TP_SKB_CB(skb)->has_seq = 1; - - l2tp_dbg(session, L2TP_MSG_SEQ, - "%s: recv data ns=%u, nr=%u, session nr=%u\n", - session->name, ns, nr, session->nr); } } else if (session->l2specific_type == L2TP_L2SPECTYPE_DEFAULT) { u32 l2h = ntohl(*(__be32 *)ptr); @@ -708,10 +704,6 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, /* Store L2TP info in the skb */ L2TP_SKB_CB(skb)->ns = ns; L2TP_SKB_CB(skb)->has_seq = 1; - - l2tp_dbg(session, L2TP_MSG_SEQ, - "%s: recv data ns=%u, session nr=%u\n", - session->name, ns, session->nr); } ptr += 4; } @@ -853,16 +845,6 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb) goto error; } - /* Trace packet contents, if enabled */ - if (tunnel->debug & L2TP_MSG_DATA) { - length = min(32u, skb->len); - if (!pskb_may_pull(skb, length)) - goto error; - - pr_debug("%s: recv\n", tunnel->name); - print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, skb->data, length); - } - /* Point to L2TP header */ optr = skb->data; ptr = skb->data; @@ -883,12 +865,8 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb) length = skb->len; /* If type is control packet, it is handled by userspace. */ - if (hdrflags & L2TP_HDRFLAG_T) { - l2tp_dbg(tunnel, L2TP_MSG_DATA, - "%s: recv control packet, len=%d\n", - tunnel->name, length); + if (hdrflags & L2TP_HDRFLAG_T) goto error; - } /* Skip flags */ ptr += 2; @@ -953,9 +931,6 @@ int l2tp_udp_encap_recv(struct sock *sk, struct sk_buff *skb) if (!tunnel) goto pass_up; - l2tp_dbg(tunnel, L2TP_MSG_DATA, "%s: received %d bytes\n", - tunnel->name, skb->len); - if (l2tp_udp_recv_core(tunnel, skb)) goto pass_up; @@ -1049,23 +1024,6 @@ static void l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb, unsigned int len = skb->len; int error; - /* Debug */ - if (session->send_seq) - l2tp_dbg(session, L2TP_MSG_DATA, "%s: send %zd bytes, ns=%u\n", - session->name, data_len, session->ns - 1); - else - l2tp_dbg(session, L2TP_MSG_DATA, "%s: send %zd bytes\n", - session->name, data_len); - - if (session->debug & L2TP_MSG_DATA) { - int uhlen = (tunnel->encap == L2TP_ENCAPTYPE_UDP) ? sizeof(struct udphdr) : 0; - unsigned char *datap = skb->data + uhlen; - - pr_debug("%s: xmit\n", session->name); - print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, - datap, min_t(size_t, 32, len - uhlen)); - } - /* Queue the packet to IP for output */ skb->ignore_df = 1; skb_dst_drop(skb); diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c index 7ed2b4eced94..657edad1263e 100644 --- a/net/l2tp/l2tp_eth.c +++ b/net/l2tp/l2tp_eth.c @@ -128,17 +128,6 @@ static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb, struct net_device *dev; struct l2tp_eth *priv; - if (session->debug & L2TP_MSG_DATA) { - unsigned int length; - - length = min(32u, skb->len); - if (!pskb_may_pull(skb, length)) - goto error; - - pr_debug("%s: eth recv\n", session->name); - print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, skb->data, length); - } - if (!pskb_may_pull(skb, ETH_HLEN)) goto error; diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index df2a35b5714a..7086d97f293c 100644 --- a/net/l2tp/l2tp_ip.c +++ b/net/l2tp/l2tp_ip.c @@ -118,7 +118,6 @@ static int l2tp_ip_recv(struct sk_buff *skb) struct l2tp_session *session; struct l2tp_tunnel *tunnel = NULL; struct iphdr *iph; - int length; if (!pskb_may_pull(skb, 4)) goto discard; @@ -147,20 +146,6 @@ static int l2tp_ip_recv(struct sk_buff *skb) if (!tunnel) goto discard_sess; - /* Trace packet contents, if enabled */ - if (tunnel->debug & L2TP_MSG_DATA) { - length = min(32u, skb->len); - if (!pskb_may_pull(skb, length)) - goto discard_sess; - - /* Point to L2TP header */ - optr = skb->data; - ptr = skb->data; - ptr += 4; - pr_debug("%s: ip recv\n", tunnel->name); - print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, ptr, length); - } - if (l2tp_v3_ensure_opt_in_linear(session, skb, &ptr, &optr)) goto discard_sess; diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c index bc757bc7e264..409ea8927f6c 100644 --- a/net/l2tp/l2tp_ip6.c +++ b/net/l2tp/l2tp_ip6.c @@ -131,7 +131,6 @@ static int l2tp_ip6_recv(struct sk_buff *skb) struct l2tp_session *session; struct l2tp_tunnel *tunnel = NULL; struct ipv6hdr *iph; - int length; if (!pskb_may_pull(skb, 4)) goto discard; @@ -160,20 +159,6 @@ static int l2tp_ip6_recv(struct sk_buff *skb) if (!tunnel) goto discard_sess; - /* Trace packet contents, if enabled */ - if (tunnel->debug & L2TP_MSG_DATA) { - length = min(32u, skb->len); - if (!pskb_may_pull(skb, length)) - goto discard_sess; - - /* Point to L2TP header */ - optr = skb->data; - ptr = skb->data; - ptr += 4; - pr_debug("%s: ip recv\n", tunnel->name); - print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, ptr, length); - } - if (l2tp_v3_ensure_opt_in_linear(session, skb, &ptr, &optr)) goto discard_sess; diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index 13c3153b40d6..ee1663a3ca7b 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c @@ -237,17 +237,9 @@ static void pppol2tp_recv(struct l2tp_session *session, struct sk_buff *skb, int if (sk->sk_state & PPPOX_BOUND) { struct pppox_sock *po; - l2tp_dbg(session, L2TP_MSG_DATA, - "%s: recv %d byte data frame, passing to ppp\n", - session->name, data_len); - po = pppox_sk(sk); ppp_input(&po->chan, skb); } else { - l2tp_dbg(session, L2TP_MSG_DATA, - "%s: recv %d byte data frame, passing to L2TP socket\n", - session->name, data_len); - if (sock_queue_rcv_skb(sk, skb) < 0) { atomic_long_inc(&session->stats.rx_errors); kfree_skb(skb);
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 <tparkin@katalix.com> --- net/l2tp/l2tp_core.c | 44 +------------------------------------------- net/l2tp/l2tp_eth.c | 11 ----------- net/l2tp/l2tp_ip.c | 15 --------------- net/l2tp/l2tp_ip6.c | 15 --------------- net/l2tp/l2tp_ppp.c | 8 -------- 5 files changed, 1 insertion(+), 92 deletions(-)