10 Dec, 2014

1 commit


24 Nov, 2014

1 commit


22 Nov, 2014

1 commit


06 Nov, 2014

1 commit

  • This encapsulates all of the skb_copy_datagram_iovec() callers
    with call argument signature "skb, offset, msghdr->msg_iov, length".

    When we move to iov_iters in the networking, the iov_iter object will
    sit in the msghdr.

    Having a helper like this means there will be less places to touch
    during that transformation.

    Based upon descriptions and patch from Al Viro.

    Signed-off-by: David S. Miller

    David S. Miller
     

20 Sep, 2014

1 commit


08 Sep, 2014

1 commit


06 Sep, 2014

2 commits

  • This syntax error was covered by L2TP_REFCNT_DEBUG not being set by
    default.

    Signed-off-by: Andy Zhou
    Signed-off-by: David S. Miller

    Andy Zhou
     
  • Use dst_entry held by sk_dst_get() to retrieve tunnel's PMTU.

    The dst_mtu(__sk_dst_get(tunnel->sock)) call was racy. __sk_dst_get()
    could return NULL if tunnel->sock->sk_dst_cache was reset just before the
    call, thus making dst_mtu() dereference a NULL pointer:

    [ 1937.661598] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
    [ 1937.664005] IP: [] pppol2tp_connect+0x33d/0x41e [l2tp_ppp]
    [ 1937.664005] PGD daf0c067 PUD d9f93067 PMD 0
    [ 1937.664005] Oops: 0000 [#1] SMP
    [ 1937.664005] Modules linked in: l2tp_ppp l2tp_netlink l2tp_core ip6table_filter ip6_tables iptable_filter ip_tables ebtable_nat ebtables x_tables udp_tunnel pppoe pppox ppp_generic slhc deflate ctr twofish_generic twofish_x86_64_3way xts lrw gf128mul glue_helper twofish_x86_64 twofish_common blowfish_generic blowfish_x86_64 blowfish_common des_generic cbc xcbc rmd160 sha512_generic hmac crypto_null af_key xfrm_algo 8021q garp bridge stp llc tun atmtcp clip atm ext3 mbcache jbd iTCO_wdt coretemp kvm_intel iTCO_vendor_support kvm pcspkr evdev ehci_pci lpc_ich mfd_core i5400_edac edac_core i5k_amb shpchp button processor thermal_sys xfs crc32c_generic libcrc32c dm_mod usbhid sg hid sr_mod sd_mod cdrom crc_t10dif crct10dif_common ata_generic ahci ata_piix tg3 libahci libata uhci_hcd ptp ehci_hcd pps_core usbcore scsi_mod libphy usb_common [last unloaded: l2tp_core]
    [ 1937.664005] CPU: 0 PID: 10022 Comm: l2tpstress Tainted: G O 3.17.0-rc1 #1
    [ 1937.664005] Hardware name: HP ProLiant DL160 G5, BIOS O12 08/22/2008
    [ 1937.664005] task: ffff8800d8fda790 ti: ffff8800c43c4000 task.ti: ffff8800c43c4000
    [ 1937.664005] RIP: 0010:[] [] pppol2tp_connect+0x33d/0x41e [l2tp_ppp]
    [ 1937.664005] RSP: 0018:ffff8800c43c7de8 EFLAGS: 00010282
    [ 1937.664005] RAX: ffff8800da8a7240 RBX: ffff8800d8c64600 RCX: 000001c325a137b5
    [ 1937.664005] RDX: 8c6318c6318c6320 RSI: 000000000000010c RDI: 0000000000000000
    [ 1937.664005] RBP: ffff8800c43c7ea8 R08: 0000000000000000 R09: 0000000000000000
    [ 1937.664005] R10: ffffffffa048e2c0 R11: ffff8800d8c64600 R12: ffff8800ca7a5000
    [ 1937.664005] R13: ffff8800c439bf40 R14: 000000000000000c R15: 0000000000000009
    [ 1937.664005] FS: 00007fd7f610f700(0000) GS:ffff88011a600000(0000) knlGS:0000000000000000
    [ 1937.664005] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    [ 1937.664005] CR2: 0000000000000020 CR3: 00000000d9d75000 CR4: 00000000000027e0
    [ 1937.664005] Stack:
    [ 1937.664005] ffffffffa049da80 ffff8800d8fda790 000000000000005b ffff880000000009
    [ 1937.664005] ffff8800daf3f200 0000000000000003 ffff8800c43c7e48 ffffffff81109b57
    [ 1937.664005] ffffffff81109b0e ffffffff8114c566 0000000000000000 0000000000000000
    [ 1937.664005] Call Trace:
    [ 1937.664005] [] ? pppol2tp_connect+0x235/0x41e [l2tp_ppp]
    [ 1937.664005] [] ? might_fault+0x9e/0xa5
    [ 1937.664005] [] ? might_fault+0x55/0xa5
    [ 1937.664005] [] ? rcu_read_unlock+0x1c/0x26
    [ 1937.664005] [] SYSC_connect+0x87/0xb1
    [ 1937.664005] [] ? sysret_check+0x1b/0x56
    [ 1937.664005] [] ? trace_hardirqs_on_caller+0x145/0x1a1
    [ 1937.664005] [] ? trace_hardirqs_on_thunk+0x3a/0x3f
    [ 1937.664005] [] ? spin_lock+0x9/0xb
    [ 1937.664005] [] SyS_connect+0x9/0xb
    [ 1937.664005] [] system_call_fastpath+0x16/0x1b
    [ 1937.664005] Code: 10 2a 84 81 e8 65 76 bd e0 65 ff 0c 25 10 bb 00 00 4d 85 ed 74 37 48 8b 85 60 ff ff ff 48 8b 80 88 01 00 00 48 8b b8 10 02 00 00 8b 47 20 ff 50 20 85 c0 74 0f 83 e8 28 89 83 10 01 00 00 89
    [ 1937.664005] RIP [] pppol2tp_connect+0x33d/0x41e [l2tp_ppp]
    [ 1937.664005] RSP
    [ 1937.664005] CR2: 0000000000000020
    [ 1939.559375] ---[ end trace 82d44500f28f8708 ]---

    Fixes: f34c4a35d879 ("l2tp: take PMTU from tunnel UDP socket")
    Signed-off-by: Guillaume Nault
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Guillaume Nault
     

02 Sep, 2014

1 commit


01 Aug, 2014

1 commit


17 Jul, 2014

1 commit


16 Jul, 2014

1 commit

  • Extend alloc_netdev{,_mq{,s}}() to take name_assign_type as argument, and convert
    all users to pass NET_NAME_UNKNOWN.

    Coccinelle patch:

    @@
    expression sizeof_priv, name, setup, txqs, rxqs, count;
    @@

    (
    -alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs)
    +alloc_netdev_mqs(sizeof_priv, name, NET_NAME_UNKNOWN, setup, txqs, rxqs)
    |
    -alloc_netdev_mq(sizeof_priv, name, setup, count)
    +alloc_netdev_mq(sizeof_priv, name, NET_NAME_UNKNOWN, setup, count)
    |
    -alloc_netdev(sizeof_priv, name, setup)
    +alloc_netdev(sizeof_priv, name, NET_NAME_UNKNOWN, setup)
    )

    v9: move comments here from the wrong commit

    Signed-off-by: Tom Gundersen
    Reviewed-by: David Herrmann
    Signed-off-by: David S. Miller

    Tom Gundersen
     

