17 Dec, 2011

1 commit


12 Dec, 2011

1 commit


09 Dec, 2011

1 commit

  • If user has configured a MAC address that is not one of the existing
    ports of the bridge, then we need to add a special entry in the forwarding
    table. This forwarding table entry has no outgoing port so it has to be
    treated a little differently. The special entry is reported by the netlink
    interface with ifindex of bridge, but ignored by the old interface since there
    is no usable way to put it in the ABI.

    Reported-by: Koki Sanagi
    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    stephen hemminger
     

17 Nov, 2011

1 commit


25 Oct, 2011

1 commit


19 Oct, 2011

1 commit

  • Need to cleanup bridge device timers and ports when being bridge
    device is being removed via netlink.

    This fixes the problem of observed when doing:
    ip link add br0 type bridge
    ip link set dev eth1 master br0
    ip link set br0 up
    ip link del br0

    which would cause br0 to hang in unregister_netdev because
    of leftover reference count.

    Reported-by: Sridhar Samudrala
    Signed-off-by: Stephen Hemminger
    Acked-by: Sridhar Samudrala
    Signed-off-by: David S. Miller

    stephen hemminger
     

07 Oct, 2011

1 commit

  • This is based on an earlier patch by Nick Carter with comments
    by David Lamparter but with some refinements. Thanks for their patience
    this is a confusing area with overlap of standards, user requirements,
    and compatibility with earlier releases.

    It adds a new sysfs attribute
    /sys/class/net/brX/bridge/group_fwd_mask
    that controls forwarding of frames with address of: 01-80-C2-00-00-0X
    The default setting has no forwarding to retain compatibility.

    One change from earlier releases is that forwarding of group
    addresses is not dependent on STP being enabled or disabled. This
    choice was made based on interpretation of tie 802.1 standards.
    I expect complaints will arise because of this, but better to follow
    the standard than continue acting incorrectly by default.

    The filtering mask is writeable, but only values that don't forward
    known control frames are allowed. It intentionally blocks attempts
    to filter control protocols. For example: writing a 8 allows
    forwarding 802.1X PAE addresses which is the most common request.

    Reported-by: David Lamparter
    Original-patch-by: Nick Carter
    Signed-off-by: Stephen Hemminger
    Tested-by: Benjamin Poirier
    Signed-off-by: David S. Miller

    stephen hemminger
     

23 Jul, 2011

1 commit

  • A bridge topology with three systems:

    +------+ +------+
    | A(2) |--| B(1) |
    +------+ +------+
    \ /
    +------+
    | C(3) |
    +------+

    What is supposed to happen:
    * bridge with the lowest ID is elected root (for example: B)
    * C detects that A->C is higher cost path and puts in blocking state

    What happens. Bridge with lowest id (B) is elected correctly as
    root and things start out fine initially. But then config BPDU
    doesn't get transmitted from A -> C. Because of that
    the link from A-C is transistioned to the forwarding state.

    The root cause of this is that the configuration messages
    is generated with bogus message age, and dropped before
    sending.

    In the standardmessage_age is supposed to be:
    the time since the generation of the Configuration BPDU by
    the Root that instigated the generation of this Configuration BPDU.

    Reimplement this by recording the timestamp (age + jiffies) when
    recording config information. The old code incorrectly used the time
    elapsed on the ageing timer which was incorrect.

    See also:
    https://bugzilla.vyatta.com/show_bug.cgi?id=7164

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

    stephen hemminger
     

29 Apr, 2011

1 commit


05 Apr, 2011

4 commits

  • Apply restrictions on STP parameters based 802.1D 1998 standard.
    * Fixes missing locking in set path cost ioctl
    * Uses common code for both ioctl and sysfs

    This is based on an earlier patch Sasikanth V but with overhaul.

    Note:
    1. It does NOT enforce the restriction on the relationship max_age and
    forward delay or hello time because in existing implementation these are
    set as independant operations.

    2. If STP is disabled, there is no restriction on forward delay

    3. No restriction on holding time because users use Linux code to act
    as hub or be sticky.

    4. Although standard allow 0-255, Linux only allows 0-63 for port priority
    because more bits are reserved for port number.

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

    stephen hemminger
     
  • Use RTM_NEWNEIGH and RTM_DELNEIGH to allow updating of entries
    in bridge forwarding table. This allows manipulating static entries
    which is not possible with existing tools.

    Example (using bridge extensions to iproute2)
    # br fdb add 00:02:03:04:05:06 dev eth0

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

    stephen hemminger
     
  • This allows applications to query and monitor bridge forwarding
    table in the same method used for neighbor table. The forward table
    entries are returned in same structure format as used by the ioctl.
    If more information is desired in future, the netlink method is
    extensible.

    Example (using bridge extensions to iproute2)
    # br monitor

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

    stephen hemminger
     
  • Adds tracking the last used time in forwarding table.
    Rename ageing_timer to updated to better describe it.

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

    stephen hemminger
     

