11 Jun, 2010

1 commit


28 May, 2010

1 commit

  • Currently we disallow GSO packets on the IPv6 forward path.
    This patch fixes this.

    Note that I discovered that our existing GSO MTU checks (e.g.,
    IPv4 forwarding) are buggy in that they skip the check altogether,
    when they really should be checking gso_size + header instead.

    I have also been lazy here in that I haven't bothered to segment
    the GSO packet by hand before generating an ICMP message. Someone
    should add that to be 100% correct.

    Reported-by: Ralf Baechle
    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     

11 May, 2010

2 commits

  • This patch adds support for multiple independant multicast routing instances,
    named "tables".

    Userspace multicast routing daemons can bind to a specific table instance by
    issuing a setsockopt call using a new option MRT6_TABLE. The table number is
    stored in the raw socket data and affects all following ip6mr setsockopt(),
    getsockopt() and ioctl() calls. By default, a single table (RT6_TABLE_DFLT)
    is created with a default routing rule pointing to it. Newly created pim6reg
    devices have the table number appended ("pim6regX"), with the exception of
    devices created in the default table, which are named just "pim6reg" for
    compatibility reasons.

    Packets are directed to a specific table instance using routing rules,
    similar to how regular routing rules work. Currently iif, oif and mark
    are supported as keys, source and destination addresses could be supported
    additionally.

    Example usage:

    - bind pimd/xorp/... to a specific table:

    uint32_t table = 123;
    setsockopt(fd, SOL_IPV6, MRT6_TABLE, &table, sizeof(table));

    - create routing rules directing packets to the new table:

    # ip -6 mrule add iif eth0 lookup 123
    # ip -6 mrule add oif eth0 lookup 123

    Signed-off-by: Patrick McHardy

    Patrick McHardy
     
  • Conflicts:
    net/bridge/br_device.c
    net/bridge/br_forward.c

    Signed-off-by: Patrick McHardy

    Patrick McHardy
     

01 May, 2010

1 commit

  • We dereference "sk" unconditionally elsewhere in the function.

    This was left over from: b30bd282 "ip6_xmit: remove unnecessary NULL
    ptr check". According to that commit message, "the sk argument to
    ip6_xmit is never NULL nowadays since the skb->priority assigment
    expects a valid socket."

    Signed-off-by: Dan Carpenter
    Signed-off-by: David S. Miller

    Dan Carpenter
     

28 Apr, 2010

1 commit


24 Apr, 2010

2 commits


22 Apr, 2010

1 commit

  • … less than IPV6_MIN_MTU

    According to RFC2460, PMTU is set to the IPv6 Minimum Link
    MTU (1280) and a fragment header should always be included
    after a node receiving Too Big message reporting PMTU is
    less than the IPv6 Minimum Link MTU.

    After receiving a ICMPv6 Too Big message reporting PMTU is
    less than the IPv6 Minimum Link MTU, sctp *can't* send any
    data/control chunk that total length including IPv6 head
    and IPv6 extend head is less than IPV6_MIN_MTU(1280 bytes).

    The failure occured in p6_fragment(), about reason
    see following(take SHUTDOWN chunk for example):
    sctp_packet_transmit (SHUTDOWN chunk, len=16 byte)
    |------sctp_v6_xmit (local_df=0)
    |------ip6_xmit
    |------ip6_output (dst_allfrag is ture)
    |------ip6_fragment

    In ip6_fragment(), for local_df=0, drops the the packet
    and returns EMSGSIZE.

    The patch fixes it with adding check length of skb->len.
    In this case, Ipv6 not to fragment upper protocol data,
    just only add a fragment header before it.

    Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

    Shan Wei
     

21 Apr, 2010

1 commit


20 Apr, 2010

1 commit


19 Apr, 2010

2 commits


16 Apr, 2010

