OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


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

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

Revision 1.239 / (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.238: +1 -3 lines
Diff to previous 1.238 (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.238 / (download) - annotate - [select for diffs], Fri Feb 10 14:39:18 2023 UTC (16 months ago) by visa
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.237: +62 -28 lines
Diff to previous 1.237 (colored)

Make tun(4) and tap(4) event filters MP-safe.

OK mvs@

Revision 1.237 / (download) - annotate - [select for diffs], Sat Jul 2 08:50:42 2022 UTC (23 months, 1 week ago) by visa
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.236: +1 -47 lines
Diff to previous 1.236 (colored)

Remove unused device poll functions.

Also remove unneeded includes of <sys/poll.h> and <sys/select.h>.

Some addenda from jsg@.

OK miod@ mpi@

Revision 1.236 / (download) - annotate - [select for diffs], Sat Feb 26 02:15:45 2022 UTC (2 years, 3 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.235: +16 -1 lines
Diff to previous 1.235 (colored)

have another go at fixing assert "sc->sc_dev == NUM" failed.

claudio figured it out. his clue was that multiple concurrent calls
to tunopen (or tapopen) will share a vnode. because tunopen can sleep,
multiple programs can be inside tunopen for the same tun interface at
the same time, all with references against the same vnode.

at the same time as this another thread/program can call VOP_REVOKE
via tun_clone_destroy (eg, ifconfig tun1 destroy does this).
VOP_REVOKE marks a vnode as bad, which in turn means that subsequent
open()s of a tun interface will get a brand new vnode.

so multiple threads holding references to a vnode can be sleeping in
tun_dev_open on the interface cloner lock. one thread wins and takes
ownership of the tun interface, then another thread can destroy that tun
interface, calls VOP_REVOKE which calls tun_dev_close to tear down the
vnodes association with the tun interface and mark the vnode as bad.
the thread that called tun_clone_destroy then creates another instance
of the interface by calling tun_clone_create immediately.

one of the original threads with the old vnode reference wakes up and
takes ownership of the new tun_softc. however, because the vnode is bad,
all the vnode ops have been replaced with the deadfs ops. the close() op
on the old vnode is now a nop from the point of view of tun interfaces.
the old vnode is no longer associated with tun and tap and will now
never call tun_dev_close (via tunclose or tapclose), which in turn means
sc_dev won't get cleared.

another thread can now call tun_clone_destroy against the new instance
of tun_softc. this instance has sc_dev set, so it tries to revoke it,
but there's no vnode associated with it because the old vnode reference
is dead.

because this second call to VOP_REVOKE couldnt find a vnode, it
can't call tunclose against it, so sc_dev is still set and this
KASSERT fires.

claudio and i came up with the following, which is to have tun_dev_open
check the state of the vnode associated with the current open call
after all the sleeping and potential tun_clone_destroy and
tun_clone_create calls. if the vnode has been made bad/dead after
all the sleeping, it returns with ENXIO.

Reported-by: syzbot+5e13201866c43afbfbf6@syzkaller.appspotmail.com
ok claudio@ visa@

Revision 1.235 / (download) - annotate - [select for diffs], Tue Feb 22 01:15:02 2022 UTC (2 years, 3 months ago) by guenther
Branch: MAIN
Changes since 1.234: +1 -2 lines
Diff to previous 1.234 (colored)

Delete unnecessary #includes of <sys/domain.h> and/or <sys/protosw.h>

net/if_pppx.c pointed out by jsg@
ok gnezdo@ deraadt@ jsg@ mpi@ millert@

Revision 1.234 / (download) - annotate - [select for diffs], Wed Feb 16 02:22:39 2022 UTC (2 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.233: +23 -11 lines
Diff to previous 1.233 (colored)

prevent (re)opening of tun/tap interfaces that are being destroyed.

if an open tun (or tap) device is destroyed via the clone destroy
ioctl (eg, like what ifconfig destroy does), there is a window while
the open device is being revoked on the vfs side that a third thread
can come and open it again. this in turn triggers a kassert in the
ifconfig destroy path where it expects the
device to be closed.

fix this by having tun_dev_open check for the TUN_DEAD flag that
the destroy function sets. this still relies on the kernel lock for
serialisation.

Reported-by: syzbot+5df2ad232f5f8b671442@syzkaller.appspotmail.com
ok visa@

Revision 1.233 / (download) - annotate - [select for diffs], Tue Feb 15 04:19:52 2022 UTC (2 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.232: +5 -2 lines
Diff to previous 1.232 (colored)

only tweak ifp if_flags while holding NET_LOCK.

tun_dev_open and tun_dev_close were being optmistic.

Revision 1.232 / (download) - annotate - [select for diffs], Tue Feb 15 04:16:10 2022 UTC (2 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.231: +5 -7 lines
Diff to previous 1.231 (colored)

make tun_link_state take the ifnet pointer instead of tun_softc.

it only works on struct ifnet data, so passing ifp makes it clearer
what's actually being manipulated. also fix tun_dev_open so
tun_link_state is called before if_put instead of immediately after.

Revision 1.231 / (download) - annotate - [select for diffs], Tue Mar 9 20:05:14 2021 UTC (3 years, 3 months ago) by anton
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.230: +3 -2 lines
Diff to previous 1.230 (colored)

Issuing FIOSETOWN and TIOCSPGRP ioctl commands on a tun(4) device leaks
device references causing a hang while trying to remove the same
interface since the reference count will never reach zero. Instead of
returning, break out of the switch in order to ensure that tun_put()
gets called.

ok deraadt@ mvs@

Reported-by: syzbot+2ca11c73711a1d0b5c6c@syzkaller.appspotmail.com

Revision 1.230 / (download) - annotate - [select for diffs], Sat Feb 20 04:39:16 2021 UTC (3 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.229: +4 -1 lines
Diff to previous 1.229 (colored)

let tun use bpf_mtap for handling input packets.

tun (not tap) input packets are written from userland in the same
format that it's bpf dlt is expecting, so we can push the packet
straight into bpf with bpf_mtap. this is more correct that using
bpf_mtap_ether for tun.

Revision 1.229 / (download) - annotate - [select for diffs], Tue Jan 19 19:39:58 2021 UTC (3 years, 4 months ago) by mvs
Branch: MAIN
Changes since 1.228: +5 -2 lines
Diff to previous 1.228 (colored)

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

ok dlg@

Revision 1.228 / (download) - annotate - [select for diffs], Fri Dec 25 12:59:53 2020 UTC (3 years, 5 months ago) by visa
Branch: MAIN
Changes since 1.227: +4 -4 lines
Diff to previous 1.227 (colored)

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@

Revision 1.227 / (download) - annotate - [select for diffs], Sun Oct 4 06:59:16 2020 UTC (3 years, 8 months ago) by anton
Branch: MAIN
Changes since 1.226: +2 -2 lines
Diff to previous 1.226 (colored)

fix indent

Revision 1.226 / (download) - annotate - [select for diffs], Fri Aug 21 22:59:27 2020 UTC (3 years, 9 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.225: +1 -2 lines
Diff to previous 1.225 (colored)

Leave default ifq_maxlen handling to ifq_init()

Most clonable interface drivers (except bridge, enc, loop, pppx,
switch, trunk and vlan) initialise the send queue's length to IFQ_MAXLEN
during *_clone_create() even though ifq_init(), which is eventually called
through if_attach(), does the same.

Remove all early "ifq_set_maxlen(&ifq->if_snd, IFQ_MAXLEN);" lines to leave
it to ifq_init() and have clonable drivers a tad more in sync.

OK mvs

Revision 1.225 / (download) - annotate - [select for diffs], Wed Jul 22 02:16:02 2020 UTC (3 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.224: +6 -11 lines
Diff to previous 1.224 (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.224 / (download) - annotate - [select for diffs], Fri Jul 10 13:26:42 2020 UTC (3 years, 11 months ago) by patrick
Branch: MAIN
Changes since 1.223: +2 -2 lines
Diff to previous 1.223 (colored)

Change users of IFQ_SET_MAXLEN() and IFQ_IS_EMPTY() to use the "new" API.

ok dlg@ tobhe@

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

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

ok dlg@ tobhe@

Revision 1.222 / (download) - annotate - [select for diffs], Wed May 13 00:48:06 2020 UTC (4 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.221: +3 -3 lines
Diff to previous 1.221 (colored)

only pass the IO_NDELAY flag to ifq_deq_sleep as the nbio argument.

Revision 1.221 / (download) - annotate - [select for diffs], Sun Apr 12 11:56:52 2020 UTC (4 years, 2 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.220: +3 -3 lines
Diff to previous 1.220 (colored)

Stop processing packets under non-exclusive (read) netlock.

Prevent concurrency in the socket layer which is not ready for that.

Two recent data corruptions in pfsync(4) and the socket layer pointed
out that, at least, tun(4) was incorrectly using NET_RUNLOCK().  Until
we find a way in software to avoid future mistakes and to make sure that
only the softnet thread and some ioctls are safe to use a read version
of the lock, put everything back to the exclusive version.

ok stsp@, visa@

Revision 1.220 / (download) - annotate - [select for diffs], Tue Apr 7 13:27:52 2020 UTC (4 years, 2 months ago) by visa
Branch: MAIN
Changes since 1.219: +4 -4 lines
Diff to previous 1.219 (colored)

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@

Revision 1.219 / (download) - annotate - [select for diffs], Thu Feb 20 16:56:52 2020 UTC (4 years, 3 months ago) by visa
Branch: MAIN
Changes since 1.218: +3 -3 lines
Diff to previous 1.218 (colored)

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@

Revision 1.218 / (download) - annotate - [select for diffs], Fri Feb 14 14:32:44 2020 UTC (4 years, 3 months ago) by mpi
Branch: MAIN
Changes since 1.217: +1 -3 lines
Diff to previous 1.217 (colored)

Push the KERNEL_LOCK() insidge pgsigio() and selwakeup().

The 3 subsystems: signal, poll/select and kqueue can now be addressed
separatly.

Note that bpf(4) and audio(4) currently delay the wakeups to a separate
context in order to respect the KERNEL_LOCK() requirement.  Sockets (UDP,
TCP) and pipes spin to grab the lock for the sames reasons.

ok anton@, visa@

Revision 1.217 / (download) - annotate - [select for diffs], Fri Jan 31 02:58:28 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.216: +5 -9 lines
Diff to previous 1.216 (colored)

actually set the link state down when the /dev entry is closed.

this means a route message is sent when the interface is closed and
goes down, but also causes another route message to be sent when
the interface comes up on the next open. this is important for
things like ospfd and the ospfd regress test because they want to
know when link comes up.

the regression was pointed out by bluhm, who also helped me isolate
the problem.

Revision 1.216 / (download) - annotate - [select for diffs], Thu Jan 30 21:17:59 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.215: +2 -2 lines
Diff to previous 1.215 (colored)

device poll handlers should return POLL flags, not errnos.

this restores restores returning POLLERR when the device is gone.
ENXIO doesn't make much sense as part of a pollfd revents field.

Revision 1.215 / (download) - annotate - [select for diffs], Tue Jan 28 16:26:09 2020 UTC (4 years, 4 months ago) by visa
Branch: MAIN
Changes since 1.214: +9 -29 lines
Diff to previous 1.214 (colored)

Simplify filterops routines where klist_invalidate() is used.
klist_invalidate() detaches knotes from the list and rewires them
synchronously so that the original filterops routines do not get
called after the invalidation.

OK anton@, mpi@

Revision 1.214 / (download) - annotate - [select for diffs], Mon Jan 27 11:00:44 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.213: +12 -2 lines
Diff to previous 1.213 (colored)

add some comments to tun_destroy, and try be a bit more paranoid.

Revision 1.213 / (download) - annotate - [select for diffs], Sat Jan 25 10:56:43 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.212: +4 -3 lines
Diff to previous 1.212 (colored)

move the SMR_LIST_REMOVE and smr_barrier up in tun_clone_destroy.

without this the tun_softc is still available on the list for the
syscalls to get to, even though the device is dead and should no
longer be referenced. by leaving it in the list after the
refcnt_finalize, it was still be found and was used.

found by claudio@
jmatthew@ agrees with the change

Revision 1.212 / (download) - annotate - [select for diffs], Sat Jan 25 06:31:32 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.211: +8 -27 lines
Diff to previous 1.211 (colored)

tweaks sleeping for an mbuf so it's more mpsafe.

the stack puts an mbuf on the tun ifq, and ifqs protect themselves
with a mutex. rather than invent another lock that tun can wrap
these ifq ops with and also coordinate it's conditionals (reading
and dying) with, try and reuse the ifq mtx for the tun stuff too.

because ifqs are more special than tun, this adds a special
ifq_deq_sleep to ifq code that tun can call. tun just passes the
reading and dying variables to ifq to check, but the tricky stuff
about ifqs are kept in the right place.

with this, tun_dev_read should be callable without the kernel lock.

Revision 1.211 / (download) - annotate - [select for diffs], Sat Jan 25 05:28:31 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.210: +16 -13 lines
Diff to previous 1.210 (colored)

use SMRs to find the right tun_softc on syscall entries.

Revision 1.210 / (download) - annotate - [select for diffs], Sat Jan 25 05:10:53 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.209: +271 -268 lines
Diff to previous 1.209 (colored)

rework the driver to better manage lifetimes and device lifetimes.

i want to make tun_dev_read and tun_dev_write safe to run without
the kernel lock. the problem with that is you need a way to prevent
the tun_softc from going away while it's being used by those syscall
paths rather than relying on the big lock to serialise them. blocking
reads sleep, and this was coped with by checking if the interface
went away or changed by looking up the ifindex after every sleep
and seeing if the ifp changed.

i wanted to simplify this by just refusing to let an interface get
destroyed while the device side is open. everyone i asked at a2k20
about whether this was acceptable said this is wrong and i was a
terrible person for trying to make my life easier for myself. so i
ended up going down this rabbit hole.

the code now keeps track of the actual device node (ie, both the
major and minor) which is open, and when the interface is destroyed
it calls VOP_REVOKE against it. this basically calls tun_dev_close
immediately, and wires the fd/vfs stuff up against some deadfs thing
which makes subsequent operations fail as if the device was pulled.
this is good. previously if a tun/tap interface was destroyed while
it was open, and then got recreated, userland wouldnt notice and
would just go ahead and use the newly created device as if it always
had it open. now it actually has access revoked, and access to a
newly created tun/tap interface has to have a new tun_dev_open call
against it.

im putting this in now so people can have a go at it. claudio@ and
i have been hitting it pretty hard, but more testing is welcome.

ok claudio@

Revision 1.209 / (download) - annotate - [select for diffs], Fri Jan 24 01:45:31 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.208: +7 -4 lines
Diff to previous 1.208 (colored)

move to if_vinput() in tun_dev_write.

this means tun doesn't queue the packet on input for the network
stack to process, it's pushed through as part of the write into the
kernel.

discussed at length with claudio@ who agrees that avoiding a queue,
and charging the writing process with the work associated with the
packet, are both reasonable (good) things to do.

Revision 1.208 / (download) - annotate - [select for diffs], Fri Jan 24 01:36:22 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.207: +23 -29 lines
Diff to previous 1.207 (colored)

provide a tun_input() interface input handler for tun(4) packets.

this makes tun(4) more like tap(4). it now relies on the network
stack to set the rcvif, rdomain, count the packets, and lock
appropriately. right now it also means we consistently use if input
queues for both tun and tap, and return backpressure at the same
points.

the tun_input handler is then responsible for pulling the "link"
header off the packet and shoving it it into the various protocol
handlers as appropriate.

a consequence of having the stack count the bytes before tun_input
strips the header is ibytes now includes the 4 byte AF header.
however, this makes tun input consistent with the accounting on tun
output, which included those 4 bytes anyway.

Revision 1.207 / (download) - annotate - [select for diffs], Fri Jan 24 01:17:22 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.206: +42 -74 lines
Diff to previous 1.206 (colored)

change tun_dev_write to allocate one mbuf and cluster for the whole packet.

this is instead of possibly allocating a change of mbufs and MCLBYTE
sized clusters, and doing uiomove in a loop.

while here add max_linkhdr space to the front of the allocated mbuf
to help if we're forwarding the frame out some other interface.

Revision 1.206 / (download) - annotate - [select for diffs], Thu Jan 23 23:43:49 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.205: +14 -14 lines
Diff to previous 1.205 (colored)

simplify the uiomove loop in tun_dev_read.

Revision 1.205 / (download) - annotate - [select for diffs], Thu Jan 23 23:36:18 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.204: +3 -9 lines
Diff to previous 1.204 (colored)

don't need to manage TUN_NBIO ourselves, we get IO_NDELAY for free.

as long as we don't error when open/ioctl/read/write have IO_NDELAY
set, the fd (vfs?) layer seems to keep track of it fine for us.

Revision 1.204 / (download) - annotate - [select for diffs], Thu Jan 23 23:30:41 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.203: +18 -1 lines
Diff to previous 1.203 (colored)

provide a custom if_enqueue handler.

tun and tap now queue a packet on output (for userland to read) on
the if send queue, and then directly call tun_wakeup to tell userland
about it. this bypasses calling the ifq serialiser machinery which
then calls tun_start, which then calls tun_wakeup.

Revision 1.203 / (download) - annotate - [select for diffs], Thu Jan 23 23:22:47 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.202: +1 -2 lines
Diff to previous 1.202 (colored)

remove IFCAP_VLAN_MTU from tap(4). it's a lie.

there's no magical extra space for tap to carry a VLAN tag up to
userland, you need to put it in the packet, and it takes up space.

Revision 1.202 / (download) - annotate - [select for diffs], Thu Jan 23 23:20:54 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.201: +5 -24 lines
Diff to previous 1.201 (colored)

unify the tun and tap output and read behaviour.

let tap use ether_output directly, and then cut back tun_output so
it does the same things that ether_output does. specifically, this
means tun_output now only prepends the packet with the "link" header,
and no longer runs BPF for outgoing packets. running BPF for tun
packets in output used to be needed because pipex used to get a
chance to steal the packet at this point, but you would still want
to see the packet in tcpdump output. now BPF is handled in tun_dev_read
for both tun and tap.

Revision 1.201 / (download) - annotate - [select for diffs], Thu Jan 23 22:32:07 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.200: +9 -12 lines
Diff to previous 1.200 (colored)

mild whitespace massaging. no functional change.

Revision 1.200 / (download) - annotate - [select for diffs], Thu Jan 23 22:27:18 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.199: +1 -18 lines
Diff to previous 1.199 (colored)

don't prototype the cdev entrypoints, sys/conf.h already does it.

Revision 1.199 / (download) - annotate - [select for diffs], Thu Jan 23 03:10:18 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.198: +1 -33 lines
Diff to previous 1.198 (colored)

remove PIPEX from tun(4) now that pppac(4) should be used instead.

ok claudio@

Revision 1.198 / (download) - annotate - [select for diffs], Wed Jan 8 16:27:41 2020 UTC (4 years, 5 months ago) by visa
Branch: MAIN
Changes since 1.197: +5 -5 lines
Diff to previous 1.197 (colored)

Unify handling of ioctls FIOSETOWN/SIOCSPGRP/TIOCSPGRP and
FIOGETOWN/SIOCGPGRP/TIOCGPGRP. Do this by determining the meaning of
the ID parameter inside the sigio code. Also add cases for FIOSETOWN
and FIOGETOWN where there have been TIOCSPGRP and TIOCGPGRP before.
These changes allow removing the ID translation from sys_fcntl() and
sys_ioctl().

Idea from NetBSD

OK mpi@, claudio@

Revision 1.197 / (download) - annotate - [select for diffs], Thu Jan 2 08:56:33 2020 UTC (4 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.196: +13 -13 lines
Diff to previous 1.196 (colored)

Switch tun(4) and tap(4) to use pgsigio(9) and sigio_init(9) for
async I/O registration and signaling instead of handrolling a solution
with csignal().
OK visa@

Revision 1.196 / (download) - annotate - [select for diffs], Tue Dec 31 13:48:32 2019 UTC (4 years, 5 months ago) by visa
Branch: MAIN
Changes since 1.195: +13 -5 lines
Diff to previous 1.195 (colored)

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@

Revision 1.195 / (download) - annotate - [select for diffs], Tue Nov 26 06:23:30 2019 UTC (4 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.194: +8 -8 lines
Diff to previous 1.194 (colored)

s/sc_arpcom/sc_ac/ to be consistent with other drivers.

no functional change

Revision 1.194 / (download) - annotate - [select for diffs], Tue Nov 26 04:03:48 2019 UTC (4 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.193: +189 -189 lines
Diff to previous 1.193 (colored)

use "sc" as the name of tun_softc variables, not "tp".

this makes the driver more like the rest of the tree. no functional change.

Revision 1.193 / (download) - annotate - [select for diffs], Thu Nov 21 07:30:28 2019 UTC (4 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.192: +113 -112 lines
Diff to previous 1.192 (colored)

rename struct tun_softc members so they're prefixed with "sc".

this makes tun more consistent with more of our drivers.

Revision 1.192 / (download) - annotate - [select for diffs], Tue Nov 19 00:06:26 2019 UTC (4 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.191: +68 -32 lines
Diff to previous 1.191 (colored)

take care to avoid a race when creating the same interface.

it was possible for multiple tun0 interfaces to be created concurrently,
which confused the pf_if code. when concurrent tun0 interfaces were
created, the pf_if code tried to add an addrhook for each interface,
but because they shared a name the two hooks ended up on one
interface. if the interface with two addrhooks was destroyed,
KASSERT(TAILQ_EMPTY(&ifp->if_addrhooks)) would trip. before the
KASSERT existed, we'd blindly free a tailq head, which would corrupt
the list, which would cause faults in pfi_detach_ifnet() anyway.

so now we take more care to ensure multiple tun0 interfaces cannot
exist concurrently.

inserting a tun or tap interface into the list of tun or tap
interfaces now checks to ensure that an interface with the same
unit number doesnt already exist. if an existing interface is found,
insert errors with EEXIST and the callers can unwind. the tunopen
and tapopen paths cope with losing the race.

Reported-by: syzbot+2b26012b9ea93834723e@syzkaller.appspotmail.com
sashan@ made a reliable test that could produce the failures
ok sashan@

Revision 1.191 / (download) - annotate - [select for diffs], Wed Oct 16 10:20:48 2019 UTC (4 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.190: +5 -5 lines
Diff to previous 1.190 (colored)

tsleep(9) -> tsleep_nsec(9)

ok cheloha@, visa@, akoshibe@

Revision 1.190 / (download) - annotate - [select for diffs], Fri Sep 13 01:31:24 2019 UTC (4 years, 8 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.189: +4 -15 lines
Diff to previous 1.189 (colored)

tweak tun/tap kn_data to be more consistent with everything else.

for EVFILT_READ, kn_data is now like FIONREAD and reports how many
bytes there are to read. previously it would report how many packets
were available to read, which is not something i've seen anywhere
else.

for EVFILT_WRITE, report the max number of bytes a write can do.
previously it was if_mtu bytes, now it is if_hdrlen + if_hardmtu
bytes, which is the same as what the write path uses as it's maximum
message size.

discussed with and ok visa@

Revision 1.189 / (download) - annotate - [select for diffs], Thu Sep 12 01:28:29 2019 UTC (4 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.188: +11 -11 lines
Diff to previous 1.188 (colored)

knf for the switch statement in tun_dev_kqfilter.

no functional change.

Revision 1.188 / (download) - annotate - [select for diffs], Thu Sep 12 01:27:02 2019 UTC (4 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.187: +3 -3 lines
Diff to previous 1.187 (colored)

let userland write up to hardmtu bytes, not just mtu bytes.

this brings tun in line with pretty much every other driver we have
where we let interfaces rx whatever they can.

while here make sure userland provides enough bytes for the link
header, which is the 4 byte address family for tun(4), and an
ethernet header for tap(4).

Revision 1.187 / (download) - annotate - [select for diffs], Mon Jun 10 21:55:16 2019 UTC (5 years ago) by dlg
Branch: MAIN
Changes since 1.186: +3 -2 lines
Diff to previous 1.186 (colored)

don't allow userland to change if_type.

if_type is now immutable in tun(4) and tap(4)

ok claudio@ mpi@

Revision 1.186 / (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.185: +3 -9 lines
Diff to previous 1.185 (colored)

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

OK mpi@

Revision 1.185 / (download) - annotate - [select for diffs], Wed May 1 06:11:46 2019 UTC (5 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.184: +3 -1 lines
Diff to previous 1.184 (colored)

pretty much all of tun_wakeup needs to be protected with KERNEL_LOCK

tun_wakeup is called from the network stack, which generally runs
with NET_LOCK, not KERNEL_LOCK, which is a problem when it calls
into things like csignal or kq code. this started causing corruption
and panics of a list inside the kq code, which got reported to
bugs@.

this version of the fix is ok mpi@ (even though he hasn't seen it)
an earlier but far trickier fix was ok visa@
the bug was reported by Olivier Antoine, and again by jmc@ privately.

Revision 1.184 / (download) - annotate - [select for diffs], Sun Feb 3 23:04:49 2019 UTC (5 years, 4 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.183: +10 -1 lines
Diff to previous 1.183 (colored)

let tun read AF_MPLS packets from userland.

Revision 1.183 / (download) - annotate - [select for diffs], Tue Dec 11 01:34:10 2018 UTC (5 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.182: +2 -3 lines
Diff to previous 1.182 (colored)

use ifq_hdatalen for handling the FIONREAD ioctl

ok stsp@

Revision 1.182 / (download) - annotate - [select for diffs], Mon Nov 12 06:35:37 2018 UTC (5 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.181: +4 -1 lines
Diff to previous 1.181 (colored)

limit the number of interface units to the number of device minors

this prevents creation of tap and tun devices that you cannot open
from userland because of the limit on the number of dev_t minor
numbers.

the lack of limit was pointed out by Greg Steuck
ok deraadt@ guenther@

Revision 1.181 / (download) - annotate - [select for diffs], Sat Feb 24 07:20:04 2018 UTC (6 years, 3 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.180: +3 -8 lines
Diff to previous 1.180 (colored)

when comparing nvgre entries, compare a with b, not a with itself.

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

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

Revision 1.179 / (download) - annotate - [select for diffs], Sat Dec 30 23:08:29 2017 UTC (6 years, 5 months ago) by guenther
Branch: MAIN
Changes since 1.178: +2 -2 lines
Diff to previous 1.178 (colored)

Don't pull in <sys/file.h> just to get fcntl.h

ok deraadt@ krw@

Revision 1.178 / (download) - annotate - [select for diffs], Fri Aug 11 21:24:19 2017 UTC (6 years, 10 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.177: +13 -13 lines
Diff to previous 1.177 (colored)

Remove NET_LOCK()'s argument.

Tested by Hrvoje Popovski, ok bluhm@

Revision 1.177 / (download) - annotate - [select for diffs], Sat Jun 3 11:58:54 2017 UTC (7 years ago) by mpi
Branch: MAIN
Changes since 1.176: +8 -3 lines
Diff to previous 1.176 (colored)

Add missing NET_LOCK().

Found by jmc@

Revision 1.176 / (download) - annotate - [select for diffs], Tue May 30 16:16:47 2017 UTC (7 years ago) by deraadt
Branch: MAIN
Changes since 1.175: +2 -2 lines
Diff to previous 1.175 (colored)

sizes for free()

Revision 1.175 / (download) - annotate - [select for diffs], Tue May 30 07:50:37 2017 UTC (7 years ago) by mpi
Branch: MAIN
Changes since 1.174: +6 -12 lines
Diff to previous 1.174 (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.174 / (download) - annotate - [select for diffs], Sat May 27 06:44:14 2017 UTC (7 years ago) by mpi
Branch: MAIN
Changes since 1.173: +14 -67 lines
Diff to previous 1.173 (colored)

Remove superflyous splnet()/splx() dances.

ok bluhm@

Revision 1.173 / (download) - annotate - [select for diffs], Tue Jan 24 10:08:30 2017 UTC (7 years, 4 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.172: +3 -3 lines
Diff to previous 1.172 (colored)

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

Revision 1.172 / (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.171: +1 -3 lines
Diff to previous 1.171 (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.171 / (download) - annotate - [select for diffs], Wed Dec 21 13:13:01 2016 UTC (7 years, 5 months ago) by mikeb
Branch: MAIN
Changes since 1.170: +7 -7 lines
Diff to previous 1.170 (colored)

Grab the netlock when opened and closed;  ok mpi, rzalamena

Revision 1.170 / (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.169: +20 -12 lines
Diff to previous 1.169 (colored)

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

inputs and ok bluhm@

Revision 1.169 / (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.168: +6 -3 lines
Diff to previous 1.168 (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.168 / (download) - annotate - [select for diffs], Wed Apr 13 11:41:15 2016 UTC (8 years, 2 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.167: +1 -2 lines
Diff to previous 1.167 (colored)

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

Revision 1.167 / (download) - annotate - [select for diffs], Tue Mar 1 21:47:52 2016 UTC (8 years, 3 months ago) by stsp
Branch: MAIN
Changes since 1.166: +2 -2 lines
Diff to previous 1.166 (colored)

Set IFF_MULTICAST flag on tun(4) interfaces so IPv6 addresses can be assigned.
ok millert@ mpi@

Revision 1.166 / (download) - annotate - [select for diffs], Sun Jan 31 13:54:13 2016 UTC (8 years, 4 months ago) by stefan
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.165: +9 -7 lines
Diff to previous 1.165 (colored)

Convert to ulmin and uiomove to prevent integer truncations.
Reviewed by Martin Natano.

Revision 1.165 / (download) - annotate - [select for diffs], Thu Jan 7 05:31:17 2016 UTC (8 years, 5 months ago) by guenther
Branch: MAIN
Changes since 1.164: +3 -1 lines
Diff to previous 1.164 (colored)

Make open(O_NONBLOCK) of tun, tap, and bpf behave like open+ioctl(FIONBIO)

problem noted by yasuoka@
ok yasuoka@ millert@

Revision 1.164 / (download) - annotate - [select for diffs], Sat Dec 5 16:09:09 2015 UTC (8 years, 6 months ago) by yasuoka
Branch: MAIN
Changes since 1.163: +3 -3 lines
Diff to previous 1.163 (colored)

Make pppx pass packets with npppd through the device.  This makes pppx work
without pipex.enable=1.  Also fix tun(4) not to pass the packets to pipex
when pipex.enable=0.

"go for it" dlg

Revision 1.163 / (download) - annotate - [select for diffs], Fri Nov 20 12:20:30 2015 UTC (8 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.162: +18 -18 lines
Diff to previous 1.162 (colored)

Prefer if_get() over if_ref() when checking if the interface has been
destroyed during our sleep.

No objection from the slackers.

Revision 1.162 / (download) - annotate - [select for diffs], Fri Nov 20 05:38:10 2015 UTC (8 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.161: +1 -2 lines
Diff to previous 1.161 (colored)

dont needlessly clear IFF_OACTIVE.

only a driver sets or clears OACTIVE. clearing it without setting it is
a waste of time.

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

if we deq m0, we should probably send it to bpf, not m.

found by and ok jsg@

Revision 1.160 / (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.159: +22 -24 lines
Diff to previous 1.159 (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.159 / (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.158: +1 -12 lines
Diff to previous 1.158 (colored)

arp_ifinit() is no longer required.

Revision 1.158 / (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.157: +2 -3 lines
Diff to previous 1.157 (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.157 / (download) - annotate - [select for diffs], Sat Oct 24 04:12:24 2015 UTC (8 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.156: +1 -1 lines
Diff to previous 1.156 (colored)

lookup tap devices in tapkqfilter, not tun devices.

libevent likes this more.

Revision 1.156 / (download) - annotate - [select for diffs], Fri Oct 23 15:08:24 2015 UTC (8 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.155: +248 -154 lines
Diff to previous 1.155 (colored)

Split up tun(4) into tun(4) & tap(4). Killing the link0 magic to switch
between modes. The two drivers still share most of the code but the mode
switcher is gone.
OK dlg@ mpi@

Revision 1.155 / (download) - annotate - [select for diffs], Thu Sep 10 17:41:15 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.154: +2 -1 lines
Diff to previous 1.154 (colored)

dont leak an ifp reference if tun isnt ready to read.

found by jsg@

Revision 1.154 / (download) - annotate - [select for diffs], Wed Sep 9 20:18:03 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.153: +5 -2 lines
Diff to previous 1.153 (colored)

if_put after if_get.

this is a bit funky cos we give up the ref while sleeping in tunread,
and have to get a new ref on wakeup.

ok claudio@

Revision 1.153 / (download) - annotate - [select for diffs], Tue Sep 1 21:24:04 2015 UTC (8 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.152: +7 -7 lines
Diff to previous 1.152 (colored)

Replace sockaddr casts with the proper satosin(), ... calls.
From David Hill; OK mpi@; tested kspillner@; tweaks bluhm@

Revision 1.152 / (download) - annotate - [select for diffs], Fri Aug 28 15:37:04 2015 UTC (8 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.151: +5 -2 lines
Diff to previous 1.151 (colored)

Fix compiling a kernel without NBPFILTER > 0.

OK mikeb@

Revision 1.151 / (download) - annotate - [select for diffs], Mon Jul 20 22:54:29 2015 UTC (8 years, 10 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.150: +1 -4 lines
Diff to previous 1.150 (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.150 / (download) - annotate - [select for diffs], Wed Jul 15 22:16:42 2015 UTC (8 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.149: +2 -3 lines
Diff to previous 1.149 (colored)

m_freem() can handle NULL, do not check for this condition beforehands.
ok stsp mpi

Revision 1.149 / (download) - annotate - [select for diffs], Wed Jul 8 07:21:50 2015 UTC (8 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.148: +2 -2 lines
Diff to previous 1.148 (colored)

MFREE(9) is dead, long live m_freem(9)!

ok bluhm@, claudio@, dlg@

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

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

ok claudio@, dlg@

Revision 1.147 / (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.146: +1 -2 lines
Diff to previous 1.146 (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.146 / (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.145: +2 -2 lines
Diff to previous 1.145 (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.145 / (download) - annotate - [select for diffs], Mon Jun 1 07:48:04 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.144: +14 -12 lines
Diff to previous 1.144 (colored)

Convert tun(4) to if_input().

Tested by Norman Golisz and <mxb AT alumni DOT chalmers DOT se>, thanks!

ok bluhm@

Revision 1.144 / (download) - annotate - [select for diffs], Tue May 26 11:36:26 2015 UTC (9 years ago) by dlg
Branch: MAIN
Changes since 1.143: +1 -4 lines
Diff to previous 1.143 (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.143 / (download) - annotate - [select for diffs], Wed May 20 08:28:54 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.142: +2 -1 lines
Diff to previous 1.142 (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.142 / (download) - annotate - [select for diffs], Tue May 19 15:10:59 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.141: +3 -3 lines
Diff to previous 1.141 (colored)

splx should also be called in the error case, fix a regression
introduced during the if_output() conversion.

Found by jsg@

Revision 1.141 / (download) - annotate - [select for diffs], Fri May 15 12:40:05 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.140: +1 -6 lines
Diff to previous 1.140 (colored)

Remove useless comments mentioning ether_output().

Revision 1.140 / (download) - annotate - [select for diffs], Fri May 15 10:15:13 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.139: +4 -7 lines
Diff to previous 1.139 (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.139 / (download) - annotate - [select for diffs], Thu Apr 30 15:19:50 2015 UTC (9 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.138: +53 -43 lines
Diff to previous 1.138 (colored)

Do not free & reallocate a new chunk of memory for the interface
descriptor during SIOCSIFFLAGS.

This prevent a use after free, triggered by the pool/malloc damage
finder being currently cooked by dlg@ and deraadt@.

ok deraadt@

Revision 1.138 / (download) - annotate - [select for diffs], Wed Apr 29 16:00:06 2015 UTC (9 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.137: +13 -2 lines
Diff to previous 1.137 (colored)

Use if_get() after every tsleep(), in case the bottom half of the driver
has destroyed or damaged the interface clone.
with mpi

Revision 1.137 / (download) - annotate - [select for diffs], Wed Apr 15 10:11:29 2015 UTC (9 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.136: +2 -2 lines
Diff to previous 1.136 (colored)

Fix a typo introduced in the niq_enqueue() conversion.

Should fix a panic reported by many on bugs@ and misc@.

ok dlg@

Revision 1.136 / (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.135: +5 -14 lines
Diff to previous 1.135 (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.135 / (download) - annotate - [select for diffs], Wed Apr 1 14:29:54 2015 UTC (9 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.134: +2 -2 lines
Diff to previous 1.134 (colored)

Kill useless comments talking about ether_input().

Revision 1.134 / (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.133: +2 -3 lines
Diff to previous 1.133 (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.133 / (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.132: +1 -2 lines
Diff to previous 1.132 (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.132 / (download) - annotate - [select for diffs], Tue Feb 10 21:56:10 2015 UTC (9 years, 4 months ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.131: +3 -3 lines
Diff to previous 1.131 (colored)

First step towards making uiomove() take a size_t size argument:
- rename uiomove() to uiomovei() and update all its users.
- introduce uiomove(), which is similar to uiomovei() but with a size_t.
- rewrite uiomovei() as an uiomove() wrapper.
ok kettenis@

Revision 1.131 / (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.130: +1 -2 lines
Diff to previous 1.130 (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.130 / (download) - annotate - [select for diffs], Fri Dec 19 17:14:40 2014 UTC (9 years, 5 months ago) by tedu
Branch: MAIN
Changes since 1.129: +1 -9 lines
Diff to previous 1.129 (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.129 / (download) - annotate - [select for diffs], Tue Oct 21 10:52:53 2014 UTC (9 years, 7 months ago) by yasuoka
Branch: MAIN
Changes since 1.128: +2 -2 lines
Diff to previous 1.128 (colored)

tun(4) has a pipex session which is used for multicast internally, it
wasn't freeed when the interface is destroyed.  Free it properly.

ok dlg

Revision 1.128 / (download) - annotate - [select for diffs], Mon Sep 8 06:24:13 2014 UTC (9 years, 9 months ago) by jsg
Branch: MAIN
Changes since 1.127: +1 -2 lines
Diff to previous 1.127 (colored)

remove uneeded route.h includes
ok miod@ mpi@

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

Fewer <netinet/in_systm.h> !

Revision 1.126 / (download) - annotate - [select for diffs], Sat Jul 12 18:44:22 2014 UTC (9 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.125: +3 -3 lines
Diff to previous 1.125 (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.125 / (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.124: +8 -4 lines
Diff to previous 1.124 (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.124 / (download) - annotate - [select for diffs], Tue Apr 22 14:41:03 2014 UTC (10 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.123: +1 -4 lines
Diff to previous 1.123 (colored)

Remove some altq tentacles.

ok pelikan@, henning@

Revision 1.123 / (download) - annotate - [select for diffs], Fri Apr 18 15:20:00 2014 UTC (10 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.122: +0 -5 lines
Diff to previous 1.122 (colored)

reaching into altq outside #ifdef ALTQ is bad, mmkay? ok claudio

Revision 1.122 / (download) - annotate - [select for diffs], Mon Apr 14 09:06:42 2014 UTC (10 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.121: +2 -2 lines
Diff to previous 1.121 (colored)

"struct pkthdr" holds a routing table ID, not a routing domain one.
Avoid the confusion by using an appropriate name for the variable.

Note that since routing domain IDs are a subset of the set of routing
table IDs, the following idiom is correct:

	rtableid = rdomain

But to get the routing domain ID corresponding to a given routing table
ID, you must call rtable_l2(9).

claudio@ likes it, ok mikeb@

Revision 1.121 / (download) - annotate - [select for diffs], Sun Mar 30 21:54:48 2014 UTC (10 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.120: +2 -2 lines
Diff to previous 1.120 (colored)

Eliminates struct pcred by moving the real and saved ugids into
struct ucred; struct process then directly links to the ucred

Based on a discussion at c2k10 or so before noting that FreeBSD and
NetBSD did this too.

ok matthew@

Revision 1.120 / (download) - annotate - [select for diffs], Thu Oct 24 11:31:43 2013 UTC (10 years, 7 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.119: +1 -5 lines
Diff to previous 1.119 (colored)

Remove the number of in6_var.h inclusions by moving some functions and
global variables to in6.h.

ok deraadt@

Revision 1.119 / (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.118: +1 -2 lines
Diff to previous 1.118 (colored)

Remove the number of in_var.h inclusions by moving some functions and
global variables to in.h.

ok mikeb@, deraadt@

Revision 1.118 / (download) - annotate - [select for diffs], Sat Oct 19 14:46:31 2013 UTC (10 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.117: +2 -37 lines
Diff to previous 1.117 (colored)

Uniformize drivers doing nothing with their multicast filters to make
them ignore the SIOC{ADD,DEL}MULTI ioctls.

ok reyk@, claudio@

Revision 1.117 / (download) - annotate - [select for diffs], Thu Oct 17 16:27:41 2013 UTC (10 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.116: +5 -1 lines
Diff to previous 1.116 (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.116 / (download) - annotate - [select for diffs], Fri Oct 4 08:40:32 2013 UTC (10 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.115: +1 -5 lines
Diff to previous 1.115 (colored)

SIOCSIFBRDADDR is not passed to the per-driver ioctl function, so it
makes no sense to let tun(4) handle it.

ok claudio@, haesbaert@

Revision 1.115 / (download) - annotate - [select for diffs], Sat May 25 10:05:52 2013 UTC (11 years ago) by mikeb
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.114: +2 -1 lines
Diff to previous 1.114 (colored)

set the IFF_RUNNNING flag when recreating an interface after the
IFF_LINK0 flag has been added;  from form, ok deraadt claudio

Revision 1.114 / (download) - annotate - [select for diffs], Thu Mar 28 16:55:27 2013 UTC (11 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.113: +1 -2 lines
Diff to previous 1.113 (colored)

do not include machine/cpu.h from a .c file; it is the responsibility of
.h files to pull it in, if needed
ok tedu

Revision 1.113 / (download) - annotate - [select for diffs], Tue Mar 26 13:19:26 2013 UTC (11 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.112: +2 -2 lines
Diff to previous 1.112 (colored)

Remove various read-only *maxlen variables and use IFQ_MAXLEN directly.

ok beck@, mikeb@

Revision 1.112 / (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_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.111: +1 -12 lines
Diff to previous 1.111 (colored)

begone, fucking rotten appletalk shit. ok room

Revision 1.111 / (download) - annotate - [select for diffs], Thu Jul 7 20:42:56 2011 UTC (12 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.110: +4 -4 lines
Diff to previous 1.110 (colored)

use IF_LEN/IFQ_LEN to access and ifqueue's length field. ryan ok
with this nothing in the tree fiddles if ifqueue internals any more, of
course except if.c and if.h (and some altq)

Revision 1.110 / (download) - annotate - [select for diffs], Sat Jul 2 22:20:08 2011 UTC (12 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.109: +2 -2 lines
Diff to previous 1.109 (colored)

kqueue attach functions should return an errno or 0, not a plain 1. Fix
the obvious cases to return EINVAL and ENXIO.

ok tedu deraadt

Revision 1.109 / (download) - annotate - [select for diffs], Thu Sep 23 04:47:02 2010 UTC (13 years, 8 months ago) by matthew
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.108: +2 -2 lines
Diff to previous 1.108 (colored)

If tunread() fails, we should increment if_oerrors, not if_ierrors.

"yup" deraadt@

Revision 1.108 / (download) - annotate - [select for diffs], Wed Sep 22 05:44:27 2010 UTC (13 years, 8 months ago) by matthew
Branch: MAIN
Changes since 1.107: +1 -4 lines
Diff to previous 1.107 (colored)

Don't bother calling suser() in tunopen().

"Sure" deraadt@

Revision 1.107 / (download) - annotate - [select for diffs], Thu Jul 8 08:40:29 2010 UTC (13 years, 11 months ago) by yasuoka
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.106: +3 -6 lines
Diff to previous 1.106 (colored)

pipex didn't work on output.  Fixed following problems:
 - pipex failed to lookup the radix tree because address and netmask
   were not initialized.
 - pipex used wrong place as a ip header because it didn't adjust
   32bit address family header that are added at tun_output.

Revision 1.106 / (download) - annotate - [select for diffs], Thu May 6 13:06:40 2010 UTC (14 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.105: +3 -37 lines
Diff to previous 1.105 (colored)

Remove the incorrect if_media code. It is no longer needed to show and track
link states. Additionally do not up the interface when opening the device.
Resulting in the same behaviour as on real ethernet interfaces.
OK sthen

Revision 1.105 / (download) - annotate - [select for diffs], Wed Jan 13 07:23:38 2010 UTC (14 years, 5 months ago) by yasuoka
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.104: +6 -7 lines
Diff to previous 1.104 (colored)

cleanup pipex code.  ok henning@

Revision 1.104 / (download) - annotate - [select for diffs], Tue Jan 12 11:28:09 2010 UTC (14 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.103: +1 -4 lines
Diff to previous 1.103 (colored)

do not need rndvar.h anymore

Revision 1.103 / (download) - annotate - [select for diffs], Tue Jan 12 04:06:55 2010 UTC (14 years, 5 months ago) by yasuoka
Branch: MAIN
Changes since 1.102: +2 -2 lines
Diff to previous 1.102 (colored)

Remove simple_unlock() that is mistakenly introduced and add required
splx().

Revision 1.102 / (download) - annotate - [select for diffs], Tue Jan 12 03:41:29 2010 UTC (14 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.101: +3 -13 lines
Diff to previous 1.101 (colored)

Unify the various fake ethernet generators as ether_fakeaddr() which
is safe for both hardware devices and virtual devices
ok mpf, kettenis, moaning and groaning and slow acceptance from mcbride
XXX should loop checking for uniqueness after new henning diff goes in

Revision 1.101 / (download) - annotate - [select for diffs], Mon Jan 11 03:50:56 2010 UTC (14 years, 5 months ago) by yasuoka
Branch: MAIN
Changes since 1.100: +37 -1 lines
Diff to previous 1.100 (colored)

Initial import PIPEX.  PIPEX(Pppac IP EXtension) is a IP forwarding
acceleration for PPP access concentrator.

ok mcbride@ dlg@ deraadt@ reyk@.

Revision 1.100 / (download) - annotate - [select for diffs], Mon Nov 9 17:53:39 2009 UTC (14 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.99: +1 -3 lines
Diff to previous 1.99 (colored)

Every selwakeup() should have a matching KNOTE() (even if kqueue isn't
supported it doesn't do any harm), so put the KNOTE() in selwakeup() itself and
remove it from any occurences where both are used, except one for kqueue itself
and one in sys_pipe.c (where the selwakeup is under a PIPE_SEL flag).

Based on a diff from tedu.

ok deraadt

Revision 1.99 / (download) - annotate - [select for diffs], Sun Aug 9 10:09:12 2009 UTC (14 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.98: +2 -1 lines
Diff to previous 1.98 (colored)

Tag packets into correct rdomain in tunwrite(). For L2 traffic this will be
done in ether_input() but L3 traffic needs to do it self.

Revision 1.98 / (download) - annotate - [select for diffs], Sun Aug 2 19:50:16 2009 UTC (14 years, 10 months ago) by mpf
Branch: MAIN
Changes since 1.97: +36 -6 lines
Diff to previous 1.97 (colored)

Preserve joined interface groups when tun(4) is switched
between layer 2 and 3 tunneling mode.
OK claudio@, markus@

Revision 1.97 / (download) - annotate - [select for diffs], Thu Jun 4 06:57:27 2009 UTC (15 years ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.96: +76 -13 lines
Diff to previous 1.96 (colored)

Emulate a link state in tun(4). The link state goes up when the device is
opened and goes down when the device fd is closed. Makes working with qemu
a bit nicer when routing to tun(4) interfaces.
dlg@ "diff reads good"

Revision 1.96 / (download) - annotate - [select for diffs], Fri Feb 20 12:47:57 2009 UTC (15 years, 3 months ago) by jsing
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.95: +12 -2 lines
Diff to previous 1.95 (colored)

Ensure that bpf_mtap() is always called at the same interrupt priority
level within the tun(4) driver. Otherwise we can be interrupted whilst
copying a packet into the BPF buffer, leading to a race between bpf_mtap()
calls. This can result in corruption within the BPF buffers.

Also ensure that we are at IPL_NET when calling ether_input_mbuf().

Fixes PR6073.

ok claudio@, canacar@ (for an earlier version of this diff)

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

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

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

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

ok jsing@

Revision 1.94 / (download) - annotate - [select for diffs], Mon Aug 4 18:55:08 2008 UTC (15 years, 10 months ago) by damien
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.93: +2 -2 lines
Diff to previous 1.93 (colored)

do not count ethernet header twice in if_obytes stats.
do not count address family field twice in tun's if_obytes stats.

ok henning@ reyk@ deraadt@ for the ethernet bits.
ok deraadt@ for the tun bits.

Revision 1.93 / (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.92: +4 -1 lines
Diff to previous 1.92 (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.92 / (download) - annotate - [select for diffs], Tue May 6 07:18:09 2008 UTC (16 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.91: +3 -1 lines
Diff to previous 1.91 (colored)

M_PREPEND can set its first parameter to NULL, and all other code
using M_PREPEND checks for NULL after the invocation. So check
here too and return ENOBUFS if NULL is detected.

ok henning@

Revision 1.91 / (download) - annotate - [select for diffs], Thu Dec 20 02:53:02 2007 UTC (16 years, 5 months ago) by brad
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.90: +2 -2 lines
Diff to previous 1.90 (colored)

return with ENOTTY instead of EINVAL for unknown ioctl requests.

ok claudio@ krw@ jason@ dlg@

Revision 1.90 / (download) - annotate - [select for diffs], Sat Sep 15 16:43:51 2007 UTC (16 years, 9 months ago) by henning
Branch: MAIN
Changes since 1.89: +2 -3 lines
Diff to previous 1.89 (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.89 / (download) - annotate - [select for diffs], Wed Jun 6 10:04:36 2007 UTC (17 years ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.88: +1 -12 lines
Diff to previous 1.88 (colored)

remove remaining IPX hooks. all inside #ifdef IPX, so no actual change

Revision 1.88 / (download) - annotate - [select for diffs], Sat May 26 17:13:31 2007 UTC (17 years ago) by jason
Branch: MAIN
Changes since 1.87: +1 -3 lines
Diff to previous 1.87 (colored)

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

Revision 1.87 / (download) - annotate - [select for diffs], Sat May 26 00:36:03 2007 UTC (17 years ago) by krw
Branch: MAIN
Changes since 1.86: +2 -2 lines
Diff to previous 1.86 (colored)

More comment typos from Diego Casati. Including winners like funtion, allmost,
oustside, seqencer, toghether, nessissary, etc.

Revision 1.86 / (download) - annotate - [select for diffs], Thu May 3 21:03:46 2007 UTC (17 years, 1 month ago) by mpf
Branch: MAIN
Changes since 1.85: +2 -2 lines
Diff to previous 1.85 (colored)

Use if_flags instead of ifr_flags.
It shouldn't make a difference, but some
ioctl-callers don't initialize the ifreq properly.
Fixes a panic w/ tun(4) on trunk(4).
OK reyk@, claudio@

Revision 1.85 / (download) - annotate - [select for diffs], Wed Feb 21 13:24:55 2007 UTC (17 years, 3 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.84: +3 -4 lines
Diff to previous 1.84 (colored)

For TUNSIFMODE protect the if_flags similar to the TUNSIFINFO case.
Don't allow the userland to fiddle with flags reserved by the driver.
Noticed by Ingo Schwarze.

Revision 1.84 / (download) - annotate - [select for diffs], Fri Feb 16 13:41:21 2007 UTC (17 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.83: +11 -2 lines
Diff to previous 1.83 (colored)

Unbreak ppp(8) over tun(4) by restriciting the flags that can be changed
via TUNSIFINFO. ppp(8) was happily clearing the RUNNING flag and so all
incomming packets where dropped. Issue reported by irix <at> ukr <dot> net.
While there check that the mtu is in a valid range -- stolen from SIOCSIFMTU
case.

Revision 1.83 / (download) - annotate - [select for diffs], Tue Feb 6 10:49:40 2007 UTC (17 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.82: +12 -29 lines
Diff to previous 1.82 (colored)

Change the behaviour of tun(4) on close.
 - if the interface was auto-created by opening a /dev/tun* device it will
   auto-destroy on close. This is comparable to ifconfig tun0 destroy and
   will remove all routes and addresses associated with the interface.
 - if the interface was created by ifconfig(8) or hostname.if(5) the interface
   is persistent -- it is just marked as not running. Especially routes are no
   longer removed when the interface is closed. This is useful for static
   setups like the server side of a ssh vpn or static qemu session.
This behaviour is more logic then the half done cleanup that is currently done.
OK mpf@

Revision 1.82 / (download) - annotate - [select for diffs], Fri Jan 26 10:58:47 2007 UTC (17 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.81: +8 -11 lines
Diff to previous 1.81 (colored)

When switching mode inherit the TUN_NBIO and TUN_ASYNC flags and clear
these flags on close.  OK mpf@

Revision 1.81 / (download) - annotate - [select for diffs], Fri Nov 10 09:34:39 2006 UTC (17 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.80: +3 -2 lines
Diff to previous 1.80 (colored)

Fix an mbuf leak in an error path. OK brad@

Revision 1.80 / (download) - annotate - [select for diffs], Wed Nov 1 03:37:24 2006 UTC (17 years, 7 months ago) by tedu
Branch: MAIN
Changes since 1.79: +2 -2 lines
Diff to previous 1.79 (colored)

poll errors should be POLLERR, not some random E value
from alexandre ratchov.  ok claudio

Revision 1.68.2.1 / (download) - annotate - [select for diffs], Fri Jul 14 01:18:11 2006 UTC (17 years, 11 months ago) by brad
Branch: OPENBSD_3_8
Changes since 1.68: +2 -2 lines
Diff to previous 1.68 (colored) next main 1.69 (colored)

MFC:
Fix by claudio@

Do not use m_adj() on empty mbufs (m->m_len is uninitialised), instead bump
m->m_data directly. This fixes the tun(4) / bridge(4) crash reported in
PR4963.

Revision 1.79 / (download) - annotate - [select for diffs], Sat Mar 25 22:41:48 2006 UTC (18 years, 2 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.78: +4 -4 lines
Diff to previous 1.78 (colored)

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

Revision 1.78 / (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.77: +4 -15 lines
Diff to previous 1.77 (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.77 / (download) - annotate - [select for diffs], Thu Mar 16 09:30:54 2006 UTC (18 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.76: +18 -2 lines
Diff to previous 1.76 (colored)

Switch tun(4) from encapsualting packets into a long mbuf chain over to use
mbuf clusters if the packet is big enough. This should speed up tun(4) and
may help in other cases where long mbuf chains hurt.
Additionally switch the default tun(4) MTU to a more sane 1500 bytes.
TUNMTU is kept because it is used in userland.
Input and OK from brad@ and djm@

Revision 1.76 / (download) - annotate - [select for diffs], Sun Mar 5 02:35:38 2006 UTC (18 years, 3 months ago) by brad
Branch: MAIN
Changes since 1.75: +2 -2 lines
Diff to previous 1.75 (colored)

change the interface type from IFF_POINTOPOINT to the more correct
type of IFF_TUNNEL (Encapsulation interface).

ok djm@

Revision 1.75 / (download) - annotate - [select for diffs], Sat Mar 4 22:40:16 2006 UTC (18 years, 3 months ago) by brad
Branch: MAIN
Changes since 1.74: +14 -14 lines
Diff to previous 1.74 (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.74 / (download) - annotate - [select for diffs], Wed Jan 11 12:51:33 2006 UTC (18 years, 5 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.73: +2 -2 lines
Diff to previous 1.73 (colored)

Do not use m_adj() on empty mbufs (m->m_len is uninitialised), instead bump
m->m_data directly. This fixes the tun(4) / bridge(4) crash reported in
PR4963. OK djm@ mpf@ markus@

Revision 1.73 / (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.72: +14 -2 lines
Diff to previous 1.72 (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.72 / (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.71: +3 -15 lines
Diff to previous 1.71 (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.71 / (download) - annotate - [select for diffs], Mon Nov 21 18:16:45 2005 UTC (18 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.70: +2 -2 lines
Diff to previous 1.70 (colored)

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h.  Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.

Revision 1.70 / (download) - annotate - [select for diffs], Thu Nov 17 11:08:52 2005 UTC (18 years, 6 months ago) by henning
Branch: MAIN
Changes since 1.69: +6 -2 lines
Diff to previous 1.69 (colored)

tun devices get created (cloned) automagically when the device is opened.
the code took a shortcut which results in the new device not beeing added
to its interface class group as it should.
call the regular if_clone_create() instead of taking shortcuts, and all is
fine.
ok markus, tested Mike Belopuhov <mkb@crypt.org.ru>

Revision 1.69 / (download) - annotate - [select for diffs], Wed Nov 16 10:45:33 2005 UTC (18 years, 6 months ago) by henning
Branch: MAIN
Changes since 1.68: +35 -33 lines
Diff to previous 1.68 (colored)

small doses of KNF

Revision 1.68 / (download) - annotate - [select for diffs], Wed Jun 8 06:53:32 2005 UTC (19 years ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE
Branch point for: OPENBSD_3_8
Changes since 1.67: +1 -7 lines
Diff to previous 1.67 (colored)

huch, more netns shitz

Revision 1.67 / (download) - annotate - [select for diffs], Wed Jun 8 06:35:04 2005 UTC (19 years ago) by henning
Branch: MAIN
Changes since 1.66: +1 -6 lines
Diff to previous 1.66 (colored)

no more netns handling for the various tunnel devices and loopback

Revision 1.66 / (download) - annotate - [select for diffs], Wed May 4 12:10:27 2005 UTC (19 years, 1 month ago) by markus
Branch: MAIN
Changes since 1.65: +2 -1 lines
Diff to previous 1.65 (colored)

set RUNNING on open; from Alexey E. Suslikov; ok henning, claudio

Revision 1.65 / (download) - annotate - [select for diffs], Tue May 3 14:33:50 2005 UTC (19 years, 1 month ago) by brad
Branch: MAIN
Changes since 1.64: +2 -2 lines
Diff to previous 1.64 (colored)

typo, automaticaly -> automatically

Revision 1.64 / (download) - annotate - [select for diffs], Thu Nov 11 10:42:04 2004 UTC (19 years, 7 months ago) by mpf
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.63: +6 -1 lines
Diff to previous 1.63 (colored)

Check IFF_UP at tun_output().
ok henning, markus.

Revision 1.63 / (download) - annotate - [select for diffs], Tue Nov 9 14:15:40 2004 UTC (19 years, 7 months ago) by henning
Branch: MAIN
Changes since 1.62: +100 -138 lines
Diff to previous 1.62 (colored)

big KNF spanking, no change in object file, ecstatic ok from claudio

Revision 1.62 / (download) - annotate - [select for diffs], Tue Nov 9 13:45:03 2004 UTC (19 years, 7 months ago) by henning
Branch: MAIN
Changes since 1.61: +9 -9 lines
Diff to previous 1.61 (colored)

use NULL instead of 0 for poiter comparisions,
from "Alexey E. Suslikov" <cruel@texnika.com.ua> with a little help from itojun

Revision 1.61 / (download) - annotate - [select for diffs], Fri Jul 16 15:01:09 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.60: +1 -12 lines
Diff to previous 1.60 (colored)

remove netiso shitz, millert ok

Revision 1.60 / (download) - annotate - [select for diffs], Fri Jun 25 04:09:03 2004 UTC (19 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.59: +214 -50 lines
Diff to previous 1.59 (colored)

Add tap aka layer 2 tunneling support to tun(4). It can be enabled by setting
the link0 flag via ifconfig(8). OK markus@, canacar@ also tested by ish@

Revision 1.28.2.10 / (download) - annotate - [select for diffs], Sat Jun 5 23:11:24 2004 UTC (20 years ago) by niklas
Branch: SMP
Changes since 1.28.2.9: +3 -1 lines
Diff to previous 1.28.2.9 (colored) to branchpoint 1.28 (colored) next main 1.29 (colored)

Merge with the trunk

Revision 1.59 / (download) - annotate - [select for diffs], Sun Apr 25 18:50:01 2004 UTC (20 years, 1 month ago) by henning
Branch: MAIN
CVS Tags: SMP_SYNC_B, SMP_SYNC_A
Changes since 1.58: +3 -1 lines
Diff to previous 1.58 (colored)

check for input queue congestion on those as well and call if_congestion when
needed; these  are slightly different so that we cannot use the new
IF_INPUT_ENQUEUE macro
deraadt ok

Revision 1.58 / (download) - annotate - [select for diffs], Tue Mar 2 23:09:29 2004 UTC (20 years, 3 months ago) by markus
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.57: +2 -2 lines
Diff to previous 1.57 (colored)

don't leak mbuf if uiomove fails; from netbsd;
ok henning, cedric, claudio, deraadt

Revision 1.28.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.28.2.8: +275 -87 lines
Diff to previous 1.28.2.8 (colored) to branchpoint 1.28 (colored)

Merge of current from two weeks agointo the SMP branch

Revision 1.57 / (download) - annotate - [select for diffs], Mon Jan 12 04:48:25 2004 UTC (20 years, 5 months ago) by tedu
Branch: MAIN
Changes since 1.56: +19 -6 lines
Diff to previous 1.56 (colored)

use klist_invalidate to permit destroy while kqueued. ok mpf@

Revision 1.56 / (download) - annotate - [select for diffs], Mon Jan 5 23:53:24 2004 UTC (20 years, 5 months ago) by mpf
Branch: MAIN
Changes since 1.55: +5 -1 lines
Diff to previous 1.55 (colored)

stop ifc_destroy() if there are still knotes registered.
ok mcbride@ markus@

Revision 1.55 / (download) - annotate - [select for diffs], Tue Dec 16 20:33:25 2003 UTC (20 years, 6 months ago) by markus
Branch: MAIN
Changes since 1.54: +4 -3 lines
Diff to previous 1.54 (colored)

return error in ifc_destroy; ok deraadt, itojun, cedric, hshoexer

Revision 1.54 / (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.53: +3 -3 lines
Diff to previous 1.53 (colored)

de-register.  deraadt ok

Revision 1.53 / (download) - annotate - [select for diffs], Sat Dec 6 09:16:38 2003 UTC (20 years, 6 months ago) by markus
Branch: MAIN
Changes since 1.52: +35 -15 lines
Diff to previous 1.52 (colored)

support destroy; ok henning

Revision 1.52 / (download) - annotate - [select for diffs], Wed Dec 3 14:53:04 2003 UTC (20 years, 6 months ago) by markus
Branch: MAIN
Changes since 1.51: +90 -59 lines
Diff to previous 1.51 (colored)

add support for ifconfig clone/destroy; ok henning deraadt

Revision 1.51 / (download) - annotate - [select for diffs], Tue Dec 2 06:00:18 2003 UTC (20 years, 6 months ago) by mickey
Branch: MAIN
Changes since 1.50: +120 -4 lines
Diff to previous 1.50 (colored)

add kq support from wayne@epipe.com.au and cmaxwell@themanor.net (now that regress test is there too)

Revision 1.50 / (download) - annotate - [select for diffs], Tue Sep 23 16:51:13 2003 UTC (20 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.49: +16 -17 lines
Diff to previous 1.49 (colored)

Replace select backends with poll backends.  selscan() and pollscan()
now call the poll backend.  With this change we implement greater
poll(2) functionality instead of emulating it via the select backend.
Adapted from NetBSD and including some changes from FreeBSD.
Tested by many, deraadt@ OK

Revision 1.49 / (download) - annotate - [select for diffs], Fri Aug 15 20:32:19 2003 UTC (20 years, 10 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.48: +2 -2 lines
Diff to previous 1.48 (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.48 / (download) - annotate - [select for diffs], Thu Jun 12 10:49:17 2003 UTC (21 years ago) by henning
Branch: MAIN
Changes since 1.47: +8 -4 lines
Diff to previous 1.47 (colored)

in FIONREAD and FREAD, use IFQ_POLL instead of looking at if_snd.ifq_len /
ifq_head, to make altq work. prevents programs from spinning in non-blocking
select()/read() loops in case of queues hitting their limits.

This makes queueing on tun interfaces work. while it is still advised to
assign packets to queues on tunX and queue on the physical interface in
generic, this doesn't work in the PPPoE case with the userland pppoe process,
there the mbuf tags with the queue IDs don't survive obviously.

based on diff from Trevor Talbot, tested successfully by a lot of people
on the pf@benzedrine.cx list.

ok pb@ kjc@

Revision 1.40.2.3 / (download) - annotate - [select for diffs], Mon May 19 22:30:41 2003 UTC (21 years ago) by tedu
Branch: UBC
Changes since 1.40.2.2: +43 -13 lines
Diff to previous 1.40.2.2 (colored) to branchpoint 1.40 (colored) next main 1.41 (colored)

sync

Revision 1.28.2.8 / (download) - annotate - [select for diffs], Tue May 13 19:36:15 2003 UTC (21 years, 1 month ago) by ho
Branch: SMP
Changes since 1.28.2.7: +19 -2 lines
Diff to previous 1.28.2.7 (colored) to branchpoint 1.28 (colored)

Sync the SMP branch to -current. This includes moving to ELF.

Revision 1.47 / (download) - annotate - [select for diffs], Sat May 3 21:15:11 2003 UTC (21 years, 1 month ago) by deraadt
Branch: MAIN
CVS Tags: UBC_SYNC_A
Changes since 1.46: +2 -2 lines
Diff to previous 1.46 (colored)

string fixes; tedu ok

Revision 1.46 / (download) - annotate - [select for diffs], Fri Apr 18 05:26:13 2003 UTC (21 years, 1 month ago) by jason
Branch: MAIN
Changes since 1.45: +18 -1 lines
Diff to previous 1.45 (colored)

Add code to set the TUN_* flags for INET6 addresses too.  This allows a
tun with ipv6 only to actually send/recv packets.  itojun "looks ok to me"
(after helping correct several iterations =)

Revision 1.28.2.7 / (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.28.2.6: +34 -11 lines
Diff to previous 1.28.2.6 (colored) to branchpoint 1.28 (colored)

Sync the SMP branch with 3.3

Revision 1.45 / (download) - annotate - [select for diffs], Tue Jan 7 09:00:34 2003 UTC (21 years, 5 months ago) by kjc
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.44: +2 -9 lines
Diff to previous 1.44 (colored)

remove the altq classifier code which is replaced by pf and no longer used.

ok henning@, deraadt@

Revision 1.44 / (download) - annotate - [select for diffs], Fri Dec 6 15:58:49 2002 UTC (21 years, 6 months ago) by nate
Branch: MAIN
Changes since 1.43: +24 -4 lines
Diff to previous 1.43 (colored)

Replace license with something that's actually free.
Approved by original author.  Julian.Onions@nexor.co.uk

Revision 1.40.2.2 / (download) - annotate - [select for diffs], Tue Oct 29 00:36:46 2002 UTC (21 years, 7 months ago) by art
Branch: UBC
Changes since 1.40.2.1: +2 -1 lines
Diff to previous 1.40.2.1 (colored) to branchpoint 1.40 (colored)

sync to -current

Revision 1.43 / (download) - annotate - [select for diffs], Sun Jun 30 13:04:36 2002 UTC (21 years, 11 months ago) by itojun
Branch: MAIN
CVS Tags: UBC_SYNC_B, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.42: +2 -1 lines
Diff to previous 1.42 (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.40.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.40: +22 -13 lines
Diff to previous 1.40 (colored)

Sync UBC branch to -current

Revision 1.42 / (download) - annotate - [select for diffs], Thu Jun 6 21:34:16 2002 UTC (22 years ago) by provos
Branch: MAIN
Changes since 1.41: +10 -1 lines
Diff to previous 1.41 (colored)

kqueue support for bpf; okay markus@

Revision 1.28.2.6 / (download) - annotate - [select for diffs], Thu Mar 28 14:57:37 2002 UTC (22 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.28.2.5: +12 -12 lines
Diff to previous 1.28.2.5 (colored) to branchpoint 1.28 (colored)

Merge in -current from roughly a week ago

Revision 1.41 / (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.40: +13 -13 lines
Diff to previous 1.40 (colored)

First round of __P removal in sys

Revision 1.28.2.5 / (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.28.2.4: +3 -5 lines
Diff to previous 1.28.2.4 (colored) to branchpoint 1.28 (colored)

Merge in trunk

Revision 1.40 / (download) - annotate - [select for diffs], Mon Dec 10 06:10:53 2001 UTC (22 years, 6 months ago) by jason
Branch: MAIN
CVS Tags: UBC_BASE
Branch point for: UBC
Changes since 1.39: +3 -5 lines
Diff to previous 1.39 (colored)

use queue.h macros for TAILQ operations

Revision 1.28.2.4 / (download) - annotate - [select for diffs], Wed Oct 31 03:29:02 2001 UTC (22 years, 7 months ago) by nate
Branch: SMP
Changes since 1.28.2.3: +26 -4 lines
Diff to previous 1.28.2.3 (colored) to branchpoint 1.28 (colored)

Sync the SMP branch to something just after 3.0

Revision 1.39 / (download) - annotate - [select for diffs], Tue Aug 21 11:03:45 2001 UTC (22 years, 9 months ago) by brian
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.38: +24 -1 lines
Diff to previous 1.38 (colored)

Add support for SIOCADDMULTI & SIOCDELMULTI; NetBSD

Revision 1.38 / (download) - annotate - [select for diffs], Fri Aug 3 21:13:40 2001 UTC (22 years, 10 months ago) by itojun
Branch: MAIN
Changes since 1.37: +3 -9 lines
Diff to previous 1.37 (colored)

simplify previous fix (0-length mbuf in mbuf chain).  from freebsd

Revision 1.37 / (download) - annotate - [select for diffs], Thu Aug 2 22:30:41 2001 UTC (22 years, 10 months ago) by itojun
Branch: MAIN
Changes since 1.36: +6 -1 lines
Diff to previous 1.36 (colored)

do not exit loop even if m_len == 0.  it is legal to have an mbuf with
m_len == 0 in mbuf chain.

Revision 1.28.2.3 / (download) - annotate - [select for diffs], Wed Jul 4 10:54:11 2001 UTC (22 years, 11 months ago) by niklas
Branch: SMP
Changes since 1.28.2.2: +58 -26 lines
Diff to previous 1.28.2.2 (colored) to branchpoint 1.28 (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.36 / (download) - annotate - [select for diffs], Wed Jun 27 06:07:46 2001 UTC (22 years, 11 months ago) by kjc
Branch: MAIN
Changes since 1.35: +58 -20 lines
Diff to previous 1.35 (colored)

introduce the ALTQ queue macros into sys/net files.
the new model removes direct references to the fields in ifp->if_snd,
and defines the following macros to manipulate ifp->if_snd.
  IFQ_ENQUEUE(ifq, m, pktattr, err)
  IFQ_DEQUEUE(ifq, m)
  IFQ_POLL(ifq, m)
  IFQ_PURGE(ifq)
  IFQ_IS_EMPTY(ifq)

the new model also enforces some rules regarding how to use these macros.
details are descrined in
http://www.csl.sony.co.jp/~kjc/software/altq-new-design.txt

Revision 1.35 / (download) - annotate - [select for diffs], Fri Jun 15 03:38:34 2001 UTC (23 years ago) by itojun
Branch: MAIN
Changes since 1.34: +1 -3 lines
Diff to previous 1.34 (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.34 / (download) - annotate - [select for diffs], Wed May 16 12:53:34 2001 UTC (23 years, 1 month ago) by ho
Branch: MAIN
Changes since 1.33: +1 -3 lines
Diff to previous 1.33 (colored)

No need to check M_WAIT/M_WAITOK malloc return values. (art@ ok)

Revision 1.28.2.2 / (download) - annotate - [select for diffs], Mon May 14 22:40:02 2001 UTC (23 years, 1 month ago) by niklas
Branch: SMP
Changes since 1.28.2.1: +38 -19 lines
Diff to previous 1.28.2.1 (colored) to branchpoint 1.28 (colored)

merge in approximately 2.9 into SMP branch

Revision 1.33 / (download) - annotate - [select for diffs], Mon Apr 23 13:55:27 2001 UTC (23 years, 1 month ago) by art
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.32: +1 -3 lines
Diff to previous 1.32 (colored)

s = splimp(); ... s = splimp(); ... splx(x); ... splx(s); is a bad idea.

Revision 1.32 / (download) - annotate - [select for diffs], Mon Mar 5 04:00:36 2001 UTC (23 years, 3 months ago) by angelos
Branch: MAIN
Changes since 1.31: +20 -2 lines
Diff to previous 1.31 (colored)

TUNSIFMODE ioctl (from NetBSD)

Revision 1.31 / (download) - annotate - [select for diffs], Tue Feb 6 03:32:02 2001 UTC (23 years, 4 months ago) by mickey
Branch: MAIN
Changes since 1.30: +18 -17 lines
Diff to previous 1.30 (colored)

allow configuring number of tunnel ifaces

Revision 1.30 / (download) - annotate - [select for diffs], Tue Dec 5 07:22:59 2000 UTC (23 years, 6 months ago) by hugh
Branch: MAIN
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (colored)

Change bpfattach() link layer type to DLT_LOOP making pcap generated
bpf filters work on the tun interface. itojun@ approved.

Revision 1.28.2.1 / (download) - annotate - [select for diffs], Fri Mar 24 09:09:33 2000 UTC (24 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.28: +2 -11 lines
Diff to previous 1.28 (colored)

Sync with -current

Revision 1.29 / (download) - annotate - [select for diffs], Tue Mar 21 23:31:27 2000 UTC (24 years, 2 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.28: +2 -11 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], Wed Dec 8 06:50:18 1999 UTC (24 years, 6 months ago) by itojun
Branch: MAIN
CVS Tags: kame_19991208, SMP_BASE
Branch point for: SMP
Changes since 1.27: +13 -1 lines
Diff to previous 1.27 (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.27 / (download) - annotate - [select for diffs], Wed Sep 29 04:30:39 1999 UTC (24 years, 8 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6
Changes since 1.26: +5 -3 lines
Diff to previous 1.26 (colored)

fix byte counters; imain@netidea.com

Revision 1.26 / (download) - annotate - [select for diffs], Sat Jul 24 03:18:32 1999 UTC (24 years, 10 months ago) by brian
Branch: MAIN
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

Return EMSGSIZE for zero length writes - don't panic.

Revision 1.25 / (download) - annotate - [select for diffs], Thu Apr 22 20:02:44 1999 UTC (25 years, 1 month ago) by art
Branch: MAIN
Changes since 1.24: +1 -2 lines
Diff to previous 1.24 (colored)

we don't need to include buf.h

Revision 1.24 / (download) - annotate - [select for diffs], Sun Aug 2 07:17:43 1998 UTC (25 years, 10 months ago) by brian
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored)

#define TUNMRU as 16384 and allow incoming packets
of up to this size rather than restricting them based
on our MTU.

Revision 1.23 / (download) - annotate - [select for diffs], Fri Jun 26 09:14:39 1998 UTC (25 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.22: +12 -12 lines
Diff to previous 1.22 (colored)

convert DLT_LOOP header to network-order u_int32_t

Revision 1.22 / (download) - annotate - [select for diffs], Wed Dec 31 06:30:30 1997 UTC (26 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_3_BASE, OPENBSD_2_3
Changes since 1.21: +7 -7 lines
Diff to previous 1.21 (colored)

return error instead of EINTR; brian

Revision 1.21 / (download) - annotate - [select for diffs], Wed Dec 31 01:22:55 1997 UTC (26 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.20: +9 -4 lines
Diff to previous 1.20 (colored)

two missing splx(); one from brian, one from me

Revision 1.20 / (download) - annotate - [select for diffs], Sun Aug 31 20:42:32 1997 UTC (26 years, 9 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.19: +12 -12 lines
Diff to previous 1.19 (colored)

for non-tty TIOCSPGRP/F_SETOWN/FIOSETOWN pgid setting calls, store uid
and euid as well, then deliver them using new csignal() interface
which ensures that pgid setting process is permitted to signal the
pgid process(es). Thanks to newsham@aloha.net for extensive help and
discussion.

Revision 1.19 / (download) - annotate - [select for diffs], Tue Jul 29 07:18:20 1997 UTC (26 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.18: +1 -4 lines
Diff to previous 1.18 (colored)

tun_bpf not needed

Revision 1.18 / (download) - annotate - [select for diffs], Tue Jul 29 05:53:22 1997 UTC (26 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.17: +15 -17 lines
Diff to previous 1.17 (colored)

tell bpf packet header is u_char sized; also indent. spotted by newsham

Revision 1.17 / (download) - annotate - [select for diffs], Thu Jul 24 22:03:15 1997 UTC (26 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.16: +15 -15 lines
Diff to previous 1.16 (colored)

reindent

Revision 1.16 / (download) - annotate - [select for diffs], Wed Jul 23 20:50:14 1997 UTC (26 years, 10 months ago) by mickey
Branch: MAIN
Changes since 1.15: +12 -1 lines
Diff to previous 1.15 (colored)

add atalk

Revision 1.15 / (download) - annotate - [select for diffs], Fri Feb 14 18:15:28 1997 UTC (27 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

limit writes to ifp->if_mtu not TUNMTU

Revision 1.14 / (download) - annotate - [select for diffs], Mon Jun 17 11:06:18 1996 UTC (28 years ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.13: +1 -2 lines
Diff to previous 1.13 (colored)

bad splx, bad bad bad

Revision 1.13 / (download) - annotate - [select for diffs], Sun Jun 2 17:24:58 1996 UTC (28 years ago) by niklas
Branch: MAIN
Changes since 1.12: +1 -1 lines
Diff to previous 1.12 (colored)

Fix accident in last commit

Revision 1.12 / (download) - annotate - [select for diffs], Sun Jun 2 16:27:44 1996 UTC (28 years ago) by niklas
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

shut up GCC -Wall about /* inside a comment

Revision 1.11 / (download) - annotate - [select for diffs], Mon May 27 07:57:59 1996 UTC (28 years ago) by deraadt
Branch: MAIN
Changes since 1.10: +3 -3 lines
Diff to previous 1.10 (colored)

if_name -> if_xname

Revision 1.10 / (download) - annotate - [select for diffs], Thu May 16 11:52:08 1996 UTC (28 years, 1 month ago) by mickey
Branch: MAIN
Changes since 1.9: +104 -30 lines
Diff to previous 1.9 (colored)

drom NetBSD PR#2411:
add bcast support, do if_flags setable, minor cleanup.

Revision 1.9 / (download) - annotate - [select for diffs], Fri May 10 12:31:13 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.8: +26 -29 lines
Diff to previous 1.8 (colored)

if_name/if_unit -> if_xname/if_softc

Revision 1.8 / (download) - annotate - [select for diffs], Wed Apr 24 06:43:51 1996 UTC (28 years, 1 month ago) by mickey
Branch: MAIN
Changes since 1.7: +1 -2 lines
Diff to previous 1.7 (colored)

sorry, folks. cut&paste bug happened.

Revision 1.7 / (download) - annotate - [select for diffs], Wed Apr 24 06:26:47 1996 UTC (28 years, 1 month ago) by mickey
Branch: MAIN
Changes since 1.6: +13 -1 lines
Diff to previous 1.6 (colored)

Add IPX support.

Revision 1.6 / (download) - annotate - [select for diffs], Sun Apr 21 22:28:35 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored)

partial sync with netbsd 960418, more to come

Revision 1.5 / (download) - annotate - [select for diffs], Sun Mar 3 21:07:11 1996 UTC (28 years, 3 months ago) by niklas
Branch: MAIN
Changes since 1.4: +33 -31 lines
Diff to previous 1.4 (colored)

From NetBSD: 960217 merge

Revision 1.4 / (download) - annotate - [select for diffs], Wed Feb 21 12:50:02 1996 UTC (28 years, 3 months ago) by mickey
Branch: MAIN
Changes since 1.3: +23 -22 lines
Diff to previous 1.3 (colored)

fixed bug in debugging code, so it'll compiles now w/o TUN_DEBUG
enabled.

Revision 1.3 / (download) - annotate - [select for diffs], Tue Feb 20 14:34:00 1996 UTC (28 years, 3 months ago) by mickey
Branch: MAIN
Changes since 1.2: +127 -82 lines
Diff to previous 1.2 (colored)

bug fixes, speedups. multiple AFs support.
bpf fixes.

Revision 1.2 / (download) - annotate - [select for diffs], Fri Dec 15 01:40:58 1995 UTC (28 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +5 -2 lines
Diff to previous 1.1 (colored)

use m_pkthdr.len for FIONREAD, correctly indicates how much data is available

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:53:06 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:06 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.