17 Sep, 2011

1 commit

  • Attempt to reduce the number of IP packets emitted in response to single
    SCTP packet (2e3216cd) introduced a complication - if a packet contains
    two COOKIE_ECHO chunks and nothing else then SCTP state machine corks the
    socket while processing first COOKIE_ECHO and then loses the association
    and forgets to uncork the socket. To deal with the issue add new SCTP
    command which can be used to set association explictly. Use this new
    command when processing second COOKIE_ECHO chunk to restore the context
    for SCTP state machine.

    Signed-off-by: Max Matveev
    Signed-off-by: David S. Miller

    Max Matveev
     

22 Jul, 2011

1 commit


15 Jul, 2011

1 commit

  • Packets to devices without NETIF_F_SCTP_CSUM (including NETIF_F_NO_CSUM)
    should be properly checksummed because the packets can be diverted or
    rerouted after construction. This still leaves packets diverted from
    NETIF_F_SCTP_CSUM-enabled devices with broken checksums. Fixing this
    needs implementing software offload fallback in networking core.

    For users of sctp_checksum_disable, skb->ip_summed should be left as
    CHECKSUM_NONE and not CHECKSUM_UNNECESSARY as per include/linux/skbuff.h.

    Signed-off-by: Michał Mirosław
    Signed-off-by: David S. Miller

    Michał Mirosław
     

14 Jul, 2011

1 commit


09 Jul, 2011

1 commit

  • Trigger user ABORT if application closes a socket which has data
    queued on the socket receive queue or chunks waiting on the
    reassembly or ordering queue as this would imply data being lost
    which defeats the point of a graceful shutdown.

    This behavior is already practiced in TCP.

    We do not check the input queue because that would mean to parse
    all chunks on it to look for unacknowledged data which seems too
    much of an effort. Control chunks or duplicated chunks may also
    be in the input queue and should not be stopping a graceful
    shutdown.

    Signed-off-by: Thomas Graf
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Thomas Graf
     

08 Jul, 2011

1 commit

  • When initiating a graceful shutdown while having data chunks
    on the retransmission queue with a peer which is in zero
    window mode the shutdown is never completed because the
    retransmission error count is reset periodically by the
    following two rules:

    - Do not timeout association while doing zero window probe.
    - Reset overall error count when a heartbeat request has
    been acknowledged.

    The graceful shutdown will wait for all outstanding TSN to
    be acknowledged before sending the SHUTDOWN request. This
    never happens due to the peer's zero window not acknowledging
    the continuously retransmitted data chunks. Although the
    error counter is incremented for each failed retransmission,
    the receiving of the SACK announcing the zero window clears
    the error count again immediately. Also heartbeat requests
    continue to be sent periodically. The peer acknowledges these
    requests causing the error counter to be reset as well.

    This patch changes behaviour to only reset the overall error
    counter for the above rules while not in shutdown. After
    reaching the maximum number of retransmission attempts, the
    T5 shutdown guard timer is scheduled to give the receiver
    some additional time to recover. The timer is stopped as soon
    as the receiver acknowledges any data.

    The issue can be easily reproduced by establishing a sctp
    association over the loopback device, constantly queueing
    data at the sender while not reading any at the receiver.
    Wait for the window to reach zero, then initiate a shutdown
    by killing both processes simultaneously. The association
    will never be freed and the chunks on the retransmission
    queue will be retransmitted indefinitely.

    Signed-off-by: Thomas Graf
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Thomas Graf
     

07 Jul, 2011

2 commits

  • We forgot to send up SCTP_SENDER_DRY_EVENT notification when
    user app subscribes to this event, and there is no data to be
    sent or retransmit.

    This is required by the Socket API and used by the DTLS/SCTP
    implementation.

    Reported-by: Michael Tüxen
    Signed-off-by: Wei Yongjun
    Tested-by: Robin Seggelmann
    Signed-off-by: David S. Miller

    Wei Yongjun
     
  • Current tcp/udp/sctp global memory limits are not taking into account
    hugepages allocations, and allow 50% of ram to be used by buffers of a
    single protocol [ not counting space used by sockets / inodes ...]

    Lets use nr_free_buffer_pages() and allow a default of 1/8 of kernel ram
    per protocol, and a minimum of 128 pages.
    Heavy duty machines sysadmins probably need to tweak limits anyway.

    References: https://bugzilla.stlinux.com/show_bug.cgi?id=38032
    Reported-by: starlight
    Suggested-by: Andrew Morton
    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