15 Jul, 2014

2 commits

  • The l2tp [get|set]sockopt() code has fallen back to the UDP functions
    for socket option levels != SOL_PPPOL2TP since day one, but that has
    never actually worked, since the l2tp socket isn't an inet socket.

    As David Miller points out:

    "If we wanted this to work, it'd have to look up the tunnel and then
    use tunnel->sk, but I wonder how useful that would be"

    Since this can never have worked so nobody could possibly have depended
    on that functionality, just remove the broken code and return -EINVAL.

    Reported-by: Sasha Levin
    Acked-by: James Chapman
    Acked-by: David Miller
    Cc: Phil Turnbull
    Cc: Vegard Nossum
    Cc: Willy Tarreau
    Cc: stable@vger.kernel.org
    Signed-off-by: Linus Torvalds

    Sasha Levin
     
  • In l2tp driver call common function udp_sock_create to create the
    listener UDP port.

    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert
     

05 Jun, 2014

1 commit


24 May, 2014

3 commits

  • Added new L2TP configuration options to allow TX and RX of
    zero checksums in IPv6. Default is not to use them.

    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert
     
  • Define separate fields in the sock structure for configuring disabling
    checksums in both TX and RX-- sk_no_check_tx and sk_no_check_rx.
    The SO_NO_CHECK socket option only affects sk_no_check_tx. Also,
    removed UDP_CSUM_* defines since they are no longer necessary.

    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert
     
  • It doesn't seem like an protocols are setting anything other
    than the default, and allowing to arbitrarily disable checksums
    for a whole protocol seems dangerous. This can be done on a per
    socket basis.

    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert
     