4 commits

  • ip6_xmit() is used by upper transport protocol.

    Signed-off-by: Shan Wei
    Signed-off-by: David S. Miller

    Shan Wei
     
  • As Herbert Xu said: we should be able to simply replace ipfragok
    with skb->local_df. commit f88037(sctp: Drop ipfargok in sctp_xmit function)
    has droped ipfragok and set local_df value properly.

    The patch kills the ipfragok parameter of .queue_xmit().

    Signed-off-by: Shan Wei
    Signed-off-by: David S. Miller

    Shan Wei
     
  • commit f88037(sctp: Drop ipfargok in sctp_xmit function)
    has droped ipfragok and set local_df value properly.

    So the change of commit 77e2f1(ipv6: Fix ip6_xmit to
    send fragments if ipfragok is true) is not needed.
    So the patch remove them.

    Signed-off-by: Shan Wei
    Signed-off-by: David S. Miller

    Shan Wei
     
  • Eric Paris got following trace with a linux-next kernel

    [ 14.203970] BUG: using smp_processor_id() in preemptible [00000000]
    code: avahi-daemon/2093
    [ 14.204025] caller is netif_rx+0xfa/0x110
    [ 14.204035] Call Trace:
    [ 14.204064] [] debug_smp_processor_id+0x105/0x110
    [ 14.204070] [] netif_rx+0xfa/0x110
    [ 14.204090] [] ip_dev_loopback_xmit+0x71/0xa0
    [ 14.204095] [] ip_mc_output+0x192/0x2c0
    [ 14.204099] [] ip_local_out+0x20/0x30
    [ 14.204105] [] ip_push_pending_frames+0x28d/0x3d0
    [ 14.204119] [] udp_push_pending_frames+0x14c/0x400
    [ 14.204125] [] udp_sendmsg+0x39c/0x790
    [ 14.204137] [] inet_sendmsg+0x45/0x80
    [ 14.204149] [] sock_sendmsg+0xf1/0x110
    [ 14.204189] [] sys_sendmsg+0x20c/0x380
    [ 14.204233] [] system_call_fastpath+0x16/0x1b

    While current linux-2.6 kernel doesnt emit this warning, bug is latent
    and might cause unexpected failures.

    ip_dev_loopback_xmit() runs in process context, preemption enabled, so
    must call netif_rx_ni() instead of netif_rx(), to make sure that we
    process pending software interrupt.

    Same change for ip6_dev_loopback_xmit()

    Reported-by: Eric Paris
    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

13 Apr, 2010

2 commits

  • Similar to how IPv4's ip_output.c works, have ip6_output also check
    the IPSKB_REROUTED flag. It will be set from xt_TEE for cloned packets
    since Xtables can currently only deal with a single packet in flight
    at a time.

    Signed-off-by: Jan Engelhardt
    Acked-by: David S. Miller
    [Patrick: changed to use an IP6SKB value instead of IPSKB]
    Signed-off-by: Patrick McHardy

    Jan Engelhardt
     
  • Patrick McHardy notes: "We used to invoke IPv4 POST_ROUTING after
    fragmentation as well just to defragment the packets in conntrack
    immediately afterwards, but that got changed during the
    netfilter-ipsec integration. Ideally IPv6 would behave like IPv4."

    This patch makes it so. Sending an oversized frame (e.g. `ping6
    -s64000 -c1 ::1`) will now show up in POSTROUTING as a single skb
    rather than multiple ones.

    Signed-off-by: Jan Engelhardt
    Signed-off-by: Patrick McHardy

    Jan Engelhardt
     

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

25 Mar, 2010

1 commit


26 Feb, 2010

1 commit

  • Clients will set their MTU to 1280 if they receive a
    ICMPV6_PKT_TOOBIG message with an MTU less than 1280.

    To allow encapsulating of packets over a 1280 link
    we should always accept packets with a size of 1280
    for forwarding even if the path has a lower MTU and
    fragment the encapsulated packets afterwards.

    In case a forwarded packet is not going to be encapsulated
    a ICMPV6_PKT_TOOBIG msg will still be send by ip6_fragment()
    with the correct MTU.

    Signed-off-by: Ulrich Weber
    Signed-off-by: David S. Miller

    Ulrich Weber
     

19 Feb, 2010

1 commit


07 Jan, 2010

1 commit

  • When we have L3 tunnels with different inner/outer families
    (i.e. IPV4/IPV6) which use a multicast address as the outer tunnel
    destination address, multicast packets will be loopbacked back to the
    sending socket even if IP*_MULTICAST_LOOP is set to disabled.

    The mc_loop flag is present in the family specific part of the socket
    (e.g. the IPv4 or IPv4 specific part). setsockopt sets the inner
    family mc_loop flag. When the packet is pushed through the L3 tunnel
    it will eventually be processed by the outer family which if different
    will check the flag in a different part of the socket then it was set.

    Signed-off-by: Octavian Purdila
    Signed-off-by: David S. Miller

    Octavian Purdila
     

03 Sep, 2009

