OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.718 / (download) - annotate - [select for diffs], Tue Feb 6 00:18:53 2024 UTC (4 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.717: +2 -2 lines
Diff to previous 1.717 (colored)

Invert broken check of panic string in if_linkstate().

original bug report from syzkaller
Reported-by: syzbot+d19060a65721eb432a72@syzkaller.appspotmail.com
broken fix found by Hrvoje Popovski
hint to the problem and OK deraadt@

Revision 1.717 / (download) - annotate - [select for diffs], Mon Feb 5 18:27:47 2024 UTC (4 months ago) by mvs
Branch: MAIN
Changes since 1.716: +5 -3 lines
Diff to previous 1.716 (colored)

Don't send route messages while rebooting after panic. Syskaller exposed
[1] that if_downall() tries to send route messages and triggers panic
again but in knote(9) layer.

1. https://syzkaller.appspot.com/bug?extid=d19060a65721eb432a72

ok bluhm

Revision 1.716 / (download) - annotate - [select for diffs], Sat Jan 6 11:42:11 2024 UTC (5 months ago) by bluhm
Branch: MAIN
Changes since 1.715: +3 -6 lines
Diff to previous 1.715 (colored)

Do not count packets though multicast loopback and simplex interfaces.

Counting multicast packets sent to local stack or packets that are
reflected by simplex interfaces does not make much sense.  They are
neither received nor output by any ethernet device.  Counting these
packets at lo0 or the loopback interface of the routing domain would
be possible, but is not worth the effort.  Make if_input_local()
MP safe by deleting the if_opackets++ code.

OK mvs@

Revision 1.715 / (download) - annotate - [select for diffs], Sat Jan 6 10:58:45 2024 UTC (5 months ago) by bluhm
Branch: MAIN
Changes since 1.714: +3 -3 lines
Diff to previous 1.714 (colored)

Take net lock before kernel lock.

Doing KERNEL_LOCK() just before NET_LOCK() does not make sense.
Net lock is a rwlock that releases kernel lock during sleep.  To
avoid an unnecessary release and take kernel lock cycle, move
KERNEL_LOCK() after NET_LOCK().
There is no lock order reversal deadlock issue.  Both locks are
used in any order thoughout the kernel.  As NET_LOCK() releases the
kernel lock when it cannot take the lock immediately and has to
sleep, we always end in the order kernel lock before net lock after
sleeping.

OK sashan@

Revision 1.714 / (download) - annotate - [select for diffs], Fri Dec 29 11:43:04 2023 UTC (5 months, 1 week ago) by bluhm
Branch: MAIN
Changes since 1.713: +9 -6 lines
Diff to previous 1.713 (colored)

Make loopback interface counters MP safe.

Create and use the MP safe version of the interface counters for
lo(4).  Input packets were counted twice.  As interface input queue
is already counting, remove input count in if_input_local().
Multicast and siplex packets are counted at the ethernet interface.
Add a comment that this not MP safe.

OK mvs@

Revision 1.713 / (download) - annotate - [select for diffs], Sat Dec 23 10:52:54 2023 UTC (5 months, 2 weeks ago) by bluhm
Branch: MAIN
Changes since 1.712: +38 -18 lines
Diff to previous 1.712 (colored)

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

Revision 1.712 / (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.711: +18 -38 lines
Diff to previous 1.711 (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.711 / (download) - annotate - [select for diffs], Sat Nov 11 14:24:03 2023 UTC (6 months, 4 weeks ago) by bluhm
Branch: MAIN
Changes since 1.710: +10 -10 lines
Diff to previous 1.710 (colored)

Pass constant struct sockaddr to interface lookup functions.

OK mvs@

Revision 1.710 / (download) - annotate - [select for diffs], Fri Nov 10 15:51:24 2023 UTC (7 months ago) by bluhm
Branch: MAIN
Changes since 1.709: +2 -2 lines
Diff to previous 1.709 (colored)

Make ifq and ifiq interface MP safe.

Rename ifq_set_maxlen() to ifq_init_maxlen().  This function neither
uses WRITE_ONCE() nor a mutex and is called before the ifq mutex
is initialized.  The new name expresses that it should be used only
during interface attach when there is no concurrency.

Protect ifq_len(), ifq_empty(), ifiq_len(), and ifiq_empty() with
READ_ONCE().  They can be used without lock as they only read a
single integer.

OK dlg@

Revision 1.709 / (download) - annotate - [select for diffs], Fri Oct 27 20:56:47 2023 UTC (7 months, 2 weeks ago) by jan
Branch: MAIN
Changes since 1.708: +12 -1 lines
Diff to previous 1.708 (colored)

Forward TCP LRO disabling to parent devices.

Also disable TCP LRO on bridged vlan(4) and default for bpe(4), nvgre(4) and
vxlan(4).

ok bluhm@

Revision 1.708 / (download) - annotate - [select for diffs], Sat Sep 16 09:33:27 2023 UTC (8 months, 3 weeks ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.707: +3 -2 lines
Diff to previous 1.707 (colored)

Allow counters_read(9) to take an optional scratch buffer.

Using a scratch buffer makes it possible to take a consistent snapshot of
per-CPU counters without having to allocate memory.

Makes ddb(4) show uvmexp command work in OOM situations.

ok kn@, mvs@, cheloha@

Revision 1.707 / (download) - annotate - [select for diffs], Fri Aug 18 08:10:16 2023 UTC (9 months, 3 weeks ago) by jsg
Branch: MAIN
Changes since 1.706: +2 -2 lines
Diff to previous 1.706 (colored)

maximium -> maximum

Revision 1.706 / (download) - annotate - [select for diffs], Fri Jul 7 19:45:26 2023 UTC (11 months ago) by bluhm
Branch: MAIN
Changes since 1.705: +4 -1 lines
Diff to previous 1.705 (colored)

Keep mbuf header field ph_mss during loopback TCP with LRO/TSO.

When M_TCP_TSO is preserved, also keep ph_mss.  In lo(4) this logic
was missing.  This may be relevant only for weird pf configs that
forward from loopback.

OK mvs@ jan@

Revision 1.705 / (download) - annotate - [select for diffs], Fri Jul 7 08:05:02 2023 UTC (11 months ago) by bluhm
Branch: MAIN
Changes since 1.704: +52 -1 lines
Diff to previous 1.704 (colored)

Fix path MTU discovery for TCP LRO/TSO when forwarding.

When doing LRO (Large Receive Offload), the drivers, currently ix(4)
and lo(4) only, record an upper bound of the size of the original
packets in ph_mss.  When sending, either stack or hardware must
chop the packets with TSO (TCP Segmentation Offload) to that size.
That means we have to call tcp_if_output_tso() before ifp->if_output().
Put that logic into if_output_tso() to avoid code duplication.  As
TCP packets on the wire do not get larger that way, path MTU discovery
should still work.

tested by and OK jan@

Revision 1.704 / (download) - annotate - [select for diffs], Thu Jul 6 04:55:04 2023 UTC (11 months ago) by dlg
Branch: MAIN
Changes since 1.703: +1 -9 lines
Diff to previous 1.703 (colored)

big update to pfsync to try and clean up locking in particular.

moving pf forward has been a real struggle, and pfsync has been a
constant source of pain. we have been papering over the problems
for a while now, but it reached the point that it needed a fundamental
restructure, which is what this diff is.

the big headliner changes in this diff are:

- pfsync specific locks

this is the whole reason for this diff.

rather than rely on NET_LOCK or KERNEL_LOCK or whatever, pfsync now
has it's own locks to protect it's internal data structures. this
is important because pfsync runs a bunch of timeouts and tasks to
push pfsync packets out on the wire, or when it's handling requests
generated by incoming pfsync packets, both of which happen outside
pf itself running. having pfsync specific locks around pfsync data
structures makes the mutations of these data structures a lot more
explicit and auditable.

- partitioning

to enable future parallelisation of the network stack, this rewrite
includes support for pfsync to partition states into different "slices".
these slices run independently, ie, the states collected by one slice
are serialised into a separate packet to the states collected and
serialised by another slice.

states are mapped to pfsync slices based on the pf state hash, which
is the same hash that the rest of the network stack and multiq
hardware uses.

- no more pfsync called from netisr

pfsync used to be called from netisr to try and bundle packets, but now
that there's multiple pfsync slices this doesnt make sense. instead it
uses tasks in softnet tqs.

- improved bulk transfer handling

there's shiny new state machines around both the bulk transmit and
receive handling. pfsync used to do horrible things to carp demotion
counters, but now it is very predictable and returns the counters back
where they started.

- better tdb handling

the tdb handling was pretty hairy, but hrvoje has kicked this around
a lot with ipsec and sasyncd and we've found and fixed a bunch of
issues as a result of that testing.

- mpsafe pf state purges

this was committed previously, but because the locks pfsync relied on
weren't clear this just caused a ton of bugs. as part of this diff it's
now reliable, and moves a big chunk of work out from under KERNEL_LOCK,
which in turn improves the responsiveness and throughput of a firewall
even if you're not using pfsync.

there's a bunch of other little changes along the way, but the above are
the big ones.

hrvoje has done performance testing with this diff and notes a big
improvement when pfsync is not in use. performance when pfsync is
enabled is about the same, but im hoping the slices means we can scale
along with pf as it improves.

lots (months) of testing by me and hrvoje on pfsync boxes
tests and ok sashan@
deraadt@ says this is a good time to put it in

Revision 1.703 / (download) - annotate - [select for diffs], Tue Jul 4 13:37:47 2023 UTC (11 months, 1 week ago) by jan
Branch: MAIN
Changes since 1.702: +2 -2 lines
Diff to previous 1.702 (colored)

Check for interface type ethernet before call ether_brport_isset()

Pointed out by bluhm.

ok bluhm@

Revision 1.702 / (download) - annotate - [select for diffs], Sun Jul 2 19:59:15 2023 UTC (11 months, 1 week ago) by bluhm
Branch: MAIN
Changes since 1.701: +22 -2 lines
Diff to previous 1.701 (colored)

Use TSO and LRO on the loopback interface to transfer TCP faster.

If tcplro is activated on lo(4), ignore the MTU with TCP packets.
They are passed along with the information that they have to be
chopped in case they are forwarded later.  New netstat(1) counter
shows that software LRO is in effect.  The feature is currently
turned off by default.

tested by jan@; OK claudio@ jan@

Revision 1.701 / (download) - annotate - [select for diffs], Tue Jun 27 21:02:13 2023 UTC (11 months, 2 weeks ago) by mvs
Branch: MAIN
Changes since 1.700: +10 -10 lines
Diff to previous 1.700 (colored)

Introduce M_IFGROUP type of memory allocation. M_TEMP is unreasonable
for interface groups data allocations.

ok kn claudio bluhm

Revision 1.700 / (download) - annotate - [select for diffs], Mon Jun 12 21:19:54 2023 UTC (11 months, 4 weeks ago) by mvs
Branch: MAIN
Changes since 1.699: +3 -3 lines
Diff to previous 1.699 (colored)

Move nd6_ifdetach() out of netlock. In this point, the interface is
disconnected from everywhere. No need to hold netlock for dummy
'nd_ifinfo' release. Netlock is also not needed for
TAILQ_EMPTY(&ifp->if_*hooks) assertions.

ok kn bluhm

Revision 1.699 / (download) - annotate - [select for diffs], Mon Jun 5 11:35:46 2023 UTC (12 months ago) by bluhm
Branch: MAIN
Changes since 1.698: +19 -2 lines
Diff to previous 1.698 (colored)

Do not calculate IP, TCP, UDP checksums on loopback interface.

Packets sent over loopback got their checksums calculated twice.
In the output path they were filled in and during TCP/IP input all
checksums were calculated again to be compared with the previous
result.

Avoid this by claiming that lo(4) supports hardware checksum
offloading.  For each packet convert the flag that the checksum
should be calculated to the flag that it has been checked successfully.
Keep the flag that it should be calculated for the case that it may
be bridged or forwarded later.

A drawback is that "tcpdump -ni lo0 -v" reports invalid checksum.
But that is the same with physical interfaces and hardware offloading.

OK dlg@

Revision 1.698 / (download) - annotate - [select for diffs], Tue May 30 23:55:42 2023 UTC (12 months, 1 week ago) by dlg
Branch: MAIN
Changes since 1.697: +17 -1 lines
Diff to previous 1.697 (colored)

add net_tq_barriers

this waits once for something to end in all the net tqs.

ok claudio@

Revision 1.697 / (download) - annotate - [select for diffs], Tue May 16 14:32:54 2023 UTC (12 months, 3 weeks ago) by jan
Branch: MAIN
Changes since 1.696: +15 -20 lines
Diff to previous 1.696 (colored)

Use separate IFCAPs for LRO and TSO.

This diff introduces separate capabilities for TCP offloading.  We split this
into LRO (large receive offloading) and TSO (TCP segmentation offloading).
LRO can be turned on/off via tcprecvoffload option of ifconfig and is not
inherited to sub interfaces.

TSO is inherited by sub interfaces to signal this hardware offloading capability
to the network stack.

With tweaks from bluhm, claudio and dlg

ok bluhm, claudio

Revision 1.696 / (download) - annotate - [select for diffs], Sun May 14 01:46:53 2023 UTC (12 months, 4 weeks ago) by dlg
Branch: MAIN
Changes since 1.695: +15 -7 lines
Diff to previous 1.695 (colored)

give softnet threads unique names by suffixing softnet with their index.

ie, you'll see softnet0, softnet1, etc in top/ps/etc now instead
of just softnet on these threads.

this is done by wrapping the taskq and name up in a softnet struct.

ok patrick@ bluhm@ mvs@ kn@ sashan@

Revision 1.695 / (download) - annotate - [select for diffs], Sun May 7 16:23:23 2023 UTC (13 months ago) by bluhm
Branch: MAIN
Changes since 1.694: +41 -22 lines
Diff to previous 1.694 (colored)

I preparation for TSO in software, cleanup the fragment code.  Use
if_output_ml() to send mbuf lists to interfaces.  This can be used
for TSO, fragments, ARP and ND6.  Rename variable fml to ml.  In
pf_route6() split the if else block.  Put the safety check (hlen +
firstlen < tlen) into ip_fragment().  It makes the code correct in
case the packet is too short to be fragmented.  This should not
happen, but other functions also have this logic.
No functional change.  OK sashan@

Revision 1.694 / (download) - annotate - [select for diffs], Wed Apr 26 19:54:35 2023 UTC (13 months, 2 weeks ago) by mvs
Branch: MAIN
Changes since 1.693: +3 -5 lines
Diff to previous 1.693 (colored)

Introduce `rtlabel_mtx' mutex(9) to protect route labels storage. This
time kernel and net locks are held in various combination to protect it.
We don't want to put kernel lock to all the places. Netlock also can't
be used  because rtfree(9) which calls rtlabel_unref() has unknown
netlock state within.

This new `rtlabel_mtx' mutex(9) protects `rt_labels' list and `label'
entry dereference. Since we don't export 'rt_label' structure, keep this
lock private to net/route.c. For this reason rtlabel_id2name() now
copies label string to externally passed buffer instead of returning
address of `rt_labels' list data. This is the way which rtlabel_id2sa()
already works.

ok bluhm@

Revision 1.693 / (download) - annotate - [select for diffs], Wed Apr 26 00:14:21 2023 UTC (13 months, 2 weeks ago) by jan
Branch: MAIN
Changes since 1.692: +12 -1 lines
Diff to previous 1.692 (colored)

Also set TSO flag on vlan interfaces.

with tweaks from bluhm, claudio and dlg

I fine with it from claudio
looks good to me from dlg

ok bluhm

Revision 1.692 / (download) - annotate - [select for diffs], Sat Apr 22 04:39:46 2023 UTC (13 months, 2 weeks ago) by dlg
Branch: MAIN
Changes since 1.691: +0 -5 lines
Diff to previous 1.691 (colored)

revert vlan(4) inherits TSO flags

tb reports amd64 RAMDISK doesn't build with it.

also, vlan_flags_from_parent doesn't look right right. it iterates
over ifnetlist, which is all interfaces in the system, but appears
to assume they're all vlan interfaces and so uses a vlan_softc *
to inspect their if_softc pointers.

Revision 1.691 / (download) - annotate - [select for diffs], Fri Apr 21 14:31:41 2023 UTC (13 months, 2 weeks ago) by jan
Branch: MAIN
Changes since 1.690: +6 -1 lines
Diff to previous 1.690 (colored)

vlan(4) inherits TSO flags

tested by Hrvoje Popovski

with tweaks from bluhm and claudio

encouraged from deraadt
ok bluhm

Revision 1.690 / (download) - annotate - [select for diffs], Tue Apr 18 22:01:24 2023 UTC (13 months, 3 weeks ago) by mvs
Branch: MAIN
Changes since 1.689: +7 -7 lines
Diff to previous 1.689 (colored)

Remove kernel lock from ifa_ifwithaddr() and ifa_ifwithdstaddr().
Netlock protects `if_list', `ifa_list' and returned `ifa' dereference,
so put netlock assertion within.

Please note, rtable_setsource() doesn't destroy data pointed by
`ar_source'. This is the `ifa_addr' data belongs to `ifa' and exclusive
netlock is required to destroy it. So the kernel lock is not required
within rt_setsource(). Take netlock by rt_setsource() caller to make
`ifa' dereference safe.

Suggestions and ok by bluhm@

Revision 1.689 / (download) - annotate - [select for diffs], Tue Apr 18 22:00:19 2023 UTC (13 months, 3 weeks ago) by mvs
Branch: MAIN
Changes since 1.688: +5 -1 lines
Diff to previous 1.688 (colored)

Document `ifnetlist' locking.

We use both kernel and net lock for protect `ifnetlist'. This means we
do modification with both locks held, but for read-only access only one
lock required. Some places doing `ifnetlist' foreach loop are protected
by kernel lock and context switch can't be introduced there. This is the
exception, so "XXXSMP:" comment added.

Proposed and ok by bluhm@

Revision 1.688 / (download) - annotate - [select for diffs], Sat Apr 8 13:49:38 2023 UTC (14 months ago) by mvs
Branch: MAIN
Changes since 1.687: +3 -3 lines
Diff to previous 1.687 (colored)

Move rtm_ifannounce(IFAN_DEPARTURE) outside netlock within if_detach().
This is the mbuf(9) allocation and broadcast transmission for PF_ROUTE
sockets, netlock is not required here.

ok bluhm@

Revision 1.687 / (download) - annotate - [select for diffs], Fri Apr 7 22:02:58 2023 UTC (14 months ago) by bluhm
Branch: MAIN
Changes since 1.686: +2 -5 lines
Diff to previous 1.686 (colored)

Remove kernel locks from the ARP input path.  Caller if_netisr()
grabs the exclusive netlock and that is sufficent for in_arpinput()
and arpcache().
with kn@; OK mvs@; tested by Hrvoje Popovski

Revision 1.686 / (download) - annotate - [select for diffs], Wed Apr 5 19:35:23 2023 UTC (14 months ago) by bluhm
Branch: MAIN
Changes since 1.685: +22 -1 lines
Diff to previous 1.685 (colored)

ARP has a queue of packets that should be sent after name resolution.
ND6 did only hold a single packet.  Unify the logic and add a mbuf
hold queue to struct llinfo_nd6.  This is MP safe and queue limits
are tracked with atomic operations.  New function if_mqoutput() has
common code for ARP and ND6.  ln_saddr6 holds the source address
of the requesting packet.  That is easier than fiddling with mbuf
queue in nd6_ns_output().
OK kn@

Revision 1.685 / (download) - annotate - [select for diffs], Tue Mar 7 20:09:48 2023 UTC (15 months ago) by jan
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.684: +18 -16 lines
Diff to previous 1.684 (colored)

Avoid enabling TSO on interfaces which are already attached to a bridge.

with tweaks from claudio and deraadt

ok claudio, bluhm

Revision 1.684 / (download) - annotate - [select for diffs], Mon Feb 27 09:35:32 2023 UTC (15 months, 1 week ago) by jan
Branch: MAIN
Changes since 1.683: +36 -27 lines
Diff to previous 1.683 (colored)

Turn off TSO if interface is added to layer 2 devices.

ok bluhm@, claudio@

Revision 1.683 / (download) - annotate - [select for diffs], Wed Nov 23 16:57:37 2022 UTC (18 months, 2 weeks ago) by kn
Branch: MAIN
Changes since 1.682: +3 -3 lines
Diff to previous 1.682 (colored)

Let nd6_if{at,de}tach() be void and take an ifp argument

Do it like the rest of at/detach routines which modify a struct ifnet
pointer without returning anything.

OK mvs

Revision 1.682 / (download) - annotate - [select for diffs], Wed Nov 23 14:50:59 2022 UTC (18 months, 2 weeks ago) by kn
Branch: MAIN
Changes since 1.681: +1 -28 lines
Diff to previous 1.681 (colored)

Remove unused struct ifnet's *if_afdata[] and struct domain's dom_if{at,de}tach()

Both made obsolete through struct ifnet's previous *if_nd addition.

IPv6 Neighbour Discovery handles per-interface data directly, nothing
else uses this generic domain API anymore.

Outside of _KERNEL, but nothing in base uses them, either.

OK bluhm mvs claudio

Revision 1.681 / (download) - annotate - [select for diffs], Wed Nov 23 14:48:27 2022 UTC (18 months, 2 weeks ago) by kn
Branch: MAIN
Changes since 1.680: +8 -1 lines
Diff to previous 1.680 (colored)

Add *if_nd to struct ifnet, call nd6_if{at,de}tach() directly

*if_afdata[] and struct domain's dom_if{at,de}tach() are only used with
IPv6 Neighbour Discovery in6_dom{at,de}tach(), which allocate/init and
free single struct nd_ifinfo.

Set up a new ND-specific *if_nd member directly to avoid yet another
layer of indirection and thus make the generic domain API obsolete.

The per-interface data is only accessed in nd6.c and nd6_nbr.c through
the ND_IFINFO() macro;  it is allocated and freed exactly once during
interface at/detach, so document it as [I]mmutable.

OK bluhm mvs claudio

Revision 1.680 / (download) - annotate - [select for diffs], Mon Nov 14 22:45:02 2022 UTC (18 months, 3 weeks ago) by kn
Branch: MAIN
Changes since 1.679: +1 -7 lines
Diff to previous 1.679 (colored)

Unlock SIOCGIFG{MEMB,ATTR,LIST}

The global interface group list is also protected by the net lock and all
access to it (all within if.c) take it accordingly.

Getting all
- members    of a group (SIOCGIFGMEMB),
- attributes of a group (SIOCGIFGATTR),
- groups                (SIOCGIFGLIST)
are each read-only operations on the global interface group `ifg_head'.

The global interface list `ifnetlist' or its per-interface group lists are
not used in these ioctls.

OK mvs

Revision 1.679 / (download) - annotate - [select for diffs], Mon Nov 14 22:07:30 2022 UTC (18 months, 3 weeks ago) by kn
Branch: MAIN
Changes since 1.678: +1 -3 lines
Diff to previous 1.678 (colored)

Unlock SIOCGIFCONF

As netintro(4) explains, this copies a bunch of data from the global
interface list as well as its per-interface address lists.

All of this is never written to by ifconf(), protected by the net lock
and documented as such in the struct comments already.

OK mvs

Revision 1.678 / (download) - annotate - [select for diffs], Mon Nov 14 22:06:25 2022 UTC (18 months, 3 weeks ago) by kn
Branch: MAIN
Changes since 1.677: +3 -2 lines
Diff to previous 1.677 (colored)

Document global interface group list locking

The per-interface group list is protected by the net lock and already
documented as such.

The global interface group list `ifg_head' is also protected by the net
lock and all access to it (all within if.c) take it accordingly.

Feedback OK mvs

Revision 1.677 / (download) - annotate - [select for diffs], Thu Nov 10 17:17:47 2022 UTC (19 months ago) by dlg
Branch: MAIN
Changes since 1.676: +114 -125 lines
Diff to previous 1.676 (colored)

bring back r1.673: replace SRP with SMR in the if_idxmap.

when i first wrote if_idxmap i didn't realise (and no one thought
to tell me) that index 0 was special and means "no interface", so
while here use the 0th slot in the interface map to store the length
of the map instead of prepending the map with a length field.
if_get() now special cases index 0 and returns NULL directly. this
also means the size of the map is now always a power of 2, which
is a nicer fit with what the kernel malloc aprovides.

the problem with r1.673 that hrvoje popovski found was that attaching
a lot of interfaces during autoconf would lock up when growing the
map called smr_barrier. the fix in this diff is to (ab)use the
usedidx bitmap to store an smr_entry and defer the freeing of the
interface pointer map with it.

tested by hrvoje popovski
tweaks and ok visa@

Revision 1.676 / (download) - annotate - [select for diffs], Wed Nov 9 22:15:50 2022 UTC (19 months ago) by dlg
Branch: MAIN
Changes since 1.675: +130 -83 lines
Diff to previous 1.675 (colored)

revert r1.673: replace SRP with SMR in the if_idxmap.

if the map has to be reallocated during boot, there's an smr_barrier
waiting for the old map to become unused. that barrier ends up
waiting for cpus that aren't running yet because we haven't finished
booting yet, so boot gets stuck.

found by hrvoje popovski

Revision 1.675 / (download) - annotate - [select for diffs], Wed Nov 9 13:09:30 2022 UTC (19 months ago) by kn
Branch: MAIN
Changes since 1.674: +1 -3 lines
Diff to previous 1.674 (colored)

Recommit r1.669 "Unlock SIOCIFGCLONERS"

OK mvs

Revision 1.674 / (download) - annotate - [select for diffs], Wed Nov 9 13:08:36 2022 UTC (19 months ago) by kn
Branch: MAIN
Changes since 1.673: +18 -4 lines
Diff to previous 1.673 (colored)

Push kernel lock from ifioctl() into ifioctl_get()

Recommit these two together:
- r1.667 "Push kernel lock into ifioctl_get()"
  locked before the switch() without unlocking in its cases
- r1.668 "Push kernel lock inside ifioctl_get()"
  locked cases individually, as intended

I messed up splitting commits, but of course, Hrvoje managed to test a
CVS checkout right inbetween those two.

OK mpi mvs

Revision 1.673 / (download) - annotate - [select for diffs], Wed Nov 9 10:41:18 2022 UTC (19 months ago) by dlg
Branch: MAIN
Changes since 1.672: +83 -130 lines
Diff to previous 1.672 (colored)

replace SRP with SMR in the if_idxmap.

when i first wrote if_idxmap i didn't realise (and no one thought
to tell me) that index 0 was special and means "no interface", so
while here use the 0th slot in the interface map to store the length
of the map instead of prepending the map with a length field.
if_get() now special cases index 0 and returns NULL directly. this
also means the size of the map is now always a power of 2, which
is a nicer fit with what the kernel malloc aprovides.

tweaks and ok visa@

Revision 1.672 / (download) - annotate - [select for diffs], Tue Nov 8 21:07:33 2022 UTC (19 months ago) by kn
Branch: MAIN
Changes since 1.671: +4 -16 lines
Diff to previous 1.671 (colored)

Revert lock changes inside ifioctl_get()

WITNESS isn't happy with r1.667 "Push kernel lock into ifioctl_get()", so
revert it (including r1.668 and r1.669 depending on it):

	witness: userret: returning with the following locks held:
	exclusive kernel_lock &kernel_lock r = 0 (0xffffffff82455f58)
	#0  witness_lock+0x311
	#1  ifioctl_get+0x2e
	#2  sys_ioctl+0x2c4
	#3  syscall+0x384
	#4  Xsyscall+0x128
	panic: witness_warn
	Stopped at      db_enter+0x10:  popq    %rbp
	    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
	* 70588  52613      0         0x3          0    4K pfctl

So back to the drawing board while leaving documentation bits (r1.670).
Thanks Hrvoje.

Revision 1.671 / (download) - annotate - [select for diffs], Tue Nov 8 18:47:58 2022 UTC (19 months ago) by kn
Branch: MAIN
Changes since 1.670: +2 -2 lines
Diff to previous 1.670 (colored)

Use four spaces not tabs on line break

Revision 1.670 / (download) - annotate - [select for diffs], Tue Nov 8 18:43:22 2022 UTC (19 months ago) by kn
Branch: MAIN
Changes since 1.669: +4 -3 lines
Diff to previous 1.669 (colored)

Document ifc_list immutability

Move up to comment explaining different locks to account for all structs.

OK millert mvs

Revision 1.669 / (download) - annotate - [select for diffs], Tue Nov 8 17:57:47 2022 UTC (19 months ago) by kn
Branch: MAIN
Changes since 1.668: +1 -3 lines
Diff to previous 1.668 (colored)

Unlock SIOCIFGCLONERS

ifconfig(8) -C is the only user in base and the if_clone_attach() comment
explains how this list is being built during autoconf(9).

After that it is only ever read.  Multiple threads may traverse the list in
parallel and reading the `int' count is atomic.

OK mvs

Revision 1.668 / (download) - annotate - [select for diffs], Tue Nov 8 17:57:14 2022 UTC (19 months ago) by kn
Branch: MAIN
Changes since 1.667: +13 -3 lines
Diff to previous 1.667 (colored)

Push kernel lock inside ifioctl_get()

After this mechanical move, I can unlock the individual SIOCG* in there.

OK mvs

Revision 1.667 / (download) - annotate - [select for diffs], Tue Nov 8 15:20:24 2022 UTC (19 months ago) by kn
Branch: MAIN
Changes since 1.666: +8 -4 lines
Diff to previous 1.666 (colored)

Push kernel lock into ifioctl_get()

Another mechanical diff without semantic changes to avoid churn in actual
unlocking diffs.

OK mpi

Revision 1.666 / (download) - annotate - [select for diffs], Tue Nov 8 11:25:01 2022 UTC (19 months ago) by kn
Branch: MAIN
Changes since 1.665: +18 -3 lines
Diff to previous 1.665 (colored)

Push kernel lock down into ifioctl()

This is a mechanical diff without semantical changes, locking ioctls
individually inside ifioctl() rather than all of them around it.

This allows us to unlock ioctls one by one.

OK mpi

Revision 1.665 / (download) - annotate - [select for diffs], Thu Sep 8 10:22:06 2022 UTC (21 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.664: +13 -13 lines
Diff to previous 1.664 (colored)

Rename global ifnet TAILQ

Naming the list like the struct itself makes for awful grepping.
Call the global variable "ifnetlist" from now on.

There used to be kvm(3) consumers in base picking up this symbol, but those
have long been converted to other interfaces.

A few potential ports users remain, same deal as sys/net/if_var.h r1.116
"Remove struct ifnet's unused if_switchport member":  they get bumped.

Previous users pointed out by deraadt
OK bluhm

Revision 1.664 / (download) - annotate - [select for diffs], Fri Sep 2 13:12:31 2022 UTC (21 months, 1 week ago) by mvs
Branch: MAIN
Changes since 1.663: +2 -2 lines
Diff to previous 1.663 (colored)

Move PRU_CONTROL request to (*pru_control)().

The 'proc *' arg is not used for PRU_CONTROL request, so remove it from
pru_control() wrapper.

Split out {tcp,udp}6_usrreqs from {tcp,udp}_usrreqs and use them for
inet6 case.

ok guenther@ bluhm@

Revision 1.663 / (download) - annotate - [select for diffs], Sat Aug 13 21:01:46 2022 UTC (21 months, 4 weeks ago) by mvs
Branch: MAIN
Changes since 1.662: +2 -4 lines
Diff to previous 1.662 (colored)

Introduce the pru_*() wrappers for corresponding (*pr_usrreq)() calls.

This is helpful for the following (*pr_usrreq)() split to multiple
handlers. But right now this makes code more readable.

Also add '#ifndef _SYS_SOCKETVAR_H_' to sys/socketvar.h. This prevents the
collisions when both sys/protosw.h and sys/socketvar.h are included
together. Both 'socket' and 'protosw' structures are required to be
defined before pru_*() wrappers, so we need to include sys/socketvar.h to
sys/protosw.h.

ok bluhm@

Revision 1.662 / (download) - annotate - [select for diffs], Sat Aug 6 15:57:58 2022 UTC (22 months ago) by bluhm
Branch: MAIN
Changes since 1.661: +17 -23 lines
Diff to previous 1.661 (colored)

Clean up the netlock macros.  Merge NET_RLOCK_IN_SOFTNET and
NET_RLOCK_IN_IOCTL, which have the same implementation.  The R and
W are hard to see, call the new macro NET_LOCK_SHARED.  Rename the
opposite assertion from NET_ASSERT_WLOCKED to NET_ASSERT_LOCKED_EXCLUSIVE.
Update some outdated comments about net locking.
OK mpi@ mvs@

Revision 1.661 / (download) - annotate - [select for diffs], Fri Aug 5 13:57:16 2022 UTC (22 months ago) by bluhm
Branch: MAIN
Changes since 1.660: +10 -2 lines
Diff to previous 1.660 (colored)

The netlock for SIOCSIFMEDIA and SIOCGIFMEDIA ioctl is not necessary.
Legacy drivers run with kernel lock, interface media is MP safe or
has kernel lock.  Assert kernel lock in ix(4) and ixl(4).
OK kettenis@

Revision 1.660 / (download) - annotate - [select for diffs], Fri Jul 29 08:23:40 2022 UTC (22 months, 1 week ago) by visa
Branch: MAIN
Changes since 1.659: +56 -10 lines
Diff to previous 1.659 (colored)

Allocate if_index before queue init

Allocate the index of a new network interface early so that the index
is available when the interface's queues are set up. This avoids
unintended concentration on net_tq(0).

Replace the kernel lock with an rwlock to serialize index map updates.
The kernel lock is not reliable here because the memory allocation
can sleep.

Also, correct the "too many interfaces" condition because the valid
index range is from 1 to USHRT_MAX.

OK bluhm@

Revision 1.659 / (download) - annotate - [select for diffs], Thu Jul 14 11:03:15 2022 UTC (22 months, 4 weeks ago) by mvs
Branch: MAIN
Changes since 1.658: +5 -2 lines
Diff to previous 1.658 (colored)

Turn pppoe(4) back to kernel lock. We can't predict netlock state within
pppoe_start(), so we can't use it for pppoe(4) data protection. Except
input path, pppoe(4) always accessed with kernel lock held, so grab it
around pppoeintr() too.

Interfaces should not use netlock for their data protection. They should
rely on kernel lock or implement their own.

ok bluhm@ bket@

Revision 1.658 / (download) - annotate - [select for diffs], Sun Jul 10 21:26:55 2022 UTC (23 months ago) by mvs
Branch: MAIN
Changes since 1.657: +5 -2 lines
Diff to previous 1.657 (colored)

if_detach() should wait until concurrent (*if_qstart)() interface start
routines finished.

Call ifq_barrier(9) just after we unlinked dying interface from the stack.
From this point it is not accessible by if_get(9) and if_unit(9), and all
concurrent threads owning interface pointer finished. It also detached
from pseudo drivers like bridge(4). We only could have concurrent
(*if_qstart)() handlers running, so wait them and then continue
destruction.

Reported and tested by Hrvoje Popovski.

ok bluhm@

Revision 1.657 / (download) - annotate - [select for diffs], Wed Jun 29 09:08:07 2022 UTC (23 months, 1 week ago) by mvs
Branch: MAIN
Changes since 1.656: +6 -1 lines
Diff to previous 1.656 (colored)

ether_input() called with shared netlock, but pppoe(4) wants it to be
exclusive. Do the pppoe(4) input within netisr handler with exclusive
netlok held and remove kernel lock hack from ether_input().

This is the step back, but it makes ether_input() path better then it
is now.

Tested by Hrvoje Popovski.

ok bluhm@ claudio@

Revision 1.656 / (download) - annotate - [select for diffs], Tue Jun 28 09:41:24 2022 UTC (23 months, 2 weeks ago) by jan
Branch: MAIN
Changes since 1.655: +5 -1 lines
Diff to previous 1.655 (colored)

ifconfig(8) return "Not supported" if you try to configure tso on a non-tso
supported interface.

pointed out by bluhm@

OK bluhm@

Revision 1.655 / (download) - annotate - [select for diffs], Tue Jun 28 08:01:40 2022 UTC (23 months, 2 weeks ago) by mvs
Branch: MAIN
Changes since 1.654: +5 -1 lines
Diff to previous 1.654 (colored)

Introduce `pipexoutq' mbuf(9) queue, and put outgoing pipex(4) related
PPPOE packets within. Do (*if_output)() calls within netisr handler with
netlock held.

We can't predict netlock state when pipex(4) related (*if_qstart)()
handlers called. This means we can't use netlock within pppac_qstart()
and pppx_if_qstart() handlers.

ok bluhm@

Revision 1.654 / (download) - annotate - [select for diffs], Mon Jun 27 15:11:23 2022 UTC (23 months, 2 weeks ago) by jan
Branch: MAIN
Changes since 1.653: +33 -1 lines
Diff to previous 1.653 (colored)

Introduce Large Receive Offloading of TCP segment offloading for ix(4).  It is
disabled by default.  Also add a tso option to ifconfig(8) to enable and
disable this feature.

ok deraadt

Revision 1.653 / (download) - annotate - [select for diffs], Tue Jun 7 22:18:34 2022 UTC (2 years ago) by sashan
Branch: MAIN
Changes since 1.652: +3 -1 lines
Diff to previous 1.652 (colored)

fixes potential memory leak. if_vinput() should always consume packet
by either passing it further or releasing it.

OK mvs@

Revision 1.652 / (download) - annotate - [select for diffs], Tue May 3 11:47:03 2022 UTC (2 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.651: +2 -2 lines
Diff to previous 1.651 (colored)

Activate parallel IP forwarding.  Start 4 softnet tasks.  Limit the
usage to the number of CPUs.
lots of testing Hrvoje Popovski; OK sashan@ sthen@

Revision 1.651 / (download) - annotate - [select for diffs], Sat Apr 30 21:13:57 2022 UTC (2 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.650: +3 -8 lines
Diff to previous 1.650 (colored)

Run IP input and forwarding with shared netlock.  Also distribute
packets from the interface receive rings into multiple net task
queues.
Note that we still have only one softnet task.  So there will be
no concurrency yet, but we can notice wrong exclusive lock assertions.
Soon the final step will be to increase the NET_TASKQ define.
lots of testing Hrvoje Popovski; OK sashan@

Revision 1.650 / (download) - annotate - [select for diffs], Thu Apr 28 16:56:39 2022 UTC (2 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.649: +7 -1 lines
Diff to previous 1.649 (colored)

Decouple IP input and forwarding from protocol input.  This allows
to have parallel IP processing while the upper layers are still not
MP safe.  Introduce ip_ours() that enqueues the packets and ipintr()
that dequeues and processes them with an exclusive netlock.
Note that we still have only one softnet task.  Running IP processing
on multiple CPU will be the next step.
lots of testing Hrvoje Popovski; OK sashan@

Revision 1.649 / (download) - annotate - [select for diffs], Fri Feb 25 23:51:03 2022 UTC (2 years, 3 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.648: +6 -7 lines
Diff to previous 1.648 (colored)

Reported-by: syzbot+1b5b209ce506db4d411d@syzkaller.appspotmail.com
Revert the pr_usrreqs move: syzkaller found a NULL pointer deref
and I won't be available to monitor for followup issues for a bit

Revision 1.648 / (download) - annotate - [select for diffs], Fri Feb 25 08:36:01 2022 UTC (2 years, 3 months ago) by guenther
Branch: MAIN
Changes since 1.647: +7 -6 lines
Diff to previous 1.647 (colored)

Move pr_attach and pr_detach to a new structure pr_usrreqs that can
then be shared among protosw structures, following the same basic
direction as NetBSD and FreeBSD for this.

Split PRU_CONTROL out of pr_usrreq into pru_control, giving it the
proper prototype to eliminate the previously necessary casts.

ok mvs@ bluhm@

Revision 1.647 / (download) - annotate - [select for diffs], Fri Jan 7 16:39:18 2022 UTC (2 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.646: +4 -3 lines
Diff to previous 1.646 (colored)

SIOCSIFXFLAGS drops into the SIOCSIFFLAGS to perform auto-up of the
interface. If this operation fails (probably due to missing firmware),
we must undo changes to the SIOCSIFXFLAGS xflags.
ok stsp.

Revision 1.646 / (download) - annotate - [select for diffs], Sun Jan 2 22:36:03 2022 UTC (2 years, 5 months ago) by jsg
Branch: MAIN
Changes since 1.645: +3 -3 lines
Diff to previous 1.645 (colored)

spelling
ok jmc@ reads ok tb@

Revision 1.645 / (download) - annotate - [select for diffs], Sun Dec 26 01:00:32 2021 UTC (2 years, 5 months ago) by sashan
Branch: MAIN
Changes since 1.644: +3 -3 lines
Diff to previous 1.644 (colored)

make 'set skip on ...' in pf.conf dynamic

This is an old issue in pf(4): whenever new interface appears
in IP stack, we must reload pf.conf to apply 'set skip on ...'
to newly plumbed network interfaces. Time has come to fix it.
The idea is to also create pfi_kif for interfaces, which are
referred by 'set skip on ...'. Such pfi_kif instances are
created/destroyed by pfi_set_flags()/pfi_clear_flags().

claudio@ dragged my attention to this in Gouveia. Also his
feedback helped me to put change into shape.

OK claudio@

Revision 1.644 / (download) - annotate - [select for diffs], Thu Nov 11 10:03:10 2021 UTC (2 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.643: +1 -10 lines
Diff to previous 1.643 (colored)

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.643 / (download) - annotate - [select for diffs], Tue Jul 20 16:32:28 2021 UTC (2 years, 10 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.642: +11 -8 lines
Diff to previous 1.642 (colored)

The current workaround to disable parallel IPsec did not work.
Variable nettaskqs must not change at runtime.  Interface input
queues choose the thread during init with ifiq_softnet = net_tq().
So it cannot be modified after pfkeyv2_send() sets the first SA in
kernel.  Also changing the calculation in net_tq() may call task_del()
with a different taskq than task_add().
Instead of restricting the index to the first softnet task, use an
exclusive lock.  For now just move the comment.  We can later decide
if a write net lock or kernel lock is better.
OK mvs@

Revision 1.642 / (download) - annotate - [select for diffs], Wed Jun 30 13:23:33 2021 UTC (2 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.641: +4 -4 lines
Diff to previous 1.641 (colored)

Remove splnet() from ifnewlladdr(), it is not needed anymore.
Add asserts and comments for the locks that are necessary.
discussed with dlg@ mpi@ mvs@; tested by Hrvoje Popovski; OK mpi@

Revision 1.641 / (download) - annotate - [select for diffs], Tue May 25 22:45:09 2021 UTC (3 years ago) by bluhm
Branch: MAIN
Changes since 1.640: +3 -3 lines
Diff to previous 1.640 (colored)

As network features are not added dynamically, the domain structures
are constant.  Having more const makes MP review easier.  More
pointers are mapped read-only in the kernel image.
OK deraadt@ mvs@

Revision 1.640 / (download) - annotate - [select for diffs], Fri Mar 26 22:41:06 2021 UTC (3 years, 2 months ago) by mvs
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.639: +2 -2 lines
Diff to previous 1.639 (colored)

Push kernel lock within rtable_add(9) and rework it to return 0 in the
case when requested table is already exists.

Except initialization time, route_output() and if_createrdomain() are the
only paths where we call rtable_add(9). We check requested table existence
by rtable_exists(9) and it's not the error condition if the table exists.
Otherwise we are trying to create requested table by rtable_add(9). Those
paths are kernel locked so concurrent thread can't create requested table
just after rtable_exists(9) check. Also rtable_add(9) has internal
rtable_exists(9) check and in this case the table existence assumed as
EEXIST error. This error path is never reached.

We are going to unlock PF_ROUTE sockets. This means route_output() will
not be serialized with if_createrdomain() and concurrent thread could
create requested table. Table existence check and creation should be
serialized and it makes sense to do this within rtable_add(9). This time
kernel lock is used for this so it pushed down to rtable_add(9). The
internal rtable_exists(9) check was modified and table existence is not
error now.

Since the external rtable_exists(9) check is useless it was removed from
if_createrdomain(). It still exists in route_output() path because the
logic is more complicated here.

ok mpi@

Revision 1.639 / (download) - annotate - [select for diffs], Sat Mar 20 17:08:57 2021 UTC (3 years, 2 months ago) by florian
Branch: MAIN
Changes since 1.638: +8 -4 lines
Diff to previous 1.638 (colored)

RFC 8981 allows the configuration of only temporary IPv6 addresses.
Make the interface come up when the IFXF_AUTOCONF6TEMP is set.
OK kn

Revision 1.638 / (download) - annotate - [select for diffs], Thu Mar 18 15:58:58 2021 UTC (3 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.637: +4 -2 lines
Diff to previous 1.637 (colored)

When changing the link local address send a RTM_IFINFO message out.
Also prefer if (error == 0) over if (!error).
OK florian@ bluhm@

Revision 1.637 / (download) - annotate - [select for diffs], Thu Mar 18 15:57:16 2021 UTC (3 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.636: +6 -3 lines
Diff to previous 1.636 (colored)

Do not call rtm_ifchg() if IFF_UP changed. The code in if_up() and if_down()
already call rtm_ifchg() and so this would just result in a duplicate message.
Noticed by deraadt@. OK florian@ bluhm@

Revision 1.636 / (download) - annotate - [select for diffs], Thu Mar 11 16:48:47 2021 UTC (3 years, 3 months ago) by florian
Branch: MAIN
Changes since 1.635: +3 -2 lines
Diff to previous 1.635 (colored)

There is no need to try to attach IPv6 to an interface when the
AUTOCONF6 flag is already set.
This is likely a leftover from when we sent router solicitations from
the kernel. This was a way to trigger sending a solicitation from
userland.
OK kn

Revision 1.635 / (download) - annotate - [select for diffs], Thu Mar 11 15:56:27 2021 UTC (3 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.634: +34 -23 lines
Diff to previous 1.634 (colored)

If the AUTOCONF4 or AUTOCONF6 flags get enabled, force the interface up.
ok florian claudio

Revision 1.634 / (download) - annotate - [select for diffs], Wed Mar 10 10:21:47 2021 UTC (3 years, 3 months ago) by jsg
Branch: MAIN
Changes since 1.633: +2 -2 lines
Diff to previous 1.633 (colored)

spelling

ok gnezdo@ semarie@ mpi@

Revision 1.633 / (download) - annotate - [select for diffs], Tue Mar 9 20:03:50 2021 UTC (3 years, 3 months ago) by anton
Branch: MAIN
Changes since 1.632: +2 -2 lines
Diff to previous 1.632 (colored)

Shorten the if_cloners_lock name preventing it from being truncated in
the top(1) wait column.

ok mvs@

Revision 1.632 / (download) - annotate - [select for diffs], Sat Feb 20 04:55:52 2021 UTC (3 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.631: +41 -1 lines
Diff to previous 1.631 (colored)

add p2p_input, like ether_input but for l3 tunnel interfaces.

the l3 protocol input to push the packet is based on a value in
m->m_pkthdr.ph_family, which tunnel drivers should set before calling
if_vinput.

add p2p_bpf_mtap to call bpf_mtap_af also using m->m_pkthdr.ph_family.

Revision 1.631 / (download) - annotate - [select for diffs], Sat Feb 20 04:37:26 2021 UTC (3 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.630: +6 -2 lines
Diff to previous 1.630 (colored)

default interfaces to bpf_mtap_ether for their if_bpf_mtap handler.

call (*ifp->if_bpf_mtap) instead of bpf_mtap_ether in ifiq_input
and if_vinput.

Revision 1.630 / (download) - annotate - [select for diffs], Sat Feb 20 01:11:43 2021 UTC (3 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.629: +3 -2 lines
Diff to previous 1.629 (colored)

add a MONITOR flag to ifaces to say they're only used for watching packets.

an example use of this is when you have a span port on a switch and
you want to be able to see the packets coming out of it with tcpdump,
but do not want these packets to enter the network stack for
processing. this is particularly important if the span port is
pushing a copy of any packets related to the machine doing the
monitoring as it will confuse pf states and the stack.

ok benno@

Revision 1.629 / (download) - annotate - [select for diffs], Thu Feb 11 20:28:01 2021 UTC (3 years, 3 months ago) by mvs
Branch: MAIN
Changes since 1.628: +2 -3 lines
Diff to previous 1.628 (colored)

We link `ifp' to `if_list' before we perform if_attachsetup(). It is not
fully initialized because we initialize `if_groups' after linking. It's
not triggered because if_attach() and if_unit(9) are serialized by
kernel lock and `ifp' is often filled by nulls. Move `if_groups'
initialization to if_attach_common() to prevent this.

ok bluhm@ claudio@ deraadt@

Revision 1.628 / (download) - annotate - [select for diffs], Wed Feb 10 14:41:53 2021 UTC (3 years, 3 months ago) by bluhm
Branch: MAIN
Changes since 1.627: +5 -3 lines
Diff to previous 1.627 (colored)

Interface group names must fit into IFNAMSIZ and be unique.  But
the kernel made the unique check before trunkating with strlcpy().
So there could be two interface groups with the same name.  The kif
is created by a name lookup.  The trunkated names are equal, so
there was only one kif owned by both groups.  When the groups got
destroyed, the single kif was removed twice from the RB tree.
Check length of group name before doing the unique check.
The empty group name was allowed and is now invalid.
Reported-by: syzbot+f47e8296ebd559f9bbff@syzkaller.appspotmail.com
OK deraadt@ gnezdo@ anton@ mvs@ claudio@

Revision 1.627 / (download) - annotate - [select for diffs], Mon Feb 8 12:30:10 2021 UTC (3 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.626: +13 -8 lines
Diff to previous 1.626 (colored)

Start refcounting interface groups with 1.  if_creategroup() returns
a new object that is already refcounted, so carp attach does not
reach into internal structures.  Add kasserts to detect counter
overflow or underflow.
OK mvs@

Revision 1.626 / (download) - annotate - [select for diffs], Mon Feb 1 07:43:33 2021 UTC (3 years, 4 months ago) by mvs
Branch: MAIN
Changes since 1.625: +7 -18 lines
Diff to previous 1.625 (colored)

ifunit() was fully replaced by if_unit(9) and should go away.

ok bluhm@ dlg@

Revision 1.625 / (download) - annotate - [select for diffs], Mon Jan 18 09:55:43 2021 UTC (3 years, 4 months ago) by mvs
Branch: MAIN
Changes since 1.624: +53 -18 lines
Diff to previous 1.624 (colored)

Introduce new function if_unit(9). This function returns a pointer the
interface descriptor corresponding to the unique name. This descriptor
is guaranteed to be valid until if_put(9) is called on the returned
pointer. if_unit(9) should replace already existent ifunit() which
returns descriptor not safe for dereference when context was switched.
This allow us to avoid some use-after-free issues in ioctl(2) path.
Also this unifies interface descriptor usage.

ok claudio@ sashan@

Revision 1.624 / (download) - annotate - [select for diffs], Sat Jan 9 14:55:21 2021 UTC (3 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.623: +5 -2 lines
Diff to previous 1.623 (colored)

Syzkaller has found a stack overflow in socket splicing.  Broadcast
packets were resent through simplex broadcast delivery and socket
splicing.  Although there is an M_LOOP check in somove(9), it did
not take effect.  if_input_local() cleared the M_BCAST and M_MCAST
flags with m_resethdr().
As if_input_local() is used for broadcast and multicast delivery,
it was a mistake to delete them.  Keep the M_BCAST and M_MCAST mbuf
flags when packets are reinjected into the network stack.
Reported-by: syzbot+a43ace363f1b663238f8@syzkaller.appspotmail.com
OK anton@; discussed with claudio@

Revision 1.623 / (download) - annotate - [select for diffs], Mon Jan 4 21:21:41 2021 UTC (3 years, 5 months ago) by kn
Branch: MAIN
Changes since 1.622: +1 -7 lines
Diff to previous 1.622 (colored)

Process pppoe(4) packets directly, do not queue through netis

Less scheduling, lock contention and queues.

Previously, if_netisr() handled the net lock around those calls, now
if_input_process() does it before calling ether_input(), so no need to add
or remove NET_*LOCK() anywhere.

OK mvs claudio

Revision 1.622 / (download) - annotate - [select for diffs], Mon Jan 4 13:56:45 2021 UTC (3 years, 5 months ago) by kn
Branch: MAIN
Changes since 1.621: +1 -3 lines
Diff to previous 1.621 (colored)

Remove kernel lock from pppoe(4) input path

"struct pppoe_softc" documents no member being protected by the kernel lock
(alone);  further review of the code paths starting from pppoeintr() shows
no sleeping points which must be avoided in the softnet thread.

Everything is fine as is to run without the big lock, so remove it.

Tests sthen
Feedback mpi mvs
OK mvs claudio

Revision 1.621 / (download) - annotate - [select for diffs], Tue Dec 15 03:43:34 2020 UTC (3 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.620: +3 -1 lines
Diff to previous 1.620 (colored)

clear M_TIMESTAMP in if_enqueue.

this is to avoid a timestamp being used on the way out of the stack
(eg, in bpf), or if it reenters the stack (eg, if it goes between
rdomains with pair(4)).

Revision 1.620 / (download) - annotate - [select for diffs], Sat Oct 3 00:23:55 2020 UTC (3 years, 8 months ago) by mvs
Branch: MAIN
Changes since 1.619: +20 -5 lines
Diff to previous 1.619 (colored)

Introduce `if_cloners_lock' rwlock and use it to serialize
if_clone_{create,destroy}(). This fixes the races described below.

if_clone_{create,destroy}() are kernel locked, but since they touch
various sleep points introduced by rwlocks and M_WAITOK allocations,
without serialization they can intersect due to race condition.

The avoided races are:

1. While performing if_clone_create(), concurrent thread which performing
    if_clone_create() can attach `ifp' with the same `if_xname' and made
    inconsistent `if_list' where all attached interfaces linked.
2. While performing if_clone_create(), concurrent thread which performing
    if_clone_destroy() can kill this incomplete `ifp'.
3. While performing if_clone_destroy(), concurrent thread which performing
    if_clone_destroy() can kill this dying `ifp'.


ok claudio@ kn@ mpi@ sashan@

Revision 1.619 / (download) - annotate - [select for diffs], Wed Aug 19 11:23:59 2020 UTC (3 years, 9 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.618: +1 -3 lines
Diff to previous 1.618 (colored)

Allow SIOCSWGDPID and SIOCSWGMAXFLOW ioctls for non-root

ifconfig(8) detects switch(4) through its unique SIOCSWGDPID ioctl(2) and
further does another switch specific ioctl for the default output regardless
of configuration and/or members.

But since these two ioctls are limited to root, running ifconfig as
unprivileged user makes switch interfaces partially appear as bridge devices
because the detection fails, e.g. STP parameters are shown instead of
datapath id and flow parameters.

ifioctl() limits a list of set/write ioctls to root, but these two read-only
ioctls seem to have been listed by mistake, so remove them to omit the root
check and fix "ifconfig switch" output for unprivileged users.

Feedback from dlg

Revision 1.618 / (download) - annotate - [select for diffs], Wed Aug 5 11:07:34 2020 UTC (3 years, 10 months ago) by mvs
Branch: MAIN
Changes since 1.617: +3 -6 lines
Diff to previous 1.617 (colored)

Revert r1.614 of net/if.c. Modifications of `ifnet' list must still be
done under both the KERNEL_LOCK() and NET_LOCK().

Revision 1.617 / (download) - annotate - [select for diffs], Tue Aug 4 09:32:05 2020 UTC (3 years, 10 months ago) by mvs
Branch: MAIN
Changes since 1.616: +1 -8 lines
Diff to previous 1.616 (colored)

We have `pipexinq' and `pipexoutq' mbuf(9) queues to store pipex(4)
related mbufs. Each mbuf(9) passed to these queues stores the pointer to
corresponding pipex(4) session referenced as `m_pkthdr.ph_cookie'. When
session was destroyed its reference can still be in these queues so we
have use after free issue while pipexintr() dereference it.

I removed `pipexinq', `pipexoutq' and pipexintr(). This not only allows
us to avoid issue described above, but also removes unnecessary context
switch in packet processing. Also it makes code simpler.

ok mpi@ yasuoka@

Revision 1.616 / (download) - annotate - [select for diffs], Fri Jul 24 18:17:14 2020 UTC (3 years, 10 months ago) by mvs
Branch: MAIN
Changes since 1.615: +4 -3 lines
Diff to previous 1.615 (colored)

Use interface index instead of pointer to `ifnet' in carp(4).

ok sashan@

Revision 1.615 / (download) - annotate - [select for diffs], Wed Jul 22 02:16:01 2020 UTC (3 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.614: +3 -108 lines
Diff to previous 1.614 (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.614 / (download) - annotate - [select for diffs], Mon Jul 20 13:55:32 2020 UTC (3 years, 10 months ago) by mvs
Branch: MAIN
Changes since 1.613: +6 -3 lines
Diff to previous 1.613 (colored)

Move insertions to `if_list' out of NET_LOCK() because KERNEL_LOCK()
protects this list. Also corresponding assertion added to be sure the
required lock was held.

This is the step to clean locking mess around `if_list'.

Also we are going to protect `if_list' by it's own lock and this will
allow us to avoid lock order issues in future.

ok dlg@

Revision 1.613 / (download) - annotate - [select for diffs], Fri Jul 17 08:56:41 2020 UTC (3 years, 10 months ago) by mvs
Branch: MAIN
Changes since 1.612: +4 -4 lines
Diff to previous 1.612 (colored)

Check destruction ability before search instance of clone interface.

ok mpi@

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

Change users of IFQ_PURGE() to use the "new" API.

ok dlg@ tobhe@

Revision 1.611 / (download) - annotate - [select for diffs], Tue Jun 30 09:31:38 2020 UTC (3 years, 11 months ago) by kn
Branch: MAIN
Changes since 1.610: +2 -2 lines
Diff to previous 1.610 (colored)

Add size to free(9) call

Size taken from if_creategroup();
OK mvs

Revision 1.610 / (download) - annotate - [select for diffs], Mon Jun 22 09:45:13 2020 UTC (3 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.609: +1 -8 lines
Diff to previous 1.609 (colored)

The interface if_ioctl routine must be called with the NET_LOCK() held.
For example the bridge_ioctl() function calls NET_UNLOCK() unconditionally
and so calling if_ioctl() without netlock will trigger an assert because
of not holding the netlock. Make sure the ioctl handlers are called with
the netlock held and drop the lock for the wg(4) specific ioctls in the
wg_ioctl handler. This fixes a panic in bridge_ioctl() triggered by
ifconfig(8) issuing a SIOCGWG ioctl against bridge(4).
This is just a workaround this needs more cleanup but at least this way
the panic can not be triggered anymore.
OK stsp@, tested by semarie@

Revision 1.609 / (download) - annotate - [select for diffs], Mon Jun 22 03:07:57 2020 UTC (3 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.608: +2 -38 lines
Diff to previous 1.608 (colored)

deprecate network livelock detection using the softclock.

livelock detection used to rely on code running at softnet blocking
the softclock handling at a lower interrupt priority level. if the
hard clock interrupt count diverged from one kept by a timeout, we
assumed the network stack was doing too much work and we should
apply backpressure to the receptions of packets.

the network stack doesnt really block timeouts from firing anymore
though. this is especially true on MP systems, because timeouts
fire on cpu0 and the nettq thread could be somewhere else entirely.
this means network activity doesn't make the softclock lose ticks,
which means we aren't scaling rx ring activity like we think we
are.

the alternative way to detect livelock is when a driver queues
packets for the stack to process, if there's too many packets built
up then the input routine return value tells the driver to slow
down. this enables finer grained livelock detection too. the rx
ring accounting is done per rx ring, and each rx ring is tied to a
specific nettq. if one of them is going too fast it shouldn't affect
the others. the tick based detection was done system wide and
punished all the drivers.

ive converted all the drivers to the new mechanism. let's see how
we go with it.

jmatthew@ confirms rings still shrink, so some backpressure is being
applied.

Revision 1.608 / (download) - annotate - [select for diffs], Sun Jun 21 12:11:26 2020 UTC (3 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.607: +9 -1 lines
Diff to previous 1.607 (colored)

add wg(4), an in kernel driver for WireGuard vpn communication.

thanks to Matt Dunwoodie and Jason A. Donenfeld for their effort.
it's at least as functional as the go implementation, and maybe
more so since this one works on more architectures.

i'm sure there's further development that can be done, but you can
say that about anything and everything that's in the tree.

ok deraadt@

Revision 1.607 / (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.606: +3 -3 lines
Diff to previous 1.606 (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.606 / (download) - annotate - [select for diffs], Fri May 29 04:42:25 2020 UTC (4 years ago) by deraadt
Branch: MAIN
Changes since 1.605: +1 -3 lines
Diff to previous 1.605 (colored)

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps).  it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.

Revision 1.605 / (download) - annotate - [select for diffs], Wed May 27 11:19:28 2020 UTC (4 years ago) by mpi
Branch: MAIN
Changes since 1.604: +12 -12 lines
Diff to previous 1.604 (colored)

Document the various flavors of NET_LOCK() and rename the reader version.

Since our last concurrency mistake only ioctl(2) ans sysctl(2) code path
take the reader lock.  This is mostly for documentation purpose as long as
the softnet thread is converted back to use a read lock.

dlg@ said that comments should be good enough.

ok sashan@

Revision 1.604 / (download) - annotate - [select for diffs], Tue May 26 14:58:55 2020 UTC (4 years ago) by visa
Branch: MAIN
Changes since 1.603: +3 -2 lines
Diff to previous 1.603 (colored)

Extract more randomness from mbuf flow

Input bits of the mbuf list head to enqueue_randomness(). While the set
of mbufs in circulation is relatively stable, the order in which they
reach if_input_process() is unpredictable. Shuffling can happen in many
subsystems, such as the network stack, device drivers, and memory
management.

OK deraadt@ mpi@

Revision 1.603 / (download) - annotate - [select for diffs], Sun Apr 12 07:04:03 2020 UTC (4 years, 1 month ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.602: +3 -1 lines
Diff to previous 1.602 (colored)

make ifpromisc assert that the caller is holding the NET_LOCK.

it needs NET_LOCK because it modifies if_flags and if_pcount.

ok visa@

Revision 1.602 / (download) - annotate - [select for diffs], Sat Apr 11 10:49:27 2020 UTC (4 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.601: +7 -7 lines
Diff to previous 1.601 (colored)

Grab the exclusive NET_LOCK() in the softnet thread.

Prevent a data corruption on a UDP receive socket buffer reported by
procter@ who triggered it with wireguard-go.

The symptoms are underflow of sb_cc/sb_datacc/sb_mcnt.

ok visa@

Revision 1.601 / (download) - annotate - [select for diffs], Tue Mar 10 09:11:55 2020 UTC (4 years, 3 months ago) by tobhe
Branch: MAIN
Changes since 1.600: +4 -5 lines
Diff to previous 1.600 (colored)

Properly exit loop at end of hooks TAILQ.

Feedback from and ok dlg@
ok kn@ todd@

Revision 1.600 / (download) - annotate - [select for diffs], Fri Jan 24 05:14:51 2020 UTC (4 years, 4 months ago) by jsg
Branch: MAIN
Changes since 1.599: +1 -2 lines
Diff to previous 1.599 (colored)

cleanup unused headers generated by config

ok tedu@ krw@ deraadt@

Revision 1.574.2.1 / (download) - annotate - [select for diffs], Thu Nov 14 18:07:26 2019 UTC (4 years, 6 months ago) by bluhm
Branch: OPENBSD_6_5
Changes since 1.574: +52 -5 lines
Diff to previous 1.574 (colored) next main 1.575 (colored)

Only root is allowed to set the WEP key.  Add an suser() check to
enforce this for the an(4) wireless network device.
found by Ilja Van Sprundel; from bluhm@; OK dlg@ deraadt@ mpi@

SIOCDVNETID mutates state, so should only be run by root.
found by Ilja Van Sprundel; from dlg@; OK deraadt@ mpi@ bluhm@

check for privileged bridges ioctls next to the other privileged ioctls.
there's now a bunch of drivers that implement the bridge ioctls,
but they're inconsistent at checking privilege. doing it up front
once means less code duplication, and more consistent application
of the checks.
found by Ilja Van Sprundel; from dlg@; OK bluhm@ deraadt@

unbreak ramdisks
from deraadt@

Non root user must not use ioctl(2) to mess around with the address
of a network interface.
from bluhm@; OK deraadt@ claudio@

Non root users must not set the parameters of pppoe(4) interfaces.
found by Ilja Van Sprundel; from bluhm@; OK deraadt@ dlg@

OpenBSD 6.5 errata 017

Revision 1.588.2.1 / (download) - annotate - [select for diffs], Thu Nov 14 18:06:29 2019 UTC (4 years, 6 months ago) by bluhm
Branch: OPENBSD_6_6
Changes since 1.588: +52 -5 lines
Diff to previous 1.588 (colored) next main 1.589 (colored)

Only root is allowed to set the WEP key.  Add an suser() check to
enforce this for the an(4) wireless network device.
found by Ilja Van Sprundel; from bluhm@; OK dlg@ deraadt@ mpi@

SIOCDVNETID mutates state, so should only be run by root.
found by Ilja Van Sprundel; from dlg@; OK deraadt@ mpi@ bluhm@

check for privileged bridges ioctls next to the other privileged ioctls.
there's now a bunch of drivers that implement the bridge ioctls,
but they're inconsistent at checking privilege. doing it up front
once means less code duplication, and more consistent application
of the checks.
found by Ilja Van Sprundel; from dlg@; OK bluhm@ deraadt@

unbreak ramdisks
from deraadt@

Non root user must not use ioctl(2) to mess around with the address
of a network interface.
from bluhm@; OK deraadt@ claudio@

Non root users must not set the parameters of pppoe(4) interfaces.
found by Ilja Van Sprundel; from bluhm@; OK deraadt@ dlg@

OpenBSD 6.6 errata 006

Revision 1.599 / (download) - annotate - [select for diffs], Thu Nov 14 01:02:02 2019 UTC (4 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.598: +5 -5 lines
Diff to previous 1.598 (colored)

avoid a use after free in if_delgroup.

if_detach passes the groupname from an ifg_list struct to if_delgroup,
if_delgroup then uses the name to find the same ifg_list struct so
it can free it, and then passes the name from the struct to
pfi_group_change(). at worst this can cause a fault if malloc(9)
actually unmaps the page the struct was on, and at best it causes
pf interfaces with garbage names to be created.

ok sashan@ bluhm@

Revision 1.598 / (download) - annotate - [select for diffs], Wed Nov 13 21:25:04 2019 UTC (4 years, 6 months ago) by bluhm
Branch: MAIN
Changes since 1.597: +24 -5 lines
Diff to previous 1.597 (colored)

Non root user must not use ioctl(2) to mess around with the address
of a network interface.
OK deraadt@ claudio@

Revision 1.597 / (download) - annotate - [select for diffs], Wed Nov 13 01:36:27 2019 UTC (4 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.596: +3 -1 lines
Diff to previous 1.596 (colored)

unbreak ramdisks

Revision 1.596 / (download) - annotate - [select for diffs], Tue Nov 12 23:27:15 2019 UTC (4 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.595: +26 -1 lines
Diff to previous 1.595 (colored)

check for privileged bridges ioctls next to the other privileged ioctls.

there's now a bunch of drivers that implement the bridge ioctls,
but they're inconsistent at checking privilege. doing it up front
once means less code duplication, and more consistent application
of the checks.

ok bluhm@ deraadt@

Revision 1.595 / (download) - annotate - [select for diffs], Tue Nov 12 01:00:58 2019 UTC (4 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.594: +2 -1 lines
Diff to previous 1.594 (colored)

SIOCDVNETID mutates state, so should only be run by root.

found by Ilja Van Sprundel
ok deraadt@ mpi@ bluhm@

Revision 1.594 / (download) - annotate - [select for diffs], Mon Nov 11 05:20:54 2019 UTC (4 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.593: +2 -2 lines
Diff to previous 1.593 (colored)

add linkstate hooks at the head of the tailq.

when vxlans parent interface has a link state change event, vxlan
reconfigures the parent to cope with things not being as it expects
when the interface comes back. it does this by removing its config
and then adding it again. part of it's config removal is to take
the link state hook away, and part of putting the config on is is
adding the link state hook.

if we're running an interfaces link state hooks from head to tail,
and the vxlan hook adds itself back to the tail, we end up running
the vxlan hook forever cos it always ends up at the tail.

bluhm@ hit this infinite loop while running regress tests. if turns
out we need to run link state hooks in the same order they were
added, i have a way to avoid this situation, but this is simple.

Revision 1.593 / (download) - annotate - [select for diffs], Sat Nov 9 09:45:25 2019 UTC (4 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.592: +6 -6 lines
Diff to previous 1.592 (colored)

whitespace fixes, no functional change.

Revision 1.592 / (download) - annotate - [select for diffs], Fri Nov 8 07:16:29 2019 UTC (4 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.591: +33 -14 lines
Diff to previous 1.591 (colored)

convert interface address change hooks to tasks and a task_list.

this follows what's been done for detach and link state hooks, and
makes handling of hooks generally more robust.

address hooks are a bit different to detach/link state hooks in
that there's only a few things that register hooks (carp, pf, vxlan),
but a lot of places to run the hooks (lots of ipv4 and ipv6 address
configuration).

an address hook cookie was in struct pfi_kif, which is part of the
pf abi. rather than break pfctl -sI, this maintains the void * used
for the cookie and uses it to store a task, which is then used as
intended with the new api.

Revision 1.591 / (download) - annotate - [select for diffs], Thu Nov 7 08:03:18 2019 UTC (4 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.590: +46 -13 lines
Diff to previous 1.590 (colored)

serialise hook adds and dels with a mutex instead of an implicit NET_LOCK.

i had NET_ASSERT_LOCKED() in the hook add and remove operations,
because that's what's held when the hooks are run. some callers do
not hold the NET_LOCK when calling them though, eg, bridge(4). aggr
and tpmr used to not hold NET_LOCK while being destroyed, which
also caused the asserts to fire, so i moved the port destroys inside
NET_LOCK, but now I have deadlocks with some barrier calls.

the hooks having their own lock means callers don't have to hold
NET_LOCK and the list will stay sane. the code that runs the hooks
gives up the mutex when calling the hook, but keeps track of where
it's up to bey putting a cursor in the list.

there's a single global mutex for all the interface linkstate and
detach hooks, but this stuff isn't a hot path by any stretch of the
imagination.

based on (a lot of) testing by hrvoje popovski. thank you.

Revision 1.590 / (download) - annotate - [select for diffs], Thu Nov 7 07:36:31 2019 UTC (4 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.589: +23 -8 lines
Diff to previous 1.589 (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.589 / (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.588: +23 -7 lines
Diff to previous 1.588 (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.588 / (download) - annotate - [select for diffs], Wed Aug 21 15:32:18 2019 UTC (4 years, 9 months ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE
Branch point for: OPENBSD_6_6
Changes since 1.587: +3 -7 lines
Diff to previous 1.587 (colored)

    Remove support for semantically opace interface identifiers (RFC 7217)
    for IPv6 link local addresses.

    Some hosting and VM providers route customer IPv6 prefixes to link
    local addresses derived from ethernet MAC addresses (RFC 2464). This
    leads to hard to debug IPv6 connectivity problems and is probably not
    worth the effort.

    RFC 7721 lists 4 weaknesses:

    3.1. Correlation of Activities over Time & 3.2. Location Tracking
    These are still possible with RFC 7217 addresses for an adversary
    connected to the same layer 2 network (think conference wifi). Since
    the link local prefix stays the same (fe80::/64) the link local
    addresses do not change between different networks.
    An adversary on the same layer 2 network can probably track ethernet
    MAC addresses via different means, too.

    3.3. Address Scanning & 3.4. Device-Specific Vulnerability Exploitation
    These now become possible, however, as noted above a layer 2 adversary
    was probably able to do this via different means.

    People concerned with these weaknesses are advised to use
    ifconfig lladdr random.
OK benno
input & OK kn

Revision 1.587 / (download) - annotate - [select for diffs], Tue Aug 6 22:57:54 2019 UTC (4 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.586: +1 -7 lines
Diff to previous 1.586 (colored)

When we needed the kernel lock for local IP packet delivery, mpi@
introduced a queue to grab the lock for multiple packets.  Now we
have only netlock for both IP and protocol input.  So the queue is
not necessary anymore.  It just switches CPU and decreases performance.
So remove the inet and inet6 ip queue for local packets.
To get TCP running on loopback, we have to queue once between TCP
input and output of the two sockets.  So use the loopback queue in
looutput() unconditionally.
OK visa@

Revision 1.586 / (download) - annotate - [select for diffs], Sun Jun 30 23:02:28 2019 UTC (4 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.585: +2 -2 lines
Diff to previous 1.585 (colored)

if_vinput should pass BPF_DIRECTION_IN to bpf_mtap, not OUT

Revision 1.585 / (download) - annotate - [select for diffs], Sat Jun 15 17:05:21 2019 UTC (4 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.584: +9 -7 lines
Diff to previous 1.584 (colored)

Free sizes for hooks and `if_sadl'.

ok kn@

Revision 1.584 / (download) - annotate - [select for diffs], Tue Jun 4 23:06:34 2019 UTC (5 years ago) by sashan
Branch: MAIN
Changes since 1.583: +5 -5 lines
Diff to previous 1.583 (colored)

if_netisr(): trade NET_LOCK() for NET_RLOCK()

OK mpi@

Revision 1.583 / (download) - annotate - [select for diffs], Sun May 12 16:38:02 2019 UTC (5 years, 1 month ago) by sashan
Branch: MAIN
Changes since 1.582: +10 -18 lines
Diff to previous 1.582 (colored)

pushing NET_LOCK() further down from if_clone_{create,destroy}()

OK mpi@

Revision 1.582 / (download) - annotate - [select for diffs], Sat May 11 23:36:40 2019 UTC (5 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.581: +2 -2 lines
Diff to previous 1.581 (colored)

Correct a check in if_isconnected().

Fix a regression introduced by the bridge(4) refactoring.

Found by and ok bluhm@

Revision 1.581 / (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.580: +4 -6 lines
Diff to previous 1.580 (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.580 / (download) - annotate - [select for diffs], Mon Apr 22 03:26:16 2019 UTC (5 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.579: +27 -1 lines
Diff to previous 1.579 (colored)

add if_vinput so pseudo (ethernet) interfaces can bypass ifiqs

if_vinput assumes that the interface that its called against uses
per cpu counters so it can count input packets, but basically does
all the things that if_input and ifiq_input do. the main difference
is it assumes the network stack is already running and runs the
interface input handlers directly. this is instead of queuing the
packets for a nettq to run.

ifiqs arent free, especially when they only run per packet like
they do on psuedo interfaces. this allows that overhead to be
bypassed.

Revision 1.579 / (download) - annotate - [select for diffs], Mon Apr 22 02:53:40 2019 UTC (5 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.578: +23 -17 lines
Diff to previous 1.578 (colored)

factor out calling the if input handlers for a packet.

this is a step toward letting interfaces like vlan bypass ifiqs

Revision 1.578 / (download) - annotate - [select for diffs], Fri Apr 19 07:38:02 2019 UTC (5 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.577: +65 -1 lines
Diff to previous 1.577 (colored)

provide factored out txhprio and rxhprio checks

l2 and l3 drivers do the same thing all the time, so reduce the
chance of error by doing the checks once and making it available
for drivers to call instead of rolling on their own again.

Revision 1.577 / (download) - annotate - [select for diffs], Fri Apr 19 04:22:09 2019 UTC (5 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.576: +2 -1 lines
Diff to previous 1.576 (colored)

only root can change rxprio

Revision 1.576 / (download) - annotate - [select for diffs], Tue Apr 16 04:04:19 2019 UTC (5 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.575: +3 -1 lines
Diff to previous 1.575 (colored)

have another go at tx mitigation

the idea is to call the hardware transmit routine less since in a
lot of cases posting a producer ring update to the chip is (very)
expensive. it's better to do it for several packets instead of each
packet, hence calling this tx mitigation.

this diff defers the call to the transmit routine to a network
taskq, or until a backlog of packets has built up. dragonflybsd
uses 16 as the size of it's backlog, so i'm copying them for now.

i've tried this before, but previous versions caused deadlocks. i
discovered that the deadlocks in the previous version was from
ifq_barrier calling taskq_barrier against the nettq. interfaces
generally hold NET_LOCK while calling ifq_barrier, but the tq might
already be waiting for the lock we hold.

this version just doesnt have ifq_barrier call taskq_barrier. it
instead relies on the IFF_RUNNING flag and normal ifq serialiser
barrier to guarantee the start routine wont be called when an
interface is going down. the taskq_barrier is only used during
interface destruction to make sure the task struct wont get used
in the future, which is already done without the NET_LOCK being
held.

tx mitigation provides a nice performanace bump in some setups. up
to 25% in some cases.

tested by tb@ and hrvoje popovski (who's running this in production).
ok visa@

Revision 1.575 / (download) - annotate - [select for diffs], Sun Apr 14 06:57:00 2019 UTC (5 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.574: +1 -4 lines
Diff to previous 1.574 (colored)

don't take splnet when running the network stack

the stack uses the NET_LOCK for most protection now, so it doesnt
need to block actual hardware interrupts. blocking hw interrupts
can cause huge latency spikes, which in turn works against the rx
ring moderation.

im putting this in early in the release cycle so it can get the
most testing possible.

ok mpi@ (a while back)

Revision 1.574 / (download) - annotate - [select for diffs], Wed Apr 10 09:51:35 2019 UTC (5 years, 2 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE
Branch point for: OPENBSD_6_5
Changes since 1.573: +32 -1 lines
Diff to previous 1.573 (colored)

do custom checks for SIOCGIFSFFPAGE.

this should only be used by root, and it should not tak the NET_LOCK
because a bunch of i2c reads can take a relatively long time during
which packets would be blocked.

while here make sure userland only requests pages from the eeprom
and diag i2c addresses.

ok deraadt@

Revision 1.573 / (download) - annotate - [select for diffs], Fri Mar 1 04:47:32 2019 UTC (5 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.572: +2 -2 lines
Diff to previous 1.572 (colored)

rework how ifiq_input decides the stack is busy and whether it should drop

previously ifiq_input uses the traditional backpressure or defense
mechanism and counts packets to decide when to shed load by dropping.
currently it ends up waiting for 10240 packets to get queued on the
stack before it would decide to drop packets. this may be ok for
some machines, but for a lot this was too much.

this diff reworks how ifiqs measure how busy the stack is by
introducing an ifiq_pressure counter that is incremented when
ifiq_input is called, and cleared when ifiq_process calls the network
stack to process the queue. if ifiq_input is called multiple times
before ifiq_process in a net taskq runs, ifiq_pressure goes up, and
ifiq_input uses a high value to decide the stack is busy and it
should drop.

i was hoping there would be no performance impact from this change,
but hrvoje popovski notes a slight bump in forwarding performance.
my own testing shows that the ifiq input list length grows to a
fraction of the 10240 it used to get to, which means the maximum
burst of packets through the stack is smoothed out a bit. instead
of big lists of packets followed by big periods of drops, we get
relatively small bursts of packets with smaller gaps where we drop.

the follow-on from this is to make drivers implementing rx ring
moderation to use the return value of ifiq_input to scale the ring
allocation down, allowing the hardware to drop packets so software
doesnt have to.

Revision 1.572 / (download) - annotate - [select for diffs], Tue Feb 26 03:20:08 2019 UTC (5 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.571: +8 -1 lines
Diff to previous 1.571 (colored)

check for root on mpls and pwe3 ioctls

part of a larger diff ok mpi@

Revision 1.571 / (download) - annotate - [select for diffs], Wed Jan 9 01:14:21 2019 UTC (5 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.570: +25 -11 lines
Diff to previous 1.570 (colored)

split if_enqueue up so drivers can replace ifq handling if needed

if_enqueue() still makes sure packets get handled by pf on the way
out, and seen by bridge if needed. however instead of falling through
to ifq mapping and output, it now calls a function pointer in the
ifnet struct. that pointer defaults to the ifq handling, but drivers
can override it to bypass ifq processing.

the most obvious users of the function pointer will be virtual
interfaces, eg, vlan(4). ifqs are good if you need to serialise
access to the thing that transmits packets (like hardware rings on
nics), or mitigate the number of times you do ring processing, but
neither of those things are desirable on vlan interfaces. ideally
vlan could transmit on any cpu without having packets serialised
by it's own ifq before being pushed down to an arbitrary number of
rings on the parent interface. bypassing ifqs means the driver can
push the vlan tag on concurrently and push down to the parent frmo
any cpu.

ok mpi@
no objection from claudio@

Revision 1.570 / (download) - annotate - [select for diffs], Thu Dec 20 10:26:36 2018 UTC (5 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.569: +2 -2 lines
Diff to previous 1.569 (colored)

Make this not hz dependent by using timeout_add_sec() also rename the
define to IFNET_SLOWTIMO since it is no longer a hz divisor.
OK visa@ bluhm@ kn@

Revision 1.569 / (download) - annotate - [select for diffs], Tue Dec 11 22:08:57 2018 UTC (5 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.568: +41 -1 lines
Diff to previous 1.568 (colored)

add optional per-cpu counters for interface stats.

these exist so interfaces that want to do mpsafe work outside the
ifq machinery have a place to allocate and update stats in. the
generic ioctl handling for getting stats to userland knows how to
roll the new per cpu stats into the rest before export.

ok visa@

Revision 1.568 / (download) - annotate - [select for diffs], Thu Nov 29 00:11:49 2018 UTC (5 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.567: +2 -1 lines
Diff to previous 1.567 (colored)

restrict setting ecn to root

ok claudio@

Revision 1.567 / (download) - annotate - [select for diffs], Mon Nov 12 23:41:22 2018 UTC (5 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.566: +2 -1 lines
Diff to previous 1.566 (colored)

only let root configure the txprio setting on an interface

ok claudio@

Revision 1.566 / (download) - annotate - [select for diffs], Mon Oct 1 12:38:32 2018 UTC (5 years, 8 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.565: +7 -3 lines
Diff to previous 1.565 (colored)

Put bridge_input & output back under the KERNEL_LOCK().

Wireless drivers call if_enqueue() out of the NET_LOCK() so it cannot
be used to serialize bridge(4) states.

Found by stsp@, ok visa@

Revision 1.565 / (download) - annotate - [select for diffs], Wed Sep 26 11:50:42 2018 UTC (5 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.564: +4 -11 lines
Diff to previous 1.564 (colored)

Move bridge input/output paths outside of the KERNEL_LOCK().

Tested by Hrvoje Popovski who measured a 30% improvement of forwarded
packets in the best case.

ok visa@

Revision 1.564 / (download) - annotate - [select for diffs], Tue Sep 11 10:23:40 2018 UTC (5 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.563: +2 -2 lines
Diff to previous 1.563 (colored)

Nuke some trailing spaces that wandered into the
crosshairs.

Revision 1.563 / (download) - annotate - [select for diffs], Mon Sep 10 16:18:34 2018 UTC (5 years, 9 months ago) by sashan
Branch: MAIN
Changes since 1.562: +10 -24 lines
Diff to previous 1.562 (colored)

- if_cloners list populated at boot time only then becomes immutable,
  so we can let go if_cloners_lock.

OK tb@, claudio@, bluhm@, kn@, henning@

Revision 1.562 / (download) - annotate - [select for diffs], Mon Sep 10 16:07:20 2018 UTC (5 years, 9 months ago) by henning
Branch: MAIN
Changes since 1.561: +35 -32 lines
Diff to previous 1.561 (colored)

if_setrdomain could potentially call if_clone_create recursively in the create
rdomain case leading to locking issues and lots of headscratching. turns out
the only case where if_setrdomain could actually create an rdomain and thus
end up with that pattern is the ioctl path.
make if_setrdomain never create an rdomain, return error if it doesn't exist
already, introduce if_createrdomain, and adjust the ioctl path to use it.
ok sashan bluhm claudio

Revision 1.561 / (download) - annotate - [select for diffs], Sun Sep 9 10:09:06 2018 UTC (5 years, 9 months ago) by henning
Branch: MAIN
Changes since 1.560: +13 -12 lines
Diff to previous 1.560 (colored)

if_setrdomain: allow empty rtables to be turned into rdomains, not just
nonexistant ones as before. nasty error handling with bluhm, feedback mpi as
well. ok bluhm

Revision 1.560 / (download) - annotate - [select for diffs], Sat Sep 8 01:03:59 2018 UTC (5 years, 9 months ago) by yasuoka
Branch: MAIN
Changes since 1.559: +3 -2 lines
Diff to previous 1.559 (colored)

Don't cause an error when setting the same rdomain.
Found by asou at soum.co.jp.

ok claudio mpi akoshibe benno

Revision 1.559 / (download) - annotate - [select for diffs], Thu Aug 9 03:35:19 2018 UTC (5 years, 10 months ago) by akoshibe
Branch: MAIN
Changes since 1.558: +5 -5 lines
Diff to previous 1.558 (colored)

Currently, attempting to move an immovable lo(4) to a new rdomain will fail
with an EPERM, but the target rdomain will still be created.

Move the check for an lo(4)'s if_index/if_rdomain to before the creation of a
nonexisting target routing table.

ok benno@ claudio@ mpi@

Revision 1.558 / (download) - annotate - [select for diffs], Wed Jul 11 09:08:21 2018 UTC (5 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.557: +1 -1 lines
Diff to previous 1.557 (colored)

in if_addgroup(), call the new pfi_group_addmember() instead of
pf_group_change() - the latter is called by _addmemeber now to update dynaddr.
before this, "set skip on lo", ifconfig lo1 create -> no skip on lo1 until
pf rueset got reloaded. Now lo1 gets the skip flag as intended. This has
caused much confusion with i. e. gif interfaces in the past.
ok benno, very excited ok phessler

Revision 1.557 / (download) - annotate - [select for diffs], Tue Jul 10 09:30:13 2018 UTC (5 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.556: +5 -0 lines
Diff to previous 1.556 (colored)

if_enqueue: call pf_delay_pkt() if m_pkthdr.pf.delay is set
ok benno sashan

Revision 1.556 / (download) - annotate - [select for diffs], Thu Jun 21 07:40:43 2018 UTC (5 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.555: +11 -5 lines
Diff to previous 1.555 (colored)

Grab the KERNEL_LOCK() rather than asserting that it is held.

Prevent a panic now that some syscall are running unlocked.

Found the hardway by Gregor Best.

Revision 1.555 / (download) - annotate - [select for diffs], Mon Jun 18 12:13:10 2018 UTC (5 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.554: +5 -3 lines
Diff to previous 1.554 (colored)

Do not allow to change the rdomain of the default loopback interface.

Routing domain must always have an existing lo(4).

Problem reported and fix tested by multiplexd at gmx.com.

Revision 1.554 / (download) - annotate - [select for diffs], Wed May 30 22:20:41 2018 UTC (6 years ago) by dlg
Branch: MAIN
Changes since 1.553: +3 -2 lines
Diff to previous 1.553 (colored)

restrict the prio values from SIOCSIFLLPRIO to what the kernel handles

previously the ioctl code checked that prio was an int less than
UCHAR_MAX, but the rest of the kernel (and priq code in particular)
expects it to be between 0 and 7 inclusive.

ok krw@ tb@

Revision 1.553 / (download) - annotate - [select for diffs], Wed May 30 18:15:47 2018 UTC (6 years ago) by sthen
Branch: MAIN
Changes since 1.552: +43 -1 lines
Diff to previous 1.552 (colored)

Add SIOCGIFGLIST to fetch a list of interface groups on the system.
From Jan Klemkow, ok mpi@ tb@, ok/bugfix bluhm@

Revision 1.552 / (download) - annotate - [select for diffs], Thu May 17 11:04:14 2018 UTC (6 years ago) by tb
Branch: MAIN
Changes since 1.551: +18 -7 lines
Diff to previous 1.551 (colored)

Move the handling of SIOCIFGCLONERS out of the NET_RLOCK(). The global
&if_clone list and the if_cloners_count are currently protected by the
KERNEL_LOCK(). Introduce the ifclonerslk rwlock to serialize access to
these two globals as a small step towards removing the KERNEL_LOCK() from
the ioctl path. While there, separate the two codepaths in if_clone_list()
more clearly and replace a ternary operator with MIN().

guidance & ok mpi, ok visa

Revision 1.551 / (download) - annotate - [select for diffs], Sat Apr 28 15:44:59 2018 UTC (6 years, 1 month ago) by jasper
Branch: MAIN
Changes since 1.550: +2 -2 lines
Diff to previous 1.550 (colored)

replace add_*_randomness with enqueue_randomness()

this gets rid of the source annotation which doesn't really add
anything other than adding complexitiy. randomess is generally
good enough that the few extra bits that the source type would
add are not worth it.

ok mikeb@ deraadt@

Revision 1.550 / (download) - annotate - [select for diffs], Tue Apr 24 15:40:55 2018 UTC (6 years, 1 month ago) by pirofti
Branch: MAIN
Changes since 1.549: +5 -4 lines
Diff to previous 1.549 (colored)

Push NET_LOCK down in the default ifioctl case.

For the PRU_CONTROL bit the NET_LOCK surrounds in[6]_control() and
on the ENOTSUPP case we guard the driver if_ioctl functions.

OK mpi@

Revision 1.549 / (download) - annotate - [select for diffs], Tue Mar 20 08:58:19 2018 UTC (6 years, 2 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.548: +5 -4 lines
Diff to previous 1.548 (colored)

Call bpfdetach() without holding the NET_LOCK().

Prevents a rwlock recursion found by stsp@.

ok stsp@, deraadt@, visa@

Revision 1.548 / (download) - annotate - [select for diffs], Fri Mar 2 15:52:11 2018 UTC (6 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.547: +2 -4 lines
Diff to previous 1.547 (colored)

Revert all the bits of the autocreate 127.0.0.1 on lo(4) creation for now.
This needs to go back to the drawing board.

Revision 1.547 / (download) - annotate - [select for diffs], Tue Feb 20 03:46:45 2018 UTC (6 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.546: +2 -1 lines
Diff to previous 1.546 (colored)

only allow root to use SIOCSVNETFLOWID.

Revision 1.546 / (download) - annotate - [select for diffs], Mon Feb 19 08:59:52 2018 UTC (6 years, 3 months ago) by mpi
Branch: MAIN
Changes since 1.545: +18 -18 lines
Diff to previous 1.545 (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.545 / (download) - annotate - [select for diffs], Mon Feb 19 00:24:48 2018 UTC (6 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.544: +2 -1 lines
Diff to previous 1.544 (colored)

make sure only root can configure an interface with SIOCSLIFPHYDF.

Revision 1.544 / (download) - annotate - [select for diffs], Sat Feb 10 09:32:54 2018 UTC (6 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.543: +1 -2 lines
Diff to previous 1.543 (colored)

There is a problem with assigning 127.0.0.1 here. Revert the call
to in_up_loopback(). There is an issue when doing ifconfig lo0 127.0.0.1/8
the system ends up with 2 127.0.0.1 routes which breaks things like smptd.
Found by tb@

Revision 1.543 / (download) - annotate - [select for diffs], Sat Feb 10 05:52:08 2018 UTC (6 years, 4 months ago) by florian
Branch: MAIN
Changes since 1.542: +14 -1 lines
Diff to previous 1.542 (colored)

Implement RFC 7217: "A Method for Generating Semantically Opaque
Interface Identifiers with IPv6 Stateless Address Autoconfiguration."

"An IPv6 address configured using this method is stable within each
subnet, but the corresponding Interface Identifier changes when the
host moves from one network to another. This method is meant to be an
alternative to generating Interface Identifiers based on hardware
addresses."

OK naddy, sthen

Revision 1.542 / (download) - annotate - [select for diffs], Sat Feb 10 05:32:21 2018 UTC (6 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.541: +5 -2 lines
Diff to previous 1.541 (colored)

Similar to the IPv6 case create 127.0.0.1/8 on lo(4) interfaces which act
as loopback interfaces for each rdomain (including lo0). This is done when
the interface is brought up. This is now also done by default (either on
attach of lo0 or when creating the rdomain).
OK mpi@

Revision 1.541 / (download) - annotate - [select for diffs], Fri Feb 9 09:35:03 2018 UTC (6 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.540: +0 -8 lines
Diff to previous 1.540 (colored)

oh carp - i didnt mean to commit these

Revision 1.540 / (download) - annotate - [select for diffs], Fri Feb 9 09:30:37 2018 UTC (6 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.539: +9 -1 lines
Diff to previous 1.539 (colored)

use struct in_addr to represent an address.

Revision 1.539 / (download) - annotate - [select for diffs], Wed Feb 7 22:36:54 2018 UTC (6 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.538: +2 -1 lines
Diff to previous 1.538 (colored)

add SIOCSETKALIVE to the list of ioctls that need root and NET_LOCK

Revision 1.538 / (download) - annotate - [select for diffs], Fri Jan 12 23:47:24 2018 UTC (6 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.537: +1 -6 lines
Diff to previous 1.537 (colored)

have carp use standard detach hooks instead of getting special handling

if_deactivate looked for carp parent interfaces and called carp_ifdetach
to have children interfaces unplug themselves. this diff has the
carp interfaces register detach hooks on the parent instead. the
effect is the same, but using the standard every other interface
uses.

while im here i shuffle the order the hooks carp_set_ifp are
estabilshed so it will fail if they arent allocated.

ok visa@ mpi@

Revision 1.537 / (download) - annotate - [select for diffs], Wed Jan 10 23:50:39 2018 UTC (6 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.536: +2 -2 lines
Diff to previous 1.536 (colored)

get rid of struct carp_if by moving the srpl into struct ifnet if_carp.

currently carp uses a struct carp_if to hold an srp list head, which
is accessed by both if_carp in struct ifnet, and via the if input
handlers list.

this gets rid of some indirection by making if_carp itself the list
head, rather than a pointer to the list head via a struct carp_if.
it also makes accessing the list consistent by only using if_carp
to get to it.

ok mpi@

Revision 1.536 / (download) - annotate - [select for diffs], Tue Jan 9 17:50:57 2018 UTC (6 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.535: +29 -10 lines
Diff to previous 1.535 (colored)

Stop grabing the KERNEL_LOCK() for running protocol input routines.

The NET_LOCK() is already held in this thread and is now enough.

People interested in ARP/bridge(4)/switch(4)/pipex(4)/pppoe(4)
performances can now push the KERNEL_LOCK() without depending on
other subsystems/drivers.

Tested by Hrvoje Popovski.

ok bluhm@, visa@

Revision 1.535 / (download) - annotate - [select for diffs], Tue Jan 9 06:24:14 2018 UTC (6 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.534: +2 -2 lines
Diff to previous 1.534 (colored)

make mpls_input take a struct ifnet *ifp argument.

this makes it like all our other protocol family input functions.

mpls_input always looks up the interface the mbuf was received on,
but it's always called by code that already has a reference to that
interface anyway. the result of this is a few less if_get/if_put
calls.

ok mpi@ bluhm@ visa@ claudio@

Revision 1.534 / (download) - annotate - [select for diffs], Thu Jan 4 10:48:02 2018 UTC (6 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.533: +10 -20 lines
Diff to previous 1.533 (colored)

Include timeout & tasks in 'struct ifnet' instead of always allocating
them as M_TEMP.

ok visa@

Revision 1.533 / (download) - annotate - [select for diffs], Tue Jan 2 12:52:17 2018 UTC (6 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.532: +36 -21 lines
Diff to previous 1.532 (colored)

Move the NET_LOCK() inside the switch and start documenting which field
is protected by which lock.

ok bluhm@, visa@

Revision 1.532 / (download) - annotate - [select for diffs], Fri Dec 29 17:05:25 2017 UTC (6 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.531: +2 -2 lines
Diff to previous 1.531 (colored)

Make the functions which link the pf state keys to mbufs, inpcbs,
or other states more consistent.
OK visa@ sashan@ on a previous version

Revision 1.531 / (download) - annotate - [select for diffs], Fri Dec 15 01:37:30 2017 UTC (6 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.530: +71 -66 lines
Diff to previous 1.530 (colored)

add ifiqueues for mp safety and nics with multiple rx rings.

currently there is a single mbuf_queue per interface, which all
rings on a nic shove packets onto. while the list inside this queue
is protected by a mutex, the counters around it (ie, ipackets,
ibytes, idrops) are not. this means updates can be lost, and reading
the statistics is also inconsistent. having a single queue means
that busy rx rings can dominate and then starve the others.

ifiqueue structs are like ifqueue structs. they provide per ring
queues, and independent counters for each ring. when ifdata is read
for userland, these counters are aggregated. having a queue per
ring now allows for per ring backpressure to be applied. MCLGETI
will have it's day again.

right now we assume every interface wants an input queue and
unconditionally provide one. individual interfaces can opt into
more.

im not completely happy about the shape of this atm, but shuffling
it around more makes the diff bigger.

ok visa@

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

Do not fail if an interface is DOWN when calling ifpromisc().

As soon as the interface will be brough UP, its device driver will
recognize it has the IFF_PROMISC flag and will configure its filters
accordingly.

ok visa@

Revision 1.529 / (download) - annotate - [select for diffs], Fri Nov 17 03:51:32 2017 UTC (6 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.528: +14 -1 lines
Diff to previous 1.528 (colored)

add if_rxr_livelocked so rxr users can request backpressure themselves.

right now the rx ring moderation code makes a decision globally
that a machine is livelocked, and uses that to apply backpressure
on all the rx rings. we're moving toward having the network stack
run on multiple cpus, and fed from multiple rx rings. if_rxr_livelocked
lets a driver apply backpressure explicitely if something tells it
that whatever is consuming previous packets cannot keep up.

while here expose the current ring watermark with if_rxr_cwm.

tweaks and ok visa@

Revision 1.528 / (download) - annotate - [select for diffs], Tue Nov 14 16:01:55 2017 UTC (6 years, 6 months ago) by tb
Branch: MAIN
Changes since 1.527: +39 -9 lines
Diff to previous 1.527 (colored)

Push the NET_LOCK into ifioctl() and use the NET_RLOCK in ifioctl_get().
In particular, this allows SIOCGIF* requests to run in parallel.

lots of help & ok mpi, ok visa, sashan

Revision 1.527 / (download) - annotate - [select for diffs], Tue Nov 14 04:08:11 2017 UTC (6 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.526: +5 -21 lines
Diff to previous 1.526 (colored)

move the adding of an ifqs counters in if_getdata to ifq.c

this keeps the knowledge of ifq locking in ifq.c

ok visa@

Revision 1.526 / (download) - annotate - [select for diffs], Sun Nov 12 14:11:15 2017 UTC (6 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.525: +15 -8 lines
Diff to previous 1.525 (colored)

Only use a single taskq to process incoming network packets as soon as
IPsec is enabled.

This is currently a no-op since we still use a single taskq.  But it
will allows us to experiment with multiple forwarding threads and the
PF_LOCK() without having to fix IPsec at the same time.

ok sashan@, visa@

Revision 1.525 / (download) - annotate - [select for diffs], Fri Nov 10 08:55:49 2017 UTC (6 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.524: +3 -3 lines
Diff to previous 1.524 (colored)

Introduce a reader version of the NET_LOCK().

This will be used to first allow read-only ioctl(2) to be executed while
the softnet taskq is running.  Then it will allows us to execute multiple
softnet taskq in parallel.

Tested by Hrvoje Popovski, ok kettenis@, sashan@, visa@, tb@

Revision 1.524 / (download) - annotate - [select for diffs], Thu Nov 9 09:07:01 2017 UTC (6 years, 7 months ago) by tb
Branch: MAIN
Changes since 1.523: +4 -3 lines
Diff to previous 1.523 (colored)

The cmd argument of ifconf() has been unused since COMPAT_LINUX was
purged.  Remove it and move the prototype to if.c since ifconf() is
not used outside of this file.

ok mpi

Revision 1.523 / (download) - annotate - [select for diffs], Sat Nov 4 16:58:46 2017 UTC (6 years, 7 months ago) by tb
Branch: MAIN
Changes since 1.522: +115 -71 lines
Diff to previous 1.522 (colored)

Move the ioctls that only need a read lock from ifioctl into a new
function ifioctl_get(). This simplifies an upcoming diff.

suggested by & ok mpi, input & ok florian

Revision 1.522 / (download) - annotate - [select for diffs], Sat Nov 4 13:11:54 2017 UTC (6 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.521: +17 -25 lines
Diff to previous 1.521 (colored)

Stop calling ifp->if_ioctl() inside in{,6}_ioctl().

Instead return EOPNOTSUPP and call it from ifioctl().  This will help
getting per-driver ioctl routines outside of need the NET_LOCK().

While here always return ENXIO when ``ifp'' is NULL.

ok visa@, florian@

Revision 1.521 / (download) - annotate - [select for diffs], Tue Oct 31 22:05:12 2017 UTC (6 years, 7 months ago) by sashan
Branch: MAIN
Changes since 1.520: +27 -11 lines
Diff to previous 1.520 (colored)

- add one more softnet taskq
  NOTE: code still runs with single softnet task.  change definition of
  SOFTNET_TASKS in net/if.c, if you want to have more than one softnet task

OK mpi@, OK phessler@

Revision 1.520 / (download) - annotate - [select for diffs], Thu Oct 26 15:13:40 2017 UTC (6 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.519: +1 -25 lines
Diff to previous 1.519 (colored)

Stop grabbing the KERNEL_LOCK() in network tasks when `ipsec_in_use'
is set.

Accesses to IPsec global data structure are now serialized by the
NET_LOCK().

Tested by many, ok visa@, bluhm@

Revision 1.519 / (download) - annotate - [select for diffs], Mon Oct 16 13:40:58 2017 UTC (6 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.518: +1 -7 lines
Diff to previous 1.518 (colored)

Remove kernel support for the following ioctl(2)s, deprecated since 2001:

- SIOCSIFPHYADDR
- SIOCSIFPHYADDR_IN6
- SIOCGIFPSRCADDR
- SIOCGIFPSRCADDR_IN6
- SIOCGIFPDSTADDR
- SIOCGIFPDSTADDR_IN6

ok bluhm@

Revision 1.518 / (download) - annotate - [select for diffs], Mon Oct 16 13:24:26 2017 UTC (6 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.517: +33 -34 lines
Diff to previous 1.517 (colored)

Multiple tweaks:

- Assert that all drivers declare a if_ioctl function pointer and stop
  checking it against NULL.

- Do not use return statements in ifioctl() where a lock is needed.

- Call if_setlladdr() only if the underlying driver did not report an
  error.

ok bluhm@

Revision 1.517 / (download) - annotate - [select for diffs], Mon Oct 16 08:19:15 2017 UTC (6 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.516: +29 -29 lines
Diff to previous 1.516 (colored)

Change most of the returns into breaks.  This will let us release a lock.

While here add error checks for SIOC{A,D}IFGROUP.

ok sashan@, bluhm@, visa@

Revision 1.516 / (download) - annotate - [select for diffs], Thu Oct 12 09:14:16 2017 UTC (6 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.515: +1 -34 lines
Diff to previous 1.515 (colored)

Move sysctl_mq() where it can safely mess with mbuf queue internals.

ok visa@, bluhm@, deraadt@

Revision 1.515 / (download) - annotate - [select for diffs], Thu Oct 12 09:10:52 2017 UTC (6 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.514: +2 -2 lines
Diff to previous 1.514 (colored)

Fix a singed vs unsigned comparison resulting in an overflow of the
routing socket.

When clang became the default compiler, `if_flags' from `struct ifnet'
was changed from "short" to "unsigned short", to silence a warning.
Sadly the copy of these flags on the stack was still a "short" which
made the flags comparison always true, which in turn made ifioctl()
generates a RTM_INFO message for many ioctl(2).

Since my last commit, the flag comparison is done for every ioctl(2).
This made the kernel generate at least one routing message per ioctl,
resulting in a lot of RTM_DESYNC.

RTM_DESYNC problem reported by krw@ thanks to dhclient(8)'s noisiness!

ok krw@, patrick@

Revision 1.514 / (download) - annotate - [select for diffs], Wed Oct 11 07:57:27 2017 UTC (6 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.513: +17 -27 lines
Diff to previous 1.513 (colored)

ifioctl() cleanups.

Only one semantic chance for SIOCSIFXFLAGS, rtm_ifchg() is now only called
when the flags changed, not always.

ok bluhm@, visa@

Revision 1.513 / (download) - annotate - [select for diffs], Mon Oct 9 08:35:38 2017 UTC (6 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.512: +13 -3 lines
Diff to previous 1.512 (colored)

Reduces the scope of the NET_LOCK() in sysctl(2) path.

Exposes per-CPU counters to real parrallelism.

ok visa@, bluhm@, jca@

Revision 1.512 / (download) - annotate - [select for diffs], Tue Aug 22 15:02:34 2017 UTC (6 years, 9 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.511: +17 -14 lines
Diff to previous 1.511 (colored)

Prevent a race against ipsec_in_use.

Problem reported and fix tested by Hrvoje Popovski.

ok bluhm@, visa@

Revision 1.511 / (download) - annotate - [select for diffs], Sat Aug 12 20:27:28 2017 UTC (6 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.510: +5 -5 lines
Diff to previous 1.510 (colored)

Use the NET_LOCK() macro instead of handrolling it.

Tested by Hrvoje Popovski.

Revision 1.510 / (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.509: +23 -32 lines
Diff to previous 1.509 (colored)

Remove NET_LOCK()'s argument.

Tested by Hrvoje Popovski, ok bluhm@

Revision 1.509 / (download) - annotate - [select for diffs], Thu Aug 10 16:48:25 2017 UTC (6 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.508: +1 -3 lines
Diff to previous 1.508 (colored)

The socket field so_proto can never be NULL.  Remove the checks.
OK mpi@ visa@

Revision 1.508 / (download) - annotate - [select for diffs], Fri Aug 4 21:32:26 2017 UTC (6 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.507: +9 -4 lines
Diff to previous 1.507 (colored)

When we disable INET6 on an interface that also removes the autoconf6
flag.  Notify userland about this via the route socket, otherwise
slaacd gets confused about the state the interface is in.
OK on a previous version sthen
input & OK bluhm

Revision 1.507 / (download) - annotate - [select for diffs], Tue Aug 1 20:57:10 2017 UTC (6 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.506: +1 -3 lines
Diff to previous 1.506 (colored)

rt_if_track() is needed even on ramdisk kernels, because of MPATH
ok mpi

Revision 1.506 / (download) - annotate - [select for diffs], Mon Jul 24 09:38:25 2017 UTC (6 years, 10 months ago) by mpi
Branch: MAIN
Changes since 1.505: +9 -5 lines
Diff to previous 1.505 (colored)

Reduce NET_LOCK() contention by moving the linktstate and watchdog
tasks from `systq' to `softnettq'.

ok kettenis@, visa@

Revision 1.505 / (download) - annotate - [select for diffs], Tue Jul 11 12:51:05 2017 UTC (6 years, 11 months ago) by florian
Branch: MAIN
Changes since 1.504: +1 -11 lines
Diff to previous 1.504 (colored)

Purging is at last at hand. Day of Doom is here. All that is evil
shall all be cleansed.

Remove sending of router solicitations and processing of router
advertisements from the kernel. It's handled by slaacd(8) these days.

Input & OK bluhm@, mpi@

Revision 1.504 / (download) - annotate - [select for diffs], Fri Jun 23 11:18:12 2017 UTC (6 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.503: +2 -1 lines
Diff to previous 1.503 (colored)

Resetting the mbuf header in if_input_local() was stripping off the
M_LOOP flag.  This broke IPv6 multicast.  Always set M_LOOP when
going through if_input_local() and adjust the flag's comment.
report rzalamena@; OK mpi@

Revision 1.503 / (download) - annotate - [select for diffs], Wed May 31 05:59:09 2017 UTC (7 years ago) by mpi
Branch: MAIN
Changes since 1.502: +36 -2 lines
Diff to previous 1.502 (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.502 / (download) - annotate - [select for diffs], Tue May 30 07:50:37 2017 UTC (7 years ago) by mpi
Branch: MAIN
Changes since 1.501: +7 -14 lines
Diff to previous 1.501 (colored)

Introduce ipv{4,6}_input(), two wrappers around IP queues.

This will help transitionning to an un-KERNEL_LOCK()ed IP
forwarding path.

Disucssed with bluhm@, ok claudio@

Revision 1.501 / (download) - annotate - [select for diffs], Tue May 30 06:42:13 2017 UTC (7 years ago) by mpi
Branch: MAIN
Changes since 1.500: +3 -3 lines
Diff to previous 1.500 (colored)

Clear the internal table used by if_get(9) and sleep until all
remaining ifp references are released *without* the NET_LOCK().

It's safe to do so because the KERNEL_LOCK() serializes accesses
to ``if_map''.

More importantly this fix possible deadlocks between if_get() and
the NET_LOCK().  It is now possible to call them in whatever order.

ok visa@, dlg@

Revision 1.500 / (download) - annotate - [select for diffs], Mon May 29 06:08:21 2017 UTC (7 years ago) by mpi
Branch: MAIN
Changes since 1.499: +6 -7 lines
Diff to previous 1.499 (colored)

Do not try to grab the NET_LOCK() while holding an ifp reference.

Fix a deadlock with a thread trying to detach the corresponding interface.

ok sashan@, bluhm@

Revision 1.499 / (download) - annotate - [select for diffs], Sun May 28 12:51:33 2017 UTC (7 years ago) by yasuoka
Branch: MAIN
Changes since 1.498: +5 -1 lines
Diff to previous 1.498 (colored)

Remove all splnet/splx from pipex(4) and pppx(4) and replace some of
them by NET_LOCK/NET_UNLOCK.  Also make the timeout for pipex_timer
run with a thread context and replace pipex softintr by NETISR_PIPEX.

ok mpi

Revision 1.498 / (download) - annotate - [select for diffs], Sun May 28 12:47:24 2017 UTC (7 years ago) by mpi
Branch: MAIN
Changes since 1.497: +3 -5 lines
Diff to previous 1.497 (colored)

Leaving IP multicast group requires the NET_LOCK().

Grab the lock before calling carpdetach().

ok bluhm@

Revision 1.497 / (download) - annotate - [select for diffs], Tue May 16 12:24:01 2017 UTC (7 years ago) by mpi
Branch: MAIN
Changes since 1.496: +6 -6 lines
Diff to previous 1.496 (colored)

Replace remaining splsoftassert(IPL_SOFTNET) by NET_ASSERT_LOCKED().

ok visa@

Revision 1.496 / (download) - annotate - [select for diffs], Mon May 15 12:26:00 2017 UTC (7 years ago) by mpi
Branch: MAIN
Changes since 1.495: +13 -1 lines
Diff to previous 1.495 (colored)

Enable the NET_LOCK(), take 3.

Recursions are still marked as XXXSMP.

ok deraadt@, bluhm@

Revision 1.495 / (download) - annotate - [select for diffs], Tue May 9 09:31:07 2017 UTC (7 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.494: +1 -6 lines
Diff to previous 1.494 (colored)

pfctlinput(PRC_IFDOWN, ...) has no effect on OpenBSD so remove it.

ok bluhm@

Revision 1.494 / (download) - annotate - [select for diffs], Thu May 4 15:00:24 2017 UTC (7 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.493: +2 -2 lines
Diff to previous 1.493 (colored)

Introduce sstosa() for converting sockaddr_storage with a type safe
inline function instead of casting it to sockaddr.  While there,
use inline instead of __inline for all these conversions.  Some
struct sockaddr casts can be avoided completely.
OK dhill@ mpi@

Revision 1.493 / (download) - annotate - [select for diffs], Fri Apr 14 15:11:31 2017 UTC (7 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.492: +3 -2 lines
Diff to previous 1.492 (colored)

Avoid some false positives with cppcheck.  No binary change.
OK jsg@

Revision 1.492 / (download) - annotate - [select for diffs], Wed Mar 22 12:45:22 2017 UTC (7 years, 2 months ago) by mikeb
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.491: +4 -4 lines
Diff to previous 1.491 (colored)

Replace an expensive microtime call with a getmicrotime for if_lastchange
reducing its resolution to 10ms.

ok florian, mpi

Revision 1.491 / (download) - annotate - [select for diffs], Fri Mar 17 17:19:16 2017 UTC (7 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.490: +1 -13 lines
Diff to previous 1.490 (colored)

Revert the NET_LOCK() and bring back pf's contention lock for release.

For the moment the NET_LOCK() is always taken by threads running under
KERNEL_LOCK().  That means it doesn't buy us anything except a possible
deadlock that we did not spot.  So make sure this doesn't happen, we'll
have plenty of time in the next release cycle to stress test it.

ok visa@

Revision 1.490 / (download) - annotate - [select for diffs], Wed Mar 8 09:19:45 2017 UTC (7 years, 3 months ago) by mpi
Branch: MAIN
Changes since 1.489: +1 -3 lines
Diff to previous 1.489 (colored)

Do not unset IFF_UP twice.

ok stsp@, claudio@, mikeb@, dlg@

Revision 1.489 / (download) - annotate - [select for diffs], Mon Mar 6 08:56:39 2017 UTC (7 years, 3 months ago) by mpi
Branch: MAIN
Changes since 1.488: +6 -6 lines
Diff to previous 1.488 (colored)

Prefix functions dealing with routing messages with 'rtm_' and keep
them all in net/rtsock.c.

This allows to easily spot which functions are doing a copyout(9)
when dealing with the routing midlayer.

ok phessler@, bluhm@, dhill@, krw@, claudio@

Revision 1.488 / (download) - annotate - [select for diffs], Tue Feb 28 15:35:02 2017 UTC (7 years, 3 months ago) by yasuoka
Branch: MAIN
Changes since 1.487: +12 -5 lines
Diff to previous 1.487 (colored)

Don't change the up status of the interface when changing its rdomain.
Diff from nagasaka@iij.

ok mpi

Revision 1.487 / (download) - annotate - [select for diffs], Thu Feb 16 10:15:12 2017 UTC (7 years, 3 months ago) by mpi
Branch: MAIN
Changes since 1.486: +1 -4 lines
Diff to previous 1.486 (colored)

Revert "Release the NET_LOCK() before entering per-driver ioctl() routine".

This is most likely to be the cause of the deadlock seen by port builders
since it's the only changed that happened after a2k17.

Instead bring back pirofti@ original hack to release the NET_LOCK() inside
iwm(4) and iwn(4).

This fixes some splassert reported by bluhm@

Deadlock reported by naddy@ and rpe@ and ajacoutot@ confirmed the deadlock
has been introduced post a2k17.

Tested by and ok tb@

Revision 1.486 / (download) - annotate - [select for diffs], Tue Feb 7 10:08:21 2017 UTC (7 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.485: +4 -1 lines
Diff to previous 1.485 (colored)

Release the NET_LOCK() before entering per-driver ioctl() routine.

This prevents a deadlock with the X server and some wireless drivers.
The real fix is to take unix domain socket code out of the NET_LOCK().

Issue reported by pirofti@ and ajacoutot@

ok tb@, stsp@, pirofti@

Revision 1.485 / (download) - annotate - [select for diffs], Wed Feb 1 02:02:01 2017 UTC (7 years, 4 months ago) by jsg
Branch: MAIN
Changes since 1.484: +3 -3 lines
Diff to previous 1.484 (colored)

Take if_attach_common() out from under netlock as it does a bunch
of sleeping mallocs to initialise a new ifp.  The ifp is later
added to the global list with the lock held.

ok mpi@

Revision 1.484 / (download) - annotate - [select for diffs], Wed Feb 1 01:25:19 2017 UTC (7 years, 4 months ago) by jsg
Branch: MAIN
Changes since 1.483: +3 -3 lines
Diff to previous 1.483 (colored)

Switch from splsoftnet to taking the netlock in if_attachhead().
The same change was made to if_attach() in rev 1.467.

ok mpi@

Revision 1.483 / (download) - annotate - [select for diffs], Tue Jan 31 12:16:20 2017 UTC (7 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.482: +0 -4 lines
Diff to previous 1.482 (colored)

Remove the inifioctl hack, checking for an unheld NET_LOCK() in
tsleep(9) & friends seem to only produce false positives and cannot
be easily disabled.

Revision 1.482 / (download) - annotate - [select for diffs], Wed Jan 25 21:59:41 2017 UTC (7 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.481: +5 -1 lines
Diff to previous 1.481 (colored)

Introduce a hack to remove false-positives when looking for memory
allocation that can sleep while holding the NET_LOCK().

To be removed once we're confident the remaining code paths are safe.

Discussed with deraadt@

Revision 1.481 / (download) - annotate - [select for diffs], Wed Jan 25 06:15:50 2017 UTC (7 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.480: +13 -1 lines
Diff to previous 1.480 (colored)

Enable the NET_LOCK(), take 2.

Recursions are currently known and marked a XXXSMP.

Please report any assert to bugs@

Revision 1.480 / (download) - annotate - [select for diffs], Tue Jan 24 10:08:30 2017 UTC (7 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.479: +2 -2 lines
Diff to previous 1.479 (colored)

A space here, a space there. Soon we're talking real whitespace
rectification.

Revision 1.479 / (download) - annotate - [select for diffs], Tue Jan 24 03:57:35 2017 UTC (7 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.478: +108 -28 lines
Diff to previous 1.478 (colored)

add support for multiple transmit ifqueues per network interface.

an ifq to transmit a packet is picked by the current traffic
conditioner (ie, priq or hfsc) by providing an index into an array
of ifqs. by default interfaces get a single ifq but can ask for
more using if_attach_queues().

the vast majority of our drivers still think there's a 1:1 mapping
between interfaces and transmit queues, so their if_start routines
take an ifnet pointer instead of a pointer to the ifqueue struct.
instead of changing all the drivers in the tree, drivers can opt
into using an if_qstart routine and setting the IFXF_MPSAFE flag.
the stack provides a compatability wrapper from the new if_qstart
handler to the previous if_start handlers if IFXF_MPSAFE isnt set.

enabling hfsc on an interface configures it to transmit everything
through the first ifq. any other ifqs are left configured as priq,
but unused, when hfsc is enabled.

getting this in now so everyone can kick the tyres.

ok mpi@ visa@ (who provided some tweaks for cnmac).

Revision 1.478 / (download) - annotate - [select for diffs], Mon Jan 23 11:37:29 2017 UTC (7 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.477: +4 -3 lines
Diff to previous 1.477 (colored)

Flag pseudo-interfaces as such in order to call add_net_randomness()
only once per packet.

Fix a regression introduced when if_input() started to be called by
every pseudo-driver.

ok claudio@, dlg@

Revision 1.477 / (download) - annotate - [select for diffs], Mon Jan 23 07:27:21 2017 UTC (7 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.476: +4 -4 lines
Diff to previous 1.476 (colored)

i botched the copyout to ifr->ifr_data in SIOCGIFDATA.

this lets pflogd run again.

rename if_data() to if_getdata() while here to make grepping for
things less noisy.

reported by jsg@
worked through with deraadt@

Revision 1.476 / (download) - annotate - [select for diffs], Mon Jan 23 01:26:09 2017 UTC (7 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.475: +34 -14 lines
Diff to previous 1.475 (colored)

merge the ifnet and ifqueue stats together when userland wants them.

a new if_data() function takes a pointer to ifnet and merges its
if_data and ifq statistics. it takes the ifq mutex around the reads
of the ifq stats so they get a consistent copy.

the ifnet and ifq stats are merged because some parts of the stack
still update the ifnet counters.

ok visa@ (on an earlier diff) mpi@ claudio@

Revision 1.475 / (download) - annotate - [select for diffs], Sun Jan 22 10:17:39 2017 UTC (7 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.474: +2 -1 lines
Diff to previous 1.474 (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.474 / (download) - annotate - [select for diffs], Thu Jan 12 09:07:46 2017 UTC (7 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.473: +5 -1 lines
Diff to previous 1.473 (colored)

Unlink PF state keys before passing mbufs to drivers.

Network drivers shouldn't have to deal with PF data structures.  This change
prevent m_free(9) called from an interrupt handler at IPL_NET to mess with
pf(4) internals.

Prevent an splassert reported by Mark Patruck.

ok mikeb@, bluhm@

Revision 1.473 / (download) - annotate - [select for diffs], Wed Jan 4 03:56:15 2017 UTC (7 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.472: +17 -11 lines
Diff to previous 1.472 (colored)

dont assume setting IFF_UP will succeed.

run a drivers ioctl handler and check if it worked before calling
if_up or if_down to report the change. propagate that error up to
userland so ifconfig can report what happened.

ok mpi@

Revision 1.472 / (download) - annotate - [select for diffs], Wed Jan 4 03:42:33 2017 UTC (7 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.471: +6 -6 lines
Diff to previous 1.471 (colored)

shuffle the last change slightly.

only check ml_empty the second time if bpf was run and may have
filtered the list.

only call task_add if mq_enlist worked.

Revision 1.471 / (download) - annotate - [select for diffs], Wed Jan 4 03:12:54 2017 UTC (7 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.470: +7 -1 lines
Diff to previous 1.470 (colored)

make if_input return early if the mbuf list is empty.

this saves doing wakeups of the softnet thread.

ok deraadt@

Revision 1.470 / (download) - annotate - [select for diffs], Tue Jan 3 13:11:55 2017 UTC (7 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.469: +4 -4 lines
Diff to previous 1.469 (colored)

Do not trash the original SPL level.

Pointed out by and ok jsg@, ok mikeb@

Revision 1.469 / (download) - annotate - [select for diffs], Thu Dec 29 12:12:43 2016 UTC (7 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.468: +1 -13 lines
Diff to previous 1.468 (colored)

Change NET_LOCK()/NET_UNLOCK() to be simple wrappers around
splsoftnet()/splx() until the known issues are fixed.

In other words, stop using a rwlock since it creates a deadlock when
chrome is used.

Issue reported by Dimitris Papastamos and kettenis@

ok visa@

Revision 1.468 / (download) - annotate - [select for diffs], Wed Dec 21 10:22:14 2016 UTC (7 years, 5 months ago) by jca
Branch: MAIN
Changes since 1.467: +3 -1 lines
Diff to previous 1.467 (colored)

Generate an IFINFO message when changing the MTU of an interface.

Helps route(4) listeners to refresh their knowledge of the MTU of
interfaces.  Prompted by a diff for ospfd(8) by Remi Locherer, ok claudio@

Revision 1.467 / (download) - annotate - [select for diffs], Tue Dec 20 19:34:56 2016 UTC (7 years, 5 months ago) by mikeb
Branch: MAIN
Changes since 1.466: +15 -4 lines
Diff to previous 1.466 (colored)

Grab the netlock during interface attach and detach.

With help from and OK mpi.

Revision 1.466 / (download) - annotate - [select for diffs], Mon Dec 19 08:36:49 2016 UTC (7 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.465: +21 -10 lines
Diff to previous 1.465 (colored)

Introduce the NET_LOCK() a rwlock used to serialize accesses to the parts
of the network stack that are not yet ready to be executed in parallel or
where new sleeping points are not possible.

This first pass replace all the entry points leading to ip_output(). This
is done to not introduce new sleeping points when trying to acquire ART's
write lock, needed when a new L2 entry is created via the RT_RESOLVE.

Inputs from and ok bluhm@, ok dlg@

Revision 1.465 / (download) - annotate - [select for diffs], Mon Dec 12 09:51:30 2016 UTC (7 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.464: +23 -13 lines
Diff to previous 1.464 (colored)

Remove most of the splsoftnet() recursions related to cloned interfaces.

inputs and ok bluhm@

Revision 1.464 / (download) - annotate - [select for diffs], Fri Dec 2 18:32:38 2016 UTC (7 years, 6 months ago) by vgross
Branch: MAIN
Changes since 1.463: +1 -8 lines
Diff to previous 1.463 (colored)

Clean up leftovers from r1.442.

Local var 'up' is never set in ifioctl().

OK mpi@

Revision 1.463 / (download) - annotate - [select for diffs], Mon Nov 28 11:18:02 2016 UTC (7 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.462: +2 -13 lines
Diff to previous 1.462 (colored)

Remove simple recursive splsoftnet() calls inside ifioctl().

Revision 1.462 / (download) - annotate - [select for diffs], Mon Nov 21 09:09:06 2016 UTC (7 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.461: +3 -1 lines
Diff to previous 1.461 (colored)

Enforce that pr_usrreq functions are called at IPL_SOFTNET.

This will allow us to keep locking simple as soon as we trade
splsoftnet() for a rwlock.

ok bluhm@, claudio@

Revision 1.461 / (download) - annotate - [select for diffs], Mon Nov 14 10:52:04 2016 UTC (7 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.460: +3 -3 lines
Diff to previous 1.460 (colored)

Automatically set ::1 on all default lo(4) interfaces.

Prodded by claudio@

Revision 1.460 / (download) - annotate - [select for diffs], Mon Nov 14 10:44:17 2016 UTC (7 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.459: +7 -3 lines
Diff to previous 1.459 (colored)

It should be possible to create the default loopback interface.

Make rdomain's default loopback test pass again.

Revision 1.459 / (download) - annotate - [select for diffs], Mon Nov 14 10:32:46 2016 UTC (7 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.458: +24 -12 lines
Diff to previous 1.458 (colored)

Automatically create a default lo(4) interface per rdomain.

In order to stop abusing lo0 for all rdomains, a new loopback interface
will be created every time a rdomain is created.  The unit number will
be the same as the rdomain, i.e. lo1 will be attached to rdomain 1.

If this loopback interface is already in use it wont be possible to create
the corresponding rdomain.

In order to know which lo(4) interface is attached to a rdomain, its index
is stored in the rtable/rdomain map.

This is a long overdue since the introduction of rtable/rdomain.  It also
fixes a recent regression due to resetting the rdomain of an incoming
packet reported by semarie@, Andreas Bartelt and Nils Frohberg.

ok claudio@

Revision 1.458 / (download) - annotate - [select for diffs], Tue Nov 8 10:47:10 2016 UTC (7 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.457: +1 -2 lines
Diff to previous 1.457 (colored)

No longer need radix.h

Revision 1.457 / (download) - annotate - [select for diffs], Tue Nov 8 10:46:04 2016 UTC (7 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.456: +1 -42 lines
Diff to previous 1.456 (colored)

RIP ifa_ifwithnet()

ok vgross@

Revision 1.456 / (download) - annotate - [select for diffs], Wed Oct 19 02:05:49 2016 UTC (7 years, 7 months ago) by yasuoka
Branch: MAIN
Changes since 1.455: +2 -2 lines
Diff to previous 1.455 (colored)

Remove the if_input task from the correct taskq.

ok bluhm henning

Revision 1.455 / (download) - annotate - [select for diffs], Sun Oct 16 21:45:17 2016 UTC (7 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.454: +3 -1 lines
Diff to previous 1.454 (colored)

m_resethdr() clears information attached to a mbuf that has been
accumulated during processing, especially pf(4) data is removed.
When a packet is reinserted to local input processing, we have to
start from scratch with a clean mbuf header.  Also the packet has
to be in the routing doamin of the interface where it is inserted.
Incoming packet with stale inp pointer seen by patrick@ on lo(4);
OK sashan@ mpi@

Revision 1.454 / (download) - annotate - [select for diffs], Sun Oct 9 20:05:10 2016 UTC (7 years, 8 months ago) by claudio
Branch: MAIN
Changes since 1.453: +2 -1 lines
Diff to previous 1.453 (colored)

This needs radix.h because it uses rn_refines().
OK guenther@

Revision 1.453 / (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.452: +1 -10 lines
Diff to previous 1.452 (colored)

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

ok mpi@

Revision 1.452 / (download) - annotate - [select for diffs], Mon Oct 3 12:26:13 2016 UTC (7 years, 8 months ago) by rzalamena
Branch: MAIN
Changes since 1.451: +1 -7 lines
Diff to previous 1.451 (colored)

Use detach hook to notify bridge of interface removal instead of adding
code to if.c.

ok mpi@

Revision 1.451 / (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.450: +10 -1 lines
Diff to previous 1.450 (colored)

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

ok reyk@, goda@

Revision 1.450 / (download) - annotate - [select for diffs], Thu Sep 22 14:50:11 2016 UTC (7 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.449: +3 -1 lines
Diff to previous 1.449 (colored)

Raise spl level to IPL_SOFTNET before calling rt_ifmsg().

From dhill@, found the hardway by semarie@

Revision 1.449 / (download) - annotate - [select for diffs], Tue Sep 20 16:14:43 2016 UTC (7 years, 8 months ago) by mikeb
Branch: MAIN
Changes since 1.448: +12 -6 lines
Diff to previous 1.448 (colored)

Create and destroy cloneable interfaces under splsoftnet

With and ok mpi, tested by David Hill and tb@, thanks!

Revision 1.448 / (download) - annotate - [select for diffs], Tue Sep 13 08:15:01 2016 UTC (7 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.447: +15 -8 lines
Diff to previous 1.447 (colored)

Split if_linkstate_task() in two to avoid SPL recursion when the
linkstate is changed from if_up() & if_down().

ok claudio@

Revision 1.447 / (download) - annotate - [select for diffs], Thu Sep 8 09:13:10 2016 UTC (7 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.446: +15 -19 lines
Diff to previous 1.446 (colored)

Replace two if/do/while dances by while loops.

Requested by and ok dlg@

Revision 1.446 / (download) - annotate - [select for diffs], Wed Sep 7 09:36:49 2016 UTC (7 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.445: +8 -20 lines
Diff to previous 1.445 (colored)

Rename rtable_mpath_next() into rtable_iterate() and make it do a proper
reference count.

rtable_iterate() frees the passed ``rt'' and returns the next one on the
multipath list or NULL if there's none.

ok dlg@

Revision 1.445 / (download) - annotate - [select for diffs], Mon Sep 5 13:09:32 2016 UTC (7 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.444: +8 -6 lines
Diff to previous 1.444 (colored)

Rename if_linkstate() to if_linkstate_task() and make sure that all callers
pass the ifindex to that function and not the ifp. This fixes the missing
link state change messages on if_up and if_down. This is a fix for Rev 1.444
which introduced this problem.
OK florian@

Revision 1.444 / (download) - annotate - [select for diffs], Sun Sep 4 17:14:58 2016 UTC (7 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.443: +26 -10 lines
Diff to previous 1.443 (colored)

Prevent a race between a thread detaching an interface and the watchdog
or linkstate task sleeping.

Pass an index to the task and use if_get(9) if the ifp is still alive.

Found the hardway by awolk@.

ok claudio@, bluhm@, mikeb@

Revision 1.443 / (download) - annotate - [select for diffs], Sun Sep 4 15:46:39 2016 UTC (7 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.442: +10 -6 lines
Diff to previous 1.442 (colored)

When auto-creating an interface when opening a /dev/{tun,tap,switch}
device, inherit the rdomain from the calling process.  This adds an
rdomain argument to if_clone_create().

OK mpi@ henning@

Revision 1.442 / (download) - annotate - [select for diffs], Sun Sep 4 15:10:59 2016 UTC (7 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.441: +61 -50 lines
Diff to previous 1.441 (colored)

Move code to change the rdomain of an interface from the ioctl switch case
to a new function if_setrdomain().

OK mpi@ henning@

Revision 1.441 / (download) - annotate - [select for diffs], Sun Sep 4 10:32:01 2016 UTC (7 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.440: +1 -3 lines
Diff to previous 1.440 (colored)

Purge routes attached to an address when this address is removed.

This is done to stop using stale ifa attached to routes, which is
the easiest way to make rtisvalid(9) MP-safe.

sthen@ and henning@ like it, ok claudio@

Revision 1.440 / (download) - annotate - [select for diffs], Sat Sep 3 10:05:19 2016 UTC (7 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.439: +4 -4 lines
Diff to previous 1.439 (colored)

Remove routes added by the kernel before userland ones.

This is a correctness change that will allow us to check that
nothing happend with kernel added routes.

Revision 1.439 / (download) - annotate - [select for diffs], Sat Sep 3 09:55:44 2016 UTC (7 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.438: +25 -17 lines
Diff to previous 1.438 (colored)

Use per-ifp tasks to process incoming packets.

Reduce the number of if_get/if_put from one per packet to one per ring
since we now know that all the packets are coming from the same interface.

Improve forwarding performances by 10Kpps in Hrvoje Popovski's test setup.

ok bluhm@, henning@, dlg@

Revision 1.438 / (download) - annotate - [select for diffs], Thu Sep 1 10:06:33 2016 UTC (7 years, 9 months ago) by goda
Branch: MAIN
Changes since 1.437: +6 -1 lines
Diff to previous 1.437 (colored)

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@

Revision 1.437 / (download) - annotate - [select for diffs], Thu Aug 11 00:58:22 2016 UTC (7 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.436: +2 -3 lines
Diff to previous 1.436 (colored)

take TASKQ_CANTSLEEP way from the softnet taskq.

the big reason for this is to let us use rw locks in the network
stack, which is how at least two major efforts outside the tree
have approached making pf mpsafe.

this was discussed at length at n2k16. there was general agreement
that this is necessary for us to move smp work forward in the stack.

Revision 1.436 / (download) - annotate - [select for diffs], Wed Jul 13 16:45:19 2016 UTC (7 years, 10 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.435: +5 -1 lines
Diff to previous 1.435 (colored)

Move ARP processing back to the KERNEL_LOCK()ed task until the race
triggered by updating a cached, but removed from the table, entry is
properly fixed.

Diff from dlg@, prodding deraadt@

Revision 1.435 / (download) - annotate - [select for diffs], Tue Jul 12 09:33:13 2016 UTC (7 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.434: +13 -4 lines
Diff to previous 1.434 (colored)

Directly drop packets filtered by bpf(4) instead of going through the
input handlers.

ok dlg@

Revision 1.434 / (download) - annotate - [select for diffs], Fri Jun 10 20:33:29 2016 UTC (8 years ago) by vgross
Branch: MAIN
Changes since 1.433: +14 -1 lines
Diff to previous 1.433 (colored)

Add the "llprio" field to struct ifnet, and the corresponding keyword
to ifconfig.

"llprio" allows one to set the priority of packets that do not go through
pf(4), as the case is for arp(4) or bpf(4).

ok sthen@ mikeb@

Revision 1.433 / (download) - annotate - [select for diffs], Wed May 18 03:46:03 2016 UTC (8 years ago) by dlg
Branch: MAIN
Changes since 1.432: +9 -9 lines
Diff to previous 1.432 (colored)

rework the srp api so it takes an srp_ref struct that the caller provides.

the srp_ref struct is used to track the location of the callers
hazard pointer so later calls to srp_follow and srp_enter already
know what to clear. this in turn means most of the caveats around
using srps go away. specifically, you can now:

- switch cpus while holding an srp ref
  - ie, you can sleep while holding an srp ref
- you can take and release srp refs in any order

the original intent was to simplify use of the api when dealing
with complicated data structures. the caller now no longer has to
track the location of the srp a value was fetched from, the srp_ref
effectively does that for you.

srp lists have been refactored to use srp_refs instead of srpl_iter
structs.

this is in preparation of using srps inside the ART code. ART is a
complicated data structure, and lookups require overlapping holds
of srp references.

ok mpi@ jmatthew@

Revision 1.432 / (download) - annotate - [select for diffs], Tue May 10 06:37:15 2016 UTC (8 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.431: +3 -2 lines
Diff to previous 1.431 (colored)

make bpf_mtap callers set the M_FILDROP flag if they care about it.

ok mpi@

Revision 1.431 / (download) - annotate - [select for diffs], Sun May 8 08:58:27 2016 UTC (8 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.430: +2 -2 lines
Diff to previous 1.430 (colored)

Do not export the IFXF_MPSAFE flag to userland, it is a kernel-only
hint.

ok kettenis@, deraadt@

Revision 1.430 / (download) - annotate - [select for diffs], Tue May 3 14:52:39 2016 UTC (8 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.429: +56 -9 lines
Diff to previous 1.429 (colored)

Stop using a soft-interrupt context to process incoming network packets.

Use a new task that runs holding the KERNEL_LOCK to execute mp-unsafe
code.  Our current goal is to progressively move input functions to the
unlocked task.

This gives a small performance boost confirmed by Hrvoje Popovski's
IPv4 forwarding measurement:

before:					after:

send           receive			send           receive
400kpps        400kpps                  400kpps        400kpps
500kpps        500kpps                  500kpps        500kpps
600kpps        600kpps                  600kpps        600kpps
650kpps        650kpps                  650kpps        640kpps
700kpps        700kpps                  700kpps        700kpps
720kpps        640kpps                  720kpps        710kpps
800kpps        640kpps                  800kpps        650kpps
1.4Mpps        570kpps                  1.4Mpps        590kpps
14Mpps         570kpps                  14Mpps         590kpps


ok kettenis@, bluhm@, dlg@

Revision 1.429 / (download) - annotate - [select for diffs], Wed Mar 16 12:08:09 2016 UTC (8 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.428: +9 -2 lines
Diff to previous 1.428 (colored)

if ticks diverge from ifq_congestion too far the diff will go negative

detect this and bump ifq_congestion forward rather than claim the
system is congested for a long period of time.

ok mpi@ henning@ jmatthew@

Revision 1.428 / (download) - annotate - [select for diffs], Mon Mar 7 18:44:00 2016 UTC (8 years, 3 months ago) by naddy
Branch: MAIN
Changes since 1.427: +3 -3 lines
Diff to previous 1.427 (colored)

Sync no-argument function declaration and definition by adding (void).
ok mpi@ millert@

Revision 1.427 / (download) - annotate - [select for diffs], Wed Mar 2 00:00:16 2016 UTC (8 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.426: +4 -1 lines
Diff to previous 1.426 (colored)

provide generic ioctls for managing an interfaces parent

in the future this will subsume the individual vlandev, carpdev,
pppoedev, foodev options for things like vlan, carp, pppoe, etc.

inspired by vnetid

ok mpi@ jmatthew@

Revision 1.426 / (download) - annotate - [select for diffs], Sun Feb 28 15:46:19 2016 UTC (8 years, 3 months ago) by naddy
Branch: MAIN
Changes since 1.425: +1 -17 lines
Diff to previous 1.425 (colored)

Support for running Linux binaries under emulation is going away.

Remove "option COMPAT_LINUX" and everything directly tied to it from the
kernel and the corresponding man page documentation.

ok visa@ guenther@

Revision 1.425 / (download) - annotate - [select for diffs], Wed Dec 9 03:22:39 2015 UTC (8 years, 6 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.424: +3 -4 lines
Diff to previous 1.424 (colored)

rework the if_start mpsafe serialisation so it can serialise arbitrary work

work is represented by struct task.

the start routine is now wrapped by a task which is serialised by the
infrastructure. if_start_barrier has been renamed to ifq_barrier and
is now implemented as a task that gets serialised with the start
routine.

this also adds an ifq_restart() function. it serialises a call to
ifq_clr_oactive and calls the start routine again. it exists to
avoid a race that kettenis@ identified in between when a start
routine discovers theres no space left on a ring, and when it calls
ifq_set_oactive. if the txeof side of the driver empties the ring
and calls ifq_clr_oactive in between the above calls in start, the
queue will be marked oactive and the stack will never call the start
routine again.

by serialising the ifq_set_oactive call in the start routine and
ifq_clr_oactive calls we avoid that race.

tested on various nics
ok mpi@

Revision 1.424 / (download) - annotate - [select for diffs], Tue Dec 8 10:18:56 2015 UTC (8 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.423: +1 -2 lines
Diff to previous 1.423 (colored)

Kill unused iftxlist.

ok dlg@

Revision 1.423 / (download) - annotate - [select for diffs], Tue Dec 8 10:06:12 2015 UTC (8 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.422: +1 -368 lines
Diff to previous 1.422 (colored)

split the interface send queue (struct ifqueue) implementation out.

the intention is to make it more clear what belongs to a transmit
queue and what belongs to an interface.

suggested by and ok mpi@

Revision 1.422 / (download) - annotate - [select for diffs], Sat Dec 5 10:07:55 2015 UTC (8 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.421: +1 -3 lines
Diff to previous 1.421 (colored)

remove old lint annotations

Revision 1.421 / (download) - annotate - [select for diffs], Fri Dec 4 11:50:01 2015 UTC (8 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.420: +7 -3 lines
Diff to previous 1.420 (colored)

Grab the KERNEL_LOCK() around bridge_output().

It is now safe to call if_enqueue() without holding the KERNEL_LOCK()
even on an interface part of a bridge(4).

ok dlg@, henning@, kettenis@

Revision 1.420 / (download) - annotate - [select for diffs], Thu Dec 3 16:27:32 2015 UTC (8 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.419: +2 -2 lines
Diff to previous 1.419 (colored)

Use SRPL_HEAD() and SRPL_ENTRY() to be consistent with and allow to
fallback to a SLIST.

ok dlg@, jasper@

Revision 1.419 / (download) - annotate - [select for diffs], Thu Dec 3 14:55:17 2015 UTC (8 years, 6 months ago) by vgross
Branch: MAIN
Changes since 1.418: +1 -8 lines
Diff to previous 1.418 (colored)

Remove broadcast matching from ifa_ifwithaddr(), use in_broadcast() where
required.

ok bluhm@ mpi@.

Revision 1.418 / (download) - annotate - [select for diffs], Thu Dec 3 12:22:51 2015 UTC (8 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.417: +79 -38 lines
Diff to previous 1.417 (colored)

rework if_start to allow nics to provide an mpsafe start routine.

existing start routines will still be called under the kernel lock
and at IPL_NET.

mpsafe start routines will be serialised so only one instance of
each interfaces function will be running in the kernel at any point
in time. this guarantees packets will be dequeued in order, and the
start routines dont have to lock against themselves because if_start
does it for them.

the code to do that is based on the scsi runqueue code.

this also provides an if_start_barrier() function that should wait
until any currently running instances of if_start have finished.

a driver can opt in to the mpsafe if_start call by doing the following:

1. setting ifp->if_xflags = IFXF_MPSAFE
2. only calling if_start() instead of its own start routine
3. clearing IFF_RUNNING before calling if_start_barrier() on its way down
4. only using IFQ_DEQUEUE (not ifq_deq_begin/commit/rollback)

to simplify the implementation the tx mitigation code has been removed.

tested by several
ok mpi@ jmatthew@

Revision 1.417 / (download) - annotate - [select for diffs], Wed Dec 2 16:35:52 2015 UTC (8 years, 6 months ago) by bluhm
Branch: MAIN
Changes since 1.416: +4 -3 lines
Diff to previous 1.416 (colored)

When destroying an interface, we have to wait until all references
are not used anymore.  This has to be done before any interface
fields become invalid.
As the route delete request cannot call if_get() anymore, pass down
the interface.  Split rtrequest_delete() into a separate function
that may take an existing inteface.
OK mpi@

Revision 1.416 / (download) - annotate - [select for diffs], Wed Dec 2 08:47:00 2015 UTC (8 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.415: +2 -2 lines
Diff to previous 1.415 (colored)

Rework the MPLS handling. Remove the lookup loops since nothing is using
them and they make everything so much harder with no gain. Remove the
ifp argument from mpls_input since it is not needed. On the input side
the lookup side is modified a bit when it comes to BOS handling.
Tested in a L3VPN setup with ldpd and bgpd. Commiting now so we can move
on with cleaning up rt_ifp usage. If this breaks L2VPN I will fix it once
reported. OK mpi@

Revision 1.415 / (download) - annotate - [select for diffs], Tue Dec 1 16:57:34 2015 UTC (8 years, 6 months ago) by vgross
Branch: MAIN
Changes since 1.414: +4 -1 lines
Diff to previous 1.414 (colored)

Iterating on &ifnet should only be done with the KERNEL_LOCK held.

With input and ok mpi@.

Revision 1.414 / (download) - annotate - [select for diffs], Fri Nov 27 11:52:44 2015 UTC (8 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.413: +2 -2 lines
Diff to previous 1.413 (colored)

Protect the growth of the routing table arrays used by rtable_get()
with SRPs.

This is a simplified version of the dynamically sizeable array of
pointers used by if_get() because routing table heads are never
freed.

ok dlg@

Revision 1.413 / (download) - annotate - [select for diffs], Wed Nov 25 03:10:00 2015 UTC (8 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.412: +6 -3 lines
Diff to previous 1.412 (colored)

replace IFF_OACTIVE manipulation with mpsafe operations.

there are two things shared between the network stack and drivers
in the send path: the send queue and the IFF_OACTIVE flag. the send
queue is now protected by a mutex. this diff makes the oactive
functionality mpsafe too.

IFF_OACTIVE is part of if_flags. there are two problems with that.
firstly, if_flags is a short and we dont have any MI atomic operations
to manipulate a short. secondly, while we could make the IFF_OACTIVE
operates mpsafe, all changes to other flags would have to be made
safe at the same time, otherwise a read-modify-write cycle on their
updates could clobber the oactive change.

instead, this moves the oactive mark into struct ifqueue and provides
an API for changing it. there's ifq_set_oactive, ifq_clr_oactive,
and ifq_is_oactive. these are modelled on ifsq_set_oactive,
ifsq_clr_oactive, and ifsq_is_oactive in dragonflybsd.

this diff includes changes to all the drivers manipulating IFF_OACTIVE
to now use the ifsq_{set,clr_is}_oactive API too.

ok kettenis@ mpi@ jmatthew@ deraadt@

Revision 1.412 / (download) - annotate - [select for diffs], Sat Nov 21 01:08:49 2015 UTC (8 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.411: +1 -17 lines
Diff to previous 1.411 (colored)

simplify ifq_deq_rollback by only having it unlock.

hfsc needed a rollback ifqop to requeue the mbuf because it used
ml_dequeue in the begin op. now it uses MBUF_LIST_FIRST to get a
ref to the first mbuf in deq_begin.

now the disciplines dont need a rollback op, so ifq_deq_rollback
can be simplified to just releasing the mutex.

based on a discussion with kenjiro cho

Revision 1.411 / (download) - annotate - [select for diffs], Fri Nov 20 12:27:42 2015 UTC (8 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.410: +2 -1 lines
Diff to previous 1.410 (colored)

Keep if_ref() private, if_get() is what you want to use before if_put().

The thread detaching an interface will sleep until all references to this
interface have been released.  So we decided to only keep references for
a short period of time.

Keeping if_ref() private will hopefully help preserve this goal as long
as it makes sense.

Calling if_get()/if_put() in the same function also allows us to make
use of static analysis tools (thanks jsg@!) to catch our errors.

ok dlg@

Revision 1.410 / (download) - annotate - [select for diffs], Fri Nov 20 11:15:07 2015 UTC (8 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.409: +3 -3 lines
Diff to previous 1.409 (colored)

i made a mistake. rename ifq_enq and ifq_deq to ifq_enqueue and ifq_dequeue

fixing it now before i regret it more.

Revision 1.409 / (download) - annotate - [select for diffs], Fri Nov 20 10:40:00 2015 UTC (8 years, 6 months ago) by sthen
Branch: MAIN
Changes since 1.408: +2 -2 lines
Diff to previous 1.408 (colored)

fix prio KASSERT, it should be <= not <.  ok dlg@

Revision 1.408 / (download) - annotate - [select for diffs], Fri Nov 20 03:35:23 2015 UTC (8 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.407: +327 -7 lines
Diff to previous 1.407 (colored)

shuffle struct ifqueue so in flight mbufs are protected by a mutex.

the code is refactored so the IFQ macros call newly implemented ifq
functions. the ifq code is split so each discipline (priq and hfsc
in our case) is an opaque set of operations that the common ifq
code can call. the common code does the locking, accounting (ifq_len
manipulation), and freeing of the mbuf if the disciplines enqueue
function rejects it. theyre kind of like bufqs in the block layer
with their fifo and nscan disciplines.

the new api also supports atomic switching of disciplines at runtime.
the hfsc setup in pf_ioctl.c has been tweaked to build a complete
hfsc_if structure which it attaches to the send queue in a single
operation, rather than attaching to the interface up front and
building up a list of queues.

the send queue is now mutexed, which raises the expectation that
packets can be enqueued or purged on one cpu while another cpu is
dequeueing them in a driver for transmission. a lot of drivers use
IFQ_POLL to peek at an mbuf and attempt to fit it on the ring before
committing to it with a later IFQ_DEQUEUE operation. if the mbuf
gets freed in between the POLL and DEQUEUE operations, fireworks
will ensue.

to avoid this, the ifq api introduces ifq_deq_begin, ifq_deq_rollback,
and ifq_deq_commit. ifq_deq_begin allows a driver to take the ifq
mutex and get a reference to the mbuf they wish to try and tx. if
there's space, they can ifq_deq_commit it to remove the mbuf and
release the mutex. if there's no space, ifq_deq_rollback simply
releases the mutex. this api was developed to make updating the
drivers using IFQ_POLL easy, instead of having to do significant
semantic changes to avoid POLL that we cannot test on all the
hardware.

the common code has been tested pretty hard, and all the driver
modifications are straightforward except for de(4). if that breaks
it can be dealt with later.

ok mpi@ jmatthew@

Revision 1.407 / (download) - annotate - [select for diffs], Wed Nov 18 13:58:02 2015 UTC (8 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.406: +31 -1 lines
Diff to previous 1.406 (colored)

Factorize the bits to check if a L2 route is connected, wether it is
attached to a carp(4) or bridge(4) member, to not dereference rt_ifp
directly.

ok visa@

Revision 1.406 / (download) - annotate - [select for diffs], Fri Nov 13 10:18:04 2015 UTC (8 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.405: +3 -3 lines
Diff to previous 1.405 (colored)

Sore the index of the interface used for revarp instead of a pointer to
its descriptor.  Get rid of a if_ref().

ok dlg@

Revision 1.405 / (download) - annotate - [select for diffs], Wed Nov 11 10:23:23 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.404: +10 -5 lines
Diff to previous 1.404 (colored)

Store the index of the lo0 interface instead of a pointer to its
descriptor.

Allow to get rid of two if_ref() in the output paths.

ok dlg@

Revision 1.404 / (download) - annotate - [select for diffs], Sat Nov 7 12:42:19 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.403: +1 -12 lines
Diff to previous 1.403 (colored)

Use input handlers for bridge(4).

This allows more flexible configurations with vlan(4) and bridge(4) on
top of the same physical interface.  In particular it allows to not feed
VLAN tagget packets into a bridge(4).

Fix regression reported by Armin Wolfermann on bugs@, ok dlg@

Revision 1.403 / (download) - annotate - [select for diffs], Fri Nov 6 17:55:55 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.402: +3 -3 lines
Diff to previous 1.402 (colored)

Rename rt_mpath_next() into rtable_mpath_next() and provide an
implementation for ART based on the singly-linked list of route
entries.

Revision 1.402 / (download) - annotate - [select for diffs], Tue Nov 3 12:25:37 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.401: +1 -2 lines
Diff to previous 1.401 (colored)

Do not clear M_PROTO1 flag before calling if_start() because pseudo-
drivers, like vlan(4), call if_enqueue() in their *start function.

Prevent an infinite recursion reported by Armin Wolfermann on bugs@.

Revision 1.401 / (download) - annotate - [select for diffs], Mon Nov 2 14:40:09 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.400: +4 -3 lines
Diff to previous 1.400 (colored)

Merge rtable_mpath_match() into rtable_lookup().

ok bluhm@

Revision 1.400 / (download) - annotate - [select for diffs], Wed Oct 28 12:14:25 2015 UTC (8 years, 7 months ago) by florian
Branch: MAIN
Changes since 1.399: +1 -15 lines
Diff to previous 1.399 (colored)

Remove linkmtu and maxmtu from struct nd_ifinfo. IN6_LINKMTU can now
die and ifp->if_mtu is the one true mtu.
Suggested by and OK mpi@

Revision 1.399 / (download) - annotate - [select for diffs], Tue Oct 27 10:52:17 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.398: +12 -5 lines
Diff to previous 1.398 (colored)

Use rt_ifidx rather than rt_ifp.

ok bluhm@

Revision 1.398 / (download) - annotate - [select for diffs], Sun Oct 25 21:58:04 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.397: +3 -1 lines
Diff to previous 1.397 (colored)

unbreak tree for ramdisks without INET6

Revision 1.397 / (download) - annotate - [select for diffs], Sun Oct 25 13:52:45 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.396: +3 -2 lines
Diff to previous 1.396 (colored)

Do not overwrite if_rtrequest() if the driver specified it *before*
calling if_attach().

Revision 1.396 / (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.395: +1 -6 lines
Diff to previous 1.395 (colored)

arp_ifinit() is no longer required.

Revision 1.395 / (download) - annotate - [select for diffs], Sun Oct 25 11:58:11 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.394: +8 -3 lines
Diff to previous 1.394 (colored)

Introduce if_rtrequest() the successor of ifa_rtrequest().

L2 resolution depends on the protocol (encoded in the route entry) and
an ``ifp''.  Not having to care about an ``ifa'' makes our life easier
in our MP effort.  Fewer dependencies between data structures implies
fewer headaches.

Discussed with bluhm@, ok claudio@

Revision 1.394 / (download) - annotate - [select for diffs], Sat Oct 24 10:52:05 2015 UTC (8 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.393: +3 -1 lines
Diff to previous 1.393 (colored)

Add pair(4), a vether-based virtual Ethernet driver to interconnect
rdomains and bridges on the local system.  This can be used to route
through local rdomains, to create L2 devices (like trunks) between
them, and many other things.

Discussed with many, with input from mpi@
OK sthen@ phessler@ yasuoka@ mikeb@

Revision 1.393 / (download) - annotate - [select for diffs], Thu Oct 22 17:48:34 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.392: +1 -25 lines
Diff to previous 1.392 (colored)

Kill link_rtrequest(), introduce in 1990 to "fix" the result
of rt_getifa() when adding link level route from outside the
kernel.

ok claudio@

Revision 1.392 / (download) - annotate - [select for diffs], Thu Oct 22 16:44:54 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.391: +3 -12 lines
Diff to previous 1.391 (colored)

Make sure that the address matching the key (destination) of a route
entry is attached to this entry.

ok phessler@, bluhm@

Revision 1.391 / (download) - annotate - [select for diffs], Thu Oct 22 15:37:47 2015 UTC (8 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.390: +2 -2 lines
Diff to previous 1.390 (colored)

Inspired by satosin(), use inline functions to convert sockaddr dl.
Instead of casts they check wether the incoming object has the
expected type.  So introduce satosdl() and sdltosa() in the kernel.
OK mpi@

Revision 1.390 / (download) - annotate - [select for diffs], Thu Oct 22 10:46:26 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.389: +2 -2 lines
Diff to previous 1.389 (colored)

Do not dereference ``ifa_ifp'' when we already have an ``ifp'' pointer.

Revision 1.389 / (download) - annotate - [select for diffs], Mon Oct 12 13:17:58 2015 UTC (8 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.388: +2 -2 lines
Diff to previous 1.388 (colored)

the pattr argument to IFQ_ENQUEUE is unused, so let's get rid of it.

also the comment above IFQ_ENQUEUE that says the pattr argument is unused.

ok mpi@

Revision 1.388 / (download) - annotate - [select for diffs], Mon Oct 12 11:32:39 2015 UTC (8 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.387: +21 -41 lines
Diff to previous 1.387 (colored)

Unify link state change notification.

ok mikeb@

Revision 1.387 / (download) - annotate - [select for diffs], Mon Oct 12 10:49:40 2015 UTC (8 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.386: +5 -1 lines
Diff to previous 1.386 (colored)

protect SIOCSLIFPHYTTL, SIOCSVNETID so only root can call them, and
return EPNOTSUPP for SIOCGLIFPHYTTL and SIOCGVNETID. all so drivers
dont have to do these checks themselves.

ok mikeb@ mpi@

Revision 1.386 / (download) - annotate - [select for diffs], Thu Oct 8 09:51:00 2015 UTC (8 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.385: +1 -3 lines
Diff to previous 1.385 (colored)

Unlock the softnet task.

ok dlg@, kettenis@

Revision 1.385 / (download) - annotate - [select for diffs], Mon Oct 5 19:05:09 2015 UTC (8 years, 8 months ago) by uebayasi
Branch: MAIN
Changes since 1.384: +0 -3 lines
Diff to previous 1.384 (colored)

Revert if_oqdrops accounting changes done in kernel, per request from mpi@.

(Especially adding IF_DROP() after IFQ_ENQUEUE() was completely wrong because
IFQ_ENQUEUE() already does it.  Oops.)

After this revert, the situation becomes:

- if_snd.ifq_drops is incremented in either IFQ_ENQUEUE() or IF_DROP(), but
  it is not shown to userland, and

- if_data.ifi_oqdrops is shown to userland, but it is not incremented by
  anyone.

Revision 1.384 / (download) - annotate - [select for diffs], Mon Oct 5 15:57:27 2015 UTC (8 years, 8 months ago) by uebayasi
Branch: MAIN
Changes since 1.383: +1 -0 lines
Diff to previous 1.383 (colored)

Count IFQ_ENQUEUE() failure as output drop.

mpi@ prefers checking IFQ_ENQUEUE() error, and this matches that.

OK dlg@

Revision 1.383 / (download) - annotate - [select for diffs], Mon Oct 5 15:39:01 2015 UTC (8 years, 8 months ago) by uebayasi
Branch: MAIN
Changes since 1.382: +3 -1 lines
Diff to previous 1.382 (colored)

Accumulate ifq_drops into if_oqdrops if if_start().

mpi@ questioned usefulness of if_snd.ifq_drops, but this is what exists now.
This area is going to be readily polished.

OK dlg@

Revision 1.382 / (download) - annotate - [select for diffs], Wed Sep 30 11:33:51 2015 UTC (8 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.381: +7 -13 lines
Diff to previous 1.381 (colored)

sleep until all references to an interface have been released during detach.

this is done by moving to the refcnt api and using refcnt_finalize.

tested by Hrjove Popovski
ok mpi@

Revision 1.381 / (download) - annotate - [select for diffs], Sun Sep 27 16:50:03 2015 UTC (8 years, 8 months ago) by stsp
Branch: MAIN
Changes since 1.380: +14 -6 lines
Diff to previous 1.380 (colored)

Add if_setlladdr(), factored out from ifioctl(). Will be used by iwm(4) soon.
With suggestions from tedu@ and guenther@
ok kettenis@

Revision 1.380 / (download) - annotate - [select for diffs], Sun Sep 13 18:15:03 2015 UTC (8 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.379: +2 -2 lines
Diff to previous 1.379 (colored)

Fix double rtfree(9) in non-INET6 kernel.

With and ok claudio@

Revision 1.379 / (download) - annotate - [select for diffs], Sun Sep 13 17:53:44 2015 UTC (8 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.378: +1 -11 lines
Diff to previous 1.378 (colored)

There's no point in abstracting ifp->if_output() as long as pf_test()
needs to see lo0 in the output path.

ok claudio@

Revision 1.378 / (download) - annotate - [select for diffs], Sun Sep 13 10:33:34 2015 UTC (8 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.377: +6 -16 lines
Diff to previous 1.377 (colored)

replace hand rolled refcounts and sleep_setup/finish with refcnts and
refcnt_finalize.

Revision 1.377 / (download) - annotate - [select for diffs], Sun Sep 13 09:58:03 2015 UTC (8 years, 8 months ago) by kettenis
Branch: MAIN
Changes since 1.376: +21 -3 lines
Diff to previous 1.376 (colored)

Run the interface watchdog timer routine as a task such that we have process
context.

ok mpi@, claudio@

Revision 1.376 / (download) - annotate - [select for diffs], Sat Sep 12 20:26:06 2015 UTC (8 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.375: +11 -2 lines
Diff to previous 1.375 (colored)

Stop overwriting the rt_ifp pointer of RTF_LOCAL routes with lo0ifp.

Use instead the RTF_LOCAL flag to loop local traffic back to the
corresponding protocol queue.

With this change rt_ifp is now always the same as rt_ifa->ifa_ifp.

ok claudio@

Revision 1.375 / (download) - annotate - [select for diffs], Sat Sep 12 19:36:37 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.374: +103 -34 lines
Diff to previous 1.374 (colored)

introduce SRPs to the interface index maps to make if_get() mpsafe.

each index in the ifidx map is now an SRP that points at each
interfaces struct ifnet.

because the map needs to be grown at run time as interfaces are
added to the system, we now use an SRP to gain access to the map.

if_get enters the idx map and follows it to the ifnet pointer. if
an interface exists at that index it gets adds a refcount before
leaving the ifp SRP.

modifications to the map pointer and the interface pointers are
serialised by the kernel lock.

ok mpi@ claudio@

Revision 1.374 / (download) - annotate - [select for diffs], Sat Sep 12 13:34:12 2015 UTC (8 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.373: +57 -1 lines
Diff to previous 1.373 (colored)

Introduce if_input_local() a function to feed local traffic back to
the protocol queues.

It basically does what looutput() was doing but having a generic
function will allow us to get rid of the loopback hack overwwritting
the rt_ifp field of RTF_LOCAL routes.

ok mikeb@, dlg@, claudio@

Revision 1.373 / (download) - annotate - [select for diffs], Fri Sep 11 16:58:00 2015 UTC (8 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.372: +10 -6 lines
Diff to previous 1.372 (colored)

Introduce rtref(9) use it in rtable_lookup() before returning a route
entry.

ok bluhm@, claudio@

Revision 1.372 / (download) - annotate - [select for diffs], Fri Sep 11 09:15:56 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.371: +4 -4 lines
Diff to previous 1.371 (colored)

remove some more trailing whitespace

Revision 1.371 / (download) - annotate - [select for diffs], Fri Sep 11 09:00:40 2015 UTC (8 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.370: +7 -7 lines
Diff to previous 1.370 (colored)

whitespaces

Revision 1.370 / (download) - annotate - [select for diffs], Fri Sep 11 08:54:54 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.369: +4 -2 lines
Diff to previous 1.369 (colored)

iterate over the new half of the if idx map rather than loop on the one
entry forever.

this will fix hangs when you have more than 7 interfaces.

ok mpi@

Revision 1.369 / (download) - annotate - [select for diffs], Thu Sep 10 18:11:05 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.368: +148 -71 lines
Diff to previous 1.368 (colored)

rework how we store and manage the interface index to ifp map in preparation of using SRPs as a backend for if_get.

this also tries to document how things work and what if index 0 is for.

ok mpi@ claudio@

Revision 1.368 / (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.367: +12 -7 lines
Diff to previous 1.367 (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.367 / (download) - annotate - [select for diffs], Thu Sep 10 14:06:43 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.366: +6 -2 lines
Diff to previous 1.366 (colored)

if_put after if_get in if_input_process

Revision 1.366 / (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.365: +94 -3 lines
Diff to previous 1.365 (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.365 / (download) - annotate - [select for diffs], Thu Sep 10 06:00:37 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.364: +6 -3 lines
Diff to previous 1.364 (colored)

only try and reference an ifp in if_get if we actually find one in
the map.

avoids a NULL deref jsg@ found

Revision 1.364 / (download) - annotate - [select for diffs], Wed Sep 9 16:01:10 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.363: +22 -2 lines
Diff to previous 1.363 (colored)

introduce reference counts for interfaces (ie, struct ifnet *ifp).

if_get can get a reference to an ifp, but it never releases that
reference. this provides an if_put function that can be used to
decrement the refcount.

we cannot come up with a scheme for letting the network stack run on
one (or many) cpus while ioctls are pulling interfaces down on another
cpu without refcounts for the interfaces.

if_put is going in now so we can go through the stack and put the
necessary calls to it in, and then we'll backfill this implementation
to actually check the refcounts when the interface detaches.

ok mpi@ mikeb@ claudio@

Revision 1.363 / (download) - annotate - [select for diffs], Tue Sep 1 04:56:55 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.362: +1 -3 lines
Diff to previous 1.362 (colored)

dont need the kernel lock for mpsafe bpfs (again)

Revision 1.362 / (download) - annotate - [select for diffs], Sun Aug 30 10:39:16 2015 UTC (8 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.361: +8 -21 lines
Diff to previous 1.361 (colored)

Use a global table for domains instead of building a list at run time.

As a side effect there's no need to run if_attachdomain() after the
list of domains has been built.

ok claudio@, reyk@

Revision 1.361 / (download) - annotate - [select for diffs], Sun Aug 23 10:01:27 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.360: +3 -1 lines
Diff to previous 1.360 (colored)

bpf+srp is blowing up, so its being backed out. bpf will need the big lock.

Revision 1.360 / (download) - annotate - [select for diffs], Tue Aug 18 08:48:36 2015 UTC (8 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.359: +6 -4 lines
Diff to previous 1.359 (colored)

Check the error value returned by in6_ifattach().

Prodded by and ok bluhm@

Revision 1.359 / (download) - annotate - [select for diffs], Sun Aug 16 12:19:06 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.358: +1 -3 lines
Diff to previous 1.358 (colored)

dont need the biglock to call bpf now.

Revision 1.358 / (download) - annotate - [select for diffs], Sun Aug 16 11:28:31 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.357: +7 -3 lines
Diff to previous 1.357 (colored)

avoid a toctou problem in if_input in the bpf handling.

load ifp->if_bpf into a local variable, test that, and pass it to bpf.
this is instead of instead of assuming ifp->if_bpf wont change between
checking it and passing it to bpf.

Revision 1.357 / (download) - annotate - [select for diffs], Thu Aug 13 07:19:58 2015 UTC (8 years, 10 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.356: +3 -1 lines
Diff to previous 1.356 (colored)

If no handler consumed a mbuf, free it.  This also apply if an interface
does not have any registered handler.

Plug a mbuf leak found by sthen@ with gif(4) in a bridge.

ok sthen@, claudio@

Revision 1.356 / (download) - annotate - [select for diffs], Wed Jul 29 00:04:03 2015 UTC (8 years, 10 months ago) by rzalamena
Branch: MAIN
Changes since 1.355: +1 -10 lines
Diff to previous 1.355 (colored)

Don't use mpls_input() as input handler anymore and instead call it
directly. Also protect non mp-safe functions while at it.

ok mpi@.

Revision 1.355 / (download) - annotate - [select for diffs], Tue Jul 21 04:21:50 2015 UTC (8 years, 10 months ago) by jca
Branch: MAIN
Changes since 1.354: +1 -5 lines
Diff to previous 1.354 (colored)

No more AF_LINK addresses on the per-ifp address lists.  ok mpi@

Revision 1.354 / (download) - annotate - [select for diffs], Mon Jul 20 22:54:29 2015 UTC (8 years, 10 months ago) by mpi
Branch: MAIN
Changes since 1.353: +1 -3 lines
Diff to previous 1.353 (colored)

Remove splassert(IPL_NET) from if_input().

if_input() has been designed to be able to safely handle a batch of
packets from physical drivers to the network stack.  Most of these
drivers have an interrupt routine executed at IPL_NET and the check
made sense during the conversion.  However we also want to re-enqueue
packets with if_input() from the network stack currently running at
IPL_SOFTNET.

ok claudio@

Revision 1.353 / (download) - annotate - [select for diffs], Mon Jul 20 21:16:39 2015 UTC (8 years, 10 months ago) by rzalamena
Branch: MAIN
Changes since 1.352: +10 -2 lines
Diff to previous 1.352 (colored)

Kill NETISR_MPLS, from now on we will use interface input handlers to deal
with MPLS packets.

ok mpi@, claudio@

Revision 1.352 / (download) - annotate - [select for diffs], Sat Jul 18 16:10:03 2015 UTC (8 years, 10 months ago) by mpi
Branch: MAIN
Changes since 1.351: +1 -17 lines
Diff to previous 1.351 (colored)

There's no longer a need to force carp(4) interfaces to be the last ones
in the &ifnet list of interfaces.

carp(4) is slowly becoming less special.  Should keep the carp interfaces
in the correct order in ifconfig output as reported by Johan Huldtgren.

ok florian@, claudio@, benno@

Revision 1.351 / (download) - annotate - [select for diffs], Sat Jul 18 15:51:16 2015 UTC (8 years, 10 months ago) by mpi
Branch: MAIN
Changes since 1.350: +6 -4 lines
Diff to previous 1.350 (colored)

Abstract the routing table internals behind an rtable_* API.

Code abusing the radix internals for the routing table should now
includes <net/rtable.h> and only deal with "struct rtentry".

Code using a radix tree for another purpose can still include
<net/radix.h>.

Inputs from and ok claudio@, mikeb@

Revision 1.350 / (download) - annotate - [select for diffs], Thu Jul 16 15:31:35 2015 UTC (8 years, 10 months ago) by mpi
Branch: MAIN
Changes since 1.349: +3 -12 lines
Diff to previous 1.349 (colored)

Properly layer Router Solicitation code.

Tweak and ok florian@

Revision 1.349 / (download) - annotate - [select for diffs], Thu Jul 2 15:16:57 2015 UTC (8 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.348: +1 -9 lines
Diff to previous 1.348 (colored)

Move back rdomain's check into ether_output() otherwise it triggers
if a pseudo-interface is on a different rdomain than its parent.

Sorry for the inconvenience, I hope you'll fly again with us.

Regression reported by and ok semarie@, ok phessler@

Revision 1.348 / (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.347: +3 -3 lines
Diff to previous 1.347 (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.347 / (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.346: +2 -2 lines
Diff to previous 1.346 (colored)

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

ok claudio@, dlg@

Revision 1.346 / (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.345: +6 -3 lines
Diff to previous 1.345 (colored)

count if_ibytes in if_input like we do for if_ipackets.

tweaks and ok mpi@

Revision 1.345 / (download) - annotate - [select for diffs], Thu Jun 25 09:20:20 2015 UTC (8 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.344: +7 -1 lines
Diff to previous 1.344 (colored)

Move brige(4)'s output hook outside of ether_output().

This fix some weird bridge(4) configurations involving pseudo-drivers
stacked on top of interfaces in a bridge.

Also simplifies the loop prevention logic to match bridge's input path.
Instead of using a tag per port/bridge simply flag output mbufs to make
sure only one copy per bridge go through bridge_output().

ok bluhm@, claudio@

Revision 1.344 / (download) - annotate - [select for diffs], Thu Jun 25 09:10:15 2015 UTC (8 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.343: +9 -1 lines
Diff to previous 1.343 (colored)

Check for correct rdomain in if_output() rather than in ether_output().

Not all drivers make use of ether_output() and there's no real reason to
call it when no ARP resolution is needed.  But in this case we still want
to make sure we're sending packets in the correct rdomain.

ok bluhm@, claudio@ as part of a larger diff.

Revision 1.343 / (download) - annotate - [select for diffs], Wed Jun 24 09:56:51 2015 UTC (8 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.342: +1 -48 lines
Diff to previous 1.342 (colored)

Stop garbgage collecting mbufs from the ARP, IPv4 and IPv6 queues when
an interface is destroyed or removed.

Since the introduction of ph_ifidx, as soon as a mbuf with an invalid
interface index is dequeued it will be freed.

ok claudio@, dlg@

Revision 1.342 / (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.341: +3 -1 lines
Diff to previous 1.341 (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.341 / (download) - annotate - [select for diffs], Tue Jun 23 09:42:23 2015 UTC (8 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.340: +10 -1 lines
Diff to previous 1.340 (colored)

Adapt bridge(4) to the new if_input() framework.

Move bridge_input() outside of ether_input() in order to duplicate packets
flowing through a bridge port before applying any transformation on mbufs.

This saves a various m_adj(9)/M_PREPEND(9) dances and remove the bridge(4)
hack from vlan(4).

Tested by mxb <mxb AT alumni DOT chalmers DOT se> and kettenis@

ok bluhm@

Revision 1.340 / (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.339: +9 -4 lines
Diff to previous 1.339 (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.339 / (download) - annotate - [select for diffs], Tue Jun 9 14:57:30 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.338: +2 -6 lines
Diff to previous 1.338 (colored)

Remove the hack to check if the received pointer has changed in an ifih
now that all drivers and pseudo-drivers are using if_input().

if_input() is reentrant and is now the only place where we set `rcvif'.

Revision 1.338 / (download) - annotate - [select for diffs], Sun Jun 7 12:02:28 2015 UTC (9 years ago) by jsg
Branch: MAIN
Changes since 1.337: +7 -1 lines
Diff to previous 1.337 (colored)

Introduce unhandled_af() for cases where code conditionally does
something based on an address family and later assumes one of the paths
was taken.  This was initially just calls to panic until guenther
suggested a function to reduce the amount of strings needed.

This reduces the amount of noise with static analysers and acts
as a sanity check.

ok guenther@ bluhm@

Revision 1.337 / (download) - annotate - [select for diffs], Wed Jun 3 22:01:07 2015 UTC (9 years ago) by mikeb
Branch: MAIN
Changes since 1.336: +2 -5 lines
Diff to previous 1.336 (colored)

Adjust yielding condition slightly in the if_input_process thread.

ok mpi, kettenis

Revision 1.336 / (download) - annotate - [select for diffs], Tue Jun 2 13:23:55 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.335: +1 -8 lines
Diff to previous 1.335 (colored)

RIP ether_input_mbuf().

Revision 1.335 / (download) - annotate - [select for diffs], Tue May 26 11:39:07 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.334: +2 -2 lines
Diff to previous 1.334 (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.334 / (download) - annotate - [select for diffs], Tue May 26 11:36:26 2015 UTC (9 years ago) by dlg
Branch: MAIN
Changes since 1.333: +5 -1 lines
Diff to previous 1.333 (colored)

move add_net_randomness from ether_input to the if_input task.

change it from feeding the ethertype of the packet (which is almost
certainly an ip packet or vlan packet, so not that variable) to the
number of packets about to be processed.

ok deraadt@ mpi@

Revision 1.333 / (download) - annotate - [select for diffs], Wed May 20 08:28:54 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.332: +1 -2 lines
Diff to previous 1.332 (colored)

Do not increment if_opackets in if_output().  It might make sense to do
that later but all drivers should be adapated.

Should fix a double output packet accounting, reported by Hrvoje Popovski.

Revision 1.332 / (download) - annotate - [select for diffs], Tue May 19 11:09:24 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.331: +10 -1 lines
Diff to previous 1.331 (colored)

Take vlan(4) out of ether_input().

To keep the list of input handlers short, multiple vlans share the
same ifih.

if_input_process() now looks if the interface of a mbuf changed to
make sure the corresponding handlers are executed.  This is a hack
and will be improved later.

ok dlg@

Revision 1.331 / (download) - annotate - [select for diffs], Fri May 15 10:15:13 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.330: +34 -1 lines
Diff to previous 1.330 (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.330 / (download) - annotate - [select for diffs], Thu Apr 23 09:45:24 2015 UTC (9 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.329: +6 -28 lines
Diff to previous 1.329 (colored)

replace the use of struct ifqueue in pipex with mbuf_queues.

this has a slight semantic change. previously pipex would only
process up to 128 packets on the input and output queues at a time
and would reschedule the softint if there were any left. now it
mq_delists the current set of pending packets and only processes
them. if anything is added to the queues later they'll cause the
softint to run again.

this in turn lets us deprecate sysctl_ifq since nothing uses it
anymore. because niqueues are mostly wrappers around mbuf_queues,
we can provide sysctl_mq and just #define sysctl_niq to it.

pipex bits are ok yasuoka@

Revision 1.329 / (download) - annotate - [select for diffs], Fri Apr 10 13:58:20 2015 UTC (9 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.328: +26 -32 lines
Diff to previous 1.328 (colored)

replace the use of ifqueues for most input queues serviced by netisr
with niqueues.

this change is so big because there's a lot of code that takes
pointers to different input queues (eg, ether_input picks between
ipv4, ipv6, pppoe, arp, and mpls input queues) and falls through
to code to enqueue packets against the pointer. if i changed only
one of the input queues id have to add sepearate code paths, one
for ifqueues and one for niqueues in each of these places

by flipping all these input queues at once i can keep the currently
common code common.

testing by mpi@ sthen@ and rafael zalamena
ok mpi@ sthen@ claudio@ henning@

Revision 1.328 / (download) - annotate - [select for diffs], Fri Apr 10 08:48:24 2015 UTC (9 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.327: +34 -20 lines
Diff to previous 1.327 (colored)

Run detach hook and similar before cleaning up any other resource when
an interface is destroyed/removed.  This way we can ensure pseudo-driver
changes done after attaching an interface are undone before detaching it.

Note: it is safe to call if_deactivate() multiple times as the interface
should not have any attached pseudo-interface after the first call.

ok deraadt@, dlg@

Revision 1.327 / (download) - annotate - [select for diffs], Tue Apr 7 10:46:20 2015 UTC (9 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.326: +2 -2 lines
Diff to previous 1.326 (colored)

Do not pass an `ifp' argument to interface input handlers since it
might be overwritten by pseudo-drivers.

ok dlg@, henning@

Revision 1.326 / (download) - annotate - [select for diffs], Thu Apr 2 09:46:01 2015 UTC (9 years, 2 months ago) by kettenis
Branch: MAIN
Changes since 1.325: +3 -1 lines
Diff to previous 1.325 (colored)

Grab the kernel lock around the bpf_mtap_ether() call in if_input().  This
allows drivers to start calling if_input() without holding the kernel lock
while others work on make the bpf code mpsafe.

ok dlg@, mpi@

Revision 1.325 / (download) - annotate - [select for diffs], Wed Apr 1 04:00:55 2015 UTC (9 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.324: +53 -4 lines
Diff to previous 1.324 (colored)

create a taskq for network tasks to run in. cut ether_input_mbuf
and if_input up so the work ether_input does gets run on the task
instead of directly from hardware receive handlers.

this is a step toward letting hardware drivers run without biglock
by shoving the work the stack does which needs that lock sideways.

general agreement at s2k15
ok mpi@ kettenis@ claudio@

Revision 1.324 / (download) - annotate - [select for diffs], Sun Mar 29 01:05:02 2015 UTC (9 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.323: +2 -10 lines
Diff to previous 1.323 (colored)

if_detached start dequeues mbufs on the start list and immediately
frees them. IFQ_PURGE does that too, so let's reuse it here.

Revision 1.323 / (download) - annotate - [select for diffs], Wed Mar 25 11:49:02 2015 UTC (9 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.322: +62 -1 lines
Diff to previous 1.322 (colored)

introduce code for network input queues. these are to replace the
use of struct ifqueue for things handled by softnet. they instead
use an mbuf_queue (yay mpsafe) and wrap up the schednetisr and
if_congestion handling.

ok mpi@

Revision 1.322 / (download) - annotate - [select for diffs], Wed Mar 18 12:23:15 2015 UTC (9 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.321: +10 -21 lines
Diff to previous 1.321 (colored)

remove the congestion handling from struct ifqueue.

its only used for the ip and ip6 network stack input queues, so it
seems unfair that every instance of ifqueue has to carry a pointer
around for this specific use case.

this moves the congestion marker to a kernel global. if we detect
that we're congested, we assume the whole system is busy and punish
all input queues.

marking a system as congested is done by setting the global to the
current value of ticks. as the system moves away from that value,
it moves away from being congested until the comparison fails.

written at s2k15
ok henning@ beck@ bluhm@ claudio@

Revision 1.321 / (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.320: +1 -2 lines
Diff to previous 1.320 (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.320 / (download) - annotate - [select for diffs], Tue Mar 3 07:54:32 2015 UTC (9 years, 3 months ago) by brad
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.319: +3 -2 lines
Diff to previous 1.319 (colored)

Fix a regression introduced when switching from rtsold to the kernel for
router solicitations. Send the router soliciation right away instead of
having a 60 second window between enabling SLAAC on the interface and the
router solicitation being sent.

ok florian@ stsp@ mpi@

Revision 1.319 / (download) - annotate - [select for diffs], Mon Feb 9 03:09:57 2015 UTC (9 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.318: +12 -9 lines
Diff to previous 1.318 (colored)

tweak the new if_input function so it takes an mbuf_list instead
of a single mbuf. this forces us to batch work between the hardware
rx handlers and the stack.

this includes a converstion of bge from ether_input to if_input.

ok claudio@ pelikan@ mpi@

Revision 1.318 / (download) - annotate - [select for diffs], Mon Feb 9 00:21:58 2015 UTC (9 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.317: +3 -1 lines
Diff to previous 1.317 (colored)

move the init of the if_input from ether_ifattach to if_attach.

ok mpi@

Revision 1.317 / (download) - annotate - [select for diffs], Sun Feb 8 06:00:52 2015 UTC (9 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.316: +22 -1 lines
Diff to previous 1.316 (colored)

Introduce if_input() a function to pass packets dequeued from a
recieving ring to the stack.

if_input() is at the moment a drop-in replacement for ether_input_mbuf()
but will let us stack pseudo-driver in a nice way in order to no longer
call ether_input() recursively.

ok pelikan@, reyk@, blambert@, henning@

Revision 1.316 / (download) - annotate - [select for diffs], Thu Feb 5 10:28:50 2015 UTC (9 years, 4 months ago) by henning
Branch: MAIN
Changes since 1.315: +8 -0 lines
Diff to previous 1.315 (colored)

implement SIOCIFAFATTACH and SIOCIFAFDETACH for AF_INET
SIOCIFAFATTACH is a noop
SIOCIFAFDETACH calls in_ifdetach(), thus removing all AF_INET addresses
ok phessler theo

Revision 1.315 / (download) - annotate - [select for diffs], Tue Jan 27 10:31:19 2015 UTC (9 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.314: +12 -21 lines
Diff to previous 1.314 (colored)

Ensure that link-local addresses are correctly configured on loopback
interfaces.

When the kernel automagically configures IPv6 addresses on loopback
interfaces, start by assigning a link-local address and then try to
assign "::1".

Only the first configured loopback interface per rdomain can have the
"::1" address.  But even if other loopback interfaces failed to get
this address, because it is already taken, give them a chance to have
a link-local address.

While here change in6_ifattach() to return an error value and remove
duplicated code.

Fix a regression introduced by the NOINET6 flag removal.

ok henning@, stsp@, florian@, benno@

Revision 1.314 / (download) - annotate - [select for diffs], Tue Jan 27 03:17:36 2015 UTC (9 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.313: +4 -5 lines
Diff to previous 1.313 (colored)

remove the second void * argument on tasks.

when workqs were introduced, we provided a second argument so you
could pass a thing and some context to work on it in. there were
very few things that took advantage of the second argument, so when
i introduced pools i suggested removing it. since tasks were meant
to replace workqs, it was requested that we keep the second argument
to make porting from workqs to tasks easier.

now that workqs are gone, i had a look at the use of the second
argument again and found only one good use of it (vdsp(4) on sparc64
if you're interested) and a tiny handful of questionable uses. the
vast majority of tasks only used a single argument. i have since
modified all tasks that used two args to only use one, so now we
can remove the second argument.

so this is a mechanical change. all tasks only passed NULL as their
second argument, so we can just remove it.

ok krw@

Revision 1.313 / (download) - annotate - [select for diffs], Wed Jan 21 02:23:14 2015 UTC (9 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.312: +7 -58 lines
Diff to previous 1.312 (colored)

Delete option COMPAT_43: support for pre-sa_len binaries has been obsolete
for a couple decades.  Keep the OSIOCGIFCONF ioctl to support COMPAT_LINUX
but move the rest of the Linux-specific ioctl() handling into linux_socket.c
This lets struct osockaddr finally move from sys/socket.h to protocols/talkd.h

ok krw@ deraadt@ mpi@

Revision 1.312 / (download) - annotate - [select for diffs], Wed Jan 14 00:37:19 2015 UTC (9 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.311: +2 -2 lines
Diff to previous 1.311 (colored)

It is sufficient to protect in6_ifattach() with splsoftnet().
OK mpi@

Revision 1.311 / (download) - annotate - [select for diffs], Sat Jan 10 11:43:37 2015 UTC (9 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.310: +6 -5 lines
Diff to previous 1.310 (colored)

Correct some comments and merge in6_if_up() into in6_ifattach() to
reflect that IPv6 link-local addresses are no longer automagically
configured the first time an interface is brought up.

ok henning@, stsp@

Revision 1.310 / (download) - annotate - [select for diffs], Tue Jan 6 21:26:46 2015 UTC (9 years, 5 months ago) by stsp
Branch: MAIN
Changes since 1.309: +33 -31 lines
Diff to previous 1.309 (colored)

Remove the NOINET6 interface flag, a left-over from the times when IPv6
was enabled by default. Add AFATTACH/AFDETACH ioctls which enable/disable
an address family for an interface (currently used for IPv6 only).

New kernel needs new ifconfig for IPv6 configuration (address assignment
still works with old ifconfig making this easy to cross over).

Committing on behalf of henning@ who is currently lebensmittelvergiftet.
ok stsp, benno, mpi

Revision 1.309 / (download) - annotate - [select for diffs], Fri Dec 19 17:14:39 2014 UTC (9 years, 5 months ago) by tedu
Branch: MAIN
Changes since 1.308: +1 -16 lines
Diff to previous 1.308 (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.308 / (download) - annotate - [select for diffs], Thu Dec 18 15:29:30 2014 UTC (9 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.307: +17 -12 lines
Diff to previous 1.307 (colored)

Change the link state change routing message generation to a taskq.
One less workq to worry about.

Tweaks from many. ok mpi@ mikeb@

Revision 1.307 / (download) - annotate - [select for diffs], Wed Dec 17 09:45:59 2014 UTC (9 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.306: +1 -6 lines
Diff to previous 1.306 (colored)

Use an interface index instead of a pointer for multicast options.

Output interface (port) selection for multicast traffic is not done via
route lookups.  Instead the output ifp is registred when setsockopt(2)
is called with the IP{V6,}_MULTICAST_IF option.  But since there is no
mechanism to invalidate such pointer stored in a pcb when an interface
is destroyed/removed, it might lead your kernel to fault.

Prevent a fault upon resume reported by frantisek holop, thanks!

ok mikeb@, claudio@

Revision 1.306 / (download) - annotate - [select for diffs], Mon Dec 8 10:46:14 2014 UTC (9 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.305: +5 -28 lines
Diff to previous 1.305 (colored)

There's no good reason to keep into "struct ifnet" a pointer that's only
used by enc(4) devices to attach their routes.

ok sthen@, mikeb@

Revision 1.305 / (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.304: +19 -22 lines
Diff to previous 1.304 (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.304 / (download) - annotate - [select for diffs], Sun Nov 23 07:39:02 2014 UTC (9 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.303: +7 -7 lines
Diff to previous 1.303 (colored)

length argument for some free() calls; ok doug

Revision 1.303 / (download) - annotate - [select for diffs], Mon Nov 3 11:02:08 2014 UTC (9 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.302: +1 -2 lines
Diff to previous 1.302 (colored)

Do no change the gateway of local routes for p2p interfaces.

This change was defeating the code in rtrequest1(9) checking for route
entries with the same dst/gw when the same IP address was configured on
multiple interfaces.

As a result, multiple local routes were created for the same address and
marked as multipath.  But changing their gateway to 127.0.0.1 would make
them similar and impossible to remove.  This would leaves entries with a
stall ifa pointer as soon as the address was removed.

Prevent a panic reported by todd@

Revision 1.302 / (download) - annotate - [select for diffs], Wed Oct 8 12:37:57 2014 UTC (9 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.301: +15 -100 lines
Diff to previous 1.301 (colored)

Tedu the RB-tree of addresses, thanks for all the fish!

ok henning@, dlg@, mikeb@

Revision 1.301 / (download) - annotate - [select for diffs], Tue Sep 30 08:27:57 2014 UTC (9 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.300: +28 -14 lines
Diff to previous 1.300 (colored)

Stop using the RB-tree in ifa_ifwithaddr() and make it lookup over
all the per-interface lists of addresses.

Teaks and ok bluhm@, ok kspillner@, claudio@

Revision 1.300 / (download) - annotate - [select for diffs], Mon Aug 25 14:00:34 2014 UTC (9 years, 9 months ago) by florian
Branch: MAIN
Changes since 1.299: +21 -1 lines
Diff to previous 1.299 (colored)

Move sending of router solicitations to the kernel; receiving and
processing of router advertisements was already in the kernel.
With this rtsol{,d}(8) is no longer necessary.

The kernel starts sending solicitations with
# ifconfig $IF inet6 autoconf
or
inet6 autoconf
in /etc/hostname.$IF.

input stsp@
much help & OK mpi@
tweaks & OK bluhm@

Revision 1.299 / (download) - annotate - [select for diffs], Thu Aug 14 11:38:14 2014 UTC (9 years, 9 months ago) by mikeb
Branch: MAIN
Changes since 1.298: +2 -2 lines
Diff to previous 1.298 (colored)

Compare number of allocated clusters with a low watermark, not
a magic number 4 since sometimes we can't fit a single packet
(jumbo frame) into 4 clusters.

OK dlg

Revision 1.298 / (download) - annotate - [select for diffs], Mon Aug 11 13:51:07 2014 UTC (9 years, 10 months ago) by mpi
Branch: MAIN
Changes since 1.297: +2 -7 lines
Diff to previous 1.297 (colored)

Use the RTF_LOCAL flag instead of abusing the RTF_LLINFO flag when
adding local route entries.

This hack made sense when we didn't have the RTF_LOCAL flag, but since
some months it is set on every local route.

Revision 1.297 / (download) - annotate - [select for diffs], Sat Jul 12 18:44:22 2014 UTC (9 years, 11 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.296: +12 -12 lines
Diff to previous 1.296 (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.296 / (download) - annotate - [select for diffs], Sat Jul 12 16:10:04 2014 UTC (9 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.295: +0 -10 lines
Diff to previous 1.295 (colored)

/* this has no effect on IP, and will kill all ISO connections XXX */
farewell, then. has been #ifdef notyet for the last 19 years

Revision 1.295 / (download) - annotate - [select for diffs], Fri Jul 11 21:54:38 2014 UTC (9 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.294: +1 -2 lines
Diff to previous 1.294 (colored)

"It's not the years, honey; it's the mileage."

bluetooth support doesn't work and isn't going anywhere. the current
design is a dead end, and should not be the basis for any future support.
general consensus says to whack it so as to not mislead the unwary.

Revision 1.294 / (download) - annotate - [select for diffs], Tue Jul 8 07:10:12 2014 UTC (9 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.293: +22 -7 lines
Diff to previous 1.293 (colored)

pull the rx ring accounting out of the mbuf layer now that its all done
via if_rxring things. this effectively deprecates the third argument
for MCLGETI and m_clget and makes the mbuf layer no longer care about
interfaces and simplifies the allocation paths.

the timeout used to measure livelock has been moved to net/if.c.

ok mpi@

Revision 1.293 / (download) - annotate - [select for diffs], Tue Jul 8 04:02:14 2014 UTC (9 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.292: +102 -1 lines
Diff to previous 1.292 (colored)

introduce the if_rxr api. it is intended to pull the rx ring accounting
out of the mbuf layer, and break the assumption that an interface will
only have a single ring per mbuf cluster size.

mpi@ is ok with moving this forward

Revision 1.292 / (download) - annotate - [select for diffs], Thu Jun 26 13:08:25 2014 UTC (9 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.291: +2 -1 lines
Diff to previous 1.291 (colored)

Calling in{6,}_purgeaddr() is not enough to remove an address from
an interface.  Two other operations are performed when issuing a
SIOCDIFADDR{_IN6,} ioctl: call the address hook and the per-driver
ioctl function.

Since carp(4) relies on an address hook to recalculate its hash, make
sure to call this hook when IFXF_NOINET6 is set or when the rdomain is
changed.

ok henning@, mikeb@

Revision 1.291 / (download) - annotate - [select for diffs], Mon Jun 23 18:51:15 2014 UTC (9 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.290: +3 -0 lines
Diff to previous 1.290 (colored)

turn of IPv6 for new interfaces by default. this really just means there
is no link-local address assigned by default, which - by default, since
INET6 is in the GENERIC kernels - makes the machine and services on it
reachable. No such thing in IPv4 land.
since assigning an inet6 address manually or running rtsol(d) etc resets the
NOINET6 flag and causes the link-local to be assigned, this really is a noop
for all inet6 users with the exception of those ONLY using the default
link-local address. These needs to run "ifconfig <if> inet6 eui64" or put
the equivalent in hostname.if.
discussed at length with many, ok at least by krw todd benno sthen

Revision 1.290 / (download) - annotate - [select for diffs], Sat Jun 7 11:04:14 2014 UTC (10 years ago) by henning
Branch: MAIN
Changes since 1.289: +0 -1 lines
Diff to previous 1.289 (colored)

g/c unused IFT_L2VLAN, ok reyk bluhm
the #define stays since it's userland visible and who knows what uses it

Revision 1.289 / (download) - annotate - [select for diffs], Fri May 16 08:21:54 2014 UTC (10 years ago) by mpi
Branch: MAIN
Changes since 1.288: +5 -25 lines
Diff to previous 1.288 (colored)

Do not put any link-layer address on the per-ifp lists or on the RB-
Tree.

Since interfaces only support one link-layer address accessible via the
if_sadl member, there's no need to have it elsewhere.  This improves
various address lookups because the first element of the list, the link-
layer address, won't necessarily be discarded.

Finally remove the empty netmask associated to every link-layer address.
This hack was needed to (ab)use the address & netmask comparison code to
do a strcmp() on the interface name embedded in the sdl_data field.

ok henning@, claudio@

Revision 1.288 / (download) - annotate - [select for diffs], Tue May 13 14:33:25 2014 UTC (10 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.287: +6 -3 lines
Diff to previous 1.287 (colored)

While Rev 1.285 fixed a RB tree corruption it caused a TAILQ corruption
in the case where the rdomain was not switched. Make sure ifa_add() is
only called if ifa_del() was called previously. Hopefully we got all the
corruption fixed.
With and OK mpi@

Revision 1.287 / (download) - annotate - [select for diffs], Mon May 5 11:44:33 2014 UTC (10 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.286: +66 -1 lines
Diff to previous 1.286 (colored)

Use a custom ifa_rtrequest function for point-to-point interfaces
instead of relying on hacks in nd6_rtrequest() to add a route to
loopback for each address configured on such interfaces.

While here document that abusing lo0 for local traffic is not safe
for interfaces in a non-default rdomain.

Tested by claudio@, jca@ and sthen@, ok sthen@

Revision 1.286 / (download) - annotate - [select for diffs], Tue Apr 22 12:35:00 2014 UTC (10 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.285: +7 -13 lines
Diff to previous 1.285 (colored)

ifa_ifwithroute() is the only magic place where an AF_LINK sockaddr
can be given to ifa_ifwithnet().

Handle this specific case directly and let ifa_ifwithnet() do only
one thing:  iterate on all the addresses of all the interfaces in a
given routing domain to return the most specific matching address.

ok mikeb@

Revision 1.285 / (download) - annotate - [select for diffs], Sun Apr 20 11:25:18 2014 UTC (10 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.284: +9 -1 lines
Diff to previous 1.284 (colored)

When switching rdomains the sadl needs to be removed and re-added from the
RB lookup tree because the rdomain id is part of the lookup key.
Without this the RB tree gets corrupted and in the worst case a use after
free can happen when the interface is destroyed.
Why the sadl addresses are added to the tree in the first place is something
to reconsider.
OK henning@, mpi@, sthen@

Revision 1.284 / (download) - annotate - [select for diffs], Sat Apr 19 12:27:59 2014 UTC (10 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.283: +0 -13 lines
Diff to previous 1.283 (colored)

remove the altq enable/attach and disable/detach bits

Revision 1.283 / (download) - annotate - [select for diffs], Thu Apr 10 13:47:21 2014 UTC (10 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.282: +2 -2 lines
Diff to previous 1.282 (colored)

Retire rtinit() an use rt_ifa_add(9) and rt_ifa_del(9) to manage
connected routes to prefixes/hosts.

Since the introduction of rt_ifa_addloop(9) and rt_ifa_delloop(9),
rtinit() was just a wrapper, so use the underlying functions
directly and document them.

Inputs from and ok mikeb@, manpage tweaks from jmc@

Revision 1.282 / (download) - annotate - [select for diffs], Thu Mar 20 13:19:06 2014 UTC (10 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.281: +11 -1 lines
Diff to previous 1.281 (colored)

Do not pull <sys/tree.h> unconditionally in <net/if.h>, only the address
tree and the 80211 nodes need it.

ok henning@, mikeb@

Revision 1.281 / (download) - annotate - [select for diffs], Wed Mar 19 13:49:12 2014 UTC (10 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.280: +13 -22 lines
Diff to previous 1.280 (colored)

Since in{,6}_ifdetach() take care of removing the IPv4/6 addresses
from the per-ifp list when an interface is destroyed/removed the
only address left on the list at this point is the link-layer one.

So remove the custom loop and its associated hack for the link-layer
address and simply call if_free_sadl().

As a side effect, this should fix any scenario where if_alloc_sadl()
is called multiple time since the first link-layer address allocated
was never removed from the per-ifp list.

Revision 1.280 / (download) - annotate - [select for diffs], Tue Feb 4 01:04:03 2014 UTC (10 years, 4 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.279: +2 -2 lines
Diff to previous 1.279 (colored)

reduce the length of some pool names. ok deraadt guenther mpi

Revision 1.279 / (download) - annotate - [select for diffs], Thu Nov 28 10:16:44 2013 UTC (10 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.278: +3 -2 lines
Diff to previous 1.278 (colored)

Change the way protocol multicast addresses are linked to an interface.

Instead of linking multicast records to the first configured address of
the corresponding protocol, making this address and its position in the
global list special, add them to a new list directly linked to the
interface descriptor.

This new multicast address list is similar to the address list, all its
elements contain a protocol agnostic part.  This design allows us to
be able to join a multicast group without necessarily having a configured
address.  That means IPv6 multicast kludges are no longer needed.

Another benefit is to be able to add and remove an IP address from an
interface without worrying about multicast records.  That means that the
global IPv4 list is no longer needed since the first configured address
of an interface is no longer special.

This new list might also be extended in the future to contain the
link-layer addresses used to configure hardware filters.

Tested by sthen@ and weerd@, ok mikeb@

Revision 1.278 / (download) - annotate - [select for diffs], Wed Nov 27 08:34:40 2013 UTC (10 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.277: +4 -4 lines
Diff to previous 1.277 (colored)

Let's call a rtableid a rtableid.

ok mikeb@, henning@, claudio@

Revision 1.277 / (download) - annotate - [select for diffs], Tue Nov 19 09:00:43 2013 UTC (10 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.276: +1 -2 lines
Diff to previous 1.276 (colored)

Remove some FDDI/ATM leftovers.

ok mikeb@, henning@, deraadt@, brad@, miod@

Revision 1.276 / (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.275: +6 -11 lines
Diff to previous 1.275 (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.275 / (download) - annotate - [select for diffs], Mon Nov 11 09:15:34 2013 UTC (10 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.274: +9 -5 lines
Diff to previous 1.274 (colored)

Replace most of our formating functions to convert IPv4/6 addresses from
network to presentation format to inet_ntop().

The few remaining functions will be soon converted.

ok mikeb@, deraadt@ and moral support from henning@

Revision 1.274 / (download) - annotate - [select for diffs], Wed Oct 23 15:12:42 2013 UTC (10 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.273: +1 -2 lines
Diff to previous 1.273 (colored)

Remove the number of in_var.h inclusions by moving some functions and
global variables to in.h.

ok mikeb@, deraadt@

Revision 1.273 / (download) - annotate - [select for diffs], Mon Oct 21 08:44:13 2013 UTC (10 years, 7 months ago) by phessler
Branch: MAIN
Changes since 1.272: +18 -2 lines
Diff to previous 1.272 (colored)

Enable IPv6 routing domain support

Started by claudio@ for IPv4, lots of heavy work by sperreault@

My part started at s2k11, continued at n2k12, g2k12, c2k12 and n2k13.

Lots of help and hints from claudio and bluhm

OK claudio@, bluhm@

Revision 1.272 / (download) - annotate - [select for diffs], Sun Oct 20 13:21:56 2013 UTC (10 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.271: +3 -3 lines
Diff to previous 1.271 (colored)

rt_mpath_next() was always called with 0 in the last argument. So drop it.
OK henning@

Revision 1.271 / (download) - annotate - [select for diffs], Sat Oct 19 14:54:18 2013 UTC (10 years, 7 months ago) by mikeb
Branch: MAIN
Changes since 1.270: +27 -6 lines
Diff to previous 1.270 (colored)

in order to make our life a tad easier and prevent rogue accesses
to the routing table from the hardware interrupt context defer the
if_link_state_change to the process context.

a token (an interface index) is passed to the workq in order to
make sure that if the interface would be gone by the time syswq
goes around to run the task it would just fall through.

ok henning, mpi, deraadt, claudio

Revision 1.270 / (download) - annotate - [select for diffs], Sat Oct 19 14:05:14 2013 UTC (10 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.269: +8 -15 lines
Diff to previous 1.269 (colored)

Bring back the if_detachhook.  We're going to have more users now.

ok mpi@ henning@ benno@

Revision 1.269 / (download) - annotate - [select for diffs], Sat Oct 19 11:11:24 2013 UTC (10 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.268: +29 -23 lines
Diff to previous 1.268 (colored)

When we attach an interface, do not try to reuse the last index to
limit the possible races related to unscheduled task, or anything
else, relying on an unique index.

I say "limit" here because a race can still occurs if you run out
of indexes and jump back to 1.  A generation number can be added
later to avoid this problem.

ok deraadt@, claudio@, krw@, mikeb@, "I can live with it" reyk@

Revision 1.268 / (download) - annotate - [select for diffs], Thu Oct 17 16:27:40 2013 UTC (10 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.267: +2 -1 lines
Diff to previous 1.267 (colored)

The header file netinet/in_var.h included netinet6/in6_var.h.  This
created a bunch of useless dependencies.  Remove this implicit
inclusion and do an explicit #include <netinet6/in6_var.h> when it
is needed.
OK mpi@ henning@

Revision 1.267 / (download) - annotate - [select for diffs], Wed Oct 9 09:33:42 2013 UTC (10 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.266: +6 -17 lines
Diff to previous 1.266 (colored)

Introduce in_ifdetach() a function to remove all the IPv4 addresses
of an interface, named after its IPv6 equivalent.

Make use of it instead of removing addresses by hand when detaching
or destroying an interface.  As a bonus, multicast records linked
to the just divorced^Wdetached interface are no longer leaked.

No objection from the gang, ok mikeb@

Revision 1.266 / (download) - annotate - [select for diffs], Tue Sep 17 13:34:17 2013 UTC (10 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.265: +15 -8 lines
Diff to previous 1.265 (colored)

Change vlan(4) detach procedure to not use a hook but a list of vlans
on the parent interface.  This is similar to what bridge(4), trunk(4)
or carp(4) are doing and allows us to get rid of the detachhook.

ok reyk@, mikeb@

Revision 1.265 / (download) - annotate - [select for diffs], Thu Sep 12 09:52:46 2013 UTC (10 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.264: +22 -28 lines
Diff to previous 1.264 (colored)

Revert previous diff to always increment the interface index, tun_switch()
depends on this feature, discussed with claudio@.

Revision 1.264 / (download) - annotate - [select for diffs], Wed Aug 28 07:38:50 2013 UTC (10 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.263: +29 -23 lines
Diff to previous 1.263 (colored)

When we attach an interface, do not try to reuse the last index to limit
the possible races related to unscheduled task relying on an unique index.

I say "limit" here because a race can still occurs if you run out of
indexes and jump back to 1.

ok krw@, mikeb@

Revision 1.263 / (download) - annotate - [select for diffs], Wed Aug 28 06:58:57 2013 UTC (10 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.262: +3 -3 lines
Diff to previous 1.262 (colored)

Remove unused argument from *rtrequest()

ok krw@, mikeb@

Revision 1.262 / (download) - annotate - [select for diffs], Tue Aug 20 09:14:22 2013 UTC (10 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.261: +1 -4 lines
Diff to previous 1.261 (colored)

tedu netnatm and ueagle(4).

ok mikeb@, sthen@, tedu@ (implied), doc bits ok jmc@

Revision 1.261 / (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.260: +17 -6 lines
Diff to previous 1.260 (colored)

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

Reported by naddy@

Revision 1.260 / (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.259: +6 -17 lines
Diff to previous 1.259 (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.259 / (download) - annotate - [select for diffs], Tue Jun 18 22:42:56 2013 UTC (10 years, 11 months ago) by uebayasi
Branch: MAIN
Changes since 1.258: +4 -10 lines
Diff to previous 1.258 (colored)

Use malloc(M_WAITOK) in if_attach_common(), because this function must
succeed, and it's always called in sleepable context.

OK mikeb@ yasuoka@

Revision 1.258 / (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.257: +12 -24 lines
Diff to previous 1.257 (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.257 / (download) - annotate - [select for diffs], Fri Mar 29 12:20:34 2013 UTC (11 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.256: +19 -20 lines
Diff to previous 1.256 (colored)

Replace hand-crafted loops in if.c with the FOREACH macro.
OK tedu@ claudio@

Revision 1.256 / (download) - annotate - [select for diffs], Thu Mar 28 23:10:05 2013 UTC (11 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.255: +2 -1 lines
Diff to previous 1.255 (colored)

code that calls timeout functions should include timeout.h
slipped by on i386, but the zaurus doesn't automagically pick it up.
spotted by patrick

Revision 1.255 / (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.254: +1 -2 lines
Diff to previous 1.254 (colored)

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

Revision 1.254 / (download) - annotate - [select for diffs], Thu Mar 28 12:06:55 2013 UTC (11 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.253: +3 -5 lines
Diff to previous 1.253 (colored)

Replace some casts to struct in_ifaddr pointer by ifatoia() or NULL.

ok millert@, haesbaert@, bluhm@

Revision 1.253 / (download) - annotate - [select for diffs], Tue Mar 26 13:19:25 2013 UTC (11 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.252: +2 -4 lines
Diff to previous 1.252 (colored)

Remove various read-only *maxlen variables and use IFQ_MAXLEN directly.

ok beck@, mikeb@

Revision 1.252 / (download) - annotate - [select for diffs], Wed Mar 20 10:34:12 2013 UTC (11 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.251: +19 -7 lines
Diff to previous 1.251 (colored)

Introduce if_get() to retrieve an interface descriptor pointer given
an interface index and replace all the redondant checks and accesses
to a global array by a call to this function.

With imputs from and ok bluhm@, mikeb@

Revision 1.251 / (download) - annotate - [select for diffs], Fri Mar 15 20:45:34 2013 UTC (11 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.250: +3 -3 lines
Diff to previous 1.250 (colored)

change LIST_END to literal NULL for clarity.
ok claudio mpi

Revision 1.250 / (download) - annotate - [select for diffs], Thu Mar 7 09:40:19 2013 UTC (11 years, 3 months ago) by mpi
Branch: MAIN
Changes since 1.249: +1 -22 lines
Diff to previous 1.249 (colored)

Remove unused ifa_ifwithaf() function.

ok mikeb@, miod@

Revision 1.249 / (download) - annotate - [select for diffs], Thu Mar 7 09:03:16 2013 UTC (11 years, 3 months ago) by mpi
Branch: MAIN
Changes since 1.248: +5 -5 lines
Diff to previous 1.248 (colored)

Remove the IFAFREE() macro, the ifafree() function it was calling already
check for the reference counter.

ok mikeb@, miod@, pelikan@, kettenis@, krw@

Revision 1.248 / (download) - annotate - [select for diffs], Fri Nov 23 20:12:03 2012 UTC (11 years, 6 months ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.247: +5 -1 lines
Diff to previous 1.247 (colored)

Add SIOCGIFHARDMTU to allow retrieving the driver's maximum supported MTU
looks fine reyk@ ok mikeb@

Revision 1.247 / (download) - annotate - [select for diffs], Tue Oct 23 17:41:00 2012 UTC (11 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.246: +3 -5 lines
Diff to previous 1.246 (colored)

Only clear the revarp_ifp if the ifp pointing to it is detached.
Since the ifp is not detached in the SIOCSIFRDOMAIN case remove the
clear there. With and OK deraadt@

Revision 1.246 / (download) - annotate - [select for diffs], Thu Oct 18 00:36:21 2012 UTC (11 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.245: +6 -5 lines
Diff to previous 1.245 (colored)

Move revarp code into #ifdef NFSCLIENT; saving space on some media.
Resurrect the rather silly "unplug my network device while I am
doing nfs diskless revarp" safety code which was disabled due to
a missing "ether.h" include, found by jsg
ok jsg

Revision 1.245 / (download) - annotate - [select for diffs], Fri Oct 5 17:17:04 2012 UTC (11 years, 8 months ago) by camield
Branch: MAIN
Changes since 1.244: +4 -4 lines
Diff to previous 1.244 (colored)

Point an interface directly to its bridgeport configuration, instead
of to the bridge itself.  This is ok, since an interface can only be part
of one bridge, and the parent bridge is easy to find from the bridgeport.

This way we can get rid of a lot of list walks, improving performance
and shortening the code.

ok henning stsp sthen reyk

Revision 1.244 / (download) - annotate - [select for diffs], Wed Sep 19 16:14:01 2012 UTC (11 years, 8 months ago) by blambert
Branch: MAIN
Changes since 1.243: +3 -5 lines
Diff to previous 1.243 (colored)

Make rt_lookup return a pointer to an rtentry struct instead of
to a radix_node struct.

The radix tree pushdown continues.

ok claudio@

Revision 1.243 / (download) - annotate - [select for diffs], Wed Sep 19 12:35:07 2012 UTC (11 years, 8 months ago) by blambert
Branch: MAIN
Changes since 1.242: +11 -12 lines
Diff to previous 1.242 (colored)

More radix internals pushdown; place rn_mpath_next, which accepts and
returns radix_node pointers, inside a new rt_mpath_next, which accepts
and returns rtentry pointers, and start using that instead.

ok claudio@

Revision 1.242 / (download) - annotate - [select for diffs], Tue Sep 18 08:16:33 2012 UTC (11 years, 8 months ago) by blambert
Branch: MAIN
Changes since 1.241: +17 -14 lines
Diff to previous 1.241 (colored)

Wrap rtable_add() and rtable_l2set() calls inside ifioctl() inside softnet,
as functions that modify routing information shouldn't be interruptable by
network traffic.

Also make sure that both of those functions assert that they are called
at softnet. I'm reasonably sure that there shouldn't be any, but if there
is any codepath that was missed, we're going to be here for another 4 days
to deal with any fallout.

While here, move the multitude of "int s" declarations inside ifioctl to
the beginning of the function.

okay claudio@

Revision 1.241 / (download) - annotate - [select for diffs], Tue Jan 3 23:41:51 2012 UTC (12 years, 5 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.240: +3 -4 lines
Diff to previous 1.240 (colored)

To access the ifaddr of an in_ifaddr or in6_ifaddr struct, it is
cleaner to access the first member via ia_ifa instead of casting.
No binary change.
ok henning@ krw@

Revision 1.240 / (download) - annotate - [select for diffs], Mon Oct 24 17:51:31 2011 UTC (12 years, 7 months ago) by camield
Branch: MAIN
Changes since 1.239: +3 -8 lines
Diff to previous 1.239 (colored)

Don't detach interface from group in if_clone_destroy(),
if_detach() handles this ok.  carpdetach() can now lower the demote
count on the carp group correctly.

ok henning mpf

Revision 1.239 / (download) - annotate - [select for diffs], Sat Jul 9 00:47:18 2011 UTC (12 years, 11 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.238: +1 -5 lines
Diff to previous 1.238 (colored)

begone, fucking rotten appletalk shit. ok room

Revision 1.238 / (download) - annotate - [select for diffs], Fri Jul 8 18:48:51 2011 UTC (12 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.237: +26 -24 lines
Diff to previous 1.237 (colored)

new priority queueing implementation, extremely low overhead, thus fast.
unconditional, always on. 8 priority levels, as every better switch, the
vlan header etc etc. ok ryan mpf sthen, pea tested as well

Revision 1.237 / (download) - annotate - [select for diffs], Wed Jul 6 02:42:28 2011 UTC (12 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.236: +2 -2 lines
Diff to previous 1.236 (colored)

cosnistently use IFQ_SET_MAXLEN, surfaced in a discussion with + ok bluhm

Revision 1.236 / (download) - annotate - [select for diffs], Tue Jul 5 00:58:27 2011 UTC (12 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.235: +1 -19 lines
Diff to previous 1.235 (colored)

now of course I only noticed if_qflush is completely unused after
adjusting it to the new world order in my tree... remove it, ok ryan claudio

Revision 1.235 / (download) - annotate - [select for diffs], Mon Jul 4 22:53:53 2011 UTC (12 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.234: +4 -4 lines
Diff to previous 1.234 (colored)

remove compat_svr4 support.  ok deraadt

Revision 1.234 / (download) - annotate - [select for diffs], Sun Mar 13 15:31:41 2011 UTC (13 years, 3 months ago) by stsp
Branch: MAIN
Changes since 1.233: +26 -1 lines
Diff to previous 1.233 (colored)

Add a way to enable/disable Wake On LAN with ifconfig.
ok deraadt

Revision 1.233 / (download) - annotate - [select for diffs], Tue Jan 25 05:44:05 2011 UTC (13 years, 4 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.232: +2 -2 lines
Diff to previous 1.232 (colored)

pool is properly spelled pl.  makes this one fit in netstat column.

Revision 1.232 / (download) - annotate - [select for diffs], Tue Jan 18 19:10:25 2011 UTC (13 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.231: +4 -2 lines
Diff to previous 1.231 (colored)

When changing the ifa_broadaddr broadcast address, ifa_update_broadaddr()
copied the pointer to the sockaddr instead of the content of
sockaddr_in.  As the source of the data resides on the stack, the
pointer got invalid later and the kernel crashed.  As only addresses
with fixed size are used, sa_len bytes of the sockaddr can be
coppied.
ok krw@ markus@ mpf@ claudio@ henning@

Revision 1.231 / (download) - annotate - [select for diffs], Mon Nov 29 19:38:59 2010 UTC (13 years, 6 months ago) by miod
Branch: MAIN
Changes since 1.230: +3 -1 lines
Diff to previous 1.230 (colored)

Let ifa_print_rb() build on INET6-free kernels. Repairs RAMDISK on a few
platforms.

Revision 1.230 / (download) - annotate - [select for diffs], Wed Nov 17 19:43:23 2010 UTC (13 years, 6 months ago) by henning
Branch: MAIN
Changes since 1.229: +12 -22 lines
Diff to previous 1.229 (colored)

make ifa_ifwithaddr use the RB tree for lookups instead of nested list
walking. make the function shorter, easier and faster with many addresses
while still being at least as fast as the old one with a common "on real IP"
setup. tested by many, ok claudio sthen dlg krw

Revision 1.229 / (download) - annotate - [select for diffs], Wed Nov 17 19:40:55 2010 UTC (13 years, 6 months ago) by henning
Branch: MAIN
Changes since 1.228: +32 -1 lines
Diff to previous 1.228 (colored)

add ifa_print_rb(), dumps the RB tree to the console, can be called from
ddb>, ok claudio dlg krw sthen

Revision 1.228 / (download) - annotate - [select for diffs], Wed Nov 17 19:34:49 2010 UTC (13 years, 6 months ago) by henning
Branch: MAIN
Changes since 1.227: +9 -1 lines
Diff to previous 1.227 (colored)

maintain an RB tree of ifaddrs in the system (addresses and broadcast addrs,
the latter is also the dest addr on P2P interfaces) for faster lookups in
the future. walking the linked list of all interfaces in the system to walk
the linked list of addresses on each of them isn't particularily fast,
especially with many interfaces and addresses.
written at n2k10 in australia in january, but had to be backed
out. the offenders have been fixed:
-ipvshit rtsol code calling these functions in interrupt context
(surprised this hasn't caused more havoc)
-various places in the stack added empty ifaddr structs, filling them in later
-sloppy recycling of ifaddrs in some places
finished at j2k10 in japan in september
tested by many, ok sthen krw dlg claudio

Revision 1.227 / (download) - annotate - [select for diffs], Wed Nov 17 18:51:57 2010 UTC (13 years, 6 months ago) by henning
Branch: MAIN
Changes since 1.226: +7 -1 lines
Diff to previous 1.226 (colored)

introduce ifa_update_broadaddr to update an ifaddr's broadcast address,
trivial for the moment, more needed soon
tested by many as part of a larger diff, ok sthen claudio dlg krw

Revision 1.226 / (download) - annotate - [select for diffs], Mon Oct 25 11:33:06 2010 UTC (13 years, 7 months ago) by blambert
Branch: MAIN
Changes since 1.225: +3 -7 lines
Diff to previous 1.225 (colored)

move to static initializers for the ifnet/ifg_head TAILQ's
fixes a race-based kernel crash under rare circumstances

reported and fix tested by chefren att pi daht net

ok claudio@ henning@

Revision 1.225 / (download) - annotate - [select for diffs], Fri Aug 27 17:08:01 2010 UTC (13 years, 9 months ago) by jsg
Branch: MAIN
Changes since 1.224: +1 -9 lines
Diff to previous 1.224 (colored)

remove the unused if_init callback in struct ifnet
ok deraadt@ henning@ claudio@

Revision 1.224 / (download) - annotate - [select for diffs], Wed Aug 25 14:07:24 2010 UTC (13 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.223: +14 -3 lines
Diff to previous 1.223 (colored)

Let rtable_add() return usefull errnos so that the ioctl handler and the
rtsock code can return a more reasonable error to the user.
OK henning

Revision 1.223 / (download) - annotate - [select for diffs], Wed Aug 25 13:57:07 2010 UTC (13 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.222: +6 -6 lines
Diff to previous 1.222 (colored)

Move the iface specific ioctl call for SIOCSIFRDOMAIN further down so that
all the magic cleanup happens before. This is needed because mpe(4) needs
to add a route which would be removed by the cleanup code.
OK henning

Revision 1.222 / (download) - annotate - [select for diffs], Wed Aug 25 13:06:09 2010 UTC (13 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.221: +2 -1 lines
Diff to previous 1.221 (colored)

When setting a rdomain also force -inet6 aka IFXF_NOINET6 on the interface
since IPv6 is not rdomain aware and freaks out about it.
OK henning

Revision 1.221 / (download) - annotate - [select for diffs], Tue Aug 24 16:13:32 2010 UTC (13 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.220: +3 -3 lines
Diff to previous 1.220 (colored)

spaces

Revision 1.220 / (download) - annotate - [select for diffs], Tue Aug 24 16:00:16 2010 UTC (13 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.219: +3 -1 lines
Diff to previous 1.219 (colored)

Add a splnet() around a block that needs it for sure. Maybe more in
SIOCSIFRDOMAIN should be protected but this is by far the biggest
offender. The same codepath in if_detach() runs at splnet().

Revision 1.219 / (download) - annotate - [select for diffs], Sat Jul 31 20:48:32 2010 UTC (13 years, 10 months ago) by blambert
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.218: +2 -1 lines
Diff to previous 1.218 (colored)

another pair of files which relied on mbuf.h for pool.h; should be the last,
as the kernel now compiles w/o ``#include <sys/pool.h>'' in mbuf.h; removing
that line, though, is for another day, as a userland program (systat, IIRC)
fails to build without it there.

ok krw@

Revision 1.218 / (download) - annotate - [select for diffs], Sat Jul 3 04:44:51 2010 UTC (13 years, 11 months ago) by guenther
Branch: MAIN
Changes since 1.217: +5 -5 lines
Diff to previous 1.217 (colored)

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains.  This changes the name of the
system calls, socket option, and ioctl.  After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me

Revision 1.217 / (download) - annotate - [select for diffs], Tue Jun 29 21:28:37 2010 UTC (13 years, 11 months ago) by reyk
Branch: MAIN
Changes since 1.216: +8 -11 lines
Diff to previous 1.216 (colored)

Replace enc(4) with a new implementation as a cloner device.  We still
create enc0 by default, but it is possible to add additional enc
interfaces.  This will be used later to allow alternative encs per
policy or to have an enc per rdomain when IPsec becomes rdomain-aware.

manpage bits ok jmc@
input from henning@ deraadt@ toby@ naddy@
ok henning@ claudio@

Revision 1.216 / (download) - annotate - [select for diffs], Fri May 28 12:09:09 2010 UTC (14 years ago) by claudio
Branch: MAIN
Changes since 1.215: +25 -1 lines
Diff to previous 1.215 (colored)

Rework the way we handle MPLS in the kernel. Instead of fumbling MPLS into
ether_output() and later on other L2 output functions use a trick and over-
load the ifp->if_output() function pointer on MPLS enabled interfaces to
go through mpls_output() which will then call the link level output function.
By setting IFXF_MPLS on an interface the output pointers are switched.
This now allows to cleanup the MPLS input and output pathes and fix mpe(4)
so that the MPLS code now actually works for both P and PE systems.
Tested by myself and michele
(A custom kernel with MPLS and mpe enabled is still needed).

Revision 1.215 / (download) - annotate - [select for diffs], Sat May 8 11:07:20 2010 UTC (14 years, 1 month ago) by stsp
Branch: MAIN
Changes since 1.214: +4 -1 lines
Diff to previous 1.214 (colored)

While handling SIOCSIFLLADDR, after adjusting the MAC of the interface,
call the interface-specific ioctl handler as well in case the driver
needs to do something special. E.g. if_trunk expects this in order to
update MAC addresses of its trunk ports.

If you now see "Inappropriate ioctl for device" errors after running
"ifconfig $if lladdr random" please let me know. Most likely the ioctl
handler of the driver needs fixing.

ok claudio@, "I only count half an ok for networking" tedu@

Revision 1.214 / (download) - annotate - [select for diffs], Sun Apr 25 17:38:53 2010 UTC (14 years, 1 month ago) by mpf
Branch: MAIN
Changes since 1.213: +3 -3 lines
Diff to previous 1.213 (colored)

Properly adjust group demotion counters when groups are added or
removed.  Extend carp demote logging to also show the reason for
the demote.  Return EINVAL instead of ERANGE if a carpdemote request
is out range.  Requested from otto.
OK mcbride, henning.

Revision 1.213 / (download) - annotate - [select for diffs], Sat Apr 17 18:31:41 2010 UTC (14 years, 1 month ago) by stsp
Branch: MAIN
Changes since 1.212: +18 -1 lines
Diff to previous 1.212 (colored)

When the MAC address changes, change the IPv6 link local address
accordingly if one is configured and we're not a router.
Else IPv6 will leak the old MAC address after "ifconfig $if lladdr random".
Based on an initial diff and idea from Theo.

OK deraadt, "makes sense" and help by naddy, silent agreement by claudio

Revision 1.212 / (download) - annotate - [select for diffs], Sat Apr 17 17:46:32 2010 UTC (14 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.211: +41 -17 lines
Diff to previous 1.211 (colored)

split SIOCSIFLLADDR code out into an ifnewlladr() function
ok stsp

Revision 1.211 / (download) - annotate - [select for diffs], Mon Mar 8 21:00:27 2010 UTC (14 years, 3 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.210: +1 -3 lines
Diff to previous 1.210 (colored)

argh, in del too, simultaneously spotted by kettenis and me

Revision 1.210 / (download) - annotate - [select for diffs], Mon Mar 8 20:52:52 2010 UTC (14 years, 3 months ago) by henning
Branch: MAIN
Changes since 1.209: +1 -3 lines
Diff to previous 1.209 (colored)

aye, broadcast addr too. spotted by kettenis

Revision 1.209 / (download) - annotate - [select for diffs], Mon Mar 8 20:29:41 2010 UTC (14 years, 3 months ago) by henning
Branch: MAIN
Changes since 1.208: +1 -3 lines
Diff to previous 1.208 (colored)

don't call ifa_item_add/del in ifa_add/del, so the ifa RB tree doesn't
get used at all. turns out this needs more work - after release.

Revision 1.208 / (download) - annotate - [select for diffs], Fri Mar 5 13:52:23 2010 UTC (14 years, 3 months ago) by henning
Branch: MAIN
Changes since 1.207: +22 -12 lines
Diff to previous 1.207 (colored)

in ifa_ifwithaddr, do not use the shiny new RB tree, there is a
balancing issue from wrong order of operations (change after insert is
illegal with RB). and apparently there are cases left. to be revisited
after release

Revision 1.207 / (download) - annotate - [select for diffs], Wed Jan 13 02:29:51 2010 UTC (14 years, 5 months ago) by henning
Branch: MAIN
Changes since 1.206: +11 -21 lines
Diff to previous 1.206 (colored)

make ifa_ifwithaddr use the shiny new ifaddr RB tree instead of traversing
the list of all interfaces and traversing the list of all addresses on each
interface.
if bugs show up with addressing this is the #1 backout candidate, something
i missed might fuck with ifaddrs behind our back, although i looked &
tested hard. 10x to naddy for inet6 testing.
ok theo ryan dlg

Revision 1.206 / (download) - annotate - [select for diffs], Wed Jan 13 02:26:49 2010 UTC (14 years, 5 months ago) by henning
Branch: MAIN
Changes since 1.205: +76 -1 lines
Diff to previous 1.205 (colored)

maintain a global RB tree of all local addresses in the system. this
includes AF_LINK addresses (aka mac addresses in the ethernet case). for
inet this also includes the broadcast addresses.
depends on ifinit() called earlier so we have a chance to pool_init before
autoconf assigns the AF_LINK addresses, the v6 fix, and the ifa_add/del
abstraction i just committed.
this is a change in semantics, it is now illegal to change the actual
address in an ifaddr struct because then the RB tree becomes unbalanced.
nothing using this tree yet.
ok theo ryan dlg

Revision 1.205 / (download) - annotate - [select for diffs], Wed Jan 13 02:13:12 2010 UTC (14 years, 5 months ago) by henning
Branch: MAIN
Changes since 1.204: +21 -5 lines
Diff to previous 1.204 (colored)

instead of fiddling with the per-interface address lists directly in
many places create a proper API (ifa_add / ifa_del) and use it.
ok theo ryan dlg

Revision 1.204 / (download) - annotate - [select for diffs], Tue Jan 12 04:05:47 2010 UTC (14 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.203: +1 -22 lines
Diff to previous 1.203 (colored)

Move initialization of the MCLGETI ticker to mbinit(), instead of ifinit()
ok henning

Revision 1.203 / (download) - annotate - [select for diffs], Fri Jan 8 19:21:19 2010 UTC (14 years, 5 months ago) by stsp
Branch: MAIN
Changes since 1.202: +13 -6 lines
Diff to previous 1.202 (colored)

During "ifconfig $if -inet6" remove v6 addresses even if the
interface is marked down, and wrap interface detach/attach in splnet().

ok henning@ todd@, "I like the idea" deraadt@

Revision 1.202 / (download) - annotate - [select for diffs], Sun Dec 13 09:41:04 2009 UTC (14 years, 6 months ago) by jsing
Branch: MAIN
Changes since 1.201: +3 -0 lines
Diff to previous 1.201 (colored)

Ensure that if_start() is called at IPL_NET.

ok claudio@

Revision 1.201 / (download) - annotate - [select for diffs], Sat Nov 21 14:08:14 2009 UTC (14 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.200: +3 -1 lines
Diff to previous 1.200 (colored)

Add a way to bind the tunnel endpoint of a gif/gre interface into a
different rdomain than the default one. This allows to do MPLS VPNs
without the MPLS madness.  OK deraadt@, henning@

Revision 1.200 / (download) - annotate - [select for diffs], Tue Nov 3 10:59:04 2009 UTC (14 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.199: +10 -1 lines
Diff to previous 1.199 (colored)

rtables are stacked on rdomains (it is possible to have multiple routing
tables on top of a rdomain) but until now our code was a crazy mix so that
it was impossible to correctly use rtables in that case. Additionally pf(4)
only knows about rtables and not about rdomains. This is especially bad when
tracking (possibly conflicting) states in various domains.
This diff fixes all or most of these issues. It adds a lookup function to
get the rdomain id based on a rtable id. Makes pf understand rdomains and
allows pf to move packets between rdomains (it is similar to NAT).
Because pf states now track the rdomain id as well it is necessary to modify
the pfsync wire format. So old and new systems will not sync up.
A lot of help by dlg@, tested by sthen@, jsg@ and probably more
OK dlg@, mpf@, deraadt@

Revision 1.199 / (download) - annotate - [select for diffs], Wed Aug 12 15:58:20 2009 UTC (14 years, 10 months ago) by henning
Branch: MAIN
Changes since 1.198: +3 -2 lines
Diff to previous 1.198 (colored)

dlg deferred calling interfaces' if_start routine so we call them less,
which does pay out, performance wise. one of the conditions to call the
interfaces' if_start routine immediately was "send queue is full".
on a very busy (hammered) machine this will itroduce too much latency
since we spend almost all cpu time in interrupt handlers and softnet,
so the softint actually doing the if_start gets called to seldom and
the queue full check is what triggers the actual transmit.
change the logic to call if's if_start routing immediately when there are
at least 8 packets (or in case if maxlen being smaller than 8, maxlen)
8 chose because it shows best performance in my test setup here.
ok dlg

Revision 1.198 / (download) - annotate - [select for diffs], Mon Aug 10 11:22:10 2009 UTC (14 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.197: +27 -1 lines
Diff to previous 1.197 (colored)

At sys_reboot time, bring all the interfaces down so that their xxstop
functions are called, which will turn off DMA.  Receiving packets into
your memory after a system reboot is pretty nasty.  This will also mean
that the shutdown hooks can go; this solution is smaller.
ok henning miod dlg kettenis

Revision 1.197 / (download) - annotate - [select for diffs], Thu Jul 9 06:40:20 2009 UTC (14 years, 11 months ago) by blambert
Branch: MAIN
Changes since 1.196: +2 -2 lines
Diff to previous 1.196 (colored)

unsigned -> unsigned int

ok claudio@, henning@

Revision 1.196 / (download) - annotate - [select for diffs], Sat Jun 6 12:31:17 2009 UTC (15 years ago) by rainer
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.195: +2 -1 lines
Diff to previous 1.195 (colored)

when xflags got changed, tell the userland by routing sockets

ok henning@

Revision 1.195 / (download) - annotate - [select for diffs], Fri Jun 5 03:10:28 2009 UTC (15 years ago) by halex
Branch: MAIN
Changes since 1.194: +3 -1 lines
Diff to previous 1.194 (colored)

Add missing #ifdef INET6 ... #endif

Makes non-IPv6 kernels build again

blame and ok henning@

Revision 1.194 / (download) - annotate - [select for diffs], Fri Jun 5 00:05:21 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.193: +75 -14 lines
Diff to previous 1.193 (colored)

Initial support for routing domains. This allows to bind interfaces to
alternate routing table and separate them from other interfaces in distinct
routing tables. The same network can now be used in any doamin at the same
time without causing conflicts.
This diff is mostly mechanical and adds the necessary rdomain checks accross
net and netinet. L2 and IPv4 are mostly covered still missing pf and IPv6.
input and tested by jsg@, phessler@ and reyk@. "put it in" deraadt@

Revision 1.193 / (download) - annotate - [select for diffs], Thu Jun 4 19:07:21 2009 UTC (15 years ago) by henning
Branch: MAIN
Changes since 1.192: +27 -3 lines
Diff to previous 1.192 (colored)

allow IPvShit to be turned off completely per-interface.
ifconfig em0 -inet6
deletes all v6 addresses including link-local and prevents new ones from
being added.
ifconfig em0 inet6 <addr>
re-enables v6, brings the link local back and adds optional <addr>
ok theo reyk

Revision 1.192 / (download) - annotate - [select for diffs], Mon Jun 1 17:49:11 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.191: +3 -4 lines
Diff to previous 1.191 (colored)

There is no need to use a variable just for sizeof(). Garbage collect ifa.
No binary change.

Revision 1.191 / (download) - annotate - [select for diffs], Sun May 31 20:22:18 2009 UTC (15 years ago) by blambert
Branch: MAIN
Changes since 1.190: +30 -41 lines
Diff to previous 1.190 (colored)

Consolidate common code for interface attachment into single function
to save some space in the kernel. Although there are deeper issues with
interface attachment, this diff was not meant to address those, just to
shave some space ;)

ok henning@, claudio@

Revision 1.190 / (download) - annotate - [select for diffs], Sun May 31 04:07:03 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.189: +1 -7 lines
Diff to previous 1.189 (colored)

Reenable interface state tracking now that I found and fixed the cause of
the rtfree panic seen by some people.

Revision 1.189 / (download) - annotate - [select for diffs], Sun Mar 15 19:40:41 2009 UTC (15 years, 2 months ago) by miod
Branch: MAIN
Changes since 1.188: +3 -3 lines
Diff to previous 1.188 (colored)

Introduce splsoftassert(), similar to splassert() but for soft interrupt
levels. This will allow for platforms where soft interrupt levels do not
map to real hardware interrupt levels to have soft ipl values overlapping
hard ipl values without breaking spl asserts.

Revision 1.188 / (download) - annotate - [select for diffs], Tue Feb 24 21:14:12 2009 UTC (15 years, 3 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.187: +7 -1 lines
Diff to previous 1.187 (colored)

Disable rt_if_track() for now. This causes the rtfree panic seen in PR6043
and I'm currently unable to find the cause of this. Time is running out so
workaround it for now.  OK deraadt.

Revision 1.187 / (download) - annotate - [select for diffs], Sat Jan 31 21:23:34 2009 UTC (15 years, 4 months ago) by grange
Branch: MAIN
Changes since 1.186: +2 -3 lines
Diff to previous 1.186 (colored)

No need to invent another _offset, just use the one from param.h.
As a bonus it eliminates casting from pointer to int.

ok miod@ tedu@ millert@

Revision 1.186 / (download) - annotate - [select for diffs], Fri Jan 9 04:41:02 2009 UTC (15 years, 5 months ago) by david
Branch: MAIN
Changes since 1.185: +3 -3 lines
Diff to previous 1.185 (colored)

fix egress group matching for IPv6; ok claudio@

Revision 1.185 / (download) - annotate - [select for diffs], Fri Dec 12 22:07:33 2008 UTC (15 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.184: +13 -1 lines
Diff to previous 1.184 (colored)

Introduce a if_priority that will be added to RTP_STATIC when routes are
added without an expilict priority. This allows to specify less prefered
interfaces that will only take over if the primary interface loses link.
OK deraadt@

Revision 1.184 / (download) - annotate - [select for diffs], Thu Dec 11 16:45:45 2008 UTC (15 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.183: +3 -97 lines
Diff to previous 1.183 (colored)

export per-interface mbuf cluster pool use statistics out to userland
inside if_data, so that netstat(1) and systat(1) can see them
ok dlg

Revision 1.183 / (download) - annotate - [select for diffs], Wed Nov 26 19:07:33 2008 UTC (15 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.182: +48 -3 lines
Diff to previous 1.182 (colored)

Avoid network livelock.

Use a 1 tick timeout() to determine if the kernel even manages to get
below softclock (from an old diff by mpf).  If our timeout comes late,
reduce the high water marks (to half) for all network interfaces, thus
starving them of future packet allocations for their RX rings.  For a
few ticks longer, also block the high water marks from rising even if
RX ring empty conditions would prod us to do so.

Cards may start dropping some packets off the end of their smaller RX
rings, but we were not able to do the work required in any case.  With
less interrupt time and mbuf movement, the system finds time to make
progress at the network queues.  Userland even gets to run.

A x40 tuned to 600MHz shows no real reduction in performance.  But a
soekris has a working console now.

ok dlg claudio, and art liked it too

Revision 1.182 / (download) - annotate - [select for diffs], Wed Nov 26 17:36:23 2008 UTC (15 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.181: +19 -2 lines
Diff to previous 1.181 (colored)

provide m_clsetlwm, an interface for an interface to raise its low
watermark for mbuf cluster allocations.

this is necessary for things like bge which cannot cope with less than a
certain number of pkts on the ring.

ok deraadt@

Revision 1.181 / (download) - annotate - [select for diffs], Tue Nov 25 16:32:41 2008 UTC (15 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.180: +2 -2 lines
Diff to previous 1.180 (colored)

expect if_flags to have IFF_RUNNING rather than IFF_UP before modifying
the per ifp cluster allocator. should prevent the hwm being raised
innapropriately when a driver fills its rx ring for the first time.

Revision 1.180 / (download) - annotate - [select for diffs], Tue Nov 25 15:43:32 2008 UTC (15 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.179: +2 -2 lines
Diff to previous 1.179 (colored)

art says he doesnt suck anymore, so enable the really big cluster
allocators again.

Revision 1.179 / (download) - annotate - [select for diffs], Tue Nov 25 12:47:00 2008 UTC (15 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.178: +10 -8 lines
Diff to previous 1.178 (colored)

Factor increases are not needed, +1 appears to work as well.
ok dlg

Revision 1.178 / (download) - annotate - [select for diffs], Tue Nov 25 12:07:55 2008 UTC (15 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.177: +11 -8 lines
Diff to previous 1.177 (colored)

m_cluncount() needs to walk the mbuf chain to correctly uncount all clusters
but don't do that in m_free() as that will cause a double loop behaviour when
called via m_freem().
OK dlg@, deraadt@

Revision 1.177 / (download) - annotate - [select for diffs], Mon Nov 24 12:57:37 2008 UTC (15 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.176: +54 -1 lines
Diff to previous 1.176 (colored)

add several backend pools to allocate mbufs clusters of various sizes out
of. currently limited to MCLBYTES (2048 bytes) and 4096 bytes until pools
can allocate objects of sizes greater than PAGESIZE.

this allows drivers to ask for "jumbo" packets to fill rx rings with.

the second half of this change is per interface mbuf cluster allocator
statistics. drivers can use the new interface (MCLGETI), which will use
these stats to selectively fail allocations based on demand for mbufs. if
the driver isnt rapidly consuming rx mbufs, we dont allow it to allocate
many to put on its rx ring.

drivers require modifications to take advantage of both the new allocation
semantic and large clusters.

this was written and developed with deraadt@ over the last two days
ok deraadt@ claudio@

Revision 1.176 / (download) - annotate - [select for diffs], Mon Nov 24 12:53:53 2008 UTC (15 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.175: +10 -1 lines
Diff to previous 1.175 (colored)

Implement link-state tracking on the routing table. Routes to interfaces
which are considered down will no be marked ~RTF_UP and so multipath routing
will start to work as expected and not pump 50% of the traffic to nirvana.
Most of the magic happens in rn_mpath_reprio() which fiddles with the
routing table internals. The rest is more straight forward.
get it in deraadt@

Revision 1.175 / (download) - annotate - [select for diffs], Fri Nov 21 18:01:30 2008 UTC (15 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.174: +3 -3 lines
Diff to previous 1.174 (colored)

Change rn_mpath_next() to be able to walk over the full multipath list
not only over routes of the same prio. This makes it possible to modify
rt_mpath_matchgate() so that if only gateway is specified without a specific
priority it will scan the full list and not only the first routes.
This is also needed for upcoming link state tracking.

Revision 1.173.2.1 / (download) - annotate - [select for diffs], Fri Nov 14 02:21:15 2008 UTC (15 years, 6 months ago) by brad
Branch: OPENBSD_4_4
Changes since 1.173: +2 -1 lines
Diff to previous 1.173 (colored) next main 1.174 (colored)

Clear ifindex2ifnet[] in if_detach() this is needed because link local
addressing in IPv6 likes to do ifp = ifindex2ifnet[ifindex] without properly
checking if the ifindex is valid. As a side-effect this solves parts of
PR 5981.

Revision 1.174 / (download) - annotate - [select for diffs], Mon Nov 10 18:08:42 2008 UTC (15 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.173: +2 -1 lines
Diff to previous 1.173 (colored)

Clear ifindex2ifnet[] in if_detach() this is needed because link local
addressing in IPv6 likes to do ifp = ifindex2ifnet[ifindex] without properly
checking if the ifindex is valid. As a side-effect this solves parts of
PR 5981. Debugged by jsing@. OK jsing@, deraadt@

Revision 1.173 / (download) - annotate - [select for diffs], Thu Jun 12 16:15:05 2008 UTC (16 years ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE
Branch point for: OPENBSD_4_4
Changes since 1.172: +5 -4 lines
Diff to previous 1.172 (colored)

Fix the egress group matching for IPv4. There are to ways to define a /0
network mask. For some reasons some parts set sa->sa_len to 0 to specify
a /0 netmask so check fot that too. tested by david@ OK henning@

Revision 1.172 / (download) - annotate - [select for diffs], Sun Jun 8 20:27:23 2008 UTC (16 years ago) by claudio
Branch: MAIN
Changes since 1.171: +3 -2 lines
Diff to previous 1.171 (colored)

The default route is 0.0.0.0/0 so it is necessary to check the mask as well.
OK henning@

Revision 1.171 / (download) - annotate - [select for diffs], Fri May 23 15:51:12 2008 UTC (16 years ago) by thib
Branch: MAIN
Changes since 1.170: +3 -3 lines
Diff to previous 1.170 (colored)

Deal with the situation when TCP nfs mounts timeout and processes
get hung in nfs_reconnect() because they do not have the proper
privilages to bind to a socket, by adding a struct proc * argument
to sobind() (and the *_usrreq() routines, and finally in{6}_pcbbind)
and do the sobind() with proc0 in nfs_connect.

OK markus@, blambert@.
"go ahead" deraadt@.

Fixes an issue reported by bernd@ (Tested by bernd@).
Fixes PR5135 too.

Revision 1.170 / (download) - annotate - [select for diffs], Wed May 7 05:51:12 2008 UTC (16 years, 1 month ago) by mpf
Branch: MAIN
Changes since 1.169: +1 -9 lines
Diff to previous 1.169 (colored)

Prevent virtual interfaces from adding to the random pool.
Also move the sampling into ether_input() where it can happen
at the interrupt and not within splnet() processing, which might
be less random. Discussed with mickey.
OK markus@, mcbride@

Revision 1.169 / (download) - annotate - [select for diffs], Thu Apr 10 23:15:45 2008 UTC (16 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.168: +37 -0 lines
Diff to previous 1.168 (colored)

introduce mitigation for the calling of an interfaces start routine.

decent drivers prefer to have a lot of packets on the send queue so they
can queue a lot of them up on the tx ring and then post them all in one
big chunk. unfortunately our stack queues one packet onto the send queue
and then calls the start handler immediately.

this mitigates against that queue, send, queue, send behaviour by trying to
call the start routine only once per softnet. now its queue, queue, queue,
send.

this is the result of a lot of discussion with claudio@
tested by many.

Revision 1.165.2.1 / (download) - annotate - [select for diffs], Fri Jan 11 12:41:26 2008 UTC (16 years, 5 months ago) by henning
Branch: OPENBSD_4_2
Changes since 1.165: +8 -5 lines
Diff to previous 1.165 (colored) next main 1.166 (colored)

MFC, initial fix by Chris Cappucino, more complete fix by me:
make sure users of rtlabel_id2name() can deal with no label present,
by not calling it when the label id is 0 (initial fix) and also checking
for rtlabel_id2name() returning NULL (complete fix). original rtlabel code
had that all right, the newer rtlabel bound to an interface code not.
impact: local users can cause a kernel panic by using the SIOCGIFRTLABEL
ioctl on interfaces with no route label assigned.

Revision 1.168 / (download) - annotate - [select for diffs], Sat Jan 5 19:08:19 2008 UTC (16 years, 5 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.167: +3 -3 lines
Diff to previous 1.167 (colored)

make sure all callers of rtlabel_id2name check for a null return value.
all the original ones did, the recently added ones for labels per interface
didn't. no cookie for reyk ;(
ok deraadt

Revision 1.167 / (download) - annotate - [select for diffs], Sat Jan 5 07:26:04 2008 UTC (16 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.166: +8 -5 lines
Diff to previous 1.166 (colored)

rtlabel_id2name() can return NULL if there is no route label..
from chris@nmedia.net

Revision 1.166 / (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.165: +8 -14 lines
Diff to previous 1.165 (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.165 / (download) - annotate - [select for diffs], Fri Jul 6 14:00:59 2007 UTC (16 years, 11 months ago) by naddy
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE
Branch point for: OPENBSD_4_2
Changes since 1.164: +1 -4 lines
Diff to previous 1.164 (colored)

btintrq has been removed from bt_input.c, don't reference it here.
Makes bluetooth build again.  ok uwe@

Revision 1.164 / (download) - annotate - [select for diffs], Wed Jul 4 12:15:53 2007 UTC (16 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.163: +3 -1 lines
Diff to previous 1.163 (colored)

Fix a use after free crash in in_delmulti(). If a interface is detached
before it is removed from the multicast group in_delmulti() will try to
access the no longer available ifp.
We invalidate the ifa_ifp back pointer in the ifa in if_detach() now and use
the ifa_ifp in in_delmulti() instead of the internal inm_ifp. By doing it
this way we know if the interface was removed.
This fixes a kernel panic triggered by ospfd and gif(4) tunnels.
looks good henning@ reyk@

Revision 1.163 / (download) - annotate - [select for diffs], Sun Jun 17 21:01:32 2007 UTC (16 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.162: +4 -2 lines
Diff to previous 1.162 (colored)

add back missing bcopy & break, got lost when removing arcnet.
spotted by Mike Belopuhov <mkb@crypt.org.ru>

Revision 1.162 / (download) - annotate - [select for diffs], Thu Jun 14 18:31:49 2007 UTC (17 years ago) by reyk
Branch: MAIN
Changes since 1.161: +21 -1 lines
Diff to previous 1.161 (colored)

Add a new "rtlabel" option to ifconfig. It allows to specify a route label
which will be used for new interface routes. For example,
	ifconfig em0 10.1.1.0 255.255.255.0 rtlabel RING_1
will set the new interface address and attach the route label RING_1 to
the corresponding route.

manpage bits from jmc@
ok claudio@ henning@

Revision 1.161 / (download) - annotate - [select for diffs], Fri Jun 8 09:31:38 2007 UTC (17 years ago) by henning
Branch: MAIN
Changes since 1.160: +1 -5 lines
Diff to previous 1.160 (colored)

kill arcnet leftovers, some pt out by Mike Belopuhov <mkb@crypt.org.ru>,
some I found afterwards, ok dlg

Revision 1.160 / (download) - annotate - [select for diffs], Wed Jun 6 10:04:36 2007 UTC (17 years ago) by henning
Branch: MAIN
Changes since 1.159: +1 -4 lines
Diff to previous 1.159 (colored)

remove remaining IPX hooks. all inside #ifdef IPX, so no actual change

Revision 1.159 / (download) - annotate - [select for diffs], Tue May 29 02:21:18 2007 UTC (17 years ago) by claudio
Branch: MAIN
Changes since 1.158: +23 -23 lines
Diff to previous 1.158 (colored)

Spaces, no binary changes.

Revision 1.158 / (download) - annotate - [select for diffs], Mon May 28 08:48:15 2007 UTC (17 years ago) by mcbride
Branch: MAIN
Changes since 1.157: +10 -1 lines
Diff to previous 1.157 (colored)

Only call add_net_randomness() once per interrupt instead of once per packet.   If multiple packets come in on a single interrupt the times mixed into
the randomness pool will be identical or predictably close anyways, and
nanotime() is expensive.

ok toby jason miod claudio

Revision 1.143.2.1 / (download) - annotate - [select for diffs], Wed Mar 28 19:47:57 2007 UTC (17 years, 2 months ago) by henning
Branch: OPENBSD_3_9
Changes since 1.143: +5 -7 lines
Diff to previous 1.143 (colored) next main 1.144 (colored)

MFC: fix by canacar
Check the reference count for interface addresses when detaching
an interface. Fixes a double free panic.
ok claudio@, looks fine henning@

ok deraadt ckuethe reyk

Revision 1.149.2.1 / (download) - annotate - [select for diffs], Wed Mar 28 19:45:48 2007 UTC (17 years, 2 months ago) by henning
Branch: OPENBSD_4_0
Changes since 1.149: +5 -7 lines
Diff to previous 1.149 (colored) next main 1.150 (colored)

MFC: fix by canacar
Check the reference count for interface addresses when detaching
an interface. Fixes a double free panic.
ok claudio@, looks fine henning@

ok deraadt ckuethe reyk

Revision 1.157 / (download) - annotate - [select for diffs], Sun Mar 25 18:26:23 2007 UTC (17 years, 2 months ago) by mpf
Branch: MAIN
Changes since 1.156: +6 -1 lines
Diff to previous 1.156 (colored)

Synchronise carp advertisements on group demotion.
This reduces group failover time to a few milliseconds.
Diff from Nathanael.
OK henning@

Revision 1.156 / (download) - annotate - [select for diffs], Sun Mar 18 23:23:17 2007 UTC (17 years, 2 months ago) by mpf
Branch: MAIN
Changes since 1.155: +2 -1 lines
Diff to previous 1.155 (colored)

Add IP load balancing support for carp(4).
This provides a similar functionality as ARP balancing,
but also works for traffic that comes across routers.
IPv6 is supported as well.
The configuration scheme will change as soon we have sth better.

Also add support for changing the MAC address on carp(4)
interfaces. (code from mcbride)

Tested by pyr@ and reyk@
OK mcbride@

Revision 1.155 / (download) - annotate - [select for diffs], Wed Feb 14 00:53:48 2007 UTC (17 years, 4 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.154: +2 -2 lines
Diff to previous 1.154 (colored)

Consistently spell FALLTHROUGH to appease lint.
ok kettenis@ cloder@ tom@ henning@

Revision 1.154 / (download) - annotate - [select for diffs], Mon Feb 12 22:36:47 2007 UTC (17 years, 4 months ago) by mpf
Branch: MAIN
Changes since 1.153: +6 -3 lines
Diff to previous 1.153 (colored)

Don't pass random flags to SIOIFFLAGS when changing the lladdr.
OK tedu@

Revision 1.153 / (download) - annotate - [select for diffs], Sun Dec 3 13:41:19 2006 UTC (17 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.152: +9 -1 lines
Diff to previous 1.152 (colored)

Add Rapid Spanning Tree Protocol support (802.1d-2004) based on work
by Andrew Thompson (thompsa@freebsd.org). The local changes include
adoption to our bridge code, reduced stack usage and many other bits.
If stp is enabled, RSTP will now be used by default.

Thanks for help from Andrew.

This code has been in snaps for while now, commit encouraged by deraadt@

Revision 1.152 / (download) - annotate - [select for diffs], Fri Nov 24 20:57:46 2006 UTC (17 years, 6 months ago) by canacar
Branch: MAIN
Changes since 1.151: +5 -7 lines
Diff to previous 1.151 (colored)

Check the reference count for interface addresses when detaching
an interface. Fixes a double free panic.
ok claudio@, looks fine henning@

Revision 1.151 / (download) - annotate - [select for diffs], Thu Nov 16 13:09:27 2006 UTC (17 years, 6 months ago) by henning
Branch: MAIN
Changes since 1.150: +29 -16 lines
Diff to previous 1.150 (colored)

introduce if_creategroup() to create an empty interface group.
code factored out from if_addgroup(), previously a group always had to have
members. ok mpf mcbride

Revision 1.150 / (download) - annotate - [select for diffs], Sat Oct 21 14:02:11 2006 UTC (17 years, 7 months ago) by henning
Branch: MAIN
Changes since 1.149: +3 -3 lines
Diff to previous 1.149 (colored)

the create and destroy functions for clonable interfaces return 0 on
success, not -1 on error. fix check in 2 cases. ok mpf mcbride

Revision 1.149 / (download) - annotate - [select for diffs], Tue Aug 29 17:19:43 2006 UTC (17 years, 9 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE
Branch point for: OPENBSD_4_0
Changes since 1.148: +5 -7 lines
Diff to previous 1.148 (colored)

allow the carp demotion counter to be changed by arbitary values as long
as the resulting demotion counter value is in range. previously, we only
allowed +/- 1. ok mpf mcbride deraadt

Revision 1.148 / (download) - annotate - [select for diffs], Tue Jul 18 09:23:43 2006 UTC (17 years, 10 months ago) by mickey
Branch: MAIN
Changes since 1.147: +2 -2 lines
Diff to previous 1.147 (colored)

typo

Revision 1.147 / (download) - annotate - [select for diffs], Fri Jun 2 19:53:12 2006 UTC (18 years ago) by mpf
Branch: MAIN
Changes since 1.146: +54 -1 lines
Diff to previous 1.146 (colored)

Introduce attributes to interface groups.
As a first user, move the global carp(4) demotion counter
into the interface group. Thus we have the possibility
to define which carp interfaces are demoted together.

Put the demotion counter into the reserved field of the carp header.
With this, we can have carp act smarter if multiple errors occur.
It now always takes over other carp peers, that are advertising
with a higher demote count.  As a side effect, we can also have
group failovers without the need of running in preempt mode.
The protocol change does not break compability with older
implementations.

Collaborative work with mcbride@

OK mcbride@, henning@

Revision 1.146 / (download) - annotate - [select for diffs], Wed Mar 22 14:37:44 2006 UTC (18 years, 2 months ago) by henning
Branch: MAIN
Changes since 1.145: +9 -18 lines
Diff to previous 1.145 (colored)

prevent anything outside rote.c from accessing the routing table heads
directly. rather provide a rt_lookup function for regular lookups,
and a rt_gettable for those that need access to the head for some reason.
the latter cases should be revisted later probably so that nothing outside
the routing core code accesses the heads at all...
tested claudio jolan me, ok claudio markus

Revision 1.145 / (download) - annotate - [select for diffs], Mon Mar 20 10:03:49 2006 UTC (18 years, 2 months ago) by henning
Branch: MAIN
Changes since 1.144: +3 -48 lines
Diff to previous 1.144 (colored)

introduce rt_if_remove which takes care of routing table updates for an
interface that is removed. use that from if.c and if_tun.c instead of
re-implementing in the latter case. ok claudio

Revision 1.144 / (download) - annotate - [select for diffs], Sat Mar 4 22:40:15 2006 UTC (18 years, 3 months ago) by brad
Branch: MAIN
Changes since 1.143: +7 -7 lines
Diff to previous 1.143 (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.143 / (download) - annotate - [select for diffs], Thu Feb 9 00:05:55 2006 UTC (18 years, 4 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE
Branch point for: OPENBSD_3_9
Changes since 1.142: +15 -1 lines
Diff to previous 1.142 (colored)

add an interface detach hook and use it with the vlan(4) driver. this
fixes a possible crash if the parent interface has been destroyed
(like vlan on trunk) before destroying the vlan interface.

ok brad@

Revision 1.137.2.1 / (download) - annotate - [select for diffs], Thu Jan 26 20:52:57 2006 UTC (18 years, 4 months ago) by brad
Branch: OPENBSD_3_8
Changes since 1.137: +4 -1 lines
Diff to previous 1.137 (colored) next main 1.138 (colored)

MFC:
Fix by deraadt@

bzero buffers after malloc, or clear string buffer before strlcpy'ing
into them, if you are gonna copy it out to userland

ok tedu@

Revision 1.104.2.1 / (download) - annotate - [select for diffs], Thu Jan 26 20:43:21 2006 UTC (18 years, 4 months ago) by brad
Branch: OPENBSD_3_7
Changes since 1.104: +3 -1 lines
Diff to previous 1.104 (colored) next main 1.105 (colored)

MFC:
Fix by deraadt@

bzero buffers after malloc, or clear string buffer before strlcpy'ing
into them, if you are gonna copy it out to userland

ok tedu@

Revision 1.142 / (download) - annotate - [select for diffs], Thu Jan 5 03:28:34 2006 UTC (18 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.141: +4 -1 lines
Diff to previous 1.141 (colored)

bzero buffers after malloc, or clear string buffer before strlcpy'ing
into them, if you are gonna copy it out to userland
some ok dhartmei, some ok tedu

Revision 1.141 / (download) - annotate - [select for diffs], Thu Dec 22 23:55:18 2005 UTC (18 years, 5 months ago) by canacar
Branch: MAIN
Changes since 1.140: +2 -4 lines
Diff to previous 1.140 (colored)

Do not check ifp->if_bpf before detaching from bpf. It is only a signal
to the driver that there is a listener. Somehow I assumed that it was
a handle, and was trying to figure out why it was becoming zero.
Corrected by and ok claudio@

Revision 1.140 / (download) - annotate - [select for diffs], Tue Nov 29 02:59:42 2005 UTC (18 years, 6 months ago) by jolan
Branch: MAIN
Changes since 1.139: +63 -13 lines
Diff to previous 1.139 (colored)

something in the eurobsdcon route-a-thon broke my simple home network
router so back out the routing stuff to pre-eurobsdcon where my machine
doesn't crash immediately.

i am happy to test diffs and report success/failures but i am not happy
to have instantaneous crashes when i reboot with a new kernel that was
compiled from pristine sources.

if you are going to be an elitist asshole then you could at least make
sure your code works.

ok and "be crass towards them" deraadt@

Revision 1.139 / (download) - annotate - [select for diffs], Sun Nov 27 16:22:45 2005 UTC (18 years, 6 months ago) by henning
Branch: MAIN
Changes since 1.138: +9 -18 lines
Diff to previous 1.138 (colored)

don't let anything outside route.c access the routing table heads directly,
but go through a provided wrapper.
also provide rt_lookup() instead of doing the lookup manually in many places.
ryan ok

Revision 1.138 / (download) - annotate - [select for diffs], Fri Nov 25 13:45:02 2005 UTC (18 years, 6 months ago) by henning
Branch: MAIN
Changes since 1.137: +5 -46 lines
Diff to previous 1.137 (colored)

move the code to delete routes having a specific interface as output
when the interface is deleted to a function in route.c, and replace
the copies of that code by calls to that function
from basel almost-hackathon

Revision 1.137 / (download) - annotate - [select for diffs], Mon Jul 4 09:52:33 2005 UTC (18 years, 11 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE
Branch point for: OPENBSD_3_8
Changes since 1.136: +2 -3 lines
Diff to previous 1.136 (colored)

in if_group_routechange(), when checking wether a default route was changed
to trigger an if_group_egress_build() call, stop looking at the mask in the
v4 case, at least until I figured out why we sometimes see masks full of
crap.

Revision 1.136 / (download) - annotate - [select for diffs], Thu Jun 23 14:30:40 2005 UTC (18 years, 11 months ago) by mickey
Branch: MAIN
Changes since 1.135: +2 -1 lines
Diff to previous 1.135 (colored)

update if_lastchange for evey IFF_UP change not only SIOCSIFFLAGS; henning@ ok

Revision 1.135 / (download) - annotate - [select for diffs], Tue Jun 14 04:00:38 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.134: +9 -9 lines
Diff to previous 1.134 (colored)

rename function and define to reflect the external -> egress name change
so it is clear what it is all about

Revision 1.134 / (download) - annotate - [select for diffs], Mon Jun 13 21:02:21 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.133: +3 -3 lines
Diff to previous 1.133 (colored)

check wether mask is NULL in if_group_routechange before dereferencing

Revision 1.133 / (download) - annotate - [select for diffs], Sun Jun 12 00:41:33 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.132: +47 -1 lines
Diff to previous 1.132 (colored)

add SIOCGIFGMEMB ioctl, returns a list of all interfaces who are member of
the given group, markus ok

Revision 1.132 / (download) - annotate - [select for diffs], Wed Jun 8 07:36:50 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.131: +6 -3 lines
Diff to previous 1.131 (colored)

if a cloned interface's destroy function fails, re-join the interface class
group, spotted by and ok markus

Revision 1.131 / (download) - annotate - [select for diffs], Wed Jun 8 06:58:11 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.130: +1 -7 lines
Diff to previous 1.130 (colored)

kill NS and DECNET bits

Revision 1.130 / (download) - annotate - [select for diffs], Wed Jun 8 00:14:45 2005 UTC (19 years ago) by deraadt
Branch: MAIN
Changes since 1.129: +3 -1 lines
Diff to previous 1.129 (colored)

more inet6 stuff that got exposed

Revision 1.129 / (download) - annotate - [select for diffs], Wed Jun 8 00:13:19 2005 UTC (19 years ago) by deraadt
Branch: MAIN
Changes since 1.128: +7 -1 lines
Diff to previous 1.128 (colored)

handle ramdisks, and kernels without inet6; henning ok

Revision 1.128 / (download) - annotate - [select for diffs], Tue Jun 7 18:21:44 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.127: +80 -1 lines
Diff to previous 1.127 (colored)

introduce a default "external" interface group, containing the interface(s)
the the default route(s) point to.
handles IPv4 and IPv6 as well as multipath routes.
follows default route changes, of course.
eases writing pf rulesets especially on laptops etc. that use different
interfaces depending on the environment (wired, wireless, ...)
ok theo ryan

Revision 1.127 / (download) - annotate - [select for diffs], Tue Jun 7 02:45:11 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.126: +1 -4 lines
Diff to previous 1.126 (colored)

do not handle CCITT any longer

Revision 1.126 / (download) - annotate - [select for diffs], Mon Jun 6 03:44:21 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.125: +2 -2 lines
Diff to previous 1.125 (colored)

use a define instead of hardcoding "all" in 3 places

Revision 1.125 / (download) - annotate - [select for diffs], Mon Jun 6 03:05:05 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.124: +9 -2 lines
Diff to previous 1.124 (colored)

make cloned interfaces join an interface class group (carp for carpX, tun
for tunX etc) in if_clone_create and leave it in if_clone_destroy, ryan ok

Revision 1.124 / (download) - annotate - [select for diffs], Sun Jun 5 20:49:25 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.123: +3 -3 lines
Diff to previous 1.123 (colored)

const'ify the char *groupname param to if_addgroup and if_delgroup

Revision 1.123 / (download) - annotate - [select for diffs], Thu May 26 04:07:45 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.122: +4 -0 lines
Diff to previous 1.122 (colored)

deny groupnames ending in digits in if_addgroup, frantzen ok
(this has been on my todo, mike beat me to it with the check in ifconfig, but
we want it here too)

Revision 1.122 / (download) - annotate - [select for diffs], Thu May 26 03:44:27 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.121: +1 -2 lines
Diff to previous 1.121 (colored)

oups another unused var

Revision 1.121 / (download) - annotate - [select for diffs], Thu May 26 03:13:41 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.120: +1 -2 lines
Diff to previous 1.120 (colored)

unused var

Revision 1.120 / (download) - annotate - [select for diffs], Thu May 26 03:11:59 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.119: +1 -6 lines
Diff to previous 1.119 (colored)

remove the interface family group (i. e. "em" for "em0")
I foudn this stupid from the beginning on :)
talked about and agreed with ryan and theo on the hike

Revision 1.119 / (download) - annotate - [select for diffs], Wed May 25 06:50:05 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.118: +9 -1 lines
Diff to previous 1.118 (colored)

when an interface joins or leaves a group call back into pf so it can
update the internal tables used for (ifgroup) notation

Revision 1.118 / (download) - annotate - [select for diffs], Tue May 24 06:48:49 2005 UTC (19 years ago) by reyk
Branch: MAIN
Changes since 1.117: +3 -1 lines
Diff to previous 1.117 (colored)

include trunk.h to get the NTRUNK value

ok cloder@

Revision 1.117 / (download) - annotate - [select for diffs], Tue May 24 04:20:25 2005 UTC (19 years ago) by markus
Branch: MAIN
Changes since 1.116: +24 -1 lines
Diff to previous 1.116 (colored)

add net.inet.ip.ifq for monitoring and changing ifqueue; similar to netbsd
ok henning

Revision 1.116 / (download) - annotate - [select for diffs], Tue May 24 02:49:34 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.115: +11 -1 lines
Diff to previous 1.115 (colored)

actually delete the interface from the member list when it leaves the group

Revision 1.115 / (download) - annotate - [select for diffs], Tue May 24 02:45:17 2005 UTC (19 years ago) by reyk
Branch: MAIN
Changes since 1.114: +10 -1 lines
Diff to previous 1.114 (colored)

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@

Revision 1.114 / (download) - annotate - [select for diffs], Tue May 24 02:26:04 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.113: +12 -1 lines
Diff to previous 1.113 (colored)

keep a list of member interfaces in ifg_group

Revision 1.113 / (download) - annotate - [select for diffs], Sun May 22 21:06:02 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.112: +5 -1 lines
Diff to previous 1.112 (colored)

missing #if NPF > 0 around ifgroups attachments

Revision 1.112 / (download) - annotate - [select for diffs], Sun May 22 18:23:04 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.111: +3 -1 lines
Diff to previous 1.111 (colored)

allow pf to match on interface groups
pass on mygroup ...
markus ok

Revision 1.111 / (download) - annotate - [select for diffs], Sat May 21 21:24:38 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.110: +2 -1 lines
Diff to previous 1.110 (colored)

make every interface join a group called "all", mcbride ok

Revision 1.110 / (download) - annotate - [select for diffs], Sat May 21 21:03:57 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.109: +1 -4 lines
Diff to previous 1.109 (colored)

clean up and rework the interface absraction code big time, rip out multiple
useless layers of indirection and make the code way cleaner overall.
this is just the start, more to come...
worked very hard on by Ryan and me in Montreal last week, on the airplane to
vancouver and yesterday here in calgary. it hurt.
ok ryan theo

Revision 1.109 / (download) - annotate - [select for diffs], Mon May 9 08:08:47 2005 UTC (19 years, 1 month ago) by mpf
Branch: MAIN
Changes since 1.108: +28 -66 lines
Diff to previous 1.108 (colored)

ansify. no binary change.
OK henning, krw, brad, moritz

Revision 1.108 / (download) - annotate - [select for diffs], Thu Apr 28 10:38:55 2005 UTC (19 years, 1 month ago) by pascoe
Branch: MAIN
Changes since 1.107: +5 -5 lines
Diff to previous 1.107 (colored)

Don't detach interface from pf's perspective until after IPv6 is done with it.

ok dlg@ henning@

Revision 1.107 / (download) - annotate - [select for diffs], Wed Apr 20 23:00:41 2005 UTC (19 years, 1 month ago) by mpf
Branch: MAIN
Changes since 1.106: +13 -6 lines
Diff to previous 1.106 (colored)

Introduce if_linkstatehooks.
This converts if_link_state_change() to a generic usable
callback with dohooks().

OK henning@, camield@
Tested by camield@ and Alexey E. Suslikov

Revision 1.106 / (download) - annotate - [select for diffs], Tue Apr 5 12:19:37 2005 UTC (19 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.105: +8 -5 lines
Diff to previous 1.105 (colored)

Return EINVAL in SIOCSIFLLADDR if new lladdr is a multicast address.
OK derradt@ tedu@

Revision 1.105 / (download) - annotate - [select for diffs], Wed Mar 30 02:55:36 2005 UTC (19 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.104: +45 -1 lines
Diff to previous 1.104 (colored)

add lladdr command to ifconfig to set MAC address.  diffs from freebsd via
Kyunghwan KIM (prs 2117 and 2118) and Fredrik Widlund.  ok deraadt

Revision 1.104 / (download) - annotate - [select for diffs], Mon Feb 7 15:00:16 2005 UTC (19 years, 4 months ago) by mcbride
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE
Branch point for: OPENBSD_3_7
Changes since 1.103: +16 -1 lines
Diff to previous 1.103 (colored)

Add new function if_link_state_change() to take care of sending messages
on the routing socket and notifying carp() of link changes.

ok brad@ mpf@

Revision 1.103 / (download) - annotate - [select for diffs], Tue Jan 18 22:10:10 2005 UTC (19 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.102: +5 -4 lines
Diff to previous 1.102 (colored)

If there is no match in ifaof_ifpforaddr() return the first match -- main
interface address -- and not the last one -- some alias. Also handle point to
point networks a bit more special.
With some input from markus@ OK markus@ henning@ fgsch@

Revision 1.102 / (download) - annotate - [select for diffs], Fri Jan 14 12:04:02 2005 UTC (19 years, 5 months ago) by grange
Branch: MAIN
Changes since 1.101: +5 -1 lines
Diff to previous 1.101 (colored)

First step in Bluetooth protocol stack support.

The code is adopted from the FreeBSD netgraph-based Bluetooth
implementation by Maksim Yevmenkin <m_evmenkin@yahoo.com> but
all netgraph glue was replaced with usual BSD network stack
hooks. This is a work in progress. Only HCI layer works for now,
L2CAP and RFCOMM are on the way.

Help in testing from many, ok markus@.

Revision 1.101 / (download) - annotate - [select for diffs], Fri Jan 14 11:49:01 2005 UTC (19 years, 5 months ago) by henning
Branch: MAIN
Changes since 1.100: +1 -7 lines
Diff to previous 1.100 (colored)

remove old ifgroups ioctls
the old ifgroups haven't been in use ever really, and the new
implementation is 3 months old today. theo ok (3 months ago)

Revision 1.100 / (download) - annotate - [select for diffs], Mon Dec 20 07:24:38 2004 UTC (19 years, 5 months ago) by pascoe
Branch: MAIN
Changes since 1.99: +19 -2 lines
Diff to previous 1.99 (colored)

Enforce an ordering on ifnet such that CARP interfaces appear later in the
list than physical interfaces.  This makes ifa_ifwith* prefer a physical
interface over a CARP one.

This addresses the problem where a CARP interface in BACKUP state is
selected after a route change, resulting in a loss of communications
despite there being another interface available which is perfectly usable.

ok mcbride@ mpf@

Revision 1.99 / (download) - annotate - [select for diffs], Wed Dec 8 07:02:16 2004 UTC (19 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.98: +8 -1 lines
Diff to previous 1.98 (colored)

Call if_down() in if_clone_destroy(). Based on diff from Chris Pascoe.

ok markus@

Revision 1.98 / (download) - annotate - [select for diffs], Wed Dec 8 06:57:55 2004 UTC (19 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.97: +3 -3 lines
Diff to previous 1.97 (colored)

Check if_type in carp_carpdev_state() to make sure we're not
dealing with a carp interface.

Revision 1.97 / (download) - annotate - [select for diffs], Tue Dec 7 20:38:46 2004 UTC (19 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.96: +3 -2 lines
Diff to previous 1.96 (colored)

Convert carp(4) to behave more like a regular interface, much in the same
style as vlan(4). carp interfaces no longer require the physical interface
to be on the same subnet as the carp interface, or even that the physical
interface has an adress at all, so CARP can now be used on /30 networks.

ok deraadt@ henning@

Revision 1.96 / (download) - annotate - [select for diffs], Tue Dec 7 19:26:46 2004 UTC (19 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.95: +27 -22 lines
Diff to previous 1.95 (colored)

KNF

Revision 1.95 / (download) - annotate - [select for diffs], Sat Dec 4 16:16:45 2004 UTC (19 years, 6 months ago) by markus
Branch: MAIN
Changes since 1.94: +2 -2 lines
Diff to previous 1.94 (colored)

use C comments.

Revision 1.94 / (download) - annotate - [select for diffs], Fri Dec 3 17:31:03 2004 UTC (19 years, 6 months ago) by henning
Branch: MAIN
Changes since 1.93: +15 -8 lines
Diff to previous 1.93 (colored)

do not use one struct timeout for the if congestion stuff, but embed
a struct timeout to struct ifqueue so that each one has its own - it
is a per-queue thing. from chris pascoe

Revision 1.93 / (download) - annotate - [select for diffs], Thu Oct 14 21:28:15 2004 UTC (19 years, 8 months ago) by mickey
Branch: MAIN
Changes since 1.92: +2 -1 lines
Diff to previous 1.92 (colored)

avoid stupid commons

Revision 1.92 / (download) - annotate - [select for diffs], Mon Oct 11 10:13:49 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.91: +91 -66 lines
Diff to previous 1.91 (colored)

ifgroups reqrite
there is now a TAILQ with all interface groups as members, and
in struct ofnet there is only a pointer to the group structure stored
and not its name.
mostly hacked at c2k4 and somewhere over the atlantic ocean
ok markus mcbride

Revision 1.91 / (download) - annotate - [select for diffs], Wed Sep 15 17:46:44 2004 UTC (19 years, 8 months ago) by grange
Branch: MAIN
Changes since 1.90: +1 -4 lines
Diff to previous 1.90 (colored)

Kill more netiso ghosts.

ok millert@

Revision 1.90 / (download) - annotate - [select for diffs], Sat Jun 26 17:36:32 2004 UTC (19 years, 11 months ago) by markus
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.89: +21 -22 lines
Diff to previous 1.89 (colored)

cleanup ioctl for ifgroups; ok pb@

Revision 1.89 / (download) - annotate - [select for diffs], Fri Jun 25 18:24:23 2004 UTC (19 years, 11 months ago) by pb
Branch: MAIN
Changes since 1.88: +127 -1 lines
Diff to previous 1.88 (colored)

introduce "interface groups"

by "ifconfig fxp0 group foobar" "ifconfig xl0 group foobar"
these two interfaces are in one group.
Every interface has its if-family as default group.

idea/design from henning@, based on some work/disucssion from Joris Vink.

henning@, mcbride@ ok.

Revision 1.27.2.10 / (download) - annotate - [select for diffs], Sat Jun 5 23:11:23 2004 UTC (20 years ago) by niklas
Branch: SMP
Changes since 1.27.2.9: +74 -7 lines
Diff to previous 1.27.2.9 (colored) to branchpoint 1.27 (colored) next main 1.28 (colored)

Merge with the trunk

Revision 1.88 / (download) - annotate - [select for diffs], Sat May 29 17:54:45 2004 UTC (20 years ago) by jcs
Branch: MAIN
CVS Tags: SMP_SYNC_B, SMP_SYNC_A
Changes since 1.87: +20 -1 lines
Diff to previous 1.87 (colored)

introduce SIOCSIFDESCR and SIOCGIFDESCR to maintain interface
descriptions, configurable with ifconfig

help from various, ok deraadt@

Revision 1.87 / (download) - annotate - [select for diffs], Wed Apr 28 01:20:29 2004 UTC (20 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.86: +3 -3 lines
Diff to previous 1.86 (colored)

spacing

Revision 1.86 / (download) - annotate - [select for diffs], Wed Apr 28 00:28:43 2004 UTC (20 years, 1 month ago) by mcbride
Branch: MAIN
Changes since 1.85: +9 -1 lines
Diff to previous 1.85 (colored)

Make carp(4) aware of its physical interface:
- If the physical interface goes down or the link goes down,
  the carp interface goes down as well.
- We treat this like the preemption holdoff with pfsync.
  So if one of the carp interfaces is known to be bad (because the
  physical interface it's associated with is bad), all the other carp
  interfaces back off: they won't preempt, and their advskew goes to 240.

ok cedric@

Revision 1.85 / (download) - annotate - [select for diffs], Sat Apr 17 00:09:01 2004 UTC (20 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.84: +26 -1 lines
Diff to previous 1.84 (colored)

add a congestion indicator to if_queue. It is set when the input queue
is full, along with a timer that unsets it again after 10ms.
The input queue beeing full is a reliable indicator for CPU overload, and
this flag allows other subsystems to cope with the situation.
hacked with beck
ok kjc@ markus@ beck@

Revision 1.84 / (download) - annotate - [select for diffs], Sat Feb 28 09:14:10 2004 UTC (20 years, 3 months ago) by mcbride
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.83: +6 -2 lines
Diff to previous 1.83 (colored)

- Don't permit 0-padded unit numbers on cloned interfaces. Bug repoprt
  from otto@
- Fix signedness issue with unit numbers. Bug report from Thorsten Glaser

ok millert@ otto@

Revision 1.27.2.9 / (download) - annotate - [select for diffs], Thu Feb 19 10:57:21 2004 UTC (20 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.27.2.8: +370 -102 lines
Diff to previous 1.27.2.8 (colored) to branchpoint 1.27 (colored)

Merge of current from two weeks agointo the SMP branch

Revision 1.83 / (download) - annotate - [select for diffs], Sun Feb 8 19:46:10 2004 UTC (20 years, 4 months ago) by markus
Branch: MAIN
Changes since 1.82: +16 -5 lines
Diff to previous 1.82 (colored)

if_detach_rtdelete(): abort and restart rn_walktree() if a cloning route
gets deleted; fixes pr 3649; ok henning, deraadt, dhartmei

Revision 1.82 / (download) - annotate - [select for diffs], Thu Jan 15 10:47:55 2004 UTC (20 years, 5 months ago) by markus
Branch: MAIN
Changes since 1.81: +7 -1 lines
Diff to previous 1.81 (colored)

add a RTM_IFANNOUNCE message; from netbsd; ok itojun, henning

Revision 1.81 / (download) - annotate - [select for diffs], Fri Jan 9 10:44:32 2004 UTC (20 years, 5 months ago) by markus
Branch: MAIN
Changes since 1.80: +11 -4 lines
Diff to previous 1.80 (colored)

fix leak ether_deatch(): if if_free_sadl() is called before if_detach()
then ifnet_addrs[ifp->if_index] leaks; if it's called after if_detach()
then if_free_sadl() does nothing; ok itojun

Revision 1.80 / (download) - annotate - [select for diffs], Wed Dec 31 11:18:25 2003 UTC (20 years, 5 months ago) by cedric
Branch: MAIN
Changes since 1.79: +16 -2 lines
Diff to previous 1.79 (colored)

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to  a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@

Revision 1.79 / (download) - annotate - [select for diffs], Tue Dec 16 20:33:24 2003 UTC (20 years, 5 months ago) by markus
Branch: MAIN
Changes since 1.78: +2 -3 lines
Diff to previous 1.78 (colored)

return error in ifc_destroy; ok deraadt, itojun, cedric, hshoexer

Revision 1.78 / (download) - annotate - [select for diffs], Wed Dec 10 07:22:42 2003 UTC (20 years, 6 months ago) by itojun
Branch: MAIN
Changes since 1.77: +30 -30 lines
Diff to previous 1.77 (colored)

de-register.  deraadt ok

Revision 1.77 / (download) - annotate - [select for diffs], Wed Dec 10 03:30:21 2003 UTC (20 years, 6 months ago) by itojun
Branch: MAIN
Changes since 1.76: +9 -6 lines
Diff to previous 1.76 (colored)

use if_indexlim (instead of if_index) and ifindex2ifnet[x] != NULL
to check if interface exists, as (1) if_index will have different meaning
(2) ifindex2ifnet could become NULL when interface gets destroyed,
when we introduce dynamically-created interfaces.  markus ok

Revision 1.76 / (download) - annotate - [select for diffs], Mon Dec 8 09:09:03 2003 UTC (20 years, 6 months ago) by markus
Branch: MAIN
Changes since 1.75: +38 -1 lines
Diff to previous 1.75 (colored)

add IOCIFGCLONERS; ifconfig -C; from netbsd; ok henning, deraadt

Revision 1.75 / (download) - annotate - [select for diffs], Wed Dec 3 13:27:36 2003 UTC (20 years, 6 months ago) by markus
Branch: MAIN
Changes since 1.74: +131 -2 lines
Diff to previous 1.74 (colored)

support for network interface "cloning", e.g. gif(4) via ifconfig(8)

Revision 1.74 / (download) - annotate - [select for diffs], Wed Dec 3 11:01:43 2003 UTC (20 years, 6 months ago) by markus
Branch: MAIN
Changes since 1.73: +31 -3 lines
Diff to previous 1.73 (colored)

protect against if_index wrap; similar to what netbsd does; ok henning deraadt

Revision 1.73 / (download) - annotate - [select for diffs], Thu Nov 6 21:09:34 2003 UTC (20 years, 7 months ago) by mickey
Branch: MAIN
Changes since 1.72: +1 -2 lines
Diff to previous 1.72 (colored)

move netisr definition into md code to allow arch provide suitable allocation; tested on most archs

Revision 1.72 / (download) - annotate - [select for diffs], Fri Oct 17 21:04:58 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.71: +12 -1 lines
Diff to previous 1.71 (colored)

Common Address Redundancy Protocol

Allows multiple hosts to share an IP address, providing high availability
and load balancing.

Based on code by mickey@, with additional help from markus@
and Marco_Pfatschbacher@genua.de

ok deraadt@

Revision 1.71 / (download) - annotate - [select for diffs], Wed Oct 1 05:06:06 2003 UTC (20 years, 8 months ago) by itojun
Branch: MAIN
Changes since 1.70: +7 -4 lines
Diff to previous 1.70 (colored)

make ifindex2ifnet growing code more correct. (found by iij seil team)

Revision 1.70 / (download) - annotate - [select for diffs], Wed Aug 27 00:33:34 2003 UTC (20 years, 9 months ago) by henric
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.69: +1 -55 lines
Diff to previous 1.69 (colored)

RNF_IGNORE can corrupt the radix tree when an interface is down, it
makes routing lookups slightly more expensive, and serves no useful
purpose.

ok itojun@ tedu@

Revision 1.69 / (download) - annotate - [select for diffs], Mon Aug 25 08:18:54 2003 UTC (20 years, 9 months ago) by fgsch
Branch: MAIN
Changes since 1.68: +8 -0 lines
Diff to previous 1.68 (colored)

if_init support, required by ieee80211.
deraadt@ ok.

Revision 1.68 / (download) - annotate - [select for diffs], Fri Aug 15 20:32:19 2003 UTC (20 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.67: +5 -5 lines
Diff to previous 1.67 (colored)

change arguments to suser.  suser now takes the process, and a flags
argument.  old cred only calls user suser_ucred.  this will allow future
work to more flexibly implement the idea of a root process.  looks like
something i saw in freebsd, but a little different.
use of suser_ucred vs suser in file system code should be looked at again,
for the moment semantics remain unchanged.
review and input from art@  testing and further review miod@

Revision 1.67 / (download) - annotate - [select for diffs], Wed Jul 23 22:48:00 2003 UTC (20 years, 10 months ago) by itojun
Branch: MAIN
Changes since 1.66: +79 -1 lines
Diff to previous 1.66 (colored)

remove packets in queues (like ipintrq) with m->m_pkthdr.rcvif pointing
to detached if.  deraadt ok

Revision 1.27.2.8 / (download) - annotate - [select for diffs], Sat Jun 7 11:06:06 2003 UTC (21 years ago) by ho
Branch: SMP
Changes since 1.27.2.7: +2 -6 lines
Diff to previous 1.27.2.7 (colored) to branchpoint 1.27 (colored)

Sync SMP branch to -current

Revision 1.66 / (download) - annotate - [select for diffs], Mon Jun 2 23:28:11 2003 UTC (21 years ago) by millert
Branch: MAIN
Changes since 1.65: +2 -6 lines
Diff to previous 1.65 (colored)

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.

Revision 1.50.2.3 / (download) - annotate - [select for diffs], Mon May 19 22:30:08 2003 UTC (21 years ago) by tedu
Branch: UBC
Changes since 1.50.2.2: +2 -1 lines
Diff to previous 1.50.2.2 (colored) to branchpoint 1.50 (colored) next main 1.51 (colored)

sync

Revision 1.27.2.7 / (download) - annotate - [select for diffs], Tue May 13 19:36:14 2003 UTC (21 years, 1 month ago) by ho
Branch: SMP
Changes since 1.27.2.6: +2 -1 lines
Diff to previous 1.27.2.6 (colored) to branchpoint 1.27 (colored)

Sync the SMP branch to -current. This includes moving to ELF.

Revision 1.65 / (download) - annotate - [select for diffs], Mon May 12 00:48:52 2003 UTC (21 years, 1 month ago) by jason
Branch: MAIN
CVS Tags: UBC_SYNC_A
Changes since 1.64: +2 -1 lines
Diff to previous 1.64 (colored)

Nuke a whole bunch of commons; ok tedu (still more to come *sigh*)

Revision 1.27.2.6 / (download) - annotate - [select for diffs], Fri Mar 28 00:41:28 2003 UTC (21 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.27.2.5: +132 -29 lines
Diff to previous 1.27.2.5 (colored) to branchpoint 1.27 (colored)

Sync the SMP branch with 3.3

Revision 1.50.2.2 / (download) - annotate - [select for diffs], Tue Oct 29 00:36:45 2002 UTC (21 years, 7 months ago) by art
Branch: UBC
Changes since 1.50.2.1: +78 -23 lines
Diff to previous 1.50.2.1 (colored) to branchpoint 1.50 (colored)

sync to -current

Revision 1.64 / (download) - annotate - [select for diffs], Wed Sep 11 05:38:47 2002 UTC (21 years, 9 months ago) by itojun
Branch: MAIN
CVS Tags: UBC_SYNC_B, OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.63: +2 -2 lines
Diff to previous 1.63 (colored)

KNF - return is not a function.

Revision 1.63 / (download) - annotate - [select for diffs], Wed Jul 3 21:19:08 2002 UTC (21 years, 11 months ago) by miod
Branch: MAIN
Changes since 1.62: +3 -1 lines
Diff to previous 1.62 (colored)

Change all variables definitions (int foo) in sys/sys/*.h to variable
declarations (extern int foo), and compensate in the appropriate locations.

Revision 1.62 / (download) - annotate - [select for diffs], Sun Jun 30 13:04:35 2002 UTC (21 years, 11 months ago) by itojun
Branch: MAIN
Changes since 1.61: +67 -16 lines
Diff to previous 1.61 (colored)

allocate sockaddr_dl for ifnet in if_alloc_sadl(), as we don't always know
the size of sockaddr_dl on if_attach() - for instance, see ether_ifattach().
from netbsd.  fgs ok

Revision 1.61 / (download) - annotate - [select for diffs], Tue Jun 11 04:26:17 2002 UTC (22 years ago) by art
Branch: MAIN
Changes since 1.60: +9 -7 lines
Diff to previous 1.60 (colored)

splassert(IPL_SOFTNET) where comment indicate that.

Revision 1.50.2.1 / (download) - annotate - [select for diffs], Tue Jun 11 03:30:45 2002 UTC (22 years ago) by art
Branch: UBC
Changes since 1.50: +65 -17 lines
Diff to previous 1.50 (colored)

Sync UBC branch to -current

Revision 1.60 / (download) - annotate - [select for diffs], Sat Jun 8 21:51:08 2002 UTC (22 years ago) by itojun
Branch: MAIN
Changes since 1.59: +2 -2 lines
Diff to previous 1.59 (colored)

splnet -> splsoftnet where appropriate

Revision 1.59 / (download) - annotate - [select for diffs], Sat Jun 8 12:02:09 2002 UTC (22 years ago) by itojun
Branch: MAIN
Changes since 1.58: +4 -1 lines
Diff to previous 1.58 (colored)

more splnet protection to dom_ifattach

Revision 1.58 / (download) - annotate - [select for diffs], Sat Jun 8 11:53:29 2002 UTC (22 years ago) by itojun
Branch: MAIN
Changes since 1.57: +6 -1 lines
Diff to previous 1.57 (colored)

protect dom_ifattach by splnet

Revision 1.57 / (download) - annotate - [select for diffs], Thu May 30 05:07:17 2002 UTC (22 years ago) by itojun
Branch: MAIN
Changes since 1.56: +2 -9 lines
Diff to previous 1.56 (colored)

improve nd6_setmtu(), to warn too-small MTU on SIOCSIFMTU.  sync w/kame

Revision 1.56 / (download) - annotate - [select for diffs], Wed May 29 02:51:37 2002 UTC (22 years ago) by itojun
Branch: MAIN
Changes since 1.55: +2 -5 lines
Diff to previous 1.55 (colored)

simplify comment, sync w/kame

Revision 1.55 / (download) - annotate - [select for diffs], Mon May 27 13:42:16 2002 UTC (22 years ago) by itojun
Branch: MAIN
Changes since 1.54: +25 -3 lines
Diff to previous 1.54 (colored)

if_attach() gets called before domaininit().  scan all interfaces for if_afdata
initialization after domaininit().

Revision 1.54 / (download) - annotate - [select for diffs], Mon May 27 02:59:40 2002 UTC (22 years ago) by itojun
Branch: MAIN
Changes since 1.53: +20 -1 lines
Diff to previous 1.53 (colored)

framework to add af-dependent data structure to struct ifnet.
as discussed at bsd-api-discuss.  sync w/kame

Revision 1.53 / (download) - annotate - [select for diffs], Wed Apr 24 16:42:59 2002 UTC (22 years, 1 month ago) by dhartmei
Branch: MAIN
Changes since 1.52: +5 -1 lines
Diff to previous 1.52 (colored)

Initialize if_addrhooks in if_attachhead() like in if_attach(), either
one may be called.

Revision 1.52 / (download) - annotate - [select for diffs], Wed Apr 24 00:51:51 2002 UTC (22 years, 1 month ago) by dhartmei
Branch: MAIN
Changes since 1.51: +6 -1 lines
Diff to previous 1.51 (colored)

Add hooks to struct ifnet that allow to register callbacks that will be
notified of interface address changes. ok provos@, angelos@

Revision 1.27.2.5 / (download) - annotate - [select for diffs], Thu Mar 28 14:57:36 2002 UTC (22 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.27.2.4: +8 -8 lines
Diff to previous 1.27.2.4 (colored) to branchpoint 1.27 (colored)

Merge in -current from roughly a week ago

Revision 1.51 / (download) - annotate - [select for diffs], Thu Mar 14 01:27:09 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.50: +9 -9 lines
Diff to previous 1.50 (colored)

First round of __P removal in sys

Revision 1.27.2.4 / (download) - annotate - [select for diffs], Wed Mar 6 02:15:06 2002 UTC (22 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.27.2.3: +32 -24 lines
Diff to previous 1.27.2.3 (colored) to branchpoint 1.27 (colored)

Merge in trunk

Revision 1.50 / (download) - annotate - [select for diffs], Sun Dec 9 12:57:26 2001 UTC (22 years, 6 months ago) by jason
Branch: MAIN
CVS Tags: UBC_BASE
Branch point for: UBC
Changes since 1.49: +32 -24 lines
Diff to previous 1.49 (colored)

Don't access the tq members directly, use the queue.h macros.  Also,
convert several of the loops to TAILQ_FOREACH.

Revision 1.27.2.3 / (download) - annotate - [select for diffs], Wed Jul 4 10:53:53 2001 UTC (22 years, 11 months ago) by niklas
Branch: SMP
Changes since 1.27.2.2: +62 -24 lines
Diff to previous 1.27.2.2 (colored) to branchpoint 1.27 (colored)

Merge in -current from two days ago in the SMP branch.
As usual with merges, they do not indicate progress, so do not hold
your breath for working SMP, and do not mail me and ask about the
state of it.  It has not changed.  There is work ongoing, but very, very
slowly.  The commit is done in parts as to not lock up the tree in too
big chunks at a time.

Revision 1.49 / (download) - annotate - [select for diffs], Fri Jun 29 22:46:05 2001 UTC (22 years, 11 months ago) by fgsch
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.48: +4 -6 lines
Diff to previous 1.48 (colored)

Move ifq_maxlen setting to if_attach(). Doing it at if_init() is wrong,
and has been wrong since PnP devices (pcmcia, carbus, etc) shown up.
If you forgot to set ifq_maxlen somewhere in the driver, you're gonna
see baaaad things; jason@ ok, angelos@ "should be ok" , theo
"don't understand why".

Revision 1.48 / (download) - annotate - [select for diffs], Wed Jun 27 05:50:06 2001 UTC (22 years, 11 months ago) by kjc
Branch: MAIN
Changes since 1.47: +15 -2 lines
Diff to previous 1.47 (colored)

ALTQ base modifications to the kernel.
 - ALTQ introduces a set of new queue macros that coexist with the
   traditional IF_XXX macros.
 - "struct ifaltq" replaces "struct ifqueue" in "struct ifnet".
 - assign cdev major 74 for i386 and 54 for alpha as ALTQ control interface.

Revision 1.47 / (download) - annotate - [select for diffs], Fri Jun 22 14:28:58 2001 UTC (22 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.46: +2 -2 lines
Diff to previous 1.46 (colored)

KNF

Revision 1.46 / (download) - annotate - [select for diffs], Fri Jun 15 03:38:33 2001 UTC (23 years ago) by itojun
Branch: MAIN
Changes since 1.45: +3 -1 lines
Diff to previous 1.45 (colored)

change the meaning of ifnet.if_lastchange to meet RFC1573 ifLastChange.
follows BSD/OS practice and ucd-snmp code (FreeBSD does it for specific
interfaces only).

was: if_lastchange get updated on every packet transmission/receipt.
now: if_lastchange get updated when IFF_UP is changed.

Revision 1.45 / (download) - annotate - [select for diffs], Fri Jun 8 04:19:25 2001 UTC (23 years ago) by angelos
Branch: MAIN
Changes since 1.44: +42 -6 lines
Diff to previous 1.44 (colored)

Move ifpromisc() from bpf.c to if.c, include cleanup.

Revision 1.44 / (download) - annotate - [select for diffs], Wed May 30 02:12:24 2001 UTC (23 years ago) by deraadt
Branch: MAIN
Changes since 1.43: +1 -12 lines
Diff to previous 1.43 (colored)

Remove ipf.  Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too).  Specifically,
Darren says that modified versions are not permitted.  But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia.  Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).

Revision 1.27.2.2 / (download) - annotate - [select for diffs], Mon May 14 22:39:59 2001 UTC (23 years, 1 month ago) by niklas
Branch: SMP
Changes since 1.27.2.1: +123 -13 lines
Diff to previous 1.27.2.1 (colored) to branchpoint 1.27 (colored)

merge in approximately 2.9 into SMP branch

Revision 1.43 / (download) - annotate - [select for diffs], Tue Feb 20 13:50:53 2001 UTC (23 years, 3 months ago) by itojun
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.42: +5 -2 lines
Diff to previous 1.42 (colored)

provide SIOC[SG]LIFPHYADDR, which greatly simplify userland manipulation.
sync with kame.  old ioctls are kept but not really recommended.

Revision 1.42 / (download) - annotate - [select for diffs], Tue Feb 13 19:49:32 2001 UTC (23 years, 4 months ago) by art
Branch: MAIN
Changes since 1.41: +40 -1 lines
Diff to previous 1.41 (colored)

When detaching an interface set the if_start, if_ioctl and if_watchdog
functions to 'nops'.

Some protocols might want to output some packets while detaching and
that could be a bad idea when the interface has gone away.
Do we need to change more functions?

Revision 1.41 / (download) - annotate - [select for diffs], Tue Jan 30 04:22:24 2001 UTC (23 years, 4 months ago) by kjell
Branch: MAIN
Changes since 1.40: +2 -2 lines
Diff to previous 1.40 (colored)

change ip_compat.h to ip_fil_compat.h for clarity. Impending ipf merge

Revision 1.40 / (download) - annotate - [select for diffs], Fri Jan 19 06:37:36 2001 UTC (23 years, 4 months ago) by itojun
Branch: MAIN
Changes since 1.39: +4 -4 lines
Diff to previous 1.39 (colored)

pull post-4.4BSD change to sys/net/route.c from BSD/OS 4.2 (UCB copyrighted).

have sys/net/route.c:rtrequest1(), which takes rt_addrinfo * as the argument.
pass rt_addrinfo all the way down to rtrequest, and ifa->ifa_rtrequest.
3rd arg of ifa->ifa_rtrequest is now rt_addrinfo * instead of sockaddr *
(almost noone is using it anyways).

benefit: the follwoing command now works.  previously we need two route(8)
invocations, "add" then "change".
# route add -inet6 default ::1 -ifp gif0

remove unsafe typecast in rtrequest(), from rtentry * to sockaddr *.  it was
introduced by 4.3BSD-reno and never corrected.

XXX is eon_rtrequest() change correct regarding to 3rd arg?
eon_rtrequest() and rtrequest() were incorrect since 4.3BSD-reno,
so i do not have correct answer in the source code.
someone with more clue about netiso-over-ip, please help.

Revision 1.39 / (download) - annotate - [select for diffs], Wed Jan 17 04:47:18 2001 UTC (23 years, 4 months ago) by fgsch
Branch: MAIN
Changes since 1.38: +3 -3 lines
Diff to previous 1.38 (colored)

IPF 3.4.15. (IPv6 not working yet).

Note: before building the userland part you need to do make includes.

Revision 1.31.2.1 / (download) - annotate - [select for diffs], Sat Oct 21 05:41:41 2000 UTC (23 years, 7 months ago) by jason
Branch: OPENBSD_2_7
Changes since 1.31: +8 -1 lines
Diff to previous 1.31 (colored) next main 1.32 (colored)

Pull in patches from current:
Fixes (itojun):
- make sure we have root priv on SIOCSIFPHY*.  from thorpej@netbsd
- there is no SIOCDIFPHYADDR in openbsd-current yet (in kame, there is)
- repair SIOCGIFP*ADDR.

Revision 1.38 / (download) - annotate - [select for diffs], Sat Oct 7 03:43:16 2000 UTC (23 years, 8 months ago) by itojun
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.37: +3 -1 lines
Diff to previous 1.37 (colored)

repair SIOCGIFP*ADDR.

Revision 1.37 / (download) - annotate - [select for diffs], Thu Oct 5 02:12:51 2000 UTC (23 years, 8 months ago) by itojun
Branch: MAIN
Changes since 1.36: +1 -2 lines
Diff to previous 1.36 (colored)

there is no SIOCDIFPHYADDR in openbsd-current yet (in kame, there is)

Revision 1.36 / (download) - annotate - [select for diffs], Wed Oct 4 23:17:27 2000 UTC (23 years, 8 months ago) by itojun
Branch: MAIN
Changes since 1.35: +7 -1 lines
Diff to previous 1.35 (colored)

make sure we have root priv on SIOCSIFPHY*.  from thorpej@netbsd

Revision 1.35 / (download) - annotate - [select for diffs], Tue Jun 20 06:49:04 2000 UTC (23 years, 11 months ago) by art
Branch: MAIN
Changes since 1.34: +10 -6 lines
Diff to previous 1.34 (colored)

Convert if_slowtimo to use new timeouts.

Revision 1.34 / (download) - annotate - [select for diffs], Sun Jun 18 00:14:27 2000 UTC (23 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.33: +5 -6 lines
Diff to previous 1.33 (colored)

increase my commit count by 1, because after telling niels three times that he has an indentation flaw, he has not fixed it, so i get a commit, thanks niels

Revision 1.33 / (download) - annotate - [select for diffs], Sat Jun 17 20:36:36 2000 UTC (23 years, 11 months ago) by provos
Branch: MAIN
Changes since 1.32: +3 -3 lines
Diff to previous 1.32 (colored)

fix comments

Revision 1.32 / (download) - annotate - [select for diffs], Sat Jun 17 20:30:34 2000 UTC (23 years, 11 months ago) by provos
Branch: MAIN
Changes since 1.31: +55 -1 lines
Diff to previous 1.31 (colored)

on ifconfig down ignore all routes pointing to the downed interface.
okay itojun@ deraadt@

Revision 1.31 / (download) - annotate - [select for diffs], Fri May 5 07:58:15 2000 UTC (24 years, 1 month ago) by itojun
Branch: MAIN
CVS Tags: OPENBSD_2_7_BASE
Branch point for: OPENBSD_2_7
Changes since 1.30: +5 -1 lines
Diff to previous 1.30 (colored)

cope with interface detach (like pcmcia card removal).  remove any
IPv6 addresses assigned to the interface.  reported by ho, bunch of
help from niklas.   KAME PR 231.

Revision 1.27.2.1 / (download) - annotate - [select for diffs], Fri Mar 24 09:09:31 2000 UTC (24 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.27: +27 -32 lines
Diff to previous 1.27 (colored)

Sync with -current

Revision 1.30 / (download) - annotate - [select for diffs], Wed Mar 22 11:28:42 2000 UTC (24 years, 2 months ago) by itojun
Branch: MAIN
Changes since 1.29: +1 -30 lines
Diff to previous 1.29 (colored)

remove if_withname(), which was imported during KAME merge by mistake.

Revision 1.29 / (download) - annotate - [select for diffs], Tue Mar 21 23:31:26 2000 UTC (24 years, 2 months ago) by mickey
Branch: MAIN
Changes since 1.28: +27 -1 lines
Diff to previous 1.28 (colored)

add SIOCGIFMTU/SIOCSIFMTU; remediate redundant code of tun, ppp, sppp; chris@ ok

Revision 1.28 / (download) - annotate - [select for diffs], Sun Mar 12 03:54:43 2000 UTC (24 years, 3 months ago) by itojun
Branch: MAIN
Changes since 1.27: +1 -3 lines
Diff to previous 1.27 (colored)

remove redundant check against ifa_dstaddr.

Revision 1.27 / (download) - annotate - [select for diffs], Sun Jan 2 05:28:24 2000 UTC (24 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: SMP_BASE
Branch point for: SMP
Changes since 1.26: +2 -2 lines
Diff to previous 1.26 (colored)

do in6_if_up() at splsoftnet() instead of splimp(), permitting device-related interrupts during that time.  It is believed this is safe

Revision 1.26 / (download) - annotate - [select for diffs], Sat Dec 18 22:03:43 1999 UTC (24 years, 5 months ago) by angelos
Branch: MAIN
Changes since 1.25: +3 -1 lines
Diff to previous 1.25 (colored)

ifdef myip_ifp (kernel/1014, thanks to dne@mayonnaise.net for testing
the patch)

Revision 1.25 / (download) - annotate - [select for diffs], Wed Dec 8 06:50:17 1999 UTC (24 years, 6 months ago) by itojun
Branch: MAIN
CVS Tags: kame_19991208
Changes since 1.24: +134 -15 lines
Diff to previous 1.24 (colored)

bring in KAME IPv6 code, dated 19991208.
replaces NRL IPv6 layer.  reuses NRL pcb layer.  no IPsec-on-v6 support.
see sys/netinet6/{TODO,IMPLEMENTATION} for more details.

GENERIC configuration should work fine as before.  GENERIC.v6 works fine
as well, but you'll need KAME userland tools to play with IPv6 (will be
bringed into soon).

Revision 1.24 / (download) - annotate - [select for diffs], Sat Nov 20 18:51:58 1999 UTC (24 years, 6 months ago) by espie
Branch: MAIN
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored)

ioctl arguments are u_long.
Replaces `undefined' code with `defined' behavior...

gcc 2.96 performs switch cases range analysis, warns about unreachable
cases, and weeds them out.

In

switch(i) {
case VALUE:
}

VALUE is first coerced into the type of i.  If i is signed, VALUE is
unsigned and exceeds i range, you lose... the result of the conversion
is undefined.

Revision 1.23 / (download) - annotate - [select for diffs], Tue Nov 9 17:49:01 1999 UTC (24 years, 7 months ago) by millert
Branch: MAIN
Changes since 1.22: +4 -1 lines
Diff to previous 1.22 (colored)

Add SIOCSIFMEDIA and SIOCGIFMEDIA to the switch in ifioctl().  SIOCSIFMEDIA
is only allowed if the user is the superuser.  Aparently this got
missed when the ifmedia support was added in ages ago.   More or less
based on how NetBSD does it (though it is rather obvious).

Revision 1.22 / (download) - annotate - [select for diffs], Wed Oct 27 16:36:25 1999 UTC (24 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.21: +6 -7 lines
Diff to previous 1.21 (colored)

move nat_ifdetach() after interface is removed from the list; avalon@coombs.anu.edu.au

Revision 1.21 / (download) - annotate - [select for diffs], Sun Aug 8 14:59:02 1999 UTC (24 years, 10 months ago) by niklas
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6
Changes since 1.20: +2 -2 lines
Diff to previous 1.20 (colored)

typo

Revision 1.20 / (download) - annotate - [select for diffs], Sun Aug 8 00:43:00 1999 UTC (24 years, 10 months ago) by niklas
Branch: MAIN
Changes since 1.19: +127 -5 lines
Diff to previous 1.19 (colored)

Support detaching of network interfaces.  Still work to do in ipf, and
other families than inet.

Revision 1.19 / (download) - annotate - [select for diffs], Sun Jul 4 20:39:28 1999 UTC (24 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored)

fix unsigned without a size-type

Revision 1.18 / (download) - annotate - [select for diffs], Wed Aug 5 19:51:06 1998 UTC (25 years, 10 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4
Changes since 1.17: +18 -3 lines
Diff to previous 1.17 (colored)

fix ifc_len == 0 hack for variable size structures.

Revision 1.17 / (download) - annotate - [select for diffs], Tue Aug 4 20:57:19 1998 UTC (25 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.16: +9 -1 lines
Diff to previous 1.16 (colored)

Add hack to SIOCGIFCONF where if ifc_len is 0, fill it in with the size needed and return; Linux does this too.  Suggested by cmetz@inner.net

Revision 1.16 / (download) - annotate - [select for diffs], Wed Mar 25 07:37:29 1998 UTC (26 years, 2 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_3_BASE, OPENBSD_2_3
Changes since 1.15: +6 -1 lines
Diff to previous 1.15 (colored)

add SIOCGIFDATA; fetches ifdata structure attached to each interface

Revision 1.15 / (download) - annotate - [select for diffs], Wed Dec 31 04:09:32 1997 UTC (26 years, 5 months ago) by mickey
Branch: MAIN
Changes since 1.14: +5 -5 lines
Diff to previous 1.14 (colored)

NULL is not 0

Revision 1.14 / (download) - annotate - [select for diffs], Fri Jul 11 23:43:00 1997 UTC (26 years, 11 months ago) by provos
Branch: MAIN
CVS Tags: OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)

argh. commited wrong file

Revision 1.13 / (download) - annotate - [select for diffs], Fri Jul 11 23:37:52 1997 UTC (26 years, 11 months ago) by provos
Branch: MAIN
Changes since 1.12: +1 -1 lines
Diff to previous 1.12 (colored)

put old esp/ah and new esp/ah in different files.
generalised way of handling transforms.

Revision 1.12 / (download) - annotate - [select for diffs], Sat Aug 3 17:50:35 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1, OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.11: +3 -1 lines
Diff to previous 1.11 (colored)

dst addr might be NULL; netbsd pr#2183; chuck@maria.wustl.edu

Revision 1.11 / (download) - annotate - [select for diffs], Tue Jul 2 06:52:05 1996 UTC (27 years, 11 months ago) by niklas
Branch: MAIN
Changes since 1.10: +3 -1 lines
Diff to previous 1.10 (colored)

-Wall & -Wstrict-prototype fixes

Revision 1.10 / (download) - annotate - [select for diffs], Sat Jun 29 18:54:08 1996 UTC (27 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.9: +26 -7 lines
Diff to previous 1.9 (colored)

provide if_attachhead(), and make if_loop use it

Revision 1.9 / (download) - annotate - [select for diffs], Fri May 10 12:31:07 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.8: +48 -112 lines
Diff to previous 1.8 (colored)

if_name/if_unit -> if_xname/if_softc

Revision 1.8 / (download) - annotate - [select for diffs], Thu May 9 11:10:28 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.7: +3 -3 lines
Diff to previous 1.7 (colored)

linux & svr4 support

Revision 1.7 / (download) - annotate - [select for diffs], Sun Apr 21 22:28:29 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.6: +2 -1 lines
Diff to previous 1.6 (colored)

partial sync with netbsd 960418, more to come

Revision 1.6 / (download) - annotate - [select for diffs], Thu Mar 14 08:35:35 1996 UTC (28 years, 3 months ago) by tholo
Branch: MAIN
Changes since 1.5: +3 -2 lines
Diff to previous 1.5 (colored)

From Lite2; only try to match a destination address on a point-to-point
interface if the destination address has been set

Revision 1.5 / (download) - annotate - [select for diffs], Tue Mar 5 02:29:37 1996 UTC (28 years, 3 months ago) by dm
Branch: MAIN
Changes since 1.4: +3 -2 lines
Diff to previous 1.4 (colored)

need some casts for clean compile

Revision 1.4 / (download) - annotate - [select for diffs], Sun Mar 3 21:07:04 1996 UTC (28 years, 3 months ago) by niklas
Branch: MAIN
Changes since 1.3: +16 -10 lines
Diff to previous 1.3 (colored)

From NetBSD: 960217 merge

Revision 1.3 / (download) - annotate - [select for diffs], Sun Feb 4 20:48:09 1996 UTC (28 years, 4 months ago) by niklas
Branch: MAIN
Changes since 1.2: +10 -3 lines
Diff to previous 1.2 (colored)

Interface# 0's name was incorrectly generated

Revision 1.2 / (download) - annotate - [select for diffs], Sat Feb 3 20:06:27 1996 UTC (28 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +10 -2 lines
Diff to previous 1.1 (colored)

handle interface unit numbers up to 2G-1; skip if total name is too long

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:53:05 1995 UTC (28 years, 8 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:53:05 1995 UTC (28 years, 8 months ago) by deraadt
Branch: MAIN

Initial revision

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.