13 May, 2014

1 commit

  • As suggested by several people, rename local_df to ignore_df,
    since it means "ignore df bit if it is set".

    Cc: Maciej Żenczykowski
    Cc: Florian Westphal
    Cc: David S. Miller
    Cc: Eric Dumazet
    Signed-off-by: Cong Wang
    Acked-by: Maciej Żenczykowski
    Signed-off-by: David S. Miller

    WANG Cong
     

09 May, 2014

1 commit

  • Validating the UDP checksum is now done in UDP before handing
    packets to the encapsulation layer. Note that this also eliminates
    the "feature" where L2TP can ignore a non-zero UDP checksum (doing
    this was contrary to RFC 1122).

    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert
     

01 May, 2014

1 commit


16 Apr, 2014

1 commit

  • ip_queue_xmit() assumes the skb it has to transmit is attached to an
    inet socket. Commit 31c70d5956fc ("l2tp: keep original skb ownership")
    changed l2tp to not change skb ownership and thus broke this assumption.

    One fix is to add a new 'struct sock *sk' parameter to ip_queue_xmit(),
    so that we do not assume skb->sk points to the socket used by l2tp
    tunnel.

    Fixes: 31c70d5956fc ("l2tp: keep original skb ownership")
    Reported-by: Zhan Jianyu
    Tested-by: Zhan Jianyu
    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

10 Apr, 2014

1 commit

  • When l2tp driver tries to get PMTU for the tunnel destination, it uses
    the pointer to struct sock that represents PPPoX socket, while it
    should use the pointer that represents UDP socket of the tunnel.

    Signed-off-by: Dmitry Petukhov
    Signed-off-by: David S. Miller

    Dmitry Petukhov
     

03 Apr, 2014