02 Jul, 2011

1 commit

  • Make the case labels the same indent as the switch.

    git diff -w shows useless break;s removed after returns
    and a comment added to an unnecessary default: break;
    because of a dubious gcc warning.

    Signed-off-by: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     

17 Jun, 2011

1 commit

  • Unnecessary casts of void * clutter the code.

    These are the remainder casts after several specific
    patches to remove netdev_priv and dev_priv.

    Done via coccinelle script:

    $ cat cast_void_pointer.cocci
    @@
    type T;
    T *pt;
    void *pv;
    @@

    - pt = (T *)pv;
    + pt = pv;

    Signed-off-by: Joe Perches
    Acked-by: Paul Moore
    Signed-off-by: David S. Miller

    Joe Perches
     

12 Jun, 2011

1 commit


07 Jun, 2011

1 commit


02 Jun, 2011

5 commits

  • In this case, the SCTP association transmits an ASCONF packet
    including addition of the new IP address and deletion of the old
    address. This patch implements this functionality.
    In this case, the ASCONF chunk is added to the beginning of the
    queue, because the other chunks cannot be transmitted in this state.

    Signed-off-by: Michio Honda
    Signed-off-by: YOSHIFUJI Hideaki
    Acked-by: Wei Yongjun
    Signed-off-by: David S. Miller

    Michio Honda
     
  • This patch allows the application to operate Auto-ASCONF on/off
    behavior via setsockopt() and getsockopt().

    Signed-off-by: Michio Honda
    Signed-off-by: YOSHIFUJI Hideaki
    Acked-by: Wei Yongjun
    Signed-off-by: David S. Miller

    Michio Honda
     
  • This patch allows the system administrator to change default
    Auto-ASCONF on/off behavior via an sysctl value.

    Signed-off-by: Michio Honda
    Signed-off-by: YOSHIFUJI Hideaki
    Acked-by: Wei Yongjun
    Signed-off-by: David S. Miller

    Michio Honda
     
  • SCTP reconfigure the IP addresses in the association by using
    ASCONF chunks as mentioned in RFC5061. For example, we can
    start to use the newly configured IP address in the existing
    association. This patch implements automatic ASCONF operation
    in the SCTP stack with address events in the host computer,
    which is called auto_asconf.

    Signed-off-by: Michio Honda
    Signed-off-by: YOSHIFUJI Hideaki
    Acked-by: Wei Yongjun
    Signed-off-by: David S. Miller

    Michio Honda
     
  • This patch fixes the problem that the original code cannot delete
    the remote address where the corresponding transport is currently
    directed, even when the ASCONF is sent from the other address (this
    situation happens when the single-homed sender transmits ASCONF
    with ADD and DEL.)

    Signed-off-by: Michio Honda
    Signed-off-by: YOSHIFUJI Hideaki
    Acked-by: Wei Yongjun
    Signed-off-by: David S. Miller

    Michio Honda
     

01 Jun, 2011

1 commit


26 May, 2011

1 commit


24 May, 2011

1 commit

  • The %pK format specifier is designed to hide exposed kernel pointers,
    specifically via /proc interfaces. Exposing these pointers provides an
    easy target for kernel write vulnerabilities, since they reveal the
    locations of writable structures containing easily triggerable function
    pointers. The behavior of %pK depends on the kptr_restrict sysctl.

    If kptr_restrict is set to 0, no deviation from the standard %p behavior
    occurs. If kptr_restrict is set to 1, the default, if the current user
    (intended to be a reader via seq_printf(), etc.) does not have CAP_SYSLOG
    (currently in the LSM tree), kernel pointers using %pK are printed as 0's.
    If kptr_restrict is set to 2, kernel pointers using %pK are printed as
    0's regardless of privileges. Replacing with 0's was chosen over the
    default "(null)", which cannot be parsed by userland %p, which expects
    "(nil)".

    The supporting code for kptr_restrict and %pK are currently in the -mm
    tree. This patch converts users of %p in net/ to %pK. Cases of printing
    pointers to the syslog are not covered, since this would eliminate useful
    information for postmortem debugging and the reading of the syslog is
    already optionally protected by the dmesg_restrict sysctl.

    Signed-off-by: Dan Rosenberg
    Cc: James Morris
    Cc: Eric Dumazet
    Cc: Thomas Graf
    Cc: Eugene Teo
    Cc: Kees Cook
    Cc: Ingo Molnar
    Cc: David S. Miller
    Cc: Peter Zijlstra
    Cc: Eric Paris
    Signed-off-by: Andrew Morton
    Signed-off-by: David S. Miller

    Dan Rosenberg
     

