OpenBSD CVS

CVS log for src/sys/net/Attic/if_switch.c


[BACK] Up to [local] / src / sys / net

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.45, Thu Nov 11 10:03:10 2021 UTC (2 years, 7 months ago) by claudio
Branch: MAIN
CVS Tags: HEAD
Changes since 1.44: +1 -1 lines
FILE REMOVED

Retire switch(4) it never really was production ready and the OpenFlow
API implemented is a deadend.
OK akoshibe@ yasuoka@ deraadt@ kn@ patrick@ sthen@

Revision 1.44 / (download) - annotate - [select for diffs], Wed Jul 7 20:19:01 2021 UTC (2 years, 11 months ago) by sashan
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.43: +17 -1 lines
Diff to previous 1.43 (colored)

tell ether_input() to call pf_test() outside of smr_read sections,
because smr_read sections don't play well with sleeping locks in pf(4).

OK bluhm@

Revision 1.43 / (download) - annotate - [select for diffs], Fri Mar 5 06:44:09 2021 UTC (3 years, 3 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.42: +3 -3 lines
Diff to previous 1.42 (colored)

pass the uint64_t dst ethernet address from ether_input to bridges.

tested on amd64 and sparc64.

Revision 1.42 / (download) - annotate - [select for diffs], Thu Feb 25 02:48:21 2021 UTC (3 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.41: +4 -4 lines
Diff to previous 1.41 (colored)

we don't have to cast to caddr_t when calling m_copydata anymore.

the first cut of this diff was made with coccinelle using this spatch:

@rule@
type caddr_t;
expression m, off, len, cp;
@@
-m_copydata(m, off, len, (caddr_t)cp)
+m_copydata(m, off, len, cp)

i had fix it's opinionated idea of formatting by hand though, so
i'm not sure it was worth it.

ok deraadt@ bluhm@

Revision 1.41 / (download) - annotate - [select for diffs], Tue Feb 23 15:13:58 2021 UTC (3 years, 3 months ago) by mvs
Branch: MAIN
Changes since 1.40: +3 -1 lines
Diff to previous 1.40 (colored)

Wrap by netlock the whole foreach loop which calls switch_port_detach() in
switch_clone_destroy(). This fixes netlock assertion within underlay
ifpromisc(). The problem was reported by hrvoje@ [1].

"why not" by deraadt@

1. https://marc.info/?l=openbsd-bugs&m=161338077403538&w=2

Revision 1.40 / (download) - annotate - [select for diffs], Tue Jan 19 19:39:14 2021 UTC (3 years, 4 months ago) by mvs
Branch: MAIN
Changes since 1.39: +29 -17 lines
Diff to previous 1.39 (colored)

switch(4): convert ifunit to if_unit(9)

ok dlg@

Revision 1.39 / (download) - annotate - [select for diffs], Sat Jan 2 13:16:40 2021 UTC (3 years, 5 months ago) by mvs
Branch: MAIN
Changes since 1.38: +1 -2 lines
Diff to previous 1.38 (colored)

Don't call if_deactivate() in switch_clone_destroy(). Following
if_detach() will do this.

ok kn@

Revision 1.38 / (download) - annotate - [select for diffs], Fri Aug 28 12:01:48 2020 UTC (3 years, 9 months ago) by mvs
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.37: +5 -1 lines
Diff to previous 1.37 (colored)

Add missing #if's to fix build without bpf(4).

ok deraadt@

Revision 1.37 / (download) - annotate - [select for diffs], Thu Jul 30 11:32:06 2020 UTC (3 years, 10 months ago) by mvs
Branch: MAIN
Changes since 1.36: +14 -6 lines
Diff to previous 1.36 (colored)

`struct bstp_state' stores pointer to parent `ifnet' as `bs_ifp'.
Replace this pointer by interface index. This allow us to avoid some use
after free issues caused by ifioctl() races.

ok sashan@

Revision 1.36 / (download) - annotate - [select for diffs], Tue Jul 28 09:52:32 2020 UTC (3 years, 10 months ago) by mvs
Branch: MAIN
Changes since 1.35: +2 -1 lines
Diff to previous 1.35 (colored)

Add missing `IFXF_CLONED' flag to clone interfaces.

ok mpi@

Revision 1.35 / (download) - annotate - [select for diffs], Tue Jul 28 07:37:05 2020 UTC (3 years, 10 months ago) by kn
Branch: MAIN
Changes since 1.34: +4 -2 lines
Diff to previous 1.34 (colored)

Return total size if SIOCBRDGIFS passes in ifbic_len set to zero

In accordance to bridge(4) which behaves correctly as per the manual.

OK dlg

Revision 1.34 / (download) - annotate - [select for diffs], Wed Jul 22 20:37:35 2020 UTC (3 years, 10 months ago) by mvs
Branch: MAIN
Changes since 1.33: +2 -2 lines
Diff to previous 1.33 (colored)

Use interface index instead of pointer to `ifnet' in `struct bstp_port'.

ok yasuoka@

Revision 1.33 / (download) - annotate - [select for diffs], Wed Jul 22 00:51:57 2020 UTC (3 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.32: +21 -11 lines
Diff to previous 1.32 (colored)

register as a bridge port, not an input handler, on member ifaces.

this is a step toward making all types of bridges coordinate their
use of port interfaces, and is a step toward deprecating the interface
input handler lists.

this has been in snaps as part of a larger diff for over a week.

Revision 1.32 / (download) - annotate - [select for diffs], Mon Jul 13 03:28:20 2020 UTC (3 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.31: +7 -7 lines
Diff to previous 1.31 (colored)

let's be explicit about only supporting Ethernet ports as members.

the packet parsing code expects Ethernet packets, so only allow
Ethernet interfaces to be added.

ok sthen@

Revision 1.31 / (download) - annotate - [select for diffs], Fri Jul 10 13:22:22 2020 UTC (3 years, 11 months ago) by patrick
Branch: MAIN
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

Change users of IFQ_DEQUEUE(), IFQ_ENQUEUE() and IFQ_LEN() to use the
"new" API.

ok dlg@ tobhe@

Revision 1.30 / (download) - annotate - [select for diffs], Wed Nov 6 03:51:26 2019 UTC (4 years, 7 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.29: +4 -4 lines
Diff to previous 1.29 (colored)

replace the hooks used with if_detachhooks with a task list.

the main semantic change is that things registering detach hooks
have to allocate and set a task structure that then gets added to
the list. this means if the task is allocated up front (eg, as part
of carps softc or bridges port structure), it avoids the possibility
that adding a hook can fail. a lot of drivers weren't checking for
failure, and unwinding state in the event of failure in other parts
was error prone.

while doing this i discovered that the list operations have to be
in a particular order, but drivers weren't doing that consistently
either. this diff wraps the list ops up so you have to seriously
go out of your way to screw them up.

ive also sprinkled some NET_ASSERT_LOCKED around the list operations
so we can make sure there's no potential for the list to be corrupted,
especially while it's being run.

hrvoje popovski has tested this a bit, and some issues he discovered
have been fixed.

ok sashan@

Revision 1.29 / (download) - annotate - [select for diffs], Mon Sep 30 01:53:05 2019 UTC (4 years, 8 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

remove the "copy function" argument to bpf_mtap_hdr.

it was previously (ab)used by pflog, which has since been fixed.
apart from that nothing else used it, so we can trim the cruft.

ok kn@ claudio@ visa@
visa@ also made sure i fixed ipw(4) so i386 won't break.

Revision 1.28 / (download) - annotate - [select for diffs], Sun May 12 16:24:44 2019 UTC (5 years, 1 month ago) by akoshibe
Branch: MAIN
Changes since 1.27: +1 -4 lines
Diff to previous 1.27 (colored)

Unused switch_port variable.

Revision 1.27 / (download) - annotate - [select for diffs], Fri May 10 15:13:38 2019 UTC (5 years, 1 month ago) by akoshibe
Branch: MAIN
Changes since 1.26: +16 -2 lines
Diff to previous 1.26 (colored)

Add port protection support to switch(4). The behavior copies that of
bridge(4), where the SIOCBRDGSIFPROT ioctl can be used to add a port to up
to 31 protected domains. This allows configuration by specifying a list of
IDs to the 'protected' option in ifconfig(8):

# ifconfig switch0 protected pair1 1,2,..

Domain membership is checked for unicast, flooded (broadcast), and
local (host-network-bound, e.g. trunk) traffic.

OK benno@

Revision 1.26 / (download) - annotate - [select for diffs], Sun Apr 28 22:15:57 2019 UTC (5 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

Removes the KERNEL_LOCK() from bridge(4)'s output fast-path.

This redefines the ifp <-> bridge relationship.  No lock can be
currently used across the multiples contexts where the bridge has
tentacles to protect a pointer, use an interface index.

Tested by various, ok dlg@, visa@

Revision 1.25 / (download) - annotate - [select for diffs], Fri Dec 28 14:32:47 2018 UTC (5 years, 5 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.24: +10 -7 lines
Diff to previous 1.24 (colored)

Fix mbuf releated crashes in switch(4).  They have been found by
syzkaller as pool corruption panic.  It is unclear which bug caused
what, but it should be better now.
- Check M_PKTHDR with assertion before accessing m_pkthdr.
- Do not access oh_length without m_pullup().
- After checking if there is space at the end of the mbuf, don't
  overwrite the data at the beginning.  Append the new content.
- Do not set m_len and m_pkthdr.len when it is unclear whether
  the ofp_error header fits at all.  Use m_makespace() to adjust
  the mbuf.
Reported-by: syzbot+6efc0a9d5b700b54392e@syzkaller.appspotmail.com
test akoshibe@; OK claudio@

Revision 1.24 / (download) - annotate - [select for diffs], Fri Dec 7 16:19:40 2018 UTC (5 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.23: +2 -3 lines
Diff to previous 1.23 (colored)

Stop passing `sc' when it isn't needed and use `ifp' where it's good
enough.

ok sthen@, visa@

Revision 1.23 / (download) - annotate - [select for diffs], Mon Feb 19 08:59:52 2018 UTC (6 years, 3 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.22: +4 -4 lines
Diff to previous 1.22 (colored)

Remove almost unused `flags' argument of suser().

The account flag `ASU' will no longer be set but that makes suser()
mpsafe since it no longer mess with a per-process field.

No objection from millert@, ok tedu@, bluhm@

Revision 1.22 / (download) - annotate - [select for diffs], Tue Jan 9 15:24:24 2018 UTC (6 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.21: +1 -3 lines
Diff to previous 1.21 (colored)

Creating a cloned interface could return ENOMEM due to temporary
memory shortage.  As it is invoked from a system call, it should
not fail and wait instead.
OK visa@ mpi@

Revision 1.21 / (download) - annotate - [select for diffs], Mon Nov 20 10:17:40 2017 UTC (6 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.20: +3 -28 lines
Diff to previous 1.20 (colored)

Remove duplicated code working around the fact that ifpromisc() required
a DOWN interface.

ok visa@

Revision 1.20 / (download) - annotate - [select for diffs], Wed May 31 05:59:09 2017 UTC (7 years ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.19: +2 -4 lines
Diff to previous 1.19 (colored)

Move IPv4 & IPv6 incoming/forwarding path, PIPEX ppp processing and
IPv4 & IPv6 dispatch functions outside the KERNEL_LOCK().

We currently rely on the NET_LOCK() serializing access to most global
data structures for that.  IP input queues are no longer used in the
forwarding case.  They still exist as boundary between the network and
transport layers because TCP/UDP & friends still need the KERNEL_LOCK().

Since we do not want to grab the NET_LOCK() for every packet, the
softnet thread will do it once before processing a batch.  That means
the L2 processing path, which is currently running without lock, will
now run with the NET_LOCK().

IPsec isn't ready to run without KERNEL_LOCK(), so the softnet thread
will grab the KERNEL_LOCK() as soon as ``ipsec_in_use'' is set.

Tested by Hrvoje Popovski.

ok visa@, bluhm@, henning@

Revision 1.19 / (download) - annotate - [select for diffs], Fri May 12 13:40:29 2017 UTC (7 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.18: +7 -1 lines
Diff to previous 1.18 (colored)

Make a kernel with switch(4) but without INET6 compile again.
Sprinkle some #ifdef INET6 and do not use in6addr_any from the
netinet6 code.
test and OK rzalamena@

Revision 1.18 / (download) - annotate - [select for diffs], Tue Jan 17 12:30:35 2017 UTC (7 years, 4 months ago) by rzalamena
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.17: +3 -36 lines
Diff to previous 1.17 (colored)

Clean-up switch(4) device by removing excess prototypes, verbose debugs
and unused functions.

ok reyk@

Revision 1.17 / (download) - annotate - [select for diffs], Thu Dec 22 15:14:05 2016 UTC (7 years, 5 months ago) by rzalamena
Branch: MAIN
Changes since 1.16: +8 -1 lines
Diff to previous 1.16 (colored)

Validate the OFP header to make sure it always have a sane size, also
make sure to not accept anything else outside of the header size
boundaries.

ok reyk@

Revision 1.16 / (download) - annotate - [select for diffs], Mon Nov 28 10:12:50 2016 UTC (7 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

Rename "flowmax" to "maxflow" and give each switch(4) ioctl a
dedicated number.  Both changes for consistency.

OK rzalamena@

Revision 1.15 / (download) - annotate - [select for diffs], Tue Nov 22 23:23:12 2016 UTC (7 years, 6 months ago) by rzalamena
Branch: MAIN
Changes since 1.14: +3 -2 lines
Diff to previous 1.14 (colored)

Fix panic on detach hook when interfaces get destroyed.

ok reyk@

Revision 1.14 / (download) - annotate - [select for diffs], Sun Nov 20 12:45:26 2016 UTC (7 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.13: +9 -4 lines
Diff to previous 1.13 (colored)

Extend the DLT_OPENFLOW header to include the switch datapath id.

OK rzalamena@

Revision 1.13 / (download) - annotate - [select for diffs], Wed Nov 16 13:47:27 2016 UTC (7 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.12: +10 -3 lines
Diff to previous 1.12 (colored)

Add new DLT_OPENFLOW link-type to allow using tcpdump to debug switch(4),
eg. tcpdump -y openflow -i switch0

Includes a minor bump for libpcap.

Feedback and OK rzalamena@

Revision 1.12 / (download) - annotate - [select for diffs], Thu Nov 10 17:32:40 2016 UTC (7 years, 7 months ago) by rzalamena
Branch: MAIN
Changes since 1.11: +30 -1 lines
Diff to previous 1.11 (colored)

Add support for partial writes in switchwrite so we can use multiple
write() to write one packet. With this we also get support for writing
multiple ofp packets with a single write.

ok mikeb@

Revision 1.11 / (download) - annotate - [select for diffs], Fri Oct 28 09:04:03 2016 UTC (7 years, 7 months ago) by rzalamena
Branch: MAIN
Changes since 1.10: +1 -22 lines
Diff to previous 1.10 (colored)

Remove unused function, the code is already inlined in action_output
function.

ok reyk@

Revision 1.10 / (download) - annotate - [select for diffs], Fri Oct 28 09:01:49 2016 UTC (7 years, 7 months ago) by rzalamena
Branch: MAIN
Changes since 1.9: +1 -4 lines
Diff to previous 1.9 (colored)

When doing pktout we must run the classifier again, because some action(s)
might want to use it. For buffered packets we probably need to save that
somehow else, but we don't support it now.

ok reyk@

Revision 1.9 / (download) - annotate - [select for diffs], Sat Oct 8 23:36:10 2016 UTC (7 years, 8 months ago) by rzalamena
Branch: MAIN
Changes since 1.8: +4 -3 lines
Diff to previous 1.8 (colored)

Add missing if_put() in the switch(4) destroy path.

ok mikeb@

Revision 1.8 / (download) - annotate - [select for diffs], Fri Oct 7 08:18:22 2016 UTC (7 years, 8 months ago) by rzalamena
Branch: MAIN
Changes since 1.7: +10 -12 lines
Diff to previous 1.7 (colored)

Use detach hook to notify switch(4) about interface removals instead of
adding code to if.c.

ok mpi@

Revision 1.7 / (download) - annotate - [select for diffs], Thu Sep 29 11:37:44 2016 UTC (7 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.6: +8 -8 lines
Diff to previous 1.6 (colored)

Rename brtag_src/brtag_dst to brtag_peer/brtag_local to avoid
confusion about the tunnel endpoints when responding to the peer.

OK yasuoka@

Revision 1.6 / (download) - annotate - [select for diffs], Wed Sep 28 08:31:42 2016 UTC (7 years, 8 months ago) by rzalamena
Branch: MAIN
Changes since 1.5: +19 -8 lines
Diff to previous 1.5 (colored)

Fix a kernel panic that happened when destroying interfaces attached to
the switch(4) without prior removal.

ok reyk@, goda@

Revision 1.5 / (download) - annotate - [select for diffs], Sun Sep 4 17:11:09 2016 UTC (7 years, 9 months ago) by goda
Branch: MAIN
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

Fixed uninitialized variable in switch_process()

Revision 1.4 / (download) - annotate - [select for diffs], Sun Sep 4 16:47:41 2016 UTC (7 years, 9 months ago) by goda
Branch: MAIN
Changes since 1.3: +4 -3 lines
Diff to previous 1.3 (colored)

Make per-packet allocated memory use pool in switch(4)

ok yasuoka@ reyk@

Revision 1.3 / (download) - annotate - [select for diffs], Sat Sep 3 13:46:57 2016 UTC (7 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.2: +39 -2 lines
Diff to previous 1.2 (colored)

Add support for a multipoint-to-multipoint mode in vxlan(4).  In this
mode, vxlan(4) must be configured to accept any virtual network
identifier with "vnetid any" and added to a bridge(4) or switch(4).
This way the driver will dynamically learn the tunnel endpoints and
their vnetids for the responses and can be used to dynamically bridge
between VXLANs.  It is also being used in combination with switch(4)
and the OpenFlow tunnel classifiers.

With input from yasuoka@ goda@
OK deraadt@ dlg@

Revision 1.2 / (download) - annotate - [select for diffs], Fri Sep 2 10:01:36 2016 UTC (7 years, 9 months ago) by goda
Branch: MAIN
Changes since 1.1: +134 -3 lines
Diff to previous 1.1 (colored)

Add switch(4) support to ifconfig

ok deraadt@ yasuoka@ reyk@ henning@

Revision 1.1 / (download) - annotate - [select for diffs], Thu Sep 1 10:06:33 2016 UTC (7 years, 9 months ago) by goda
Branch: MAIN

Import switch(4), an in-kernel OpenFlow switch which can work alone.
switch(4) currently supports OpenFlow 1.3.5.
Currently, it's disabled by the kernel config.

With help from yasuoka@ reyk@ jsg@.

ok deraadt@ yasuoka@ reyk@ henning@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.