1 commit

  • Christoph Lameter pointed out that packet drops at qdisc level where not
    accounted in SNMP counters. Only if application sets IP_RECVERR, drops
    are reported to user (-ENOBUFS errors) and SNMP counters updated.

    IP_RECVERR is used to enable extended reliable error message passing,
    but these are not needed to update system wide SNMP stats.

    This patch changes things a bit to allow SNMP counters to be updated,
    regardless of IP_RECVERR being set or not on the socket.

    Example after an UDP tx flood
    # netstat -s
    ...
    IP:
    1487048 outgoing packets dropped
    ...
    Udp:
    ...
    SndbufErrors: 1487048

    send() syscalls, do however still return an OK status, to not
    break applications.

    Note : send() manual page explicitly says for -ENOBUFS error :

    "The output queue for a network interface was full.
    This generally indicates that the interface has stopped sending,
    but may be caused by transient congestion.
    (Normally, this does not occur in Linux. Packets are just silently
    dropped when a device queue overflows.) "

    This is not true for IP_RECVERR enabled sockets : a send() syscall
    that hit a qdisc drop returns an ENOBUFS error.

    Many thanks to Christoph, David, and last but not least, Alexey !

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

02 Sep, 2009

1 commit


14 Aug, 2009

1 commit

  • This replaces assignments of the type "int on LHS" = "u8 on RHS" with
    simpler code. The LHS can express all of the unsigned right hand side
    values, hence the assigned value can not be negative.

    Signed-off-by: Gerrit Renker
    Signed-off-by: David S. Miller

    Gerrit Renker
     

17 Jul, 2009

1 commit


13 Jul, 2009

2 commits


12 Jul, 2009

1 commit

  • After commit 2b85a34e911bf483c27cfdd124aeb1605145dc80
    (net: No more expensive sock_hold()/sock_put() on each tx)
    we do not take any more references on sk->sk_refcnt on outgoing packets.

    I forgot to delete two __sock_put() from ip_push_pending_frames()
    and ip6_push_pending_frames().

    Reported-by: Emil S Tantilov
    Signed-off-by: Eric Dumazet
    Tested-by: Emil S Tantilov
    Signed-off-by: David S. Miller

    Eric Dumazet
     

11 Jun, 2009

1 commit

  • One of the problem with sock memory accounting is it uses
    a pair of sock_hold()/sock_put() for each transmitted packet.

    This slows down bidirectional flows because the receive path
    also needs to take a refcount on socket and might use a different
    cpu than transmit path or transmit completion path. So these
    two atomic operations also trigger cache line bounces.

    We can see this in tx or tx/rx workloads (media gateways for example),
    where sock_wfree() can be in top five functions in profiles.

    We use this sock_hold()/sock_put() so that sock freeing
    is delayed until all tx packets are completed.

    As we also update sk_wmem_alloc, we could offset sk_wmem_alloc
    by one unit at init time, until sk_free() is called.
    Once sk_free() is called, we atomic_dec_and_test(sk_wmem_alloc)
    to decrement initial offset and atomicaly check if any packets
    are in flight.

    skb_set_owner_w() doesnt call sock_hold() anymore

    sock_wfree() doesnt call sock_put() anymore, but check if sk_wmem_alloc
    reached 0 to perform the final freeing.

    Drawback is that a skb->truesize error could lead to unfreeable sockets, or
    even worse, prematurely calling __sk_free() on a live socket.

    Nice speedups on SMP. tbench for example, going from 2691 MB/s to 2711 MB/s
    on my 8 cpu dev machine, even if tbench was not really hitting sk_refcnt
    contention point. 5 % speedup on a UDP transmit workload (depends
    on number of flows), lowering TX completion cpu usage.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

09 Jun, 2009

1 commit


03 Jun, 2009

1 commit

  • Define three accessors to get/set dst attached to a skb

    struct dst_entry *skb_dst(const struct sk_buff *skb)

    void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)

    void skb_dst_drop(struct sk_buff *skb)
    This one should replace occurrences of :
    dst_release(skb->dst)
    skb->dst = NULL;

    Delete skb->dst field

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

27 Apr, 2009

1 commit

  • The IP MIB (RFC 4293) defines stats for InOctets, OutOctets, InMcastOctets and
    OutMcastOctets:
    http://tools.ietf.org/html/rfc4293
    But it seems we don't track those in any way that easy to separate from other
    protocols. This patch adds those missing counters to the stats file. Tested
    successfully by me

    With help from Eric Dumazet.

    Signed-off-by: Neil Horman
    Signed-off-by: David S. Miller

    Neil Horman
     

06 Feb, 2009

1 commit


11 Dec, 2008

1 commit


29 Oct, 2008

1 commit


09 Oct, 2008

2 commits