21 May, 2011

2 commits

  • Commit c182f90bc1f22ce5039b8722e45621d5f96862c2 ("SCTP: fix race
    between sctp_bind_addr_free() and sctp_bind_addr_conflict()") and
    commit 1231f0baa547a541a7481119323b7f964dda4788 ("net,rcu: convert
    call_rcu(sctp_local_addr_free) to kfree_rcu()"), happening in
    different trees, introduced a build failure.

    Simply make the SCTP race fix use kfree_rcu() too.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1446 commits)
    macvlan: fix panic if lowerdev in a bond
    tg3: Add braces around 5906 workaround.
    tg3: Fix NETIF_F_LOOPBACK error
    macvlan: remove one synchronize_rcu() call
    networking: NET_CLS_ROUTE4 depends on INET
    irda: Fix error propagation in ircomm_lmp_connect_response()
    irda: Kill set but unused variable 'bytes' in irlan_check_command_param()
    irda: Kill set but unused variable 'clen' in ircomm_connect_indication()
    rxrpc: Fix set but unused variable 'usage' in rxrpc_get_transport()
    be2net: Kill set but unused variable 'req' in lancer_fw_download()
    irda: Kill set but unused vars 'saddr' and 'daddr' in irlan_provider_connect_indication()
    atl1c: atl1c_resume() is only used when CONFIG_PM_SLEEP is defined.
    rxrpc: Fix set but unused variable 'usage' in rxrpc_get_peer().
    rxrpc: Kill set but unused variable 'local' in rxrpc_UDP_error_handler()
    rxrpc: Kill set but unused variable 'sp' in rxrpc_process_connection()
    rxrpc: Kill set but unused variable 'sp' in rxrpc_rotate_tx_window()
    pkt_sched: Kill set but unused variable 'protocol' in tc_classify()
    isdn: capi: Use pr_debug() instead of ifdefs.
    tg3: Update version to 3.119
    tg3: Apply rx_discards fix to 5719/5720
    ...

    Fix up trivial conflicts in arch/x86/Kconfig and net/mac80211/agg-tx.c
    as per Davem.

    Linus Torvalds
     

20 May, 2011

1 commit

  • During the sctp_close() call, we do not use rcu primitives to
    destroy the address list attached to the endpoint. At the same
    time, we do the removal of addresses from this list before
    attempting to remove the socket from the port hash

    As a result, it is possible for another process to find the socket
    in the port hash that is in the process of being closed. It then
    proceeds to traverse the address list to find the conflict, only
    to have that address list suddenly disappear without rcu() critical
    section.

    Fix issue by closing address list removal inside RCU critical
    section.

    Race can result in a kernel crash with general protection fault or
    kernel NULL pointer dereference:

    kernel: general protection fault: 0000 [#1] SMP
    kernel: RIP: 0010:[] [] sctp_bind_addr_conflict+0x64/0x82 [sctp]
    kernel: Call Trace:
    kernel: [] ? sctp_get_port_local+0x17b/0x2a3 [sctp]
    kernel: [] ? sctp_bind_addr_match+0x33/0x68 [sctp]
    kernel: [] ? sctp_do_bind+0xd3/0x141 [sctp]
    kernel: [] ? sctp_bindx_add+0x4d/0x8e [sctp]
    kernel: [] ? sctp_setsockopt_bindx+0x112/0x4a4 [sctp]
    kernel: [] ? generic_file_aio_write+0x7f/0x9b
    kernel: [] ? sctp_setsockopt+0x14f/0xfee [sctp]
    kernel: [] ? do_sync_write+0xab/0xeb
    kernel: [] ? fsnotify+0x239/0x282
    kernel: [] ? alloc_file+0x18/0xb1
    kernel: [] ? compat_sys_setsockopt+0x1a5/0x1d9
    kernel: [] ? compat_sys_socketcall+0x143/0x1a4
    kernel: [] ? sysenter_dispatch+0x7/0x32

    Signed-off-by: Jacek Luczak
    Acked-by: Vlad Yasevich
    CC: Eric Dumazet
    Reviewed-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Jacek Luczak
     

13 May, 2011

2 commits


11 May, 2011

1 commit


09 May, 2011

4 commits


08 May, 2011

1 commit


04 May, 2011

1 commit


28 Apr, 2011

5 commits

  • Change the call to take the transport parameter and set the
    cached 'dst' appropriately inside the get_dst() function calls.

    This will allow us in the future to clean up source address
    storage as well.

    Signed-off-by: Vlad Yasevich
    Signed-off-by: Wei Yongjun
    Signed-off-by: David S. Miller

    Vlad Yasevich
     
  • There is no point in passing a destination address to
    a get_saddr() call.

    Signed-off-by: Vlad Yasevich
    Signed-off-by: Wei Yongjun
    Signed-off-by: David S. Miller

    Vlad Yasevich
     
  • SCTP never called xfrm_output after it's v6 route lookups so
    that never really worked with ipsec. Additioanlly, we never
    passed port nubmers and protocol in the flowi, so any port
    based policies were never applied as well. Now that we can
    fixed ipv6 routing lookup code, using ip6_dst_lookup_flow()
    and pass port numbers.

    Signed-off-by: Vlad Yasevich
    Signed-off-by: Wei Yongjun
    Signed-off-by: David S. Miller

    Vlad Yasevich
     
  • The ipv6 routing lookup does give us a source address,
    but instead of filling it into the dst, it's stored in
    the flowi. We can use that instead of going through the
    entire source address selection again.
    Also the useless ->dst_saddr member of sctp_pf is removed.
    And sctp_v6_dst_saddr() is removed, instead by introduce
    sctp_v6_to_addr(), which can be reused to cleanup some dup
    code.

    Signed-off-by: Vlad Yasevich
    Signed-off-by: Wei Yongjun
    Signed-off-by: David S. Miller

    Vlad Yasevich
     
  • In the below test case, using the source address routing,
    sctp can not work.
    Node-A
    1)ifconfig eth0 inet6 add 2001:1::1/64
    2)ip -6 rule add from 2001:1::1 table 100 pref 100
    3)ip -6 route add 2001:2::1 dev eth0 table 100
    4)sctp_darn -H 2001:1::1 -P 250 -l &
    Node-B
    1)ifconfig eth0 inet6 add 2001:2::1/64
    2)ip -6 rule add from 2001:2::1 table 100 pref 100
    3)ip -6 route add 2001:1::1 dev eth0 table 100
    4)sctp_darn -H 2001:2::1 -P 250 -h 2001:1::1 -p 250 -s

    root cause:
    Node-A and Node-B use the source address routing, and
    at begining, source address will be NULL,sctp will
    search the routing table by the destination address,
    because using the source address routing table, and
    the result dst_entry will be NULL.

    solution:
    walk through the bind address list to get the source
    address and then lookup the routing table again to get
    the correct dst_entry.

    Signed-off-by: Weixing Shi
    Signed-off-by: Vlad Yasevich
    Signed-off-by: Wei Yongjun
    Signed-off-by: David S. Miller

    Weixing Shi
     

27 Apr, 2011

1 commit


23 Apr, 2011

1 commit


22 Apr, 2011

1 commit

  • This patch implement event notification SCTP_SENDER_DRY_EVENT.
    SCTP Socket API Extensions:

    6.1.9. SCTP_SENDER_DRY_EVENT

    When the SCTP stack has no more user data to send or retransmit, this
    notification is given to the user. Also, at the time when a user app
    subscribes to this event, if there is no data to be sent or
    retransmit, the stack will immediately send up this notification.

    Signed-off-by: Wei Yongjun
    Signed-off-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Wei Yongjun