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
     

12 Nov, 2009

1 commit

  • Now that sys_sysctl is a compatiblity wrapper around /proc/sys
    all sysctl strategy routines, and all ctl_name and strategy
    entries in the sysctl tables are unused, and can be
    revmoed.

    In addition neigh_sysctl_register has been modified to no longer
    take a strategy argument and it's callers have been modified not
    to pass one.

    Cc: "David Miller"
    Cc: Hideaki YOSHIFUJI
    Cc: netdev@vger.kernel.org
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     

24 Sep, 2009

1 commit

  • It's unused.

    It isn't needed -- read or write flag is already passed and sysctl
    shouldn't care about the rest.

    It _was_ used in two places at arch/frv for some reason.

    Signed-off-by: Alexey Dobriyan
    Cc: David Howells
    Cc: "Eric W. Biederman"
    Cc: Al Viro
    Cc: Ralf Baechle
    Cc: Martin Schwidefsky
    Cc: Ingo Molnar
    Cc: "David S. Miller"
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

25 Aug, 2009

1 commit

  • commit f216f082b2b37c4943f1e7c393e2786648d48f6f
    ([NETFILTER]: bridge netfilter: deal with martians correctly)
    added a refcount leak on in_dev.

    Instead of using in_dev_get(), we can use __in_dev_get_rcu(),
    as netfilter hooks are running under rcu_read_lock(), as pointed
    by Patrick.

    Signed-off-by: Eric Dumazet
    Signed-off-by: Patrick McHardy

    Eric Dumazet
     

06 Jul, 2009

1 commit


03 Jun, 2009

2 commits

  • 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
     
  • Define skb_rtable(const struct sk_buff *skb) accessor to get rtable from skb

    Delete skb->rtable field

    Setting rtable is not allowed, just set dst instead as rtable is an alias.

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

    Eric Dumazet
     

20 Apr, 2009

1 commit

  • br_nf_dev_queue_xmit only checks for ETH_P_IP packets for fragmenting but not
    VLAN packets. This results in dropping of large VLAN packets. This can be
    observed when connection tracking is enabled. Connection tracking re-assembles
    fragmented packets, and these have to re-fragmented when transmitting out. Also,
    make sure only refragmented packets are defragmented as per suggestion from
    Patrick McHardy.

    Signed-off-by: Saikiran Madugula
    Signed-off-by: Patrick McHardy

    hummerbliss@gmail.com
     

01 Feb, 2009

1 commit


13 Jan, 2009

2 commits

  • The PPPOE/VLAN processing code in the bridge netfilter is broken
    by design. The VLAN tag and the PPPOE session ID are an integral
    part of the packet flow information, yet they're completely
    ignored by the bridge netfilter. This is potentially a security
    hole as it treats all VLANs and PPPOE sessions as the same.

    What's more, it's actually broken for PPPOE as the bridge netfilter
    tries to trim the packets to the IP length without adjusting the
    PPPOE header (and adjusting the PPPOE header isn't much better
    since the PPPOE peer may require the padding to be present).

    Therefore we should disable this by default.

    It does mean that people relying on this feature may lose networking
    depending on how their bridge netfilter rules are configured.
    However, IMHO the problems this code causes are serious enough to
    warrant this.

    Signed-off-by: Herbert Xu
    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • Currently the bridge FORWARD/POST_ROUTING chains treats all
    non-IPv4 packets as IPv6. This packet fixes that by returning
    NF_ACCEPT on non-IP packets instead, just as is done in PRE_ROUTING.

    Signed-off-by: Herbert Xu
    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Herbert Xu
     

28 Nov, 2008

1 commit


27 Nov, 2008

1 commit


25 Nov, 2008

1 commit

  • As GRE tries to call the update_pmtu function on skb->dst and
    bridge supplies an skb->dst that has a NULL ops field, all is
    not well.

    This patch fixes this by giving the bridge device an ops field
    with an update_pmtu function. For the moment I've left all
    other fields blank but we can fill them in later should the
    need arise.

    Based on report and patch by Philip Craig.

    Signed-off-by: Herbert Xu
    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Herbert Xu
     

04 Nov, 2008

2 commits


20 Oct, 2008

1 commit

  • (Supplements: ee999d8b9573df1b547aacdc6d79f86eb79c25cd)

    NFPROTO_ARP actually has a different value from NF_ARP, so ensure all
    callers use the new value so that packets _do_ get delivered to the
    registered hooks.

    Signed-off-by: Jan Engelhardt
    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Jan Engelhardt
     

08 Oct, 2008

1 commit


05 Aug, 2008

