OpenBSD CVS

CVS log for src/sys/net/if_trunk.c


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.154 / (download) - annotate - [select for diffs], Sat Dec 23 10:52:54 2023 UTC (5 months, 2 weeks ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.153: +2 -1 lines
Diff to previous 1.153 (colored)

Backout always allocate per-CPU statistics counters for network
interface descriptor.  It panics during attach of em(4) device at
boot.

Revision 1.153 / (download) - annotate - [select for diffs], Fri Dec 22 23:01:50 2023 UTC (5 months, 2 weeks ago) by mvs
Branch: MAIN
Changes since 1.152: +1 -2 lines
Diff to previous 1.152 (colored)

Always allocate per-CPU statistics counters for network interface
descriptor.

We have the mess in network interface statistics. Only pseudo drivers
do per-CPU counters allocation, all other network devices use the old
`if_data'. The network stack partially uses per-CPU counters and
partially use `if_data', but the protection is inconsistent: some times
counters accessed with exclusive netlock, some times with shared
netlock, some times with kernel lock, but without netlock, some times
with another locks.

To make network interfaces statistics more consistent, always allocate
per-CPU counters at interface attachment time and use it instead of
`if_data'. At this step only move counters allocation to the if_attach()
internals. The `if_data' removal will be performed with the following
diffs to make review and tests easier.

ok bluhm

Revision 1.152 / (download) - annotate - [select for diffs], Mon Aug 2 21:10:55 2021 UTC (2 years, 10 months ago) by mvs
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.151: +1 -2 lines
Diff to previous 1.151 (colored)

Don't call rtm_ifchg() in trunk_port_state().

The preceding trunk_link_active() already produced RTM_IFINFO message when
trunk(4) state was changed. I such case we double RTM_IFINFO message or we
produce false message when trunk(4) state was not changed.

ok florian@

Revision 1.151 / (download) - annotate - [select for diffs], Thu Jan 28 20:04:44 2021 UTC (3 years, 4 months ago) by mvs
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.150: +21 -9 lines
Diff to previous 1.150 (colored)

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

ok bluhm@

Revision 1.150 / (download) - annotate - [select for diffs], Sat Sep 12 20:12:09 2020 UTC (3 years, 8 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.149: +1 -5 lines
Diff to previous 1.149 (colored)

Keep port interface UP on removal

There is no reason to change flags on member interfaces when removing
them, aggr(4) does not pull its members down either.

OK florian bluhm

Revision 1.149 / (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.148: +2 -1 lines
Diff to previous 1.148 (colored)

Add missing `IFXF_CLONED' flag to clone interfaces.

ok mpi@

Revision 1.148 / (download) - annotate - [select for diffs], Wed Jul 22 02:16:02 2020 UTC (3 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.147: +35 -18 lines
Diff to previous 1.147 (colored)

deprecate interface input handler lists, just use one input function.

the interface input handler lists were originally set up to help
us during the intial mpsafe network stack work. at the time not all
the virtual ethernet interfaces (vlan, svlan, bridge, trunk, etc)
were mpsafe, so we wanted a way to avoid them by default, and only
take the kernel lock hit when they were specifically enabled on the
interface. since then, they have been fixed up to be mpsafe.

i could leave the list in place, but it has some semantic problems.
because virtual interfaces filter packets based on the order they
were attached to the parent interface, you can get packets taken
away in surprising ways, especially when you reboot and netstart
does something different to what you did by hand. by hardcoding the
order that things like vlan and bridge get to look at packets, we
can document the behaviour and get consistency.

it also means we can get rid of a use of SRPs which were difficult
to replace with SMRs. the interface input handler list is an SRPL,
which we would like to deprecate. it turns out that you can sleep
during stack processing, which you're not supposed to do with SRPs
or SMRs, but SRPs are a lot more forgiving and it worked.

lastly, it turns out that this code is faster than the input list
handling, so lots of winning all around.

special thanks to hrvoje popovski and aaron bieber for testing.
this has been in snaps as part of a larger diff for over a week.

Revision 1.147 / (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.146: +2 -2 lines
Diff to previous 1.146 (colored)

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

ok dlg@ tobhe@

Revision 1.146 / (download) - annotate - [select for diffs], Wed Jun 17 06:45:22 2020 UTC (3 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.145: +3 -3 lines
Diff to previous 1.145 (colored)

make ph_flowid in mbufs 16bits by storing whether it's set in csum_flags.

i've been wanting to do this for a while, and now that we've got
stoeplitz and it gives us 16 bits, it seems like the right time.

Revision 1.145 / (download) - annotate - [select for diffs], Thu May 21 00:44:36 2020 UTC (4 years ago) by dlg
Branch: MAIN
Changes since 1.144: +1 -3 lines
Diff to previous 1.144 (colored)

don't limit the output queue (ifq) length to 1 anymore.

if we use the ifq to move packet processing to another context,
it's too easy to fill up the one slot and cause packet loss.

the ifq len was set to 1 to avoid delays produced by the original
implementation of tx mitigation. however, trunk now introduces
latency because it isn't mpsafe yet, which causes the network stack
to have to take the kernel lock for each packet, and the kernel
lock can be quite contended. i want to use the ifq to move the
packet to the systq thread (which already has the kernel lock)
before trunk is asked to transmit it.

tested by mark patruck and myself.

Revision 1.144 / (download) - annotate - [select for diffs], Fri Dec 6 02:02:18 2019 UTC (4 years, 6 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.143: +2 -2 lines
Diff to previous 1.143 (colored)

when copying capabilities from the first port to a trunk, copy hardmtu too.

previously it copied the ports if_mtu to the trunks if_hardmtu,
which makes it hard for things like vlan(4) to work with a full
frame size, or large frame size.

tested by hrvoje popovski

Revision 1.143 / (download) - annotate - [select for diffs], Thu Nov 7 07:36:32 2019 UTC (4 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.142: +4 -4 lines
Diff to previous 1.142 (colored)

turn the linkstate hooks into a task list, like the detach hooks.

this is largely mechanical, except for carp. this moves the addition
of the carp link state hook after we're committed to using the new
interface as a carpdev. because the add can't fail, we avoid a
complicated unwind dance. also, this tweaks the carp linkstate hook
so it only updates the relevant carp interface, not all of the
carpdevs on the parent.

hrvoje popovski has tested an early version of this diff and it's
generally ok, but there's some splasserts that this diff fires that
i'll fix in an upcoming diff.

ok claudio@

Revision 1.142 / (download) - annotate - [select for diffs], Wed Nov 6 03:51:26 2019 UTC (4 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.141: +4 -4 lines
Diff to previous 1.141 (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.141 / (download) - annotate - [select for diffs], Fri Jul 5 01:24:56 2019 UTC (4 years, 11 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.140: +9 -1 lines
Diff to previous 1.140 (colored)

record when trunk takes over an interface by setting ac_trunkport

this will be used to prevent trunk and the upcoming aggr driver
from taking ownership of an Ethernet interface at the same time.

Revision 1.140 / (download) - annotate - [select for diffs], Sat May 11 18:10:45 2019 UTC (5 years, 1 month ago) by florian
Branch: MAIN
Changes since 1.139: +3 -1 lines
Diff to previous 1.139 (colored)

A trunk(4) usually stays up when the link state of one of its members
changes. While we do get RTM_IFINFO messages for the (physical) member
interfaces there is no indication that something changed from the
trunk(4) interface.
It is helpful to get this information in userland from the trunk so that
userland daemons do not need to track interface membership by themselves.
OK phessler

Revision 1.139 / (download) - annotate - [select for diffs], Mon Apr 29 04:26:47 2019 UTC (5 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.138: +1 -2 lines
Diff to previous 1.138 (colored)

tr_unit is unused, so gc it

Revision 1.138 / (download) - annotate - [select for diffs], Tue Apr 23 10:53:45 2019 UTC (5 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.137: +3 -4 lines
Diff to previous 1.137 (colored)

a first cut at converting some virtual ethernet interfaces to if_vinput

this let's input processing bypass ifiqs. there's a performance
benefit from this, and it will let me tweak the backpressure detection
mechanism that ifiqs use without impacting on a stack of virtual
interfaces.

ive tested all of these except mpw, which i will end up testing
soon anyway.

Revision 1.137 / (download) - annotate - [select for diffs], Sun Aug 12 23:50:31 2018 UTC (5 years, 10 months ago) by ccardenas
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.136: +92 -1 lines
Diff to previous 1.136 (colored)

Add administrative options to LACP trunk implementation.

The trunk driver now has a new ioctl (SIOCxTRUNKOPTS), which for now only
has options for LACP:
* Mode - Active or Passive (default Active)
* Timeout - Fast or Slow (default Slow)
* System Priority - 1(high) to 65535(low) (default 32768/0x8000)
* Port Priority - 1(high) to 65535(low) (default 32768/0x8000)
* IFQ Priority - 0 to NUM_QUEUES (default 6)

At the moment, ifconfig only has options for lacpmode and lacptimeout
plumbed as those are the immediate need.

The approach taken for the options was to make them on a "trunk" vs a
"port" as what's typically seen on various NOSes (JunOS, NXOS, etc...)
as it's uncommon for a host to have one link "Passive" and the other
"Active" in a given trunk.

Just like on a NOS, when applying lacpmode or lacptimeout, the settings
are immediately applied to all existing ports in the trunk and to all
future ports brought into the trunk.

Tested by many on a plethora of NIC drivers and switches.

Ok remi@

Revision 1.136 / (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_3_BASE, OPENBSD_6_3
Changes since 1.135: +4 -4 lines
Diff to previous 1.135 (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.135 / (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.134: +2 -4 lines
Diff to previous 1.134 (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.134 / (download) - annotate - [select for diffs], Mon Aug 14 08:31:00 2017 UTC (6 years, 9 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.133: +4 -8 lines
Diff to previous 1.133 (colored)

The "ret" return value is reused and overwritten, potentially
returning 0 (success) on error instead of an error number.  The caller
doesn't evaluate the return value, so it is good enough to return
ENOBUFS (non-0) on error and to remove "ret" in trunk_cast_start().

Coverity CID 1453105; Severity: Minor

OK mpi@

Revision 1.133 / (download) - annotate - [select for diffs], Fri Aug 11 21:24:19 2017 UTC (6 years, 10 months ago) by mpi
Branch: MAIN
Changes since 1.132: +5 -5 lines
Diff to previous 1.132 (colored)

Remove NET_LOCK()'s argument.

Tested by Hrvoje Popovski, ok bluhm@

Revision 1.132 / (download) - annotate - [select for diffs], Sun May 28 15:03:53 2017 UTC (7 years ago) by mpi
Branch: MAIN
Changes since 1.131: +4 -2 lines
Diff to previous 1.131 (colored)

Add missing NET_UNLOCK() in error path.

Spotted by sashan@

Revision 1.131 / (download) - annotate - [select for diffs], Sun May 28 14:26:38 2017 UTC (7 years ago) by mpi
Branch: MAIN
Changes since 1.130: +4 -2 lines
Diff to previous 1.130 (colored)

trunk_port_destroy() needs the NET_LOCK().

It brings the interface down and restore the original lladdr.

Found by Hrvoje Popovski

Revision 1.130 / (download) - annotate - [select for diffs], Sun May 28 09:38:32 2017 UTC (7 years ago) by mpi
Branch: MAIN
Changes since 1.129: +5 -29 lines
Diff to previous 1.129 (colored)

Remove useless splnet()/splx() dances.

Data structures modified in the ioctl path are protected by the NET_LOCK().

ok sashan@

Revision 1.129 / (download) - annotate - [select for diffs], Sun Jan 22 10:17:39 2017 UTC (7 years, 4 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.128: +2 -4 lines
Diff to previous 1.128 (colored)

move counting if_opackets next to counting if_obytes in if_enqueue.

this means packets are consistently counted in one place, unlike the
many and various ways that drivers thought they should do it.

ok mpi@ deraadt@

Revision 1.128 / (download) - annotate - [select for diffs], Fri Sep 16 09:51:21 2016 UTC (7 years, 8 months ago) by mikeb
Branch: MAIN
Changes since 1.127: +4 -3 lines
Diff to previous 1.127 (colored)

Reconfigure interface capabilities after switching trunkproto; ok mpi

Revision 1.127 / (download) - annotate - [select for diffs], Wed Apr 13 11:41:15 2016 UTC (8 years, 1 month ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.126: +1 -2 lines
Diff to previous 1.126 (colored)

We're always ready!  So send IFQ_SET_READY() to the bitbucket.

Revision 1.126 / (download) - annotate - [select for diffs], Thu Dec 31 14:18:34 2015 UTC (8 years, 5 months ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.125: +4 -4 lines
Diff to previous 1.125 (colored)

Move tr_port_destroy down; fixes 'lacp_compose_key protection fault trap'
when removing a port from a lacp trunk. Part of a larger diff from mpi,
as suggested by mikeb. ok mpi@

Revision 1.125 / (download) - annotate - [select for diffs], Sat Nov 21 11:02:23 2015 UTC (8 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.124: +0 -4 lines
Diff to previous 1.124 (colored)

dont check IFF_OACTIVE to see if the port is busy.

dont check if its busy at all, actually.

fine with reyk@

Revision 1.124 / (download) - annotate - [select for diffs], Fri Nov 20 05:33:54 2015 UTC (8 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.123: +2 -3 lines
Diff to previous 1.123 (colored)

dont play with IFF_OACTIVE needlessly.

only a driver sets or clears it, and trunk never sets it. therefore it
never needs to clear it.

Revision 1.123 / (download) - annotate - [select for diffs], Thu Nov 12 10:07:14 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.122: +3 -3 lines
Diff to previous 1.122 (colored)

Prefix flowid with ph_ and print it in m_print().

ok dlg@

Revision 1.122 / (download) - annotate - [select for diffs], Sun Oct 25 12:05:40 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.121: +2 -6 lines
Diff to previous 1.121 (colored)

arp_ifinit() is no longer required.

Revision 1.121 / (download) - annotate - [select for diffs], Thu Oct 8 13:58:07 2015 UTC (8 years, 8 months ago) by mikeb
Branch: MAIN
Changes since 1.120: +5 -5 lines
Diff to previous 1.120 (colored)

Make sure that when trunk_port_ioctl is called to set a new
lladdr the trunk port is already on the list.

OK mpi

Revision 1.120 / (download) - annotate - [select for diffs], Thu Oct 8 11:39:59 2015 UTC (8 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.119: +4 -1 lines
Diff to previous 1.119 (colored)

if the mbuf has a valid flowid, use it instead of using siphash24
and a bunch of header fields we have to parse the mbuf for.

siphash24 is about 20% of the cost of sending a udp packet on a
trunk interface with tcpbench on my box. if there's a flowid set
we get all that back.

ok mpi@ mikeb@ sthen@

Revision 1.119 / (download) - annotate - [select for diffs], Mon Oct 5 13:00:04 2015 UTC (8 years, 8 months ago) by mikeb
Branch: MAIN
Changes since 1.118: +2 -1 lines
Diff to previous 1.118 (colored)

Factor LACP frame processing out to a separate task

This is slightly refactored version of the diff by jmatthew@
that makes use of a single per-trunk task but retains per-port
mbuf queues.

Running LACP frame processing in a task context allows a simple
way to synchronize changes to the trunk ports and trunk itself
performed from the ioctl, timeout and task contexts with a kernel
lock.

OK mpi

Revision 1.118 / (download) - annotate - [select for diffs], Tue Sep 29 10:11:40 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.117: +9 -11 lines
Diff to previous 1.117 (colored)

add sizes to some of the simpler free calls
ok mpi

Revision 1.117 / (download) - annotate - [select for diffs], Mon Sep 28 08:24:53 2015 UTC (8 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.116: +4 -6 lines
Diff to previous 1.116 (colored)

Remove "if_tp" from the "struct ifnet".

Instead of violating a layer of abstraction by keeping per pseudo-driver
informations in "struct ifnet", the port trunk is now passed as a cookie
to the interface input handler (ifih).

The time of per pseudo-driver hack in the network stack is over!

ok mikeb@

Revision 1.116 / (download) - annotate - [select for diffs], Thu Sep 24 14:46:22 2015 UTC (8 years, 8 months ago) by mikeb
Branch: MAIN
Changes since 1.115: +8 -1 lines
Diff to previous 1.115 (colored)

add a comment explaining how we serialize when switching trunkproto;
requested by mpi@

Revision 1.115 / (download) - annotate - [select for diffs], Thu Sep 24 14:01:20 2015 UTC (8 years, 8 months ago) by mikeb
Branch: MAIN
Changes since 1.114: +2 -2 lines
Diff to previous 1.114 (colored)

Avoid a theoretical m_pullup(9) mishandling by delegating the mbuf
reclaiming to the PDU and marker input routines.

m_pullup may return a pointer to the newly allocated mbuf.  In this
case m_freem is called by the trunk_input, not by the proto specific
code and pointer to the mbuf is not passed by reference. Therefore
m_freem will either be called on the middle element of the chain
(when the m_pullup call succeeds) or on the stale pointer (when it
frees the chain in the failure case).  Fortunately we should never
hit this case as the receive path uniformly uses contiguous chunks
of memory.

Verified with and ok blambert, ok mpi

Revision 1.114 / (download) - annotate - [select for diffs], Wed Sep 23 12:50:06 2015 UTC (8 years, 8 months ago) by mikeb
Branch: MAIN
Changes since 1.113: +12 -7 lines
Diff to previous 1.113 (colored)

Serialize trunk changes with input handler insertion and removal.

This moves around calls to if_ih_insert and if_ih_remove to ensure
that we either have completed port initialization or are going to
tear the port configuration down and don't want any input processes
to get hold of the port.

When trunk_port_destroy is called from the ioctl this would wait for
all input processes to finish and release their references to be able
to disestablish the input handler and ensure full control of the port.

When switching trunkproto it is required for the ioctl context to
be able to touch all trunk ports and the protocol (tr_psc).  The
easiest way do this is to disestablish all input handlers (while
making sure they all complete) and then reestablish them after the
trunk reconfiguration is completed.

This avoids getting trunk a separate locking protocol of its own.

ok mpi, suggested by and ok dlg

Revision 1.113 / (download) - annotate - [select for diffs], Wed Sep 23 12:42:45 2015 UTC (8 years, 8 months ago) by mikeb
Branch: MAIN
Changes since 1.112: +51 -22 lines
Diff to previous 1.112 (colored)

Keep track of an active port in the failover trunk to avoid list
iterations and additional locking protection in the future.

Suggested by and ok mpi

Revision 1.112 / (download) - annotate - [select for diffs], Wed Sep 23 12:40:12 2015 UTC (8 years, 8 months ago) by mikeb
Branch: MAIN
Changes since 1.111: +1 -41 lines
Diff to previous 1.111 (colored)

Remove trunk watchdog code since it doesn't do anything useful
and we want to limit the number of different places where we
access trunk port pointers.

trunk_watchdog should be never called as we don't set up it's
if_timer and trunk_port_watchdog just calls the if_watchdog
from the underlying interface.

It's possible that this is no longer needed due to if_slowtimo/
if_watchdog changes done earlier.

ok mpi

Revision 1.111 / (download) - annotate - [select for diffs], Thu Sep 10 16:41:30 2015 UTC (8 years, 9 months ago) by mikeb
Branch: MAIN
Changes since 1.110: +5 -5 lines
Diff to previous 1.110 (colored)

pass a cookie argument to interface input handlers that can be used
to pass additional context or transient data with the similar life
time.

ok mpi, suggestions, hand holding and ok from dlg

Revision 1.110 / (download) - annotate - [select for diffs], Thu Sep 10 13:32:19 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.109: +3 -4 lines
Diff to previous 1.109 (colored)

move the if input handler list to an SRP list.

instead of having every driver that manipulates the ifih list
understand SRPLs, this moves that processing into if_ih_insert and
if_ih_remove functions.

we rely on the kernel lock to serialise the modifications to the
list.

tested by mpi@
ok mpi@ claudio@ mikeb@

Revision 1.109 / (download) - annotate - [select for diffs], Fri Jul 17 23:32:18 2015 UTC (8 years, 10 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.108: +16 -1 lines
Diff to previous 1.108 (colored)

Drop promiscuously received packets if the trunk(4) interface is not
in promiscuous mode.

The long story is that claudio@ had his ssh session reset multiple
times in the hackroom because czarkoff@'s machine was sending reset.
We figured out that the packet was reaching pf because of this missing
check.  pf would then not find any state and sent a reset.

Analyzed with and ok phessler@, claudio@

Revision 1.108 / (download) - annotate - [select for diffs], Thu Jul 2 10:02:40 2015 UTC (8 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.107: +10 -12 lines
Diff to previous 1.107 (colored)

Unify the check for up & running between all pseudo-drivers.

Revision 1.107 / (download) - annotate - [select for diffs], Thu Jul 2 09:40:02 2015 UTC (8 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.106: +3 -11 lines
Diff to previous 1.106 (colored)

By design if_input_process() needs to hold a reference on the receiving
ifp in order to access its ifih handlers.

So get rid of if_get() in the various ifih handlers we know the ifp is
live at this point.

ok dlg@

Revision 1.106 / (download) - annotate - [select for diffs], Tue Jun 30 13:54:42 2015 UTC (8 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.105: +7 -11 lines
Diff to previous 1.105 (colored)

Rename if_output() into if_enqueue() to avoid confusion with comments
talking about (*ifp->if_output)().

ok claudio@, dlg@

Revision 1.105 / (download) - annotate - [select for diffs], Mon Jun 29 10:32:29 2015 UTC (8 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.104: +1 -3 lines
Diff to previous 1.104 (colored)

count if_ibytes in if_input like we do for if_ipackets.

tweaks and ok mpi@

Revision 1.104 / (download) - annotate - [select for diffs], Wed Jun 24 09:40:54 2015 UTC (8 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.103: +1 -2 lines
Diff to previous 1.103 (colored)

Increment if_ipackets in if_input().

Note that pseudo-drivers not using if_input() are not affected by this
conversion.

ok mikeb@, kettenis@, claudio@, dlg@

Revision 1.103 / (download) - annotate - [select for diffs], Tue Jun 16 11:09:39 2015 UTC (8 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.102: +8 -3 lines
Diff to previous 1.102 (colored)

Store a unique ID, an interface index, rather than a pointer to the
receiving interface in the packet header of every mbuf.

The interface pointer should now be retrieved when necessary with
if_get().  If a NULL pointer is returned by if_get(), the interface
has probably been destroy/removed and the mbuf should be freed.

Such mechanism will simplify garbage collection of mbufs and limit
problems with dangling ifp pointers.

Tested by jmatthew@ and krw@, discussed with many.

ok mikeb@, bluhm@, dlg@

Revision 1.102 / (download) - annotate - [select for diffs], Mon Jun 15 15:55:08 2015 UTC (8 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.101: +10 -8 lines
Diff to previous 1.101 (colored)

Fix a double free in the destroy path triggered when a second process,
in my case dhclient(8), races with ifconfig(8) to free the descriptors
of the joined multicast groups.

While here reduce the difference with carp(4).

ok dms@

Revision 1.101 / (download) - annotate - [select for diffs], Tue Jun 9 14:50:14 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.100: +9 -19 lines
Diff to previous 1.100 (colored)

Convert trunk(4) to if_input().

ok dlg@

Revision 1.100 / (download) - annotate - [select for diffs], Tue May 26 11:39:07 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.99: +5 -7 lines
Diff to previous 1.99 (colored)

Now that the Ethernet header is always passed as part of the mbuf, kill
the second (unused) argument of the input packet handlers.

ok dlg@

Revision 1.99 / (download) - annotate - [select for diffs], Fri May 15 10:15:13 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.98: +7 -30 lines
Diff to previous 1.98 (colored)

Introduce if_output(), a function do to the last steps before enqueuing
a packet on the sending queue of an interface.

Tested by many, thanks a lot!

ok dlg@, claudio@

Revision 1.98 / (download) - annotate - [select for diffs], Thu May 14 10:55:28 2015 UTC (9 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.97: +4 -16 lines
Diff to previous 1.97 (colored)

Allocate the input packet handler as part of the trunk_port structure
since they have the same lifetime.

Requested by and ok dlg@

Revision 1.97 / (download) - annotate - [select for diffs], Wed May 13 08:16:01 2015 UTC (9 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.96: +22 -1 lines
Diff to previous 1.96 (colored)

Get rid of the last "#if NTRUNK" by overwriting trunk ports' output
function.

ok claudio@, reyk@

Revision 1.96 / (download) - annotate - [select for diffs], Mon May 11 08:41:43 2015 UTC (9 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.95: +61 -50 lines
Diff to previous 1.95 (colored)

Take trunk(4) out of ether_input().

Each physical interface of a trunk now gets a specific ifih (interface
input handler) that runs before ether_input().

Tested by sthen@, dlg@, Theo Buehler and <mxb AT alumni.chalmers DOT se>

ok sthen@, dlg@

Revision 1.95 / (download) - annotate - [select for diffs], Sat Mar 14 03:38:51 2015 UTC (9 years, 3 months ago) by jsg
Branch: MAIN
Changes since 1.94: +1 -2 lines
Diff to previous 1.94 (colored)

Remove some includes include-what-you-use claims don't
have any direct symbols used.  Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@

Revision 1.94 / (download) - annotate - [select for diffs], Fri Dec 19 17:14:39 2014 UTC (9 years, 5 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.93: +1 -9 lines
Diff to previous 1.93 (colored)

unifdef INET in net code as a precursor to removing the pretend option.
long live the one true internet.
ok henning mikeb

Revision 1.93 / (download) - annotate - [select for diffs], Thu Dec 4 00:01:53 2014 UTC (9 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.92: +20 -16 lines
Diff to previous 1.92 (colored)

use siphash for trunk loadbalancing. ok deraadt

Revision 1.92 / (download) - annotate - [select for diffs], Mon Dec 1 15:06:54 2014 UTC (9 years, 6 months ago) by mikeb
Branch: MAIN
Changes since 1.91: +8 -3 lines
Diff to previous 1.91 (colored)

Make every interface with a watchdog register it's own slow timeout

This removes the system wide if_slowtimo timeout and lets every
interface with a valid if_watchdog method register it's own in
order to get rid of the ifnet loop in the softclock context and
avoid further complications with concurrent access to the ifnet
list.

ok deraadt, input and ok mpi, looked at by claudio

Revision 1.91 / (download) - annotate - [select for diffs], Tue Nov 18 02:37:31 2014 UTC (9 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.90: +1 -3 lines
Diff to previous 1.90 (colored)

move arc4random prototype to systm.h. more appropriate for most code
to include that than rdnvar.h. ok deraadt dlg

Revision 1.90 / (download) - annotate - [select for diffs], Tue Jul 22 11:06:09 2014 UTC (9 years, 10 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.89: +1 -2 lines
Diff to previous 1.89 (colored)

Fewer <netinet/in_systm.h> !

Revision 1.89 / (download) - annotate - [select for diffs], Sat Jul 12 18:44:22 2014 UTC (9 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.88: +8 -8 lines
Diff to previous 1.88 (colored)

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.

Revision 1.88 / (download) - annotate - [select for diffs], Wed Jul 9 09:30:49 2014 UTC (9 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.87: +2 -2 lines
Diff to previous 1.87 (colored)

bpf code surgery / shuffling / simplification.
the various bpf_mtap_* are very similiar, they differ in what (and to some
extent how) they prepend something, and what copy function they pass to
bpf_catchpacket.
use an internal _bpf_mtap as "backend" for bpf_mtap and friends.
extend bpf_mtap_hdr so that it covers all common cases:
if dlen is 0, nothing gets prepended.
copy function can be given, if NULL the default bpf_mcopy is used.
adjust the existing bpf_mtap_hdr users to pass a NULL ptr for the copy fn.
re-implement bpf_mtap_af as simple wrapper for bpf_mtap_hdr.
re-implement bpf_mtap_ether using bpf_map_hdr
re-implement bpf_mtap_pflog as trivial bpf_mtap_hdr wrapper
ok bluhm benno

Revision 1.87 / (download) - annotate - [select for diffs], Mon Mar 10 12:21:35 2014 UTC (10 years, 3 months ago) by mpi
Branch: MAIN
Changes since 1.86: +2 -4 lines
Diff to previous 1.86 (colored)

if_lladdr -> if_sadl, no functional change.

ok mikeb@

Revision 1.86 / (download) - annotate - [select for diffs], Thu Nov 21 16:16:08 2013 UTC (10 years, 6 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.85: +1 -2 lines
Diff to previous 1.85 (colored)

Remove unneeded include.

ok deraadt@

Revision 1.85 / (download) - annotate - [select for diffs], Mon Nov 18 09:16:30 2013 UTC (10 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.84: +12 -11 lines
Diff to previous 1.84 (colored)

Convert trunk(4) to use a detachhook, discussed at b2k13 with many.

While here add a comment explaining detach hooks' order of execution when
destroying/detaching an interface.

Revision 1.84 / (download) - annotate - [select for diffs], Thu Jun 20 12:03:40 2013 UTC (10 years, 11 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.83: +6 -4 lines
Diff to previous 1.83 (colored)

Revert previous and unbreak asr, the new include should be protected.

Reported by naddy@

Revision 1.83 / (download) - annotate - [select for diffs], Thu Jun 20 09:38:24 2013 UTC (10 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.82: +4 -6 lines
Diff to previous 1.82 (colored)

Allocate the various hook head descriptors as part of the ifnet
structure rather than doing various M_WAITOK allocations during
the *attach() functions, we always rely on them anyway.

ok mikeb@, uebayasi@

Revision 1.82 / (download) - annotate - [select for diffs], Sat May 11 11:18:27 2013 UTC (11 years, 1 month ago) by sthen
Branch: MAIN
Changes since 1.81: +18 -1 lines
Diff to previous 1.81 (colored)

Set trunk(4)'s MTU to that of the first trunkport. Allows trunk to work with
jumbo/baby-jumbo frames. To avoid problems with mismatches between trunkports,
any additional ports must have the same MTU as already set on the trunk(4).
Based on changes made in FreeBSD. Tested by myself and jj@, ok reyk@

Revision 1.81 / (download) - annotate - [select for diffs], Tue Apr 2 08:54:37 2013 UTC (11 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.80: +2 -4 lines
Diff to previous 1.80 (colored)

Instead of storing the link-level address of every interface in a global
array indexed by interface numbers, add a new field to the interface
descriptor pointing to it.

claudio@ and todd@ like it, ok mikeb@

Revision 1.80 / (download) - annotate - [select for diffs], Thu Mar 28 16:45:16 2013 UTC (11 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.79: +2 -2 lines
Diff to previous 1.79 (colored)

no need for a lot of code to include proc.h

Revision 1.79 / (download) - annotate - [select for diffs], Mon Feb 25 22:00:46 2013 UTC (11 years, 3 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.78: +28 -17 lines
Diff to previous 1.78 (colored)

trunk_bcast_start sent packets on all its member interfaces by copying
the mbuf it just sent on the previous interface. this is bad because the
previous interface could have modified the mbuf chain, which can make the
subsequent m_copym()s panic.

this copies the dance that rtsock.c does for broadcasting mbufs which
copies the mbuf before transmit, except for the last interface which it
handles outside the loop.

tested by halex@ who verified it fixes his panic.
ok claudio@ deraadt@

Revision 1.78 / (download) - annotate - [select for diffs], Fri Oct 28 12:49:43 2011 UTC (12 years, 7 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.77: +4 -1 lines
Diff to previous 1.77 (colored)

Take more care to ensure all callbacks are initialized. In particular
tr_linkstate() was not initialized in trunk_rr_attach(), and
tr_init() and tr_stop() were missing in trunk_lb_attach().

Fixes crash triggered by changing trunkproto, reported by Anders
Berggren on bugs@.

ok mpf henning

Revision 1.77 / (download) - annotate - [select for diffs], Fri Jan 28 14:20:37 2011 UTC (13 years, 4 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.76: +3 -3 lines
Diff to previous 1.76 (colored)

Fix another memory leak by replacing m_free() with m_freem() in trunk's
broadcast mode.

ok blambert@ mikeb@

Revision 1.76 / (download) - annotate - [select for diffs], Fri Nov 12 13:26:29 2010 UTC (13 years, 7 months ago) by dhill
Branch: MAIN
Changes since 1.75: +2 -2 lines
Diff to previous 1.75 (colored)

avoid pointer arithmetic on void *
no change in .o

ok claudio

Revision 1.75 / (download) - annotate - [select for diffs], Sat May 8 11:26:06 2010 UTC (14 years, 1 month ago) by stsp
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.74: +3 -2 lines
Diff to previous 1.74 (colored)

Upon changing the MAC address of an if_trunk interface, all ports are switched
to the new MAC. But subsequently added ports were still being assigned the
old MAC address because it was copied from the wrong place. Give newly added
trunk ports the current MAC of the master port, rather than the saved MAC of
the master port. The saved MAC should only be used to restore the original
MAC address of the interface when it is removed from the trunk.

ok claudio@

Revision 1.74 / (download) - annotate - [select for diffs], Fri Apr 23 13:51:31 2010 UTC (14 years, 1 month ago) by stsp
Branch: MAIN
Changes since 1.73: +2 -2 lines
Diff to previous 1.73 (colored)

Use proper Queen's English in a comment. Drive-by fix, no functional change.

Revision 1.73 / (download) - annotate - [select for diffs], Tue Apr 20 22:05:43 2010 UTC (14 years, 1 month ago) by tedu
Branch: MAIN
Changes since 1.72: +1 -2 lines
Diff to previous 1.72 (colored)

remove proc.h include from uvm_map.h.  This has far reaching effects, as
sysctl.h was reliant on this particular include, and many drivers included
sysctl.h unnecessarily.  remove sysctl.h or add proc.h as needed.
ok deraadt

Revision 1.72 / (download) - annotate - [select for diffs], Sat Apr 17 17:47:03 2010 UTC (14 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.71: +2 -16 lines
Diff to previous 1.71 (colored)

use ifnewlladdr() for trunk lladdr changes, too
ok stsp

Revision 1.71 / (download) - annotate - [select for diffs], Tue Jan 12 01:36:33 2010 UTC (14 years, 5 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.70: +2 -2 lines
Diff to previous 1.70 (colored)

set the length of the send queue to 1.

this prevents the ultimate length of the queue of the underlying interface
from being artificially inflated while hte vlan/trunk queue is filled and
then dumped wholesale on the underlying interface, which will dump its
massive queue wholesale on the chip.

tx mitigation is only triggered on real interfaces now (which is where the
cost is)

ok beck@ original diff ok kjc@ henning@

Revision 1.70 / (download) - annotate - [select for diffs], Wed Nov 18 02:09:59 2009 UTC (14 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.69: +3 -6 lines
Diff to previous 1.69 (colored)

do not do setup that ether_ifattach() takes care of; ok jsg

Revision 1.69 / (download) - annotate - [select for diffs], Thu Sep 17 13:13:56 2009 UTC (14 years, 8 months ago) by claudio
Branch: MAIN
Changes since 1.68: +3 -1 lines
Diff to previous 1.68 (colored)

Add an splassert check trunk_enqueue() calling this function at anything
below splnet() is a good recipe for doom.
OK henning, reyk, mpf

Revision 1.68 / (download) - annotate - [select for diffs], Wed Sep 9 15:01:18 2009 UTC (14 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.67: +4 -25 lines
Diff to previous 1.67 (colored)

remove inline functions and move some code from the trunk_lacp_input()
API function directly to lacp_input() to simplify the code path.

ok mpf@

Revision 1.67 / (download) - annotate - [select for diffs], Thu Jul 16 22:58:45 2009 UTC (14 years, 10 months ago) by thib
Branch: MAIN
Changes since 1.66: +1 -1 lines
Diff to previous 1.66 (colored)

Backout rev1.79 of if_vlan.c and rev1.66 of if_trunk.c;
Changes in those revision limited the send queue to one slot.

This breaks NFS over vlan(4) has discovered by sthen@.

"just plain back it out." deraadt@

Revision 1.66 / (download) - annotate - [select for diffs], Mon Jul 13 12:39:22 2009 UTC (14 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.65: +1 -1 lines
Diff to previous 1.65 (colored)

make the send queue one slot long. this forces packets off the virtual
interfaces down to the queue on the physical interface immediately.

this avoids having the tx mitigation code wasting cpu time dicking around
with simply shuffling packets off virtual interface queues and lets it
do its job of ammortising the cost of calling a real interfaces start
routine.

it also prevents an artificial inflation of the physical interfaces queue
length where packets could hide on the virtual interfaces queues during
softnet before being dumped en masse onto the hardware. this will smooth
out the rate at which packets are submitted to the hardware.

kjc@ says this has no impact on altq. ya henning@

Revision 1.65 / (download) - annotate - [select for diffs], Tue Jan 27 16:40:54 2009 UTC (15 years, 4 months ago) by naddy
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.64: +2 -2 lines
Diff to previous 1.64 (colored)

handle HW VLAN tags being passed down; from Brad

Revision 1.64 / (download) - annotate - [select for diffs], Tue Jan 27 12:58:27 2009 UTC (15 years, 4 months ago) by naddy
Branch: MAIN
Changes since 1.63: +3 -2 lines
Diff to previous 1.63 (colored)

make the hardware/no hardware tag stripping cases consistent and don't
hash the VLAN priority; ok henning@

Revision 1.63 / (download) - annotate - [select for diffs], Sun Dec 14 23:08:52 2008 UTC (15 years, 5 months ago) by brad
Branch: MAIN
Changes since 1.62: +6 -3 lines
Diff to previous 1.62 (colored)

Allow trunk_hashmbuf() to take HW VLAN tagging into consideration.

ok mpf@ naddy@

Revision 1.62 / (download) - annotate - [select for diffs], Sun Dec 14 23:04:06 2008 UTC (15 years, 5 months ago) by brad
Branch: MAIN
Changes since 1.61: +17 -17 lines
Diff to previous 1.61 (colored)

Since trunk_hashmbuf() and thus trunk_lb_gethdr() are no longer specific
to the loadbalance code rename trunk_lb_gethdr() to just trunk_gethr().

ok mpf@

Revision 1.61 / (download) - annotate - [select for diffs], Fri Nov 28 02:44:18 2008 UTC (15 years, 6 months ago) by brad
Branch: MAIN
Changes since 1.60: +1 -8 lines
Diff to previous 1.60 (colored)

Eliminate the redundant bits of code for MTU and multicast handling
from the individual drivers now that ether_ioctl() handles this.

Shrinks the i386 kernels by..
RAMDISK - 2176 bytes
RAMDISKB - 1504 bytes
RAMDISKC - 736 bytes

Tested by naddy@/okan@/sthen@/brad@/todd@/jmc@ and lots of users.
Build tested on almost all archs by todd@/brad@

ok naddy@

Revision 1.60 / (download) - annotate - [select for diffs], Sun Nov 16 03:42:13 2008 UTC (15 years, 6 months ago) by brad
Branch: MAIN
Changes since 1.59: +10 -8 lines
Diff to previous 1.59 (colored)

Make sure to increment the the output error counter if
not using TRUNK_PROTO_NONE and there are no member ports.

ok mpf@

Revision 1.59 / (download) - annotate - [select for diffs], Sat Nov 8 01:00:01 2008 UTC (15 years, 7 months ago) by mpf
Branch: MAIN
Changes since 1.58: +2 -2 lines
Diff to previous 1.58 (colored)

Take into account that our ether_input() already strips the
ethernet header. This lets us actually process the incoming
LACP-Packets.  It should now work with a lot more switches.
At least a Catalyst 3500 seems happy.
OK brad@

Revision 1.58 / (download) - annotate - [select for diffs], Tue Nov 4 13:44:11 2008 UTC (15 years, 7 months ago) by brad
Branch: MAIN
Changes since 1.57: +2 -7 lines
Diff to previous 1.57 (colored)

Move the trunk port count check from trunk_lb_start() to trunk_start()
before the protocol start routine is called so as to cover all protocols
with the same check.

ok mpf@

Revision 1.57 / (download) - annotate - [select for diffs], Thu Oct 30 20:44:02 2008 UTC (15 years, 7 months ago) by brad
Branch: MAIN
Changes since 1.56: +3 -2 lines
Diff to previous 1.56 (colored)

Fix building with !INET6 kernels.

Revision 1.56 / (download) - annotate - [select for diffs], Tue Oct 28 07:18:45 2008 UTC (15 years, 7 months ago) by brad
Branch: MAIN
Changes since 1.55: +1 -3 lines
Diff to previous 1.55 (colored)

Remove return at the end of a void function.

Revision 1.55 / (download) - annotate - [select for diffs], Tue Oct 28 07:14:45 2008 UTC (15 years, 7 months ago) by brad
Branch: MAIN
Changes since 1.54: +5 -4 lines
Diff to previous 1.54 (colored)

In trunk_media_status() mark the interface as active if any ports are
active rather than just the primary being UP.

From FreeBSD

Ok mpf@

Revision 1.54 / (download) - annotate - [select for diffs], Tue Oct 28 07:13:01 2008 UTC (15 years, 7 months ago) by brad
Branch: MAIN
Changes since 1.53: +3 -7 lines
Diff to previous 1.53 (colored)

In trunk_lb_start() port % count will never be greater than
TRUNK_MAX_PORTS so nuke the test.

From FreeBSD

Ok mpf@

Revision 1.53 / (download) - annotate - [select for diffs], Tue Oct 28 07:11:03 2008 UTC (15 years, 7 months ago) by brad
Branch: MAIN
Changes since 1.52: +4 -2 lines
Diff to previous 1.52 (colored)

Feed IPv6 flow label to hash calculation.

From FreeBSD

Ok mpf@

Revision 1.52 / (download) - annotate - [select for diffs], Tue Oct 28 07:10:09 2008 UTC (15 years, 7 months ago) by brad
Branch: MAIN
Changes since 1.51: +6 -1 lines
Diff to previous 1.51 (colored)

Show the ACTIVE flag in ifconfig for the single interface that is
actually active in failover mode rather than all interfaces with a
link. This makes it clear if the master interface is in use or one
of the backup links.

From FreeBSD

Tested by jmc@
Ok mpf@

Revision 1.51 / (download) - annotate - [select for diffs], Thu Oct 2 20:21:14 2008 UTC (15 years, 8 months ago) by brad
Branch: MAIN
Changes since 1.50: +2 -6 lines
Diff to previous 1.50 (colored)

First step towards cleaning up the Ethernet driver ioctl handling.
Move calling ether_ioctl() from the top of the ioctl function, which
at the moment does absolutely nothing, to the default switch case.
Thus allowing drivers to define their own ioctl handlers and then
falling back on ether_ioctl(). The only functional change this results
in at the moment is having all Ethernet drivers returning the proper
errno of ENOTTY instead of EINVAL/ENXIO when encountering unknown
ioctl's.

Shrinks the i386 kernels by..
RAMDISK - 1024 bytes
RAMDISKB -  1120 bytes
RAMDISKC - 832 bytes

Tested by martin@/jsing@/todd@/brad@
Build tested on almost all archs by todd@/brad@

ok jsing@

Revision 1.50 / (download) - annotate - [select for diffs], Wed Sep 17 20:10:37 2008 UTC (15 years, 8 months ago) by chl
Branch: MAIN
Changes since 1.49: +3 -4 lines
Diff to previous 1.49 (colored)

remove dead stores and newly created unused variables.

fix potential use of uninitialized value in trunk_port_ioctl() function.

Found by LLVM/Clang Static Analyzer.

ok mpf@ henning@

Revision 1.49 / (download) - annotate - [select for diffs], Thu Aug 7 18:06:17 2008 UTC (15 years, 10 months ago) by damien
Branch: MAIN
Changes since 1.48: +7 -4 lines
Diff to previous 1.48 (colored)

do not touch m after IFQ_ENQUEUE()+if_start().

ok brad@, mpf@, henning@, reyk@

Revision 1.48 / (download) - annotate - [select for diffs], Wed Aug 6 17:04:28 2008 UTC (15 years, 10 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.47: +3 -1 lines
Diff to previous 1.47 (colored)

fix trunk breakage that sneaked in with the lacp diff:

- don't use in-kernel IFMEDIA ioctls in lacp and remove two KASSERTs
that caused reliable panics - the lacp key can be locally assigned and
we don't need to query the media subtype here.

- unbreak failover/loadbalance/broadcast status handling.

Reported by brad@
ok deraadt@

Revision 1.47 / (download) - annotate - [select for diffs], Wed Jul 30 10:15:35 2008 UTC (15 years, 10 months ago) by mpf
Branch: MAIN
Changes since 1.46: +6 -1 lines
Diff to previous 1.46 (colored)

Prevent a divide by zero panic if trunkproto loadbalance is
used w/out any trunkports. Patch from Dmitri Alenitchev.
OK reyk@

Revision 1.46 / (download) - annotate - [select for diffs], Sun Jun 15 06:56:09 2008 UTC (15 years, 11 months ago) by mpf
Branch: MAIN
Changes since 1.45: +137 -5 lines
Diff to previous 1.45 (colored)

Add 802.3ad LACP support for trunk(4).
Implementation from NetBSD. Ported via FreeBSD's version in trunk^Wlagg(4).
This is still work in progress.  Tested with a HP ProCurve 3500.
OK reyk@

Revision 1.45 / (download) - annotate - [select for diffs], Sat Jun 14 01:18:53 2008 UTC (16 years ago) by mpf
Branch: MAIN
Changes since 1.44: +23 -17 lines
Diff to previous 1.44 (colored)

Move bpf_mtap_hdr() above the trunk_*_input() routines.
This makes it easier to add trunk protocols that consume some packets.
Add a special case for the failover protocol, to prevent shoving
duplicates to bpf. (Not beautiful, but it has to do for the moment).
OK reyk@, claudio@

Revision 1.44 / (download) - annotate - [select for diffs], Fri Jun 13 23:24:21 2008 UTC (16 years ago) by mpf
Branch: MAIN
Changes since 1.43: +8 -6 lines
Diff to previous 1.43 (colored)

Move the responsibility to free received packets on trunked interfaces
from ether_input() into trunk_input() where it can be handled in a smarter way.
OK claudio@ and reyk@ on an earlier version.

Revision 1.43 / (download) - annotate - [select for diffs], Sun Jun 8 17:25:46 2008 UTC (16 years ago) by brad
Branch: MAIN
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored)

Use m_freem() instead of m_free() in trunk_start() to ensure that the
full mbuf chain is being free'd.

ok reyk@

Revision 1.42 / (download) - annotate - [select for diffs], Wed May 7 13:45:35 2008 UTC (16 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.41: +1 -2 lines
Diff to previous 1.41 (colored)

enable tx mitigation when putting packets on the wire by switching from
calls to ifp->if_start to if_start(). these are the obviously right cases
where we can do that, the less obvious ones may follow as theyre figured
out.

deraadt@ said to go for it

Revision 1.41 / (download) - annotate - [select for diffs], Thu Jan 10 09:52:04 2008 UTC (16 years, 5 months ago) by brad
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.40: +7 -4 lines
Diff to previous 1.40 (colored)

return with ENOTTY instead of EINVAL for unknown ioctl requests to trunk
ports.

ok reyk@ dlg@

Revision 1.40 / (download) - annotate - [select for diffs], Mon Nov 26 09:28:33 2007 UTC (16 years, 6 months ago) by martynas
Branch: MAIN
Changes since 1.39: +2 -2 lines
Diff to previous 1.39 (colored)

typos;  ok jmc@
sys/netinet/in_pcb.c and sys/net/bridgestp.c ok henning@
sys/dev/pci/bktr/* ok jakemsr@

Revision 1.39 / (download) - annotate - [select for diffs], Tue Nov 20 20:42:11 2007 UTC (16 years, 6 months ago) by canacar
Branch: MAIN
Changes since 1.38: +13 -5 lines
Diff to previous 1.38 (colored)

Fix possible mbuf leak on error. ok reyk@

Revision 1.38 / (download) - annotate - [select for diffs], Mon Oct 22 17:02:03 2007 UTC (16 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.37: +14 -13 lines
Diff to previous 1.37 (colored)

use the input mbuf for the first active port instead of copying it in
the broadcast start routing.

ok pyr@

Revision 1.37 / (download) - annotate - [select for diffs], Mon Oct 22 14:48:52 2007 UTC (16 years, 7 months ago) by pyr
Branch: MAIN
Changes since 1.36: +76 -1 lines
Diff to previous 1.36 (colored)

Add a broadcast mode to trunk(4). This mode sends frames on all
ports and receives frame on any port. This allows interaction with
some L2 configurations.
with input and ok reyk@

Revision 1.36 / (download) - annotate - [select for diffs], Sat Sep 15 16:43:51 2007 UTC (16 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.35: +3 -5 lines
Diff to previous 1.35 (colored)

malloc sweep:
-remove useless casts
-MALLOC/FREE -> malloc/free
-use M_ZERO where appropriate instead of seperate bzero
feedback & ok krw, hshoexer

Revision 1.35 / (download) - annotate - [select for diffs], Fri Sep 7 11:00:47 2007 UTC (16 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.34: +4 -9 lines
Diff to previous 1.34 (colored)

use M_ZERO

Revision 1.34 / (download) - annotate - [select for diffs], Thu Sep 6 16:22:55 2007 UTC (16 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.33: +2 -2 lines
Diff to previous 1.33 (colored)

bump the copyright while touching these files

Revision 1.33 / (download) - annotate - [select for diffs], Thu Sep 6 16:14:05 2007 UTC (16 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.32: +2 -2 lines
Diff to previous 1.32 (colored)

With a trunk(4) interface in fail over mode the trunk(4) interface
will show input errors for packets received from any of the ports that
are part of a fail over interface but are not the "master" port at the
time. This fixes the problem by checking the error condition
correctly.

From brad at comstyle dot com

Revision 1.32 / (download) - annotate - [select for diffs], Sat May 26 17:13:31 2007 UTC (17 years ago) by jason
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.31: +1 -2 lines
Diff to previous 1.31 (colored)

one extern seems to be better than 20 for ifqmaxlen; ok krw

Revision 1.31 / (download) - annotate - [select for diffs], Thu Apr 26 08:57:59 2007 UTC (17 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.30: +135 -116 lines
Diff to previous 1.30 (colored)

extend the trunk protocol API with some additional callbacks required
for future work. also move the repeated tx start code into a common
function.

parts of it are merged from FreeBSD's trunk(4) port. oh, wait... they
renamed it to 'lagg(4)' because a little green guy from Cizzco-Eeeh
told them "trunk is for VLANs, trunk is for VLANs". Bad FreeBSD, don't
listen to the little green guy from Cizzco-Eeeh!

ok claudio@

Revision 1.30 / (download) - annotate - [select for diffs], Wed Jan 31 06:20:19 2007 UTC (17 years, 4 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.29: +25 -11 lines
Diff to previous 1.29 (colored)

handle the full duplex link state in trunk(4). load sharing trunks
with at least two ports are always handled as full fuplex links. this
change will allow trunks as edge ports in a rstp bridge(4).

ok brad@ pyr@

Revision 1.29 / (download) - annotate - [select for diffs], Sun May 28 01:14:15 2006 UTC (18 years ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.28: +5 -5 lines
Diff to previous 1.28 (colored)

check if the interface is active and UP. some, but not all, network
drivers report an active link state even if the interface is DOWN.
this should fix trunk with various ethernet devices.

ok brad@

Revision 1.28 / (download) - annotate - [select for diffs], Tue May 23 04:56:55 2006 UTC (18 years ago) by reyk
Branch: MAIN
Changes since 1.27: +2 -5 lines
Diff to previous 1.27 (colored)

knf and remove an unneeded debug message

Revision 1.27 / (download) - annotate - [select for diffs], Tue May 23 04:35:52 2006 UTC (18 years ago) by reyk
Branch: MAIN
Changes since 1.26: +224 -5 lines
Diff to previous 1.26 (colored)

add

Revision 1.26 / (download) - annotate - [select for diffs], Sat May 20 22:03:24 2006 UTC (18 years ago) by reyk
Branch: MAIN
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

bump copyright

Revision 1.25 / (download) - annotate - [select for diffs], Sat May 20 20:52:57 2006 UTC (18 years ago) by reyk
Branch: MAIN
Changes since 1.24: +3 -3 lines
Diff to previous 1.24 (colored)

drop packets received on inactive failover ports without increasing the
error counter. just silently drop them...

figured out by todd@, ok brad@

Revision 1.24 / (download) - annotate - [select for diffs], Tue May 16 20:23:10 2006 UTC (18 years ago) by reyk
Branch: MAIN
Changes since 1.23: +6 -4 lines
Diff to previous 1.23 (colored)

the ifp->if_linkstatehooks may be NULL, add an extra check to avoid
possible kernel panic. this happened to me by using tun(4) in layer 2
mode (link0 flag) as a trunk port for testing.

Revision 1.23 / (download) - annotate - [select for diffs], Sat Mar 25 22:41:47 2006 UTC (18 years, 2 months ago) by djm
Branch: MAIN
Changes since 1.22: +4 -3 lines
Diff to previous 1.22 (colored)

allow bpf(4) to ignore packets based on their direction (inbound or
outbound), using a new BIOCSDIRFILT ioctl;
guidance, feedback and ok canacar@

Revision 1.22 / (download) - annotate - [select for diffs], Sat Mar 11 03:12:36 2006 UTC (18 years, 3 months ago) by brad
Branch: MAIN
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

splimp -> splnet

Revision 1.21 / (download) - annotate - [select for diffs], Sat Mar 4 22:40:16 2006 UTC (18 years, 3 months ago) by brad
Branch: MAIN
Changes since 1.20: +3 -3 lines
Diff to previous 1.20 (colored)

With the exception of two other small uncommited diffs this moves
the remainder of the network stack from splimp to splnet.

ok miod@

Revision 1.20 / (download) - annotate - [select for diffs], Wed Jan 4 17:51:39 2006 UTC (18 years, 5 months ago) by brad
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.19: +5 -5 lines
Diff to previous 1.19 (colored)

Move bpf_mtap_hdr() after trunk_*_input() so that we hopefully see only one
copy of the packet with bpf.

From mcbride@

some testing by todd@, ok reyk@

Revision 1.19 / (download) - annotate - [select for diffs], Wed Jan 4 06:04:42 2006 UTC (18 years, 5 months ago) by canacar
Branch: MAIN
Changes since 1.18: +1 -4 lines
Diff to previous 1.18 (colored)

Remove redundant calls to bpfdetach.
ok brad@

Revision 1.18 / (download) - annotate - [select for diffs], Wed Dec 21 18:44:21 2005 UTC (18 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.17: +11 -11 lines
Diff to previous 1.17 (colored)

knf

Revision 1.17 / (download) - annotate - [select for diffs], Wed Dec 21 18:41:55 2005 UTC (18 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.16: +13 -10 lines
Diff to previous 1.16 (colored)

fix possible NULL pointer, thanks to Marco Molteni

Revision 1.16 / (download) - annotate - [select for diffs], Sun Dec 18 17:59:59 2005 UTC (18 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

Update my e-mail address in the copyright statement, no binary changes.

Revision 1.15 / (download) - annotate - [select for diffs], Sat Dec 17 23:44:29 2005 UTC (18 years, 5 months ago) by brad
Branch: MAIN
Changes since 1.14: +6 -6 lines
Diff to previous 1.14 (colored)

revert last commit as it introduced system panics due to improper use
of bpf_mtap().

Revision 1.14 / (download) - annotate - [select for diffs], Sun Nov 27 15:53:50 2005 UTC (18 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.13: +6 -5 lines
Diff to previous 1.13 (colored)

Move bpf_mtap() after trunk_*_input() so that we hopefull see only one
copy of the packet with bpf.

ok reyk@

Revision 1.13 / (download) - annotate - [select for diffs], Sun Nov 27 15:46:04 2005 UTC (18 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.12: +19 -4 lines
Diff to previous 1.12 (colored)

Attempt to accept a packet only once when operating in failover mode.

Makes trunk usable with hubs or switches which don't have actual trunk support.

ok reyk@

Revision 1.12 / (download) - annotate - [select for diffs], Sun Nov 27 09:29:42 2005 UTC (18 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.11: +4 -3 lines
Diff to previous 1.11 (colored)

Fix dereference of uninitialised pointer in trunk_input() error path.

ok reyk@

Revision 1.11 / (download) - annotate - [select for diffs], Sun Nov 27 09:27:14 2005 UTC (18 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.10: +47 -9 lines
Diff to previous 1.10 (colored)

Make the trunk interface link state depend on the link states of the
trunkports (link is UP as long as at least one of the trunkports is up)

ok reyk@

Revision 1.10 / (download) - annotate - [select for diffs], Sun Oct 23 14:07:11 2005 UTC (18 years, 7 months ago) by mpf
Branch: MAIN
Changes since 1.9: +13 -8 lines
Diff to previous 1.9 (colored)

Rework of multicast deletion code for vlan(4) and trunk(4).
The previous code could wrongly delete multicast groups
on the parent interface. Now we forward only remembered
delete requests.
OK mcbride, mickey.

Revision 1.9 / (download) - annotate - [select for diffs], Sun Oct 9 18:45:27 2005 UTC (18 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.8: +3 -6 lines
Diff to previous 1.8 (colored)

use label

Revision 1.8 / (download) - annotate - [select for diffs], Mon Oct 3 01:46:47 2005 UTC (18 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.7: +123 -19 lines
Diff to previous 1.7 (colored)

add a simple active "failover" trunk mode. port priorities will be
added later, currently the master port will always be the default
(active) port and the the next active port will be used as the
failover port.

ok brad@

Revision 1.7 / (download) - annotate - [select for diffs], Wed Sep 14 08:07:24 2005 UTC (18 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.6: +17 -5 lines
Diff to previous 1.6 (colored)

correctly set IFF_RUNNING flag after device state changes.

ok brad@

Revision 1.6 / (download) - annotate - [select for diffs], Sun Sep 11 16:17:01 2005 UTC (18 years, 9 months ago) by brad
Branch: MAIN
Changes since 1.5: +4 -3 lines
Diff to previous 1.5 (colored)

when adding any IP addresses make sure to UP the interface.

ok reyk@

Revision 1.5 / (download) - annotate - [select for diffs], Sat Sep 10 22:40:36 2005 UTC (18 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.4: +199 -8 lines
Diff to previous 1.4 (colored)

update the trunk(4) driver

- add multicast support by passing multicast addresses to the ports.
this is a requirement for carp(4) over trunk(4).

- support the smallest common interface capabilities. ie., this adds
support for VLAN MTUs if all attached ports have this capability.

- add a port_destroy callback to the trunk protocol. this fixes a
potential crash if the master port has been detached while running.

discussed with deraadt@, brad@ and some others.

Revision 1.4 / (download) - annotate - [select for diffs], Sun Jul 31 03:52:18 2005 UTC (18 years, 10 months ago) by pascoe
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.3: +3 -10 lines
Diff to previous 1.3 (colored)

Introduce bpf_mtap_af and bpf_mtap_hdr to be used when passing a mbuf chain
to bpf with either an address family or other header added.

These helpers only allocate a much smaller struct m_hdr on the stack when
needed, rather than leaving 256 byte struct mbufs on the stack in deep
call paths.  Also removes a fair bit of duplicated code.

commit now, tune after deraadt@

Revision 1.3 / (download) - annotate - [select for diffs], Fri May 27 22:57:13 2005 UTC (19 years ago) by reyk
Branch: MAIN
Changes since 1.2: +4 -2 lines
Diff to previous 1.2 (colored)

add missing free on error. thanks to Andrey Matveev.

Revision 1.2 / (download) - annotate - [select for diffs], Tue May 24 07:51:53 2005 UTC (19 years ago) by reyk
Branch: MAIN
Changes since 1.1: +44 -10 lines
Diff to previous 1.1 (colored)

support trunk stacking (trunks as trunk ports) and some fixes

ok brad@

Revision 1.1 / (download) - annotate - [select for diffs], Tue May 24 02:45:17 2005 UTC (19 years ago) by reyk
Branch: MAIN

initial import of a trunking (link aggregation and link failover)
implementation. it currently supports round robin mode with link state
checking, additional modes will be added later.

ok brad@, deraadt@

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.