28 Mar, 2011

1 commit


17 Mar, 2011

1 commit


20 Feb, 2011

1 commit


12 Feb, 2011

1 commit

  • As it turns out we never need to walk through the list of multicast
    groups subscribed by the bridge interface itself (the only time we'd
    want to do that is when we shut down the bridge, in which case we
    simply walk through all multicast groups), we don't really need to
    keep an hlist for mp->mglist.

    This means that we can replace it with just a single bit to indicate
    whether the bridge interface is subscribed to a group.

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

    Herbert Xu
     

25 Jan, 2011

1 commit

  • Quoting Ben Hutchings: we presumably won't be defining features that
    can only be enabled on 64-bit architectures.

    Occurences found by `grep -r` on net/, drivers/net, include/

    [ Move features and vlan_features next to each other in
    struct netdev, as per Eric Dumazet's suggestion -DaveM ]

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

    Michał Mirosław
     

16 Nov, 2010

3 commits


03 Jul, 2010

1 commit


02 Jul, 2010

1 commit

  • Support more fine grained control of bridge netfilter iptables invocation
    by adding seperate brnf_call_*tables parameters for each device using the
    sysfs interface. Packets are passed to layer 3 netfilter when either the
    global parameter or the per bridge parameter is enabled.

    Acked-by: Stephen Hemminger
    Acked-by: David S. Miller
    Signed-off-by: Patrick McHardy

    Patrick McHardy
     

24 Jun, 2010

1 commit

  • Use u64_stats_sync infrastructure to provide 64bit rx/tx
    counters even on 32bit hosts.

    It is safe to use a single u64_stats_sync for rx and tx,
    because BH is disabled on both, and we use per_cpu data.

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

    Eric Dumazet
     

16 Jun, 2010

3 commits

  • The version of br_netpoll_send_skb used when netpoll is off is
    missing a const thus causing a warning.

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

    Herbert Xu
     
  • Register net_bridge_port pointer as rx_handler data pointer. As br_port is
    removed from struct net_device, another netdev priv_flag is added to indicate
    the device serves as a bridge port. Also rcuized pointers are now correctly
    dereferenced in br_fdb.c and in netfilter parts.

    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jiri Pirko
     
  • There are multiple problems with the newly added netpoll support:

    1) Use-after-free on each netpoll packet.
    2) Invoking unsafe code on netpoll/IRQ path.
    3) Breaks when netpoll is enabled on the underlying device.

    This patch fixes all of these problems. In particular, we now
    allocate proper netpoll structures for each underlying device.

    We only allow netpoll to be enabled on the bridge when all the
    devices underneath it support netpoll. Once it is enabled, we
    do not allow non-netpoll devices to join the bridge (until netpoll
    is disabled again).

    This allows us to do away with the npinfo juggling that caused
    problem number 1.

    Incidentally this patch fixes number 2 by bypassing unsafe code
    such as multicast snooping and netfilter.

    Reported-by: Qianfeng Zhang
    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     

02 Jun, 2010

1 commit

  • What this patch does is it removes two receive frame hooks (for bridge and for
    macvlan) from __netif_receive_skb. These are replaced them with a single
    hook for both. It only supports one hook per device because it makes no
    sense to do bridging and macvlan on the same device.

    Then a network driver (of virtual netdev like macvlan or bridge) can register
    an rx_handler for needed net device.

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

    Jiri Pirko
     

16 May, 2010

