History log of /src/sys/net/if_bridgevar.h |
Revision | | Date | Author | Comments |
1.40 |
| 22-Apr-2025 |
ozaki-r | bridge: resolve a race condition in bridge_stop()
Without BRIDGE_LOCK, the callout can be scheduled after callout_halt.
Note that we should avoid depending on IFF_RUNNING which can be racy. Suggested by riastradh at https://mail-index.netbsd.org/source-changes-d/2025/04/16/msg014470.html
PR kern/59340
|
1.39 |
| 03-Sep-2024 |
ozaki-r | bridge: implement interface protection
It enables a feature similar to "protected-port" or "isolation" in some router products by marking member interfaces protected; when a frame arrives on a protected interface and is being forwarded to another protected interface, the frame will be discarded.
The code is developed by the SEIL team at IIJ.
|
1.38 |
| 16-Jul-2024 |
ozaki-r | bridge: get rid of unnecessary macros for pserialize
|
1.37 |
| 30-Sep-2021 |
yamaguchi | branches: 1.37.4; bridge: Register bridge_ifdetach to ether_ifdetach hook
|
1.36 |
| 30-Sep-2021 |
yamaguchi | bridge: Register bridge_calc_link_state to link-state change hook
|
1.35 |
| 27-Sep-2020 |
roy | bridge: Calculate link state as the best link state of any member
If any member is LINK_STATE_UP then it's LINK_STATE_UP. Otherwise if any member is LINK_STATE_UNKNOWN then it's LINK_STATE_UNKNOWN. Otherwise it's LINK_STATE_DOWN.
|
1.34 |
| 30-Apr-2020 |
jdolecek | add sc_capenable member, forgot to commit
|
1.33 |
| 12-Dec-2018 |
rin | branches: 1.33.4; PR kern/53562
Handle TX offload in software when a packet is sent via bridge_output(). We can send it as is in the following exceptional cases:
For unicast:
(1) When the destination interface is the same as source.
(2) When the destination supports all TX offload options specified in a packet.
For multicast/broadcast:
(3) When all the members of the bridge support the specified TX offload options.
For (3), add sc_csum_flags_tx flag to bridge softc, which is logical AND b/w capabilities of TX offload options in member interface (ifp->if_csum_flags_tx). The flag is updated when a member is (i) added to or (ii) removed from a bridge, or (iii) if_csum_flags_tx flag of a member interface is manipulated via ifconfig(8).
Turn on M_CSUM_TSOv[46] bit in ifp->if_csum_flags_tx flag when TSO[46] is enabled for that interface.
OK msaitoh thorpej
|
1.32 |
| 18-Apr-2018 |
ozaki-r | branches: 1.32.2; bridge: use pslist(9) for rtlist and rthash
The change fixes race conditions on list operations. One example is that a reader may see invalid pointers on a looking item in a list due to lack of membar_producer.
|
1.31 |
| 28-Apr-2016 |
ozaki-r | branches: 1.31.10; 1.31.16; Constify rtentry of if_output
We no longer need to change rtentry below if_output.
The change makes it clear where rtentries are changed (or not) and helps forthcoming locking (os psrefing) rtentries.
|
1.30 |
| 19-Apr-2016 |
ozaki-r | Apply psref(9) to bridge(4)
Note that there is an issue that ioctls for an interface and a destruction of the interface can run in parallel and it causes race conditions on bridge as well (it rarely happens). The issue will be addressed in the interface common code (if.c).
|
1.29 |
| 19-Apr-2016 |
ozaki-r | Remove BRIDGE_MPSAFE switch and enable MP-safe code by default
We need to enable it by default because bridge_input now runs in softint, but bridge_input w/o BRIDGE_MPSAFE was designed as it runs in hardware interrupt.
Note that there remains a racy code in bridge_output; it will be solved in the upcoming change (applying psref(9)).
|
1.28 |
| 11-Apr-2016 |
ozaki-r | Move #include <sys/pslist.h> inside #ifdef _KERNEL for building brconfig
|
1.27 |
| 11-Apr-2016 |
ozaki-r | Use pslist(9) in bridge(4)
This adds missing memory barriers to list operations for pserialize.
|
1.26 |
| 15-Feb-2016 |
ozaki-r | Simplify bridge(4)
Thanks to introducing softint-based if_input, the entire bridge code now never run in hardware interrupt context. So we can simplify the code.
- Remove spin mutexes - They were needed because some code of bridge could run in hardware interrupt context - We now need only an adaptive mutex for each shared object (a member list and a forwarding table) - Remove pktqueue - bridge_input is already in softint, using another softint (for bridge_forward) is useless - Packet distribution should be down at device drivers
|
1.25 |
| 10-Feb-2016 |
ozaki-r | Don't share struct work, instead have one per softc
Pointed out by riastradh@
|
1.24 |
| 01-Jun-2015 |
matt | Modify the BRDGGIFS and BRDGRTS cmds to be more COMPAT_NETBSD32 friendly. (XXX whitespace)
|
1.23 |
| 16-Jan-2015 |
ozaki-r | Introduce defflag for NET_MPSAFE
|
1.22 |
| 08-Jan-2015 |
ozaki-r | Use pserialize for rtlist in bridge
This change enables lockless accesses to bridge rtable lists. See locking notes in a comment to know how pserialize and mutexes are used. Some functions are rearranged to use pserialize. A workqueue is introduced to use pserialize in bridge_rtage via bridge_timer callout.
As usual, pserialize and mutexes are used only when NET_MPSAFE on. On the other hand, the newly added workqueue is used regardless of NET_MPSAFE on or off.
|
1.21 |
| 31-Dec-2014 |
ozaki-r | Use pserialize in bridge
This change enables lockless accesses to bridge member lists. See locking notes in a comment to know how pserialize and mutexes are used.
This change also provides support for softint-based interrupt handling; pserialize readers can run in both HW interrupt and softint contexts.
As usual, pserialize is used only when NET_MPSAFE on.
|
1.20 |
| 14-Jul-2014 |
ozaki-r | branches: 1.20.4; Make bridge MPSAFE
- Introduce BRIDGE_MPSAFE - It's enabled only when NET_MPSAFE is defined in if.h or the kernel config - Add iflist and rtlist mutex locks - Locking iflist is performance sensitive, so it's not used when !BRIDGE_MPSAFE - Add bif object reference counting - It enables fine-grain locking for bridge member lists by allowing to not hold a lock during touching a bif - bridge_release_member is added to decrement the reference count - A condition variable is added to do bridge_delete_member gracefully - Add if_bridgeif to ifnet - It's a shortcut to a bif object of a bridge member - It reduces a bif lookup cost and so lock contention on iflist - Make bridgestp MPSAFE too
|
1.19 |
| 20-Jun-2014 |
ozaki-r | Remove unnecessary sc_softintr
|
1.18 |
| 17-Jun-2014 |
ozaki-r | Restructure ether_input and bridge_input
The network stack of NetBSD is well organized and layered. A packet reception is processed from a lower layer to an upper layer one by one. However, ether_input and bridge_input are not structured so. bridge_input is called inside ether_input.
The new structure replaces ifnet#if_input of a bridge member with bridge_input when the member is attached. So a packet goes straight on a packet reception via a bridge, bridge_input => ether_input => ip_input.
The change is part of a patch of Lloyd Parkes submitted in PR 48104. Unlike the patch, the change doesn't intend to change the behavior of the packet processing. Another patch will fix PR 48104.
|
1.17 |
| 16-Jun-2014 |
ozaki-r | Include pktqueue.h only if _KERNEL
|
1.16 |
| 16-Jun-2014 |
ozaki-r | Use pktqueue for bridge forwarding queue and softint
|
1.15 |
| 23-Aug-2012 |
drochner | branches: 1.15.2; 1.15.12; the address expire counter is just a time difference; it can turn negative after the timer expired until the entry is deleted. make it signed, so that we don't get output like "00:1b:78:12:50:46 wm0 18446744073709551349 flags=0<>"
|
1.14 |
| 04-Apr-2009 |
bouyer | branches: 1.14.12; Fix for if_start() and pfil_hook() being called from hardware interrupt context (reported on various mailing-lists, and part of PR kern/41114, causing panic in pf(4) and possibly ipf(4) when BRIDGE_IPF is used). Defer bridge_forward() to a software interrupt; bridge_input() enqueues mbufs to ifp->if_snd which is handled in bridge_forward().
|
1.13 |
| 18-Jan-2009 |
mrg | branches: 1.13.2; Fix multiple problems:
* A sign extension error creating the bridge ID corrupted the priority (always making it the maximum). * Do not catch STP packets on an interface for which STP is not enabled -- it's a violation of the spec, and causes STP to fail on neighboring bridges. * An optimization to bstp_input() -- some information is already known when we call it.
contributed anonymously.
|
1.12 |
| 11-Jan-2009 |
christos | merge christos-time_t
|
1.11 |
| 09-Jul-2007 |
ad | branches: 1.11.28; 1.11.30; 1.11.34; 1.11.44; 1.11.46; Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes - select()/poll() improvements - miscellaneous MT safety improvements
|
1.10 |
| 04-Mar-2007 |
christos | branches: 1.10.2; 1.10.4; Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
|
1.9 |
| 17-Feb-2007 |
dyoung | KNF: de-__P, bzero -> memset, bcmp -> memcmp. Remove extraneous parentheses in return statements.
Cosmetic: don't open-code TAILQ_FOREACH().
Cosmetic: change types of variables to avoid oodles of casts: in in6_src.c, avoid casts by changing several route_in6 pointers to struct route pointers. Remove unnecessary casts to caddr_t elsewhere.
Pave the way for eliminating address family-specific route caches: soon, struct route will not embed a sockaddr, but it will hold a reference to an external sockaddr, instead. We will set the destination sockaddr using rtcache_setdst(). (I created a stub for it, but it isn't used anywhere, yet.) rtcache_free() will free the sockaddr. I have extracted from rtcache_free() a helper subroutine, rtcache_clear(). rtcache_clear() will "forget" a cached route, but it will not forget the destination by releasing the sockaddr. I use rtcache_clear() instead of rtcache_free() in rtcache_update(), because rtcache_update() is not supposed to forget the destination.
Constify:
1 Introduce const accessor for route->ro_dst, rtcache_getdst().
2 Constify the 'dst' argument to ifnet->if_output(). This led me to constify a lot of code called by output routines.
3 Constify the sockaddr argument to protosw->pr_ctlinput. This led me to constify a lot of code called by ctlinput routines.
4 Introduce const macros for converting from a generic sockaddr to family-specific sockaddrs, e.g., sockaddr_in: satocsin6, satocsin, et cetera.
|
1.8 |
| 10-Dec-2005 |
elad | branches: 1.8.26; Multiple inclusion protection, as suggested by christos@ on tech-kern@ few days ago.
|
1.7 |
| 28-Jun-2005 |
seanb | branches: 1.7.2; - Rearranged layout of struct bridge_iflist slightly to make members naturally aligned. - This saves 8 bytes worth of pad.
|
1.6 |
| 26-Feb-2005 |
perry | nuke trailing whitespace
|
1.5 |
| 16-Sep-2003 |
jdc | branches: 1.5.8; 1.5.10; Add filter/no filter flag parameter to bridge_enqueue().
|
1.4 |
| 08-Jul-2003 |
itojun | prototype must not have variable name
|
1.3 |
| 19-Mar-2003 |
bouyer | branches: 1.3.2; Fix 2 bugs: - initialise stp when the bridge is turned up, without this stp will keep all interfaces disabled in a sequence like: brconfig bridge0 add if0 add if1 stp if0 stp if1 up - s/BRDGSPRI/BRDGSIFPRIO in brconfig.c:cmd_ifpriority()
add a command (ifpathcost) to change the stp path cost of the STP path cost of an interface. Display the interface path cost with the others STP parameters.
|
1.2 |
| 15-Feb-2003 |
perseant | Add ipf packet-filtering option to if_bridge. The option is controlled at compile-time by BRIDGE_IPF, and at runtime by brconfig with the {ipf,-ipf} option on a per-bridge basis.
As a side-effect, add PFIL_HOOKS processing to if_bridge.
|
1.1 |
| 17-Aug-2001 |
thorpej | branches: 1.1.2; 1.1.4; 1.1.18; Add support for building Ethernet bridges, based on Jason Wright's bridge driver from OpenBSD, although the bridge code has been *heavily* modified by me (the 802.1D code remains mostly unchanged from the original).
|
1.1.18.1 |
| 30-Jun-2003 |
grant | Apply patch (requested by bouyer in ticket #1355):
Fix 2 bugs: - initialise stp when the bridge is turned up, without this stp will keep all interfaces disabled in a sequence like: brconfig bridge0 add if0 add if1 stp if0 stp if1 up - s/BRDGSPRI/BRDGSIFPRIO in brconfig.c:cmd_ifpriority()
add a command (ifpathcost) to change the stp path cost of the STP path cost of an interface. Display the interface path cost with the others STP parameters.
|
1.1.4.2 |
| 25-Aug-2001 |
thorpej | Merge Aug 24 -current into the kqueue branch.
|
1.1.4.1 |
| 17-Aug-2001 |
thorpej | file if_bridgevar.h was added on branch kqueue on 2001-08-25 06:16:56 +0000
|
1.1.2.2 |
| 24-Aug-2001 |
nathanw | Catch up with -current.
|
1.1.2.1 |
| 17-Aug-2001 |
nathanw | file if_bridgevar.h was added on branch nathanw_sa on 2001-08-24 00:12:08 +0000
|
1.3.2.6 |
| 11-Dec-2005 |
christos | Sync with head.
|
1.3.2.5 |
| 10-Nov-2005 |
skrll | Sync with HEAD. Here we go again...
|
1.3.2.4 |
| 04-Mar-2005 |
skrll | Sync with HEAD.
Hi Perry!
|
1.3.2.3 |
| 21-Sep-2004 |
skrll | Fix the sync with head I botched.
|
1.3.2.2 |
| 18-Sep-2004 |
skrll | Sync with HEAD.
|
1.3.2.1 |
| 03-Aug-2004 |
skrll | Sync with HEAD
|
1.5.10.1 |
| 19-Mar-2005 |
yamt | sync with head. xen and whitespace. xen part is not finished.
|
1.5.8.1 |
| 29-Apr-2005 |
kent | sync with -current
|
1.7.2.3 |
| 03-Sep-2007 |
yamt | sync with head.
|
1.7.2.2 |
| 26-Feb-2007 |
yamt | sync with head.
|
1.7.2.1 |
| 21-Jun-2006 |
yamt | sync with head.
|
1.8.26.2 |
| 12-Mar-2007 |
rmind | Sync with HEAD.
|
1.8.26.1 |
| 27-Feb-2007 |
yamt | - sync with head. - move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
|
1.10.4.1 |
| 11-Jul-2007 |
mjf | Sync with head.
|
1.10.2.1 |
| 01-Jul-2007 |
ad | Adapt to callout API change.
|
1.11.46.1 |
| 04-Apr-2009 |
snj | Pull up following revision(s) (requested by bouyer in ticket #660): sys/net/if_bridge.c: revision 1.65 sys/net/if_bridgevar.h: revision 1.14 Fix for if_start() and pfil_hook() being called from hardware interrupt context (reported on various mailing-lists, and part of PR kern/41114, causing panic in pf(4) and possibly ipf(4) when BRIDGE_IPF is used). Defer bridge_forward() to a software interrupt; bridge_input() enqueues mbufs to ifp->if_snd which is handled in bridge_forward().
|
1.11.44.2 |
| 28-Apr-2009 |
skrll | Sync with HEAD.
|
1.11.44.1 |
| 19-Jan-2009 |
skrll | Sync with HEAD.
|
1.11.34.1 |
| 04-May-2009 |
yamt | sync with head.
|
1.11.30.1 |
| 29-Mar-2008 |
christos | Welcome to the time_t=long long dev_t=uint64_t branch.
|
1.11.28.1 |
| 17-Jan-2009 |
mjf | Sync with HEAD.
|
1.13.2.1 |
| 13-May-2009 |
jym | Sync with HEAD.
Commit is split, to avoid a "too many arguments" protocol error.
|
1.14.12.1 |
| 30-Oct-2012 |
yamt | sync with head
|
1.15.12.1 |
| 10-Aug-2014 |
tls | Rebase.
|
1.15.2.2 |
| 03-Dec-2017 |
jdolecek | update from HEAD
|
1.15.2.1 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.20.4.5 |
| 29-May-2016 |
skrll | Sync with HEAD
|
1.20.4.4 |
| 22-Apr-2016 |
skrll | Sync with HEAD
|
1.20.4.3 |
| 19-Mar-2016 |
skrll | Sync with HEAD
|
1.20.4.2 |
| 06-Jun-2015 |
skrll | Sync with HEAD
|
1.20.4.1 |
| 06-Apr-2015 |
skrll | Sync with HEAD
|
1.31.16.2 |
| 26-Dec-2018 |
pgoyette | Sync with HEAD, resolve a few conflicts
|
1.31.16.1 |
| 22-Apr-2018 |
pgoyette | Sync with HEAD
|
1.31.10.1 |
| 18-Apr-2018 |
martin | Pull up following revision(s) (requested by ozaki-r in ticket #777):
tests/net/if_bridge/t_rtable.sh: revision 1.3 sys/net/if_bridge.c: revision 1.150-1.154 sys/net/if_bridgevar.h: revision 1.32
Remove obsolete NULL checks
Simplify bridge_rtnode_insert (NFC)
bridge: use pslist(9) for rtlist and rthash
The change fixes race conditions on list operations. One example is that a reader may see invalid pointers on a looking item in a list due to lack of membar_producer.
Add a test that checks if brconfig flush surely removes all entries
Get rid of a unnecessary semicolon Pointed out by kamil@
Add missing PSLIST_ENTRY_INIT and PSLIST_ENTRY_DESTROY
|
1.32.2.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.33.4.1 |
| 15-May-2025 |
martin | Pull up following revision(s) (requested by ozaki-r in ticket #1953):
sys/net/if_bridge.c: revision 1.199 sys/net/if_bridgevar.h: revision 1.40
bridge: resolve a race condition in bridge_stop() Without BRIDGE_LOCK, the callout can be scheduled after callout_halt.
Note that we should avoid depending on IFF_RUNNING which can be racy. Suggested by riastradh at
https://mail-index.netbsd.org/source-changes-d/2025/04/16/msg014470.html
PR kern/59340
|
1.37.4.2 |
| 15-May-2025 |
martin | Pull up following revision(s) (requested by ozaki-r in ticket #1116):
sys/net/if_bridge.c: revision 1.199 sys/net/if_bridgevar.h: revision 1.40
bridge: resolve a race condition in bridge_stop() Without BRIDGE_LOCK, the callout can be scheduled after callout_halt.
Note that we should avoid depending on IFF_RUNNING which can be racy. Suggested by riastradh at
https://mail-index.netbsd.org/source-changes-d/2025/04/16/msg014470.html
PR kern/59340
|
1.37.4.1 |
| 05-Sep-2024 |
martin | Pull up following revision(s) (requested by ozaki-r in ticket #818):
sys/net/if_bridgevar.h: revision 1.39 sbin/brconfig/brconfig.c: revision 1.18 tests/net/if_bridge/unicast.pcap.uue: revision 1.1 tests/net/if_bridge/t_bridge.sh: revision 1.20 sbin/brconfig/brconfig.8: revision 1.21 tests/net/if_bridge/t_bridge.sh: revision 1.21 sys/net/if_bridge.c: revision 1.194 tests/net/if_bridge/Makefile: revision 1.4 distrib/sets/lists/tests/mi: revision 1.1336 tests/net/if_bridge/broadcast.pcap.uue: revision 1.1
bridge: implement interface protection
It enables a feature similar to "protected-port" or "isolation" in some router products by marking member interfaces protected; when a frame arrives on a protected interface and is being forwarded to another protected interface, the frame will be discarded.
The code is developed by the SEIL team at IIJ.
tests: dedup test scripts like others
brconfig: add protect/-protect commands
It marks/clears a specified interface "protected". tests, bridge: add tests for interface protection
The original author of the test is k-goda@IIJ. ozaki-r improved the test slightly.
distrib: install uuencoded pcap files for testing
|