1 commit

  • Pull networking updates from David Miller:
    "Here is my initial pull request for the networking subsystem during
    this merge window:

    1) Support for ESN in AH (RFC 4302) from Fan Du.

    2) Add full kernel doc for ethtool command structures, from Ben
    Hutchings.

    3) Add BCM7xxx PHY driver, from Florian Fainelli.

    4) Export computed TCP rate information in netlink socket dumps, from
    Eric Dumazet.

    5) Allow IPSEC SA to be dumped partially using a filter, from Nicolas
    Dichtel.

    6) Convert many drivers to pci_enable_msix_range(), from Alexander
    Gordeev.

    7) Record SKB timestamps more efficiently, from Eric Dumazet.

    8) Switch to microsecond resolution for TCP round trip times, also
    from Eric Dumazet.

    9) Clean up and fix 6lowpan fragmentation handling by making use of
    the existing inet_frag api for it's implementation.

    10) Add TX grant mapping to xen-netback driver, from Zoltan Kiss.

    11) Auto size SKB lengths when composing netlink messages based upon
    past message sizes used, from Eric Dumazet.

    12) qdisc dumps can take a long time, add a cond_resched(), From Eric
    Dumazet.

    13) Sanitize netpoll core and drivers wrt. SKB handling semantics.
    Get rid of never-used-in-tree netpoll RX handling. From Eric W
    Biederman.

    14) Support inter-address-family and namespace changing in VTI tunnel
    driver(s). From Steffen Klassert.

    15) Add Altera TSE driver, from Vince Bridgers.

    16) Optimizing csum_replace2() so that it doesn't adjust the checksum
    by checksumming the entire header, from Eric Dumazet.

    17) Expand BPF internal implementation for faster interpreting, more
    direct translations into JIT'd code, and much cleaner uses of BPF
    filtering in non-socket ocntexts. From Daniel Borkmann and Alexei
    Starovoitov"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1976 commits)
    netpoll: Use skb_irq_freeable to make zap_completion_queue safe.
    net: Add a test to see if a skb is freeable in irq context
    qlcnic: Fix build failure due to undefined reference to `vxlan_get_rx_port'
    net: ptp: move PTP classifier in its own file
    net: sxgbe: make "core_ops" static
    net: sxgbe: fix logical vs bitwise operation
    net: sxgbe: sxgbe_mdio_register() frees the bus
    Call efx_set_channels() before efx->type->dimension_resources()
    xen-netback: disable rogue vif in kthread context
    net/mlx4: Set proper build dependancy with vxlan
    be2net: fix build dependency on VxLAN
    mac802154: make csma/cca parameters per-wpan
    mac802154: allow only one WPAN to be up at any given time
    net: filter: minor: fix kdoc in __sk_run_filter
    netlink: don't compare the nul-termination in nla_strcmp
    can: c_can: Avoid led toggling for every packet.
    can: c_can: Simplify TX interrupt cleanup
    can: c_can: Store dlc private
    can: c_can: Reduce register access
    can: c_can: Make the code readable
    ...

    Linus Torvalds
     

01 Apr, 2014

1 commit

  • Pull workqueue changes from Tejun Heo:
    "PREPARE_[DELAYED_]WORK() were used to change the work function of work
    items without fully reinitializing it; however, this makes workqueue
    consider the work item as a different one from before and allows the
    work item to start executing before the previous instance is finished
    which can lead to extremely subtle issues which are painful to debug.

    The interface has never been popular. This pull request contains
    patches to remove existing usages and kill the interface. As one of
    the changes was routed during the last devel cycle and another
    depended on a pending change in nvme, for-3.15 contains a couple merge
    commits.

    In addition, interfaces which were deprecated quite a while ago -
    __cancel_delayed_work() and WQ_NON_REENTRANT - are removed too"

    * 'for-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
    workqueue: remove deprecated WQ_NON_REENTRANT
    workqueue: Spelling s/instensive/intensive/
    workqueue: remove PREPARE_[DELAYED_]WORK()
    staging/fwserial: don't use PREPARE_WORK
    afs: don't use PREPARE_WORK
    nvme: don't use PREPARE_WORK
    usb: don't use PREPARE_DELAYED_WORK
    floppy: don't use PREPARE_[DELAYED_]WORK
    ps3-vuart: don't use PREPARE_WORK
    wireless/rt2x00: don't use PREPARE_WORK in rt2800usb.c
    workqueue: Remove deprecated __cancel_delayed_work()

    Linus Torvalds
     

29 Mar, 2014

1 commit

  • Tejun Heo has made WQ_NON_REENTRANT useless in the dbf2576e37
    ("workqueue: make all workqueues non-reentrant"). So remove its
    usages and definition.

    This patch doesn't introduce any behavior changes.

    tj: minor description updates.

    Signed-off-by: ZhangZhen
    Sigend-off-by: Tejun Heo
    Acked-by: James Chapman
    Acked-by: Ulf Hansson

    ZhangZhen
     

15 Mar, 2014

1 commit


11 Mar, 2014

1 commit

  • net/l2tp/l2tp_core.c:1111:15: warning: unused variable
    'sk' [-Wunused-variable]

    Fixes: 31c70d5956fc ("l2tp: keep original skb ownership")
    Reported-by: kbuild test robot
    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

08 Mar, 2014

1 commit

  • There is no reason to orphan skb in l2tp.

    This breaks things like per socket memory limits, TCP Small queues...

    Fix this before more people copy/paste it.

    This is very similar to commit 8f646c922d550
    ("vxlan: keep original skb ownership")

    Signed-off-by: Eric Dumazet
    Cc: James Chapman
    Signed-off-by: David S. Miller

    Eric Dumazet
     

07 Mar, 2014

2 commits

  • As pppol2tp_recv() never queues up packets to plain L2TP sockets,
    pppol2tp_recvmsg() never returns data to userspace, thus making
    the recv*() system calls unusable.

    Instead of dropping packets when the L2TP socket isn't bound to a PPP
    channel, this patch adds them to its reception queue.

    Signed-off-by: Guillaume Nault
    Signed-off-by: David S. Miller

    Guillaume Nault
     
  • Commit e0d4435f "l2tp: Update PPP-over-L2TP driver to work over L2TPv3"
    broke the PPPOL2TP_SO_SENDSEQ setsockopt. The L2TP header length was
    previously computed by pppol2tp_l2t_header_len() before each call to
    l2tp_xmit_skb(). Now that header length is retrieved from the hdr_len
    session field, this field must be updated every time the L2TP header
    format is modified, or l2tp_xmit_skb() won't push the right amount of
    data for the L2TP header.

    This patch uses l2tp_session_set_header_len() to adjust hdr_len every
    time sequencing is (de)activated from userspace (either by the
    PPPOL2TP_SO_SENDSEQ setsockopt or the L2TP_ATTR_SEND_SEQ netlink
    attribute).

    Signed-off-by: Guillaume Nault
    Signed-off-by: David S. Miller

    Guillaume Nault
     

14 Feb, 2014

1 commit

  • One of my pet coding style peeves is the practice of
    adding extra return; at the end of function.
    Kill several instances of this in network code.

    I suppose some coccinelle wizardy could do this automatically.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    stephen hemminger
     

22 Jan, 2014

1 commit

  • Some ipv6 protocols cannot handle ipv4 addresses, so we must not allow
    connecting and binding to them. sendmsg logic does already check msg->name
    for this but must trust already connected sockets which could be set up
    for connection to ipv4 address family.

    Per-socket flag ipv6only is of no use here, as it is under users control
    by setsockopt.

    Signed-off-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    Hannes Frederic Sowa
     

19 Jan, 2014

1 commit

  • This is a follow-up patch to f3d3342602f8bc ("net: rework recvmsg
    handler msg_name and msg_namelen logic").

    DECLARE_SOCKADDR validates that the structure we use for writing the
    name information to is not larger than the buffer which is reserved
    for msg->msg_name (which is 128 bytes). Also use DECLARE_SOCKADDR
    consistently in sendmsg code paths.

    Signed-off-by: Steffen Hurrle
    Suggested-by: Hannes Frederic Sowa
    Acked-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    Steffen Hurrle
     

14 Jan, 2014

1 commit


20 Dec, 2013

1 commit

  • Steffen Klassert says:

    ====================
    pull request (net-next): ipsec-next 2013-12-19

    1) Use the user supplied policy index instead of a generated one
    if present. From Fan Du.

    2) Make xfrm migration namespace aware. From Fan Du.

    3) Make the xfrm state and policy locks namespace aware. From Fan Du.

    4) Remove ancient sleeping when the SA is in acquire state,
    we now queue packets to the policy instead. This replaces the
    sleeping code.

    5) Remove FLOWI_FLAG_CAN_SLEEP. This was used to notify xfrm about the
    posibility to sleep. The sleeping code is gone, so remove it.

    6) Check user specified spi for IPComp. Thr spi for IPcomp is only
    16 bit wide, so check for a valid value. From Fan Du.

    7) Export verify_userspi_info to check for valid user supplied spi ranges
    with pfkey and netlink. From Fan Du.

    8) RFC3173 states that if the total size of a compressed payload and the IPComp
    header is not smaller than the size of the original payload, the IP datagram
    must be sent in the original non-compressed form. These packets are dropped
    by the inbound policy check because they are not transformed. Document the need
    to set 'level use' for IPcomp to receive such packets anyway. From Fan Du.

    Please pull or let me know if there are problems.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

11 Dec, 2013

1 commit

  • This patch is following b579035ff766c9412e2b92abf5cab794bff102b6
    "ipv6: remove old conditions on flow label sharing"

    Since there is no reason to restrict a label to a
    destination, we should not erase the destination value of a
    socket with the value contained in the flow label storage.

    This patch allows to really have the same flow label to more
    than one destination.

    Signed-off-by: Florent Fourcot
    Reviewed-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    Florent Fourcot
     

06 Dec, 2013

1 commit


24 Nov, 2013

1 commit

  • Commit bceaa90240b6019ed73b49965eac7d167610be69 ("inet: prevent leakage
    of uninitialized memory to user in recv syscalls") conditionally updated
    addr_len if the msg_name is written to. The recv_error and rxpmtu
    functions relied on the recvmsg functions to set up addr_len before.

    As this does not happen any more we have to pass addr_len to those
    functions as well and set it to the size of the corresponding sockaddr
    length.

    This broke traceroute and such.

    Fixes: bceaa90240b6 ("inet: prevent leakage of uninitialized memory to user in recv syscalls")
    Reported-by: Brad Spengler
    Reported-by: Tom Labanowski
    Cc: mpb
    Cc: David S. Miller
    Cc: Eric Dumazet
    Signed-off-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    Hannes Frederic Sowa
     

21 Nov, 2013

1 commit