3 commits

  • Links for each port are created in sysfs using the device
    name, but this could be changed after being added to the
    bridge.

    As well as being unable to remove interfaces after this
    occurs (because userspace tools don't recognise the new
    name, and the kernel won't recognise the old name), adding
    another interface with the old name to the bridge will
    cause an error trying to create the sysfs link.

    This fixes the problem by listening for NETDEV_CHANGENAME
    notifications and renaming the link.

    https://bugzilla.kernel.org/show_bug.cgi?id=12743

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

    Simon Arlott
     
  • Use one set of macro's for all bridge messages.

    Note: can't use netdev_XXX macro's because bridge is purely
    virtual and has no device parent.

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

    stephen hemminger
     
  • Move code around so that the ifdef for NETPOLL_CONTROLLER don't have to
    show up in main code path. The control functions should be in helpers
    that are only compiled if needed.

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

    stephen hemminger
     

06 May, 2010

1 commit

  • Based on the previous patch, make bridge support netpoll by:

    1) implement the 2 methods to support netpoll for bridge;

    2) modify netpoll during forwarding packets via bridge;

    3) disable netpoll support of bridge when a netpoll-unabled device
    is added to bridge;

    4) enable netpoll support when all underlying devices support netpoll.

    Cc: David Miller
    Cc: Neil Horman
    Cc: Stephen Hemminger
    Cc: Matt Mackall
    Signed-off-by: WANG Cong
    Signed-off-by: David S. Miller

    WANG Cong
     

23 Apr, 2010

2 commits


21 Apr, 2010

1 commit


17 Mar, 2010

2 commits


16 Mar, 2010

1 commit

  • From: Michael Braun

    bridge: Fix br_forward crash in promiscuous mode

    It's a linux-next kernel from 2010-03-12 on an x86 system and it
    OOPs in the bridge module in br_pass_frame_up (called by
    br_handle_frame_finish) because brdev cannot be dereferenced (its set to
    a non-null value).

    Adding some BUG_ON statements revealed that
    BR_INPUT_SKB_CB(skb)->brdev == br-dev
    (as set in br_handle_frame_finish first)
    only holds until br_forward is called.
    The next call to br_pass_frame_up then fails.

    Digging deeper it seems that br_forward either frees the skb or passes
    it to NF_HOOK which will in turn take care of freeing the skb. The
    same is holds for br_pass_frame_ip. So it seems as if two independent
    skb allocations are required. As far as I can see, commit
    b33084be192ee1e347d98bb5c9e38a53d98d35e2 ("bridge: Avoid unnecessary
    clone on forward path") removed skb duplication and so likely causes
    this crash. This crash does not happen on 2.6.33.

    I've therefore modified br_forward the same way br_flood has been
    modified so that the skb is not freed if skb0 is going to be used
    and I can confirm that the attached patch resolves the issue for me.

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

    Michael Braun
     

08 Mar, 2010

1 commit

  • Constify struct sysfs_ops.

    This is part of the ops structure constification
    effort started by Arjan van de Ven et al.

    Benefits of this constification:

    * prevents modification of data that is shared
    (referenced) by many other structure instances
    at runtime

    * detects/prevents accidental (but not intentional)
    modification attempts on archs that enforce
    read-only kernel data at runtime

    * potentially better optimized code as the compiler
    can assume that the const data cannot be changed

    * the compiler/linker move const data into .rodata
    and therefore exclude them from false sharing

    Signed-off-by: Emese Revfy
    Acked-by: David Teigland
    Acked-by: Matt Domsch
    Acked-by: Maciej Sosnowski
    Acked-by: Hans J. Koch
    Acked-by: Pekka Enberg
    Acked-by: Jens Axboe
    Acked-by: Stephen Hemminger
    Signed-off-by: Greg Kroah-Hartman

    Emese Revfy
     

02 Mar, 2010

1 commit

  • Fix the following build error when IGMP_SNOOPING is not enabled.
    In file included from net/bridge/br.c:24:
    net/bridge/br_private.h: In function 'br_multicast_is_router':
    net/bridge/br_private.h:361: error: 'struct net_bridge' has no member named 'multicast_router'
    net/bridge/br_private.h:362: error: 'struct net_bridge' has no member named 'multicast_router'
    net/bridge/br_private.h:363: error: 'struct net_bridge' has no member named 'multicast_router_timer'

    Signed-off-by: Sridhar Samudrala
    Acked-by: Randy Dunlap
    Acked-by: Herbert Xu
    Signed-off-by: David S. Miller

    Sridhar Samudrala