1 commit

  • This patch fixes the following warning due to incompatible pointer
    assignment:

    net/bridge/br_netfilter.c: In function 'br_netfilter_rtable_init':
    net/bridge/br_netfilter.c:116: warning: assignment from incompatible
    pointer type

    This warning is due to commit 4adf0af6818f3ea52421dc0bae836cfaf20ef72a
    from July 30 (send correct MTU value in PMTU (revised)).

    Signed-off-by: Rami Rosen
    Signed-off-by: David S. Miller

    Rami Rosen
     

31 Jul, 2008

1 commit

  • When bridging interfaces with different MTUs, the bridge correctly chooses
    the minimum of the MTUs of the physical devices as the bridges MTU. But
    when a frame is passed which fits through the incoming, but not through
    the outgoing interface, a "Fragmentation Needed" packet is generated.

    However, the propagated MTU is hardcoded to 1500, which is wrong in this
    situation. The sender will repeat the packet again with the same frame
    size, and the same problem will occur again.

    Instead of sending 1500, the (correct) MTU value of the bridge is now sent
    via PMTU. To achieve this, the corresponding rtable structure is stored
    in its net_bridge structure.

    Modified to get rid of fake_net_device as well.

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

    Simon Wunderlich
     

14 Apr, 2008

2 commits


06 Mar, 2008

1 commit


01 Feb, 2008

1 commit


29 Jan, 2008

4 commits


21 Jan, 2008

1 commit

  • When packets are flood-forwarded to multiple output devices, the
    bridge-netfilter code reuses skb->nf_bridge for each clone to store
    the bridge port. When queueing packets using NFQUEUE netfilter takes
    a reference to skb->nf_bridge->physoutdev, which is overwritten
    when the packet is forwarded to the second port. This causes
    refcount unterflows for the first device and refcount leaks for all
    others. Additionally this provides incorrect data to the iptables
    physdev match.

    Unshare skb->nf_bridge by copying it if it is shared before assigning
    the physoutdev device.

    Reported, tested and based on initial patch by
    Jan Christoph Nordholz .

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     

12 Jan, 2008

1 commit

  • The bridge code incorrectly causes two POST_ROUTING hook invocations
    for DNATed packets that end up on the same bridge device. This
    happens because packets with a changed destination address are passed
    to dst_output() to make them go through the neighbour output function
    again to build a new destination MAC address, before they will continue
    through the IP hooks simulated by bridge netfilter.

    The resulting hook order is:
    PREROUTING (bridge netfilter)
    POSTROUTING (dst_output -> ip_output)
    FORWARD (bridge netfilter)
    POSTROUTING (bridge netfilter)

    The deferred hooks used to abort the first POST_ROUTING invocation,
    but since the only thing bridge netfilter actually really wants is
    a new MAC address, we can avoid going through the IP stack completely
    by simply calling the neighbour output function directly.

    Tested, reported and lots of data provided by: Damien Thebault

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     

13 Nov, 2007

1 commit


16 Oct, 2007

2 commits


11 Oct, 2007

1 commit

  • The netfilter sysctls in the bridging code don't set strategy routines:

    sysctl table check failed: /net/bridge/bridge-nf-call-arptables .3.10.1 Missing strategy
    sysctl table check failed: /net/bridge/bridge-nf-call-iptables .3.10.2 Missing strategy
    sysctl table check failed: /net/bridge/bridge-nf-call-ip6tables .3.10.3 Missing strategy
    sysctl table check failed: /net/bridge/bridge-nf-filter-vlan-tagged .3.10.4 Missing strategy
    sysctl table check failed: /net/bridge/bridge-nf-filter-pppoe-tagged .3.10.5 Missing strategy

    These binary sysctls can't work. The binary sysctl numbers of
    other netfilter sysctls with this problem are being removed. These
    need to go as well.

    Signed-off-by: Joseph Fannin
    Acked-by: "Eric W. Biederman"
    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Joseph Fannin
     

17 Sep, 2007

1 commit

  • This patch adds an optimised version of skb_cow that avoids the copy if
    the header can be modified even if the rest of the payload is cloned.

    This can be used in encapsulating paths where we only need to modify the
    header. As it is, this can be used in PPPOE and bridging.

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

    Herbert Xu
     

27 Aug, 2007

1 commit

  • I tried to preserve bridging code as it was before, but logic is quite
    strange - I think we should free skb on error, since it is already
    unshared and thus will just leak.

    Herbert Xu states:

    > + if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
    > + goto out;

    If this happens it'll be a double-free on skb since we'll
    return NF_DROP which makes the caller free it too.

    We could return NF_STOLEN to prevent that but I'm not sure
    whether that's correct netfilter semantics. Patrick, could
    you please make a call on this?

    Patrick McHardy states:

    NF_STOLEN should work fine here.

    Signed-off-by: Evgeniy Polyakov
    Signed-off-by: David S. Miller

    Evgeniy Polyakov
     

03 May, 2007

1 commit


26 Apr, 2007

3 commits