The NetBSD Project

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

[BACK] Up to [cvs.NetBSD.org] / src / sys / net

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.528 / (download) - annotate - [select for diffs], Fri Nov 25 06:18:42 2022 UTC (2 months, 1 week ago) by msaitoh
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10, HEAD
Changes since 1.527: +56 -45 lines
Diff to previous 1.527 (colored)

KNF. No functional change.

Revision 1.527 / (download) - annotate - [select for diffs], Mon Oct 24 08:11:25 2022 UTC (3 months, 1 week ago) by msaitoh
Branch: MAIN
Changes since 1.526: +6 -6 lines
Diff to previous 1.526 (colored)

Make ifq_drops in struct ifqueue and struct ifaltq 64 bit.

Revision 1.526 / (download) - annotate - [select for diffs], Tue Sep 20 02:23:37 2022 UTC (4 months, 2 weeks ago) by knakahara
Branch: MAIN
CVS Tags: bouyer-sunxi-drm-base, bouyer-sunxi-drm
Changes since 1.525: +3 -3 lines
Diff to previous 1.525 (colored)

Remove routes on an address removal if the routes referencing to the address.  Implemented by ozaki-r@n.o.

A route that has a gateway is on a connected route can be invalid if the
connected route is deleted, i.e., an associated address is removed.
Traditionally NetBSD doesn't sweep such a route on the address removal.  Sending
packets over the route fails with "No route to host".  Also the route holds an
orphan ifaddr as rt_ifa that is destructed say by in_purgeaddr.

If the same address is assgined again in such a state, there can be two
different ifaddr objects with the same address.  Until recently it's not a
big problem because we can send packets anyway.  However after MP-ification
of the network stack, we can't send packets because we strictly check if rt_ifa
(i.e., the (old) ifaddr) is valid.

This change automatically removes such routes on a removal of an associated
address to avoid keeping inconsistent routes.

Revision 1.525 / (download) - annotate - [select for diffs], Sat Sep 3 02:53:18 2022 UTC (5 months ago) by thorpej
Branch: MAIN
Changes since 1.524: +2 -45 lines
Diff to previous 1.524 (colored)

Garbage-collect everything related to struct domain::dom_ifqueues
(except dom_ifqueues itself, until the next kernel version bump).
It's no longer used now that nothing uses the legacy netisr mechanism.

Revision 1.524 / (download) - annotate - [select for diffs], Sat Sep 3 02:47:59 2022 UTC (5 months ago) by thorpej
Branch: MAIN
Changes since 1.523: +2 -3 lines
Diff to previous 1.523 (colored)

Garbage-collect the remaining vestiges of netisr.

Revision 1.523 / (download) - annotate - [select for diffs], Fri Sep 2 05:50:36 2022 UTC (5 months ago) by thorpej
Branch: MAIN
Changes since 1.522: +8 -12 lines
Diff to previous 1.522 (colored)

Re-factor how pktq_barrier() is issued by if_detach().

Rather than excplicitly referencing ip_pktq and ip6_pktq in if_detach(),
instead add all pktqueues to a global list.  This list is then used in
the new pktq_ifdetach() function to issue a barrier on all pktqueues.

Note that the performance of this list is not critical; it will seldom
be accessed (then pktqueues are created/destroyed and when network
interfaces are detached), and so a simple synchronization strategy using
a rwlock is sufficient.

Revision 1.522 / (download) - annotate - [select for diffs], Fri Sep 2 04:34:58 2022 UTC (5 months ago) by thorpej
Branch: MAIN
Changes since 1.521: +29 -29 lines
Diff to previous 1.521 (colored)

f_detach(): Drain the protocol input queues before the pr_purgeif()
calls; pktq_barrier() doesn't remove packets from the queue, it waits
for the packets enqueued before the barrier to drain.  This, in turn,
may cause the protocols to gain additional references to the interface
that's detaching.  By draining the queues first, we ensure that no
additional references will be taken after calling pr_purgeif().

Revision 1.521 / (download) - annotate - [select for diffs], Fri Sep 2 03:50:00 2022 UTC (5 months ago) by thorpej
Branch: MAIN
Changes since 1.520: +2 -111 lines
Diff to previous 1.520 (colored)

pktqueue: Re-factor sysctl handling.

Provide a new pktq_sysctl_setup() function that attaches standard
pktq sysctl nodes below a specified parent node, with either a
fixed node ID or CTL_CREATE to dynamically assign node IDs.  Make
all of the sysctl handlers private to pktqueue.c, and remove the
INET- and INET6-specific pktqueue sysctl code from net/if.c.

Revision 1.520 / (download) - annotate - [select for diffs], Sun Aug 21 12:34:39 2022 UTC (5 months, 1 week ago) by skrll
Branch: MAIN
Changes since 1.519: +13 -24 lines
Diff to previous 1.519 (colored)

Sprinkle more const. NFC.

Revision 1.519 / (download) - annotate - [select for diffs], Sun Aug 21 07:17:19 2022 UTC (5 months, 1 week ago) by skrll
Branch: MAIN
Changes since 1.518: +27 -42 lines
Diff to previous 1.518 (colored)

Sprinkle const. NFC.

Revision 1.518 / (download) - annotate - [select for diffs], Sun Aug 21 07:03:09 2022 UTC (5 months, 1 week ago) by skrll
Branch: MAIN
Changes since 1.517: +7 -8 lines
Diff to previous 1.517 (colored)

Style / whitespace.

Revision 1.517 / (download) - annotate - [select for diffs], Sat Aug 20 15:11:27 2022 UTC (5 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.516: +9 -3 lines
Diff to previous 1.516 (colored)

ifnet(9): Make sure to use if_timer and if_watchdog at IPL_NET.

Revision 1.516 / (download) - annotate - [select for diffs], Sat Aug 20 14:05:22 2022 UTC (5 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.515: +4 -3 lines
Diff to previous 1.515 (colored)

ifnet(9): On if_deactivate, don't make null if_slowtimo nonnull.

Fixes crash on detach.

Revision 1.515 / (download) - annotate - [select for diffs], Sat Aug 20 12:42:51 2022 UTC (5 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.514: +16 -4 lines
Diff to previous 1.514 (colored)

ifnet(9): Kernel lock for struct ifnet::if_timer.

Revision 1.514 / (download) - annotate - [select for diffs], Sat Aug 20 11:09:41 2022 UTC (5 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.513: +79 -8 lines
Diff to previous 1.513 (colored)

ifnet(9): Add sysctl net.interaces.ifN.watchdog.trigger.

For interfaces that use if_watchdog, this forces it to be called at
the next tick.

Revision 1.513 / (download) - annotate - [select for diffs], Sat Aug 20 11:09:24 2022 UTC (5 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.512: +74 -25 lines
Diff to previous 1.512 (colored)

ifnet(9): Defer if_watchdog (a.k.a. if_slowtimo) to workqueue.

This is necessary to make mii_down and the *_init/stop routines that
call it to sleep waiting for MII callouts on other CPUs.

Mark the workqueue and callout MP-safe; only take the kernel lock
around the callback.

No kernel bump despite change to struct ifnet because the change is
ABI-compatible and using the callout outside net/if.c has never been
kosher.

Revision 1.512 / (download) - annotate - [select for diffs], Wed Aug 17 19:56:28 2022 UTC (5 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.511: +3 -3 lines
Diff to previous 1.511 (colored)

if.c: fix typo in comment

Revision 1.511 / (download) - annotate - [select for diffs], Fri Jul 29 15:24:28 2022 UTC (6 months ago) by skrll
Branch: MAIN
Changes since 1.510: +3 -3 lines
Diff to previous 1.510 (colored)

Fix a typo in a comment.

Revision 1.510 / (download) - annotate - [select for diffs], Fri Jul 29 15:19:30 2022 UTC (6 months ago) by skrll
Branch: MAIN
Changes since 1.509: +4 -3 lines
Diff to previous 1.509 (colored)

KNF a comment

Revision 1.509 / (download) - annotate - [select for diffs], Mon Jul 11 07:40:58 2022 UTC (6 months, 3 weeks ago) by skrll
Branch: MAIN
Changes since 1.508: +6 -4 lines
Diff to previous 1.508 (colored)

KNF two comments.

Revision 1.508 / (download) - annotate - [select for diffs], Mon Jul 11 07:36:56 2022 UTC (6 months, 3 weeks ago) by skrll
Branch: MAIN
Changes since 1.507: +4 -4 lines
Diff to previous 1.507 (colored)

Grammar in a comment.

Revision 1.507 / (download) - annotate - [select for diffs], Fri Jul 8 07:02:47 2022 UTC (6 months, 3 weeks ago) by skrll
Branch: MAIN
Changes since 1.506: +4 -4 lines
Diff to previous 1.506 (colored)

alredy -> already

Revision 1.506 / (download) - annotate - [select for diffs], Thu Jul 7 18:17:33 2022 UTC (6 months, 4 weeks ago) by riastradh
Branch: MAIN
Changes since 1.505: +5 -2 lines
Diff to previous 1.505 (colored)

ifioctl(9): Don't touch ifconf or ifreq until command is validated.

sys_ioctl validates the data pointer according to the command's size
and direction.  But userland may ioctl commands other than
OSIOCGIFCONF or OOSIOCGIFCONF -- and if userland passes an IOC_VOID
command, the argument is passed through verbatim and may be null.

Reported-by: syzbot+19b1bf83e5481273eafc@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=f4c91a7dcd31901c80d91af6ed01456faf0a7286

Reported-by: syzbot+442c033feb784d055185@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=4a3a4b92dbe9695046ff17a5474cef52aed23e0b

Reported-by: syzbot+4c87d0cdf7025741ea7a@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=3e5f42c998e43ad42da40dec3c7873e6aae187e4

Revision 1.505 / (download) - annotate - [select for diffs], Sun May 22 11:27:36 2022 UTC (8 months, 1 week ago) by andvar
Branch: MAIN
Changes since 1.504: +3 -3 lines
Diff to previous 1.504 (colored)

fix various small typos, mainly in comments.

Revision 1.504 / (download) - annotate - [select for diffs], Wed May 11 14:58:01 2022 UTC (8 months, 3 weeks ago) by andvar
Branch: MAIN
Changes since 1.503: +3 -3 lines
Diff to previous 1.503 (colored)

fix various typos in comments.

Revision 1.503 / (download) - annotate - [select for diffs], Sat Apr 9 23:38:33 2022 UTC (9 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.502: +4 -4 lines
Diff to previous 1.502 (colored)

sys: Use membar_release/acquire around reference drop.

This just goes through my recent reference count membar audit and
changes membar_exit to membar_release and membar_enter to
membar_acquire -- this should make everything cheaper on most CPUs
without hurting correctness, because membar_acquire is generally
cheaper than membar_enter.

Revision 1.502 / (download) - annotate - [select for diffs], Sat Mar 12 15:32:32 2022 UTC (10 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.501: +11 -5 lines
Diff to previous 1.501 (colored)

sys: Membar audit around reference count releases.

If two threads are using an object that is freed when the reference
count goes to zero, we need to ensure that all memory operations
related to the object happen before freeing the object.

Using an atomic_dec_uint_nv(&refcnt) == 0 ensures that only one
thread takes responsibility for freeing, but it's not enough to
ensure that the other thread's memory operations happen before the
freeing.

Consider:

	  Thread A			  Thread B
	obj->foo = 42;			obj->baz = 73;
	mumble(&obj->bar);		grumble(&obj->quux);
	/* membar_exit(); */		/* membar_exit(); */
	atomic_dec -- not last		atomic_dec -- last
					/* membar_enter(); */
					KASSERT(invariant(obj->foo,
					    obj->bar));
					free_stuff(obj);

The memory barriers ensure that

	obj->foo = 42;
	mumble(&obj->bar);

in thread A happens before

	KASSERT(invariant(obj->foo, obj->bar));
	free_stuff(obj);

in thread B.  Without them, this ordering is not guaranteed.

So in general it is necessary to do

	membar_exit();
	if (atomic_dec_uint_nv(&obj->refcnt) != 0)
		return;
	membar_enter();

to release a reference, for the `last one out hit the lights' style
of reference counting.  (This is in contrast to the style where one
thread blocks new references and then waits under a lock for existing
ones to drain with a condvar -- no membar needed thanks to mutex(9).)

I searched for atomic_dec to find all these.  Obviously we ought to
have a better abstraction for this because there's so much copypasta.
This is a stop-gap measure to fix actual bugs until we have that.  It
would be nice if an abstraction could gracefully handle the different
styles of reference counting in use -- some years ago I drafted an
API for this, but making it cover everything got a little out of hand
(particularly with struct vnode::v_usecount) and I ended up setting
it aside to work on psref/localcount instead for better scalability.

I got bored of adding #ifdef __HAVE_ATOMIC_AS_MEMBAR everywhere, so I
only put it on things that look performance-critical on 5sec review.
We should really adopt membar_enter_preatomic/membar_exit_postatomic
or something (except they are applicable only to atomic r/m/w, not to
atomic_load/store_*, making the naming annoying) and get rid of all
the ifdefs.

Revision 1.501 / (download) - annotate - [select for diffs], Fri Dec 31 14:26:29 2021 UTC (13 months ago) by riastradh
Branch: MAIN
Changes since 1.500: +21 -2 lines
Diff to previous 1.500 (colored)

sys/net: Document if_mcast_op with comment and refuse other commands.

Meant only for multicast addition/deletion operations, nothing else.

Revision 1.500 / (download) - annotate - [select for diffs], Fri Dec 31 14:26:19 2021 UTC (13 months ago) by riastradh
Branch: MAIN
Changes since 1.499: +11 -2 lines
Diff to previous 1.499 (colored)

sys/net: Document if_flags_set with a comment.

Revision 1.499 / (download) - annotate - [select for diffs], Fri Dec 31 14:25:58 2021 UTC (13 months ago) by riastradh
Branch: MAIN
Changes since 1.498: +18 -11 lines
Diff to previous 1.498 (colored)

sys/net: Assert IFNET_LOCKED in if_ioctl, if_init, and if_stop.

Exception: Not for SIOCADDMULTI/SIOCDELMULTI, for which it is the
driver's responsibility to take internal locks.  Typically this is
already done via struct ethercom::ec_lock.

Revision 1.498 / (download) - annotate - [select for diffs], Fri Dec 31 14:24:50 2021 UTC (13 months ago) by riastradh
Branch: MAIN
Changes since 1.497: +7 -7 lines
Diff to previous 1.497 (colored)

sys: Use if_ioctl wrapper function.

Revision 1.497 / (download) - annotate - [select for diffs], Fri Dec 31 14:24:26 2021 UTC (13 months ago) by riastradh
Branch: MAIN
Changes since 1.496: +60 -5 lines
Diff to previous 1.496 (colored)

sys/net: New functions if_ioctl, if_init, and if_stop.

These are wrappers, suitable for inserting appropriate kasserts
regarding the API's locking contract, for the corresponding functions
in struct ifnet.

Since these are intended to commit configuration changes to the
interface, which may involve resetting the device, the caller should
hold IFNET_LOCK.  However, I can't straightforwardly prove that all
callers do yet, so the assertion is disabled for now.

Revision 1.496 / (download) - annotate - [select for diffs], Thu Sep 30 03:51:05 2021 UTC (16 months ago) by yamaguchi
Branch: MAIN
Changes since 1.495: +2 -7 lines
Diff to previous 1.495 (colored)

net: obsolete ifnet::if_link_state_chenged
that was used for updating link-state of vlan I/F

The obsoleted function is replaced with
ifnet::if_linkstate_hooks

Revision 1.495 / (download) - annotate - [select for diffs], Thu Sep 30 03:43:25 2021 UTC (16 months ago) by yamaguchi
Branch: MAIN
Changes since 1.494: +2 -7 lines
Diff to previous 1.494 (colored)

carp: Register carp_carpdev_state to link-state change hook

Revision 1.494 / (download) - annotate - [select for diffs], Thu Sep 30 03:39:39 2021 UTC (16 months ago) by yamaguchi
Branch: MAIN
Changes since 1.493: +2 -12 lines
Diff to previous 1.493 (colored)

lagg: Register lagg_linkstate_changed to link-state change hook

Revision 1.493 / (download) - annotate - [select for diffs], Thu Sep 30 03:35:55 2021 UTC (16 months ago) by yamaguchi
Branch: MAIN
Changes since 1.492: +2 -7 lines
Diff to previous 1.492 (colored)

bridge: Register bridge_calc_link_state to link-state change hook

Revision 1.492 / (download) - annotate - [select for diffs], Thu Sep 30 03:23:48 2021 UTC (16 months ago) by yamaguchi
Branch: MAIN
Changes since 1.491: +29 -2 lines
Diff to previous 1.491 (colored)

Provide a hook point called at change of link state

Revision 1.491 / (download) - annotate - [select for diffs], Thu Sep 30 03:15:25 2021 UTC (16 months ago) by yamaguchi
Branch: MAIN
Changes since 1.490: +3 -3 lines
Diff to previous 1.490 (colored)

Replace ifnet::if_agriprivate with ifnet::if_lagg

agr(4) and lagg(4) can not be used on the same interface so that
if_agrprivate and if_lagg are not used at the same time.
For resolve this wasteful, if_lagg is used in not only lagg(4)
but also agr(4).

After this modification, if_lagg has 3 states:
1. if_lagg == NULL
   - Both agr(4) and lagg(4) are not running on the interface
2. if_lagg != NULL && ifp->if_type != IFT_IEEE8023ADLAG
   - agr(4) is running on the I/F
3. if_lagg != NULL && ifp->if_type == IFT_IEEE8023ADLAG
   - lagg(4) is running on the I/F

Revision 1.490 / (download) - annotate - [select for diffs], Tue Sep 21 14:57:26 2021 UTC (16 months, 1 week ago) by christos
Branch: MAIN
Changes since 1.489: +4 -4 lines
Diff to previous 1.489 (colored)

remove extra changes

Revision 1.489 / (download) - annotate - [select for diffs], Tue Sep 21 14:56:42 2021 UTC (16 months, 1 week ago) by christos
Branch: MAIN
Changes since 1.488: +6 -6 lines
Diff to previous 1.488 (colored)

don't opencode kauth_cred_get()

Revision 1.488 / (download) - annotate - [select for diffs], Thu Sep 16 20:17:47 2021 UTC (16 months, 2 weeks ago) by andvar
Branch: MAIN
Changes since 1.487: +3 -3 lines
Diff to previous 1.487 (colored)

fix various typos, mainly in comments.

Revision 1.484.6.2 / (download) - annotate - [select for diffs], Sun Aug 1 22:42:41 2021 UTC (18 months ago) by thorpej
Branch: thorpej-i2c-spi-conf
Changes since 1.484.6.1: +10 -29 lines
Diff to previous 1.484.6.1 (colored) to branchpoint 1.484 (colored) next main 1.485 (colored)

Sync with HEAD.

Revision 1.487 / (download) - annotate - [select for diffs], Thu Jul 1 22:08:13 2021 UTC (19 months ago) by blymn
Branch: MAIN
CVS Tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-futex2-base, thorpej-futex2, thorpej-cfargs2-base, thorpej-cfargs2
Changes since 1.486: +6 -4 lines
Diff to previous 1.486 (colored)

Back out fix for kern_pmf.c calling a null if_stop and apply a fix
suggested by Jared McNeill which sets if_stop to a stub function
which means that more than just the pmf is protected from the NULL call.

Revision 1.486 / (download) - annotate - [select for diffs], Tue Jun 29 21:19:58 2021 UTC (19 months ago) by riastradh
Branch: MAIN
Changes since 1.485: +6 -27 lines
Diff to previous 1.485 (colored)

Make if_stats_init, if_attach, if_initialize return void.

percpu_alloc can't fail.


Author: Maya Rashish <maya@NetBSD.org>
Committer: Taylor R Campbell <riastradh@NetBSD.org>

Revision 1.484.6.1 / (download) - annotate - [select for diffs], Thu Jun 17 04:46:34 2021 UTC (19 months, 2 weeks ago) by thorpej
Branch: thorpej-i2c-spi-conf
Changes since 1.484: +12 -2 lines
Diff to previous 1.484 (colored)

Sync w/ HEAD.

Revision 1.484.8.1 / (download) - annotate - [select for diffs], Mon May 31 22:15:21 2021 UTC (20 months ago) by cjep
Branch: cjep_staticlib_x
Changes since 1.484: +12 -2 lines
Diff to previous 1.484 (colored) next main 1.485 (colored)

sync with head

Revision 1.485 / (download) - annotate - [select for diffs], Mon May 17 04:07:43 2021 UTC (20 months, 2 weeks ago) by yamaguchi
Branch: MAIN
CVS Tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1
Changes since 1.484: +12 -2 lines
Diff to previous 1.484 (colored)

Add a new link-aggregation pseudo interface named lagg(4)

 - FreeBSD's lagg(4) based implementation
 - MP-safe and MP-scalable

Revision 1.484 / (download) - annotate - [select for diffs], Thu Oct 15 10:20:44 2020 UTC (2 years, 3 months ago) by roy
Branch: MAIN
CVS Tags: thorpej-futex-base, thorpej-futex, thorpej-cfargs-base, thorpej-cfargs, cjep_staticlib_x-base
Branch point for: thorpej-i2c-spi-conf, cjep_staticlib_x
Changes since 1.483: +2 -6 lines
Diff to previous 1.483 (colored)

net: remove IFEF_NO_LINK_STATE_CHANGE

This flag was only set for virtual interfaces.
All virtual interfaces have a means of knowing if they are going to work
or not and as such now support link state changes.

If we want this flag back, it should be used as an indicator that
the interfaces does not support link state changes that userland can use
so it can make a decision on what to do when the link state is UNKNOWN.

Revision 1.483 / (download) - annotate - [select for diffs], Sun Sep 27 19:16:28 2020 UTC (2 years, 4 months ago) by roy
Branch: MAIN
Changes since 1.482: +24 -2 lines
Diff to previous 1.482 (colored)

bridge: When an interface joins then mark addresses on it as tentative

The exact flow is detatch addresses, join bridge and then mark detached
addresses as tentative.
This ensures that Duplicate Address Detection for the joining interface
are performed across all members of the bridge.

Revision 1.482 / (download) - annotate - [select for diffs], Sun Sep 27 00:32:17 2020 UTC (2 years, 4 months ago) by roy
Branch: MAIN
Changes since 1.481: +7 -2 lines
Diff to previous 1.481 (colored)

bridge: Calculate link state as the best link state of any member

If any member is LINK_STATE_UP then it's LINK_STATE_UP.
Otherwise if any member is LINK_STATE_UNKNOWN then it's LINK_STATE_UNKNOWN.
Otherwise it's LINK_STATE_DOWN.

Revision 1.481 / (download) - annotate - [select for diffs], Sat Sep 26 18:35:12 2020 UTC (2 years, 4 months ago) by roy
Branch: MAIN
Changes since 1.480: +7 -2 lines
Diff to previous 1.480 (colored)

net: Add a callback to ifnet to notify of link state changes

Revision 1.480 / (download) - annotate - [select for diffs], Sat Sep 26 11:57:05 2020 UTC (2 years, 4 months ago) by roy
Branch: MAIN
Changes since 1.479: +65 -62 lines
Diff to previous 1.479 (colored)

net: Fix the setting of if_link_state

Link state changes are not dependant on the interface being up, but we also
need to guard against more link state changes being scheduled when the
interface is being detached.

We do this by clearing the link queue but keeping if_link_sheduled = true.
We can check for this in both if_link_state_change() and
if_link_state_change_work() to abort early as there is no point in doing
anything if the interface is being detached because if_down() is called
in if_detach() after the workqueue has been drained to the same overall
effect.

Revision 1.394.2.19 / (download) - annotate - [select for diffs], Fri Jul 17 15:28:07 2020 UTC (2 years, 6 months ago) by martin
Branch: netbsd-8
Changes since 1.394.2.18: +6 -3 lines
Diff to previous 1.394.2.18 (colored) to branchpoint 1.394 (colored) next main 1.395 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1576):

	sys/net/if.c: revision 1.479
	sys/compat/common/uipc_syscalls_40.c: revision 1.23
	sys/compat/linux/common/linux_socket.c: revision 1.150
	sys/compat/linux32/common/linux32_socket.c: revision 1.31

 Don't accept negative value.

Revision 1.457.2.4 / (download) - annotate - [select for diffs], Fri Jul 17 15:24:48 2020 UTC (2 years, 6 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE
Changes since 1.457.2.3: +6 -3 lines
Diff to previous 1.457.2.3 (colored) to branchpoint 1.457 (colored) next main 1.458 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1018):

	sys/net/if.c: revision 1.479
	sys/compat/common/uipc_syscalls_40.c: revision 1.23
	sys/compat/linux/common/linux_socket.c: revision 1.150
	sys/compat/linux32/common/linux32_socket.c: revision 1.31

 Don't accept negative value.

Revision 1.479 / (download) - annotate - [select for diffs], Thu Jul 16 15:02:08 2020 UTC (2 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.478: +6 -3 lines
Diff to previous 1.478 (colored)

 Don't accept negative value.

Reported-by: syzbot+e71a77402d6668f1868d@syzkaller.appspotmail.com

Revision 1.478 / (download) - annotate - [select for diffs], Fri Jun 12 11:04:45 2020 UTC (2 years, 7 months ago) by roy
Branch: MAIN
Changes since 1.477: +2 -11 lines
Diff to previous 1.477 (colored)

Remove in-kernel handling of Router Advertisements

This is much better handled by a user-land tool.
Proposed on tech-net here:
https://mail-index.netbsd.org/tech-net/2020/04/22/msg007766.html

Note that the ioctl SIOCGIFINFO_IN6 no longer sets flags. That now
needs to be done using the pre-existing SIOCSIFINFO_FLAGS ioctl.

Compat is fully provided where it makes sense, but trying to turn on
RA handling will obviously throw an error as it no longer exists.

Note that if you use IPv6 temporary addresses, this now needs to be
turned on in dhcpcd.conf(5) rather than in sysctl.conf(5).

Revision 1.477 / (download) - annotate - [select for diffs], Tue May 5 09:26:29 2020 UTC (2 years, 9 months ago) by jdolecek
Branch: MAIN
Changes since 1.476: +3 -3 lines
Diff to previous 1.476 (colored)

adjust comment - sosetopt() path doesn't take IFNET_LOCK()

Revision 1.476 / (download) - annotate - [select for diffs], Tue May 5 09:22:24 2020 UTC (2 years, 9 months ago) by jdolecek
Branch: MAIN
Changes since 1.475: +7 -2 lines
Diff to previous 1.475 (colored)

add a NOMPSAFE comment for if_mcast_op(), it is called from context
which doesn't hold IFNET_LOCK() in some cases, and calls if_ioctl

this needs to be sorted out for NET_MPSAFE

Revision 1.475 / (download) - annotate - [select for diffs], Tue May 5 08:05:03 2020 UTC (2 years, 9 months ago) by jdolecek
Branch: MAIN
Changes since 1.474: +4 -8 lines
Diff to previous 1.474 (colored)

remove struct ifnet if_mcastop, it's not used by anything

Revision 1.428.2.3 / (download) - annotate - [select for diffs], Tue Apr 21 18:42:44 2020 UTC (2 years, 9 months ago) by martin
Branch: phil-wifi
Changes since 1.428.2.2: +12 -1 lines
Diff to previous 1.428.2.2 (colored) to branchpoint 1.428 (colored) next main 1.429 (colored)

Sync with HEAD

Revision 1.473.4.1 / (download) - annotate - [select for diffs], Mon Apr 20 11:29:12 2020 UTC (2 years, 9 months ago) by bouyer
Branch: bouyer-xenpvh
Changes since 1.473: +14 -3 lines
Diff to previous 1.473 (colored) next main 1.474 (colored)

Sync with HEAD

Revision 1.474 / (download) - annotate - [select for diffs], Sat Apr 18 15:56:26 2020 UTC (2 years, 9 months ago) by thorpej
Branch: MAIN
CVS Tags: phil-wifi-20200421, bouyer-xenpvh-base2, bouyer-xenpvh-base1
Changes since 1.473: +14 -3 lines
Diff to previous 1.473 (colored)

In _if_down(), release the link state change lock before calling
workqueue_wait().  Add a comment explaining how the locking here
works.

PR kern/55018.

Revision 1.428.2.2 / (download) - annotate - [select for diffs], Mon Apr 13 08:05:15 2020 UTC (2 years, 9 months ago) by martin
Branch: phil-wifi
Changes since 1.428.2.1: +221 -76 lines
Diff to previous 1.428.2.1 (colored) to branchpoint 1.428 (colored)

Mostly merge changes from HEAD upto 20200411

Revision 1.466.2.2 / (download) - annotate - [select for diffs], Sat Feb 29 20:21:06 2020 UTC (2 years, 11 months ago) by ad
Branch: ad-namecache
Changes since 1.466.2.1: +78 -62 lines
Diff to previous 1.466.2.1 (colored) to branchpoint 1.466 (colored) next main 1.467 (colored)

Sync with head.

Revision 1.473 / (download) - annotate - [select for diffs], Fri Feb 21 00:26:23 2020 UTC (2 years, 11 months ago) by joerg
Branch: MAIN
CVS Tags: phil-wifi-20200411, phil-wifi-20200406, is-mlppp-base, is-mlppp, bouyer-xenpvh-base, ad-namecache-base3
Branch point for: bouyer-xenpvh
Changes since 1.472: +3 -3 lines
Diff to previous 1.472 (colored)

Explicitly cast pointers to uintptr_t before casting to enums. They are
not necessarily the same size. Don't cast pointers to bool, check for
NULL instead.

Revision 1.472 / (download) - annotate - [select for diffs], Fri Feb 7 01:14:55 2020 UTC (2 years, 11 months ago) by thorpej
Branch: MAIN
Changes since 1.471: +3 -3 lines
Diff to previous 1.471 (colored)

IPL_SOFTNET -> IPL_NET in previous.

Revision 1.471 / (download) - annotate - [select for diffs], Thu Feb 6 23:30:19 2020 UTC (2 years, 11 months ago) by thorpej
Branch: MAIN
Changes since 1.470: +40 -29 lines
Diff to previous 1.470 (colored)

Perform link state change processing on a work queue, rather than in a
softint.

Revision 1.470 / (download) - annotate - [select for diffs], Sat Feb 1 12:54:50 2020 UTC (3 years ago) by riastradh
Branch: MAIN
Changes since 1.469: +10 -14 lines
Diff to previous 1.469 (colored)

Switch sys/net to percpu_create.

Revision 1.469 / (download) - annotate - [select for diffs], Wed Jan 29 03:16:28 2020 UTC (3 years ago) by thorpej
Branch: MAIN
Changes since 1.468: +31 -22 lines
Diff to previous 1.468 (colored)

Add support for MP-safe network interface statistics by maintaining them
in per-cpu storage, and collecting them for export in an if_data structure
when user-space wants them.

The new if_stat API is structured to make a gradual transition to the
new way in network drivers possible, and per-cpu stats are currently
disabled (thus there is no kernel ABI change).  Once all drivers have
been converted, the old ABI will be removed, and per-cpu stats will be
enabled universally.

Revision 1.466.2.1 / (download) - annotate - [select for diffs], Sat Jan 25 22:38:51 2020 UTC (3 years ago) by ad
Branch: ad-namecache
Changes since 1.466: +3 -5 lines
Diff to previous 1.466 (colored)

Sync with head.

Revision 1.468 / (download) - annotate - [select for diffs], Mon Jan 20 18:38:18 2020 UTC (3 years ago) by thorpej
Branch: MAIN
CVS Tags: ad-namecache-base2
Changes since 1.467: +3 -4 lines
Diff to previous 1.467 (colored)

Remove FDDI support.

Revision 1.467 / (download) - annotate - [select for diffs], Sun Jan 19 20:00:36 2020 UTC (3 years ago) by thorpej
Branch: MAIN
Changes since 1.466: +3 -4 lines
Diff to previous 1.466 (colored)

Remove Token Ring support.

Revision 1.457.2.3 / (download) - annotate - [select for diffs], Tue Dec 17 16:12:54 2019 UTC (3 years, 1 month ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-0-RELEASE, netbsd-9-0-RC2
Changes since 1.457.2.2: +49 -46 lines
Diff to previous 1.457.2.2 (colored) to branchpoint 1.457 (colored)

Pull up following revision(s) (requested by christos in ticket #569):

	sys/dev/usb/if_umb.c: revision 1.10
	sys/net/if.c: revision 1.466
	sys/dev/ic/ath.c: revision 1.129

Protect network ioctls from non-authorized users. (Ilja Van Sprundel)

Revision 1.466 / (download) - annotate - [select for diffs], Tue Dec 17 04:54:36 2019 UTC (3 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: ad-namecache-base1, ad-namecache-base
Branch point for: ad-namecache
Changes since 1.465: +48 -45 lines
Diff to previous 1.465 (colored)

Protect network ioctls from non-authorized users. (Ilja Van Sprundel)

Revision 1.465 / (download) - annotate - [select for diffs], Thu Nov 14 16:23:53 2019 UTC (3 years, 2 months ago) by maxv
Branch: MAIN
CVS Tags: phil-wifi-20191119
Changes since 1.464: +5 -2 lines
Diff to previous 1.464 (colored)

Add support for Kernel Memory Sanitizer (kMSan). It detects uninitialized
memory used by the kernel at run time, and just like kASan and kCSan, it
is an excellent feature. It has already detected 38 uninitialized variables
in the kernel during my testing, which I have since discreetly fixed.

We use two shadows:
 - "shad", to track uninitialized memory with a bit granularity (1:1).
   Each bit set to 1 in the shad corresponds to one uninitialized bit of
   real kernel memory.
 - "orig", to track the origin of the memory with a 4-byte granularity
   (1:1). Each uint32_t cell in the orig indicates the origin of the
   associated uint32_t of real kernel memory.

The memory consumption of these shadows is consequent, so at least 4GB of
RAM is recommended to run kMSan.

The compiler inserts calls to specific __msan_* functions on each memory
access, to manage both the shad and the orig and detect uninitialized
memory accesses that change the execution flow (like an "if" on an
uninitialized variable).

We mark as uninit several types of memory buffers (stack, pools, kmem,
malloc, uvm_km), and check each buffer passed to copyout, copyoutstr,
bwrite, if_transmit_lock and DMA operations, to detect uninitialized memory
that leaves the system. This allows us to detect kernel info leaks in a way
that is more efficient and also more user-friendly than KLEAK.

Contrary to kASan, kMSan requires comprehensive coverage, ie we cannot
tolerate having one non-instrumented function, because this could cause
false positives. kMSan cannot instrument ASM functions, so I converted
most of them to __asm__ inlines, which kMSan is able to instrument. Those
that remain receive special treatment.

Contrary to kASan again, kMSan uses a TLS, so we must context-switch this
TLS during interrupts. We use different contexts depending on the interrupt
level.

The orig tracks precisely the origin of a buffer. We use a special encoding
for the orig values, and pack together in each uint32_t cell of the orig:
 - a code designating the type of memory (Stack, Pool, etc), and
 - a compressed pointer, which points either (1) to a string containing
   the name of the variable associated with the cell, or (2) to an area
   in the kernel .text section which we resolve to a symbol name + offset.

This encoding allows us not to consume extra memory for associating
information with each cell, and produces a precise output, that can tell
for example the name of an uninitialized variable on the stack, the
function in which it was pushed on the stack, and the function where we
accessed this uninitialized variable.

kMSan is available with LLVM, but not with GCC.

The code is organized in a way that is similar to kASan and kCSan, so it
means that other architectures than amd64 can be supported.

Revision 1.464 / (download) - annotate - [select for diffs], Wed Nov 13 02:51:22 2019 UTC (3 years, 2 months ago) by ozaki-r
Branch: MAIN
Changes since 1.463: +5 -5 lines
Diff to previous 1.463 (colored)

Get rid of unnecessary NULL checks for rt_ifa and ifa_ifp

They are always non-NULL nowadays.

Revision 1.463 / (download) - annotate - [select for diffs], Sun Oct 6 15:11:17 2019 UTC (3 years, 3 months ago) by uwe
Branch: MAIN
Changes since 1.462: +3 -5 lines
Diff to previous 1.462 (colored)

xc_barrier - convenience function to xc_broadcast() a nop.

Make the intent more clear and also avoid a bunch of (xcfunc_t)nullop
casts that gcc 8 -Wcast-function-type is not happy about.

Revision 1.462 / (download) - annotate - [select for diffs], Wed Sep 25 09:53:37 2019 UTC (3 years, 4 months ago) by ozaki-r
Branch: MAIN
Changes since 1.461: +3 -3 lines
Diff to previous 1.461 (colored)

Make panic messages more informative

Revision 1.394.2.18 / (download) - annotate - [select for diffs], Tue Sep 24 18:27:09 2019 UTC (3 years, 4 months ago) by martin
Branch: netbsd-8
CVS Tags: netbsd-8-2-RELEASE
Changes since 1.394.2.17: +59 -2 lines
Diff to previous 1.394.2.17 (colored) to branchpoint 1.394 (colored)

Pull up following revision(s) (requested by knakahara in ticket #1385):

	sys/net/if.c				1.461
	sys/net/if.h				1.277
	sys/net/if_gif.c			1.149
	sys/net/if_gif.h			1.33
	sys/net/if_ipsec.c			1.19,1.20,1.24
	sys/net/if_ipsec.h			1.5
	sys/net/if_l2tp.c			1.33,1.36-1.39
	sys/net/if_l2tp.h			1.7,1.8
	sys/net/route.c				1.220,1.221
	sys/net/route.h				1.125
	sys/netinet/in_gif.c			1.95
	sys/netinet/in_l2tp.c			1.17
	sys/netinet/ip_input.c			1.391,1.392
	sys/netinet/wqinput.c			1.6
	sys/netinet6/in6_gif.c			1.94
	sys/netinet6/in6_l2tp.c			1.18
	sys/netinet6/ip6_forward.c		1.97
	sys/netinet6/ip6_input.c		1.210,1.211
	sys/netipsec/ipsec_output.c		1.82,1.83 (patched)
	sys/netipsec/ipsecif.c			1.12,1.13,1.15,1.17 (patched)
	sys/netipsec/key.c			1.259,1.260

ipsecif(4) support input drop packet counter.

ipsecif(4) should not increment drop counter by errors not related to if_snd. Pointed out by ozaki-r@n.o, thanks.
Remove unnecessary addresses in PF_KEY message.

MOBIKE Extensions for PF_KEY draft-schilcher-mobike-pfkey-extension-01.txt says
====================
5.  SPD Update
// snip
   SADB_X_SPDADD:
// snip
      sadb_x_ipsecrequest_reqid:
         An ID for that SA can be passed to the kernel in the
         sadb_x_ipsecrequest_reqid field.
      If tunnel mode is specified, the sadb_x_ipsecrequest structure is
      followed by two sockaddr structures that define the tunnel
      endpoint addresses.  In the case that transport mode is used, no
      additional addresses are specified.
====================
see: <a  rel="nofollow" href="https://tools.ietf.org/html/draft-schilcher-mobike-pfkey-extension-01">https://tools.ietf.org/html/draft-schilcher-mobike-pfkey-extension-01</a>

ipsecif(4) uses transport mode, so it should not add addresses.

ipsecif(4) supports multiple peers in the same NAPT.

E.g. ipsec0 connects between NetBSD_A and NetBSD_B, ipsec1 connects
NetBSD_A and NetBSD_C at the following figure.
                                        +----------+
                                   +----| NetBSD_B |
 +----------+           +------+   |    +----------+
 | NetBSD_A |--- ... ---| NAPT |---+
 +----------+           +------+   |    +----------+
                                   +----| NetBSD_C |
                                        +----------+

Add ATF later.

l2tp(4): fix output bytes counter. Pointed by k-goda@IIJ, thanks.
remove a variable which is no longer used.

l2tp: initialize mowner variables for MBUFTRACE

Avoid having a rtcache directly in a percpu storage
percpu(9) has a certain memory storage for each CPU and provides it by the piece
to users.  If the storages went short, percpu(9) enlarges them by allocating new
larger memory areas, replacing old ones with them and destroying the old ones.
A percpu storage referenced by a pointer gotten via percpu_getref can be
destroyed by the mechanism after a running thread sleeps even if percpu_putref
has not been called.

Using rtcache, i.e., packet processing, typically involves sleepable operations
such as rwlock so we must avoid dereferencing a rtcache that is directly stored
in a percpu storage during packet processing.  Address this situation by having
just a pointer to a rtcache in a percpu storage instead.

Reviewed by knakahara@ and yamaguchi@


wqinput: avoid having struct wqinput_worklist directly in a percpu storage
percpu(9) has a certain memory storage for each CPU and provides it by the piece
to users.  If the storages went short, percpu(9) enlarges them by allocating new
larger memory areas, replacing old ones with them and destroying the old ones.

A percpu storage referenced by a pointer gotten via percpu_getref can be
destroyed by the mechanism after a running thread sleeps even if percpu_putref
has not been called.

Input handlers of wqinput normally involves sleepable operations so we must
avoid dereferencing a percpu data (struct wqinput_worklist) after executing
an input handler.  Address this situation by having just a pointer to the data
in a percpu storage instead.

Reviewed by knakahara@ and yamaguchi@

Add missing #include <sys/kmem.h>

Divide Tx context of l2tp(4) to improve performance.
It seems l2tp(4) call path is too long for instruction cache. So, dividing
l2tp(4) Tx context improves CPU use efficiency.

After this commit, l2tp(4) throughput gains 10% on my machine(Atom C3000).

Apply some missing changes lost on the previous commit

Avoid having a rtcache directly in a percpu storage for tunnel protocols.
percpu(9) has a certain memory storage for each CPU and provides it by the piece
to users.  If the storages went short, percpu(9) enlarges them by allocating new
larger memory areas, replacing old ones with them and destroying the old ones.
A percpu storage referenced by a pointer gotten via percpu_getref can be
destroyed by the mechanism after a running thread sleeps even if percpu_putref
has not been called.

Using rtcache, i.e., packet processing, typically involves sleepable operations
such as rwlock so we must avoid dereferencing a rtcache that is directly stored
in a percpu storage during packet processing.  Address this situation by having
just a pointer to a rtcache in a percpu storage instead.

Reviewed by ozaki-r@ and yamaguchi@

l2tp(4): avoid having struct ifqueue directly in a percpu storage.

percpu(9) has a certain memory storage for each CPU and provides it by the piece
to users.  If the storages went short, percpu(9) enlarges them by allocating new
larger memory areas, replacing old ones with them and destroying the old ones.

A percpu storage referenced by a pointer gotten via percpu_getref can be
destroyed by the mechanism after a running thread sleeps even if percpu_putref
has not been called.

Tx processing of l2tp(4) uses normally involves sleepable operations so we
must avoid dereferencing a percpu data (struct ifqueue) after executing Tx
processing.  Address this situation by having just a pointer to the data in
a percpu storage instead.

Reviewed by ozaki-r@ and yamaguchi@

Revision 1.457.2.2 / (download) - annotate - [select for diffs], Tue Sep 24 03:10:35 2019 UTC (3 years, 4 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-0-RC1
Changes since 1.457.2.1: +59 -2 lines
Diff to previous 1.457.2.1 (colored) to branchpoint 1.457 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #238):

	sys/netipsec/ipsec_output.c: revision 1.83
	sys/net/route.h: revision 1.125
	sys/netinet6/ip6_input.c: revision 1.210
	sys/netinet6/ip6_input.c: revision 1.211
	sys/net/if.c: revision 1.461
	sys/net/if_gif.h: revision 1.33
	sys/net/route.c: revision 1.220
	sys/net/route.c: revision 1.221
	sys/net/if.h: revision 1.277
	sys/netinet6/ip6_forward.c: revision 1.97
	sys/netinet/wqinput.c: revision 1.6
	sys/net/if_ipsec.h: revision 1.5
	sys/netinet6/in6_l2tp.c: revision 1.18
	sys/netinet6/in6_gif.c: revision 1.94
	sys/net/if_l2tp.h: revision 1.7
	sys/net/if_gif.c: revision 1.149
	sys/net/if_l2tp.h: revision 1.8
	sys/netinet/in_gif.c: revision 1.95
	sys/netinet/in_l2tp.c: revision 1.17
	sys/netipsec/ipsecif.c: revision 1.17
	sys/net/if_ipsec.c: revision 1.24
	sys/net/if_l2tp.c: revision 1.37
	sys/netinet/ip_input.c: revision 1.391
	sys/net/if_l2tp.c: revision 1.38
	sys/netinet/ip_input.c: revision 1.392
	sys/net/if_l2tp.c: revision 1.39

Avoid having a rtcache directly in a percpu storage

percpu(9) has a certain memory storage for each CPU and provides it by the piece
to users.  If the storages went short, percpu(9) enlarges them by allocating new
larger memory areas, replacing old ones with them and destroying the old ones.

A percpu storage referenced by a pointer gotten via percpu_getref can be
destroyed by the mechanism after a running thread sleeps even if percpu_putref
has not been called.

Using rtcache, i.e., packet processing, typically involves sleepable operations
such as rwlock so we must avoid dereferencing a rtcache that is directly stored
in a percpu storage during packet processing.  Address this situation by having
just a pointer to a rtcache in a percpu storage instead.
Reviewed by knakahara@ and yamaguchi@

 -

wqinput: avoid having struct wqinput_worklist directly in a percpu storage

percpu(9) has a certain memory storage for each CPU and provides it by the piece
to users.  If the storages went short, percpu(9) enlarges them by allocating new
larger memory areas, replacing old ones with them and destroying the old ones.

A percpu storage referenced by a pointer gotten via percpu_getref can be
destroyed by the mechanism after a running thread sleeps even if percpu_putref
has not been called.

Input handlers of wqinput normally involves sleepable operations so we must
avoid dereferencing a percpu data (struct wqinput_worklist) after executing
an input handler.  Address this situation by having just a pointer to the data
in a percpu storage instead.
Reviewed by knakahara@ and yamaguchi@

 -

Add missing #include <sys/kmem.h>

 -

Divide Tx context of l2tp(4) to improve performance.

It seems l2tp(4) call path is too long for instruction cache. So, dividing
l2tp(4) Tx context improves CPU use efficiency.

After this commit, l2tp(4) throughput gains 10% on my machine(Atom C3000).

 -

Apply some missing changes lost on the previous commit

 -

Avoid having a rtcache directly in a percpu storage for tunnel protocols.
percpu(9) has a certain memory storage for each CPU and provides it by the piece
to users.  If the storages went short, percpu(9) enlarges them by allocating new
larger memory areas, replacing old ones with them and destroying the old ones.

A percpu storage referenced by a pointer gotten via percpu_getref can be
destroyed by the mechanism after a running thread sleeps even if percpu_putref
has not been called.

Using rtcache, i.e., packet processing, typically involves sleepable operations
such as rwlock so we must avoid dereferencing a rtcache that is directly stored
in a percpu storage during packet processing.  Address this situation by having
just a pointer to a rtcache in a percpu storage instead.

Reviewed by ozaki-r@ and yamaguchi@

 -

l2tp(4): avoid having struct ifqueue directly in a percpu storage.
percpu(9) has a certain memory storage for each CPU and provides it by the piece
to users.  If the storages went short, percpu(9) enlarges them by allocating new
larger memory areas, replacing old ones with them and destroying the old ones.

A percpu storage referenced by a pointer gotten via percpu_getref can be
destroyed by the mechanism after a running thread sleeps even if percpu_putref
has not been called.

Tx processing of l2tp(4) uses normally involves sleepable operations so we
must avoid dereferencing a percpu data (struct ifqueue) after executing Tx
processing.  Address this situation by having just a pointer to the data in
a percpu storage instead.

Reviewed by ozaki-r@ and yamaguchi@

Revision 1.461 / (download) - annotate - [select for diffs], Thu Sep 19 06:07:24 2019 UTC (3 years, 4 months ago) by knakahara
Branch: MAIN
Changes since 1.460: +59 -2 lines
Diff to previous 1.460 (colored)

Avoid having a rtcache directly in a percpu storage for tunnel protocols.

percpu(9) has a certain memory storage for each CPU and provides it by the piece
to users.  If the storages went short, percpu(9) enlarges them by allocating new
larger memory areas, replacing old ones with them and destroying the old ones.
A percpu storage referenced by a pointer gotten via percpu_getref can be
destroyed by the mechanism after a running thread sleeps even if percpu_putref
has not been called.

Using rtcache, i.e., packet processing, typically involves sleepable operations
such as rwlock so we must avoid dereferencing a rtcache that is directly stored
in a percpu storage during packet processing.  Address this situation by having
just a pointer to a rtcache in a percpu storage instead.

Reviewed by ozaki-r@ and yamaguchi@

Revision 1.460 / (download) - annotate - [select for diffs], Fri Sep 13 07:55:07 2019 UTC (3 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.459: +6 -6 lines
Diff to previous 1.459 (colored)

 if_flags is neither int nor short. It's unsigned short.

Revision 1.459 / (download) - annotate - [select for diffs], Tue Aug 20 10:59:00 2019 UTC (3 years, 5 months ago) by roy
Branch: MAIN
Changes since 1.458: +10 -4 lines
Diff to previous 1.458 (colored)

if: announce flag changes other than up or down

For example toggling promiscuous mode or disabling ARP.

XXX Pullup -9

Revision 1.457.2.1 / (download) - annotate - [select for diffs], Mon Aug 19 16:10:35 2019 UTC (3 years, 5 months ago) by martin
Branch: netbsd-9
Changes since 1.457: +15 -3 lines
Diff to previous 1.457 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #98):

	sys/net/if.c: revision 1.458
	tests/net/if/t_ifconfig.sh: revision 1.21

Restore if_ioctl on error of ifc_destroy

Otherwise subsequence ioctls won't work.

Patch from Harold Gutch on PR kern/54434 (tweaked a bit by me)
tests: check if ifconfig (ioctl) works after a failure of ifconfig destroy

This is a test for PR kern/54434.

Revision 1.394.2.17 / (download) - annotate - [select for diffs], Mon Aug 19 14:27:16 2019 UTC (3 years, 5 months ago) by martin
Branch: netbsd-8
Changes since 1.394.2.16: +15 -3 lines
Diff to previous 1.394.2.16 (colored) to branchpoint 1.394 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #1339):

	sys/net/if.c: revision 1.458
	tests/net/if/t_ifconfig.sh: revision 1.21

Restore if_ioctl on error of ifc_destroy

Otherwise subsequence ioctls won't work.

Patch from Harold Gutch on PR kern/54434 (tweaked a bit by me)
tests: check if ifconfig (ioctl) works after a failure of ifconfig destroy

This is a test for PR kern/54434.

Revision 1.458 / (download) - annotate - [select for diffs], Thu Aug 15 04:20:59 2019 UTC (3 years, 5 months ago) by ozaki-r
Branch: MAIN
Changes since 1.457: +15 -3 lines
Diff to previous 1.457 (colored)

Restore if_ioctl on error of ifc_destroy

Otherwise subsequence ioctls won't work.

Patch from Harold Gutch on PR kern/54434 (tweaked a bit by me)

Revision 1.457 / (download) - annotate - [select for diffs], Thu Jul 25 07:45:57 2019 UTC (3 years, 6 months ago) by knakahara
Branch: MAIN
CVS Tags: netbsd-9-base
Branch point for: netbsd-9
Changes since 1.456: +5 -5 lines
Diff to previous 1.456 (colored)

micro-optimization for if_snd_is_used()

Revision 1.456 / (download) - annotate - [select for diffs], Thu Jul 4 02:44:25 2019 UTC (3 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.455: +54 -2 lines
Diff to previous 1.455 (colored)

Add support for a network interface description.

ioctl(2):
- Add SIOCGIFDESCR/SIOCSIFDESCR commands to get/set the description.

This enables to make a memo for interface, like "Home network" or "Remote VPN".

From t-kusaba@IIJ

Revision 1.428.2.1 / (download) - annotate - [select for diffs], Mon Jun 10 22:09:45 2019 UTC (3 years, 7 months ago) by christos
Branch: phil-wifi
Changes since 1.428: +126 -104 lines
Diff to previous 1.428 (colored)

Sync with HEAD

Revision 1.455 / (download) - annotate - [select for diffs], Tue May 21 09:18:37 2019 UTC (3 years, 8 months ago) by msaitoh
Branch: MAIN
CVS Tags: phil-wifi-20190609
Changes since 1.454: +10 -10 lines
Diff to previous 1.454 (colored)

 KNF. No functional change.

Revision 1.454 / (download) - annotate - [select for diffs], Fri May 17 07:37:12 2019 UTC (3 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.453: +17 -11 lines
Diff to previous 1.453 (colored)

 The max subtype of the ifmedia word is 31. It's too small for Ethernet now.
We currently use use it up to 30. We should extend the limit to be able to use
more than 10Gbps speeds. Our ifmedia(4) is inconvenience and have some problem
so we should redesign the interface, but it's too late for netbsd-9 to do it.
So, we keep the data structure size and modify the structure a bit. The
strategy is almost the same as FreeBSD. Many bits of IFM_OMASK for Ethernet
have not used, so use some of them for Ethernet's subtype.

The differences against FreeBSD are:
 - We use NetBSD style compat code (i.e. no SIOCGIFXMEDIA).
 - FreeBSD's IFM_ETH_XTYPE's bit location is from 11 to "14" even though
   IFM_OMASK is from 8 to "15". We use _IFM_ETH_XTMASK from bit 13 to "15".
 - FreeBSD changed the meaning of IFM_TYPE_MATCH(). I think we should
   not do it. We keep it not changing and added new IFM_TYPE_SUBTYPE_MATCH()
   macro for matching both TYPE and SUBTYPE.
 - Added up to 400GBASE-SR16.

New layout of the media word is as follows (from ifmedia_h):

 * if_media Options word:
 *	Bits	Use
 *	----	-------
 *	0-4	Media subtype	MAX SUBTYPE == 255 for ETH and 31 for others
 *	5-7	Media type
 *	8-15	Type specific options
 *	16-18	Mode (for multi-mode devices)
 *	19	(Reserved for Future Use)
 *	20-27	Shared (global) options
 *	28-31	Instance
 *
 *   3                     2                   1
 *   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
 *  +-------+---------------+-+-----+---------------+-----+---------+
 *  |       |               |R|     |               |     |         |
 *  | IMASK |     GMASK     |F|MMASK+-----+ OMASK   |NMASK|  TMASK  |
 *  |       |               |U|     |XTMSK|         |     |         |
 *  +-------+---------------+-+-----+-----+---------+-----+---------+
 *   <----->                   <--->                 <--->
 *  IFM_INST()               IFM_MODE()            IFM_TYPE()
 *
 *                              IFM_SUBTYPE(other than ETH)<------->
 *
 *                                   <---> IFM_SUBTYPE(ETH)<------->
 *
 *
 *           <------------->         <------------->
 *                        IFM_OPTIONS()

Revision 1.453 / (download) - annotate - [select for diffs], Fri May 17 03:34:26 2019 UTC (3 years, 8 months ago) by ozaki-r
Branch: MAIN
Changes since 1.452: +7 -3 lines
Diff to previous 1.452 (colored)

Implement an aggressive psref leak detector

It is yet another psref leak detector that enables to tell where a leak occurs
while a simpler version that is already committed just tells an occurrence of a
leak.

Investigating of psref leaks is hard because once a leak occurs a percpu list of
psref that tracks references can be corrupted.  A reference to a tracking object
is memorized in the list via an intermediate object (struct psref) that is
normally allocated on a stack of a thread.  Thus, the intermediate object can be
overwritten on a leak resulting in corruption of the list.

The tracker makes a shadow entry to an intermediate object and stores some hints
into it (currently it's a caller address of psref_acquire).  We can detect a
leak by checking the entries on certain points where any references should be
released such as the return point of syscalls and the end of each softint
handler.

The feature is expensive and enabled only if the kernel is built with
PSREF_DEBUG.

Proposed on tech-kern

Revision 1.452 / (download) - annotate - [select for diffs], Wed May 15 02:56:48 2019 UTC (3 years, 8 months ago) by ozaki-r
Branch: MAIN
Changes since 1.451: +2 -9 lines
Diff to previous 1.451 (colored)

Store IFF_ALLMULTI in ec_flags instead of if_flags to avoid data races

IFF_ALLMULTI is set/unset to if_flags via if_mcast_op.  To avoid data races on
if_flags, IFNET_LOCK was added for if_mcast_op.  Unfortunately it produces
a deadlock so we want to remove added IFNET_LOCK by avoiding the data races by
another approach.

This fix introduces ec_flags to struct ethercom and stores IFF_ALLMULTI to it.
ec_flags is protected by ETHER_LOCK and thus IFNET_LOCK is no longer necessary
for if_mcast_op.  Note that the fix is applied only to MP-safe drivers that
the data races matter.

In the kernel, IFF_ALLMULTI is set by a driver and used by the driver itself.
So changing the storing place doesn't break anything.  One exception is
ioctl(SIOCGIFFLAGS); we have to include IFF_ALLMULTI in a result if needed to
export the flag as well as before.

A upcoming commit will remove IFNET_LOCK.

PR kern/54189

Revision 1.451 / (download) - annotate - [select for diffs], Sat Apr 20 22:16:47 2019 UTC (3 years, 9 months ago) by pgoyette
Branch: MAIN
CVS Tags: isaki-audio2-base, isaki-audio2
Changes since 1.450: +4 -4 lines
Diff to previous 1.450 (colored)

Typos in comments.  NFCI.

Revision 1.290.2.1.2.1 / (download) - annotate - [select for diffs], Fri Apr 19 16:03:08 2019 UTC (3 years, 9 months ago) by martin
Branch: netbsd-7-0
Changes since 1.290.2.1: +3 -2 lines
Diff to previous 1.290.2.1 (colored) next main 1.290.2.2 (colored)

Pull up following revision(s) via patch (requested by christos in ticket #1689):

	sys/compat/linux/common/linux_socket.c: revision 1.145
	sys/net/if.c: revision 1.449
	sys/compat/linux32/common/linux32_socket.c: revision 1.30
	sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

 -

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@

Revision 1.290.2.1.6.1 / (download) - annotate - [select for diffs], Fri Apr 19 16:02:24 2019 UTC (3 years, 9 months ago) by martin
Branch: netbsd-7-1
Changes since 1.290.2.1: +3 -2 lines
Diff to previous 1.290.2.1 (colored) next main 1.290.2.2 (colored)

Pull up following revision(s) via patch (requested by christos in ticket #1689):

	sys/compat/linux/common/linux_socket.c: revision 1.145
	sys/net/if.c: revision 1.449
	sys/compat/linux32/common/linux32_socket.c: revision 1.30
	sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

 -

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@

Revision 1.290.2.2 / (download) - annotate - [select for diffs], Fri Apr 19 16:01:34 2019 UTC (3 years, 9 months ago) by martin
Branch: netbsd-7
Changes since 1.290.2.1: +3 -2 lines
Diff to previous 1.290.2.1 (colored) to branchpoint 1.290 (colored) next main 1.291 (colored)

Pull up following revision(s) via patch (requested by christos in ticket #1689):

	sys/compat/linux/common/linux_socket.c: revision 1.145
	sys/net/if.c: revision 1.449
	sys/compat/linux32/common/linux32_socket.c: revision 1.30
	sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

 -

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@

Revision 1.394.2.16 / (download) - annotate - [select for diffs], Fri Apr 19 09:12:58 2019 UTC (3 years, 9 months ago) by martin
Branch: netbsd-8
CVS Tags: netbsd-8-1-RELEASE, netbsd-8-1-RC1
Changes since 1.394.2.15: +3 -2 lines
Diff to previous 1.394.2.15 (colored) to branchpoint 1.394 (colored)

Pull up following revision(s) (requested by christos in ticket #1233):

	sys/compat/linux/common/linux_socket.c: revision 1.145
	sys/net/if.c: revision 1.449
	sys/compat/linux32/common/linux32_socket.c: revision 1.30
	sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

 -

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@

Revision 1.450 / (download) - annotate - [select for diffs], Tue Apr 16 04:31:43 2019 UTC (3 years, 9 months ago) by msaitoh
Branch: MAIN
Changes since 1.449: +9 -6 lines
Diff to previous 1.449 (colored)

Rename ifreqo2n() and ifreqo2n() to IFREQO2N_43() and IFREQN2O_43():
 - ifreqo2n() and ifreqn2o() are for COMPAT_43, so add _43 to the name.
 - Uppercase to make it clear those are macros.

Revision 1.449 / (download) - annotate - [select for diffs], Mon Apr 15 20:51:46 2019 UTC (3 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.448: +3 -2 lines
Diff to previous 1.448 (colored)

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

Revision 1.448 / (download) - annotate - [select for diffs], Thu Apr 11 03:07:11 2019 UTC (3 years, 9 months ago) by msaitoh
Branch: MAIN
Changes since 1.447: +2 -3 lines
Diff to previous 1.447 (colored)

 Remove inclusion of compat/sys/socket.h. It's not required anymore.

Revision 1.447 / (download) - annotate - [select for diffs], Sat Mar 23 09:48:04 2019 UTC (3 years, 10 months ago) by pgoyette
Branch: MAIN
Changes since 1.446: +8 -2 lines
Diff to previous 1.446 (colored)

Replace compile-time checking for vlan code with a module hook.

Should resolve the errors reported on irc when booting a kernel which
has agr without vlan:


 [   1.0000000] WARNING: module error: built-in module if_agr can't find builtin dependency `if_vlan'
 [   1.0000000] WARNING: module error: built-in module if_agr prerequisite if_vlan failed, error 2

Revision 1.446 / (download) - annotate - [select for diffs], Fri Mar 1 11:06:57 2019 UTC (3 years, 11 months ago) by pgoyette
Branch: MAIN
Changes since 1.445: +7 -7 lines
Diff to previous 1.445 (colored)

Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.

Revision 1.445 / (download) - annotate - [select for diffs], Tue Jan 29 09:28:50 2019 UTC (4 years ago) by pgoyette
Branch: MAIN
Changes since 1.444: +5 -5 lines
Diff to previous 1.444 (colored)

Normalize all the compat hooks' names to the form

	<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.

Revision 1.444 / (download) - annotate - [select for diffs], Sun Jan 27 02:08:48 2019 UTC (4 years ago) by pgoyette
Branch: MAIN
Changes since 1.443: +24 -39 lines
Diff to previous 1.443 (colored)

Merge the [pgoyette-compat] branch

Revision 1.419.2.22 / (download) - annotate - [select for diffs], Tue Jan 22 07:42:41 2019 UTC (4 years ago) by pgoyette
Branch: pgoyette-compat
CVS Tags: pgoyette-compat-merge-20190127
Changes since 1.419.2.21: +14 -32 lines
Diff to previous 1.419.2.21 (colored) to branchpoint 1.419 (colored) next main 1.420 (colored)

Convert the MODULE_{,VOID_}HOOK_CALL macros to do everything in-line
rather than defining an intermediate hook##call function.  Almost
all of the hooks are called only once, and although we lose the
ability of doing things like

	if (MODULE_HOOK_CALL(...) == 0) ...

we simplify things quite a bit.  With this change, we no longer need
to have both declaration and definition macros, and the definition
no longer needs to have both prototype argument list and a "real"
argument list.

FWIW, the above if now needs to written as

	int ret;

	MODULE_HOOK_CALL(..., ret);
	if (ret == 0) ...

with appropriate use of braces {}.

Revision 1.419.2.21 / (download) - annotate - [select for diffs], Fri Jan 18 00:01:02 2019 UTC (4 years ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.20: +10 -10 lines
Diff to previous 1.419.2.20 (colored) to branchpoint 1.419 (colored)

Don't restrict hooks to having only int or void types.  Pass the hook's
type to the various macros, as needed.

Allows us to reduce diffs to original in at least one or two places (we
no longer have to provide an additional parameter to the hook routine
for returning a non-int return value).

Revision 1.419.2.20 / (download) - annotate - [select for diffs], Mon Jan 14 13:34:28 2019 UTC (4 years ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.19: +10 -10 lines
Diff to previous 1.419.2.19 (colored) to branchpoint 1.419 (colored)

Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.

Revision 1.419.2.19 / (download) - annotate - [select for diffs], Sun Jan 13 10:49:50 2019 UTC (4 years ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.18: +15 -15 lines
Diff to previous 1.419.2.18 (colored) to branchpoint 1.419 (colored)

Remove the HOOK2 versions of the MODULE_HOOK macros.  There were
only a few uses, and using them led to some lack of clarity in the
code.  Instead, we now use two separate hooks, with names that
make it clear(er) what we're doing.

This also positions us to start unraveling some of the rtsock_50
mess, which will need (at least) five hooks.

Revision 1.419.2.18 / (download) - annotate - [select for diffs], Wed Dec 26 14:02:04 2018 UTC (4 years, 1 month ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.17: +29 -22 lines
Diff to previous 1.419.2.17 (colored) to branchpoint 1.419 (colored)

Sync with HEAD, resolve a few conflicts

Revision 1.443 / (download) - annotate - [select for diffs], Fri Dec 21 08:58:08 2018 UTC (4 years, 1 month ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226
Changes since 1.442: +3 -2 lines
Diff to previous 1.442 (colored)

 Add SIOCSETHERCAP. It's used to change ec_capenable.

Revision 1.442 / (download) - annotate - [select for diffs], Wed Dec 12 01:46:47 2018 UTC (4 years, 1 month ago) by rin
Branch: MAIN
Changes since 1.441: +28 -22 lines
Diff to previous 1.441 (colored)

PR kern/53562

Handle TX offload in software when a packet is sent via
bridge_output(). We can send it as is in the following
exceptional cases:

For unicast:

(1) When the destination interface is the same as source.

(2) When the destination supports all TX offload options
    specified in a packet.

For multicast/broadcast:

(3) When all the members of the bridge support the specified
    TX offload options.

For (3), add sc_csum_flags_tx flag to bridge softc, which is
logical AND b/w capabilities of TX offload options in member
interface (ifp->if_csum_flags_tx). The flag is updated when a
member is (i) added to or (ii) removed from a bridge, or (iii)
if_csum_flags_tx flag of a member interface is manipulated via
ifconfig(8).

Turn on M_CSUM_TSOv[46] bit in ifp->if_csum_flags_tx flag when
TSO[46] is enabled for that interface.

OK msaitoh thorpej

Revision 1.419.2.17 / (download) - annotate - [select for diffs], Mon Nov 26 01:52:50 2018 UTC (4 years, 2 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.16: +11 -7 lines
Diff to previous 1.419.2.16 (colored) to branchpoint 1.419 (colored)

Sync with HEAD, resolve a couple of conflicts

Revision 1.441 / (download) - annotate - [select for diffs], Thu Nov 15 10:23:56 2018 UTC (4 years, 2 months ago) by maxv
Branch: MAIN
CVS Tags: pgoyette-compat-1126
Changes since 1.440: +3 -3 lines
Diff to previous 1.440 (colored)

Remove the 't' argument from m_tag_find().

Revision 1.394.2.15 / (download) - annotate - [select for diffs], Tue Nov 6 14:38:58 2018 UTC (4 years, 2 months ago) by martin
Branch: netbsd-8
Changes since 1.394.2.14: +10 -6 lines
Diff to previous 1.394.2.14 (colored) to branchpoint 1.394 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #1080):

	sys/netinet6/nd6.c: revision 1.251
	sys/netinet/if_arp.c: revision 1.276
	sys/net/if.c: revision 1.438
	sys/net/if.c: revision 1.439
	sys/net/route.c: revision 1.214
	sys/net/route.c: revision 1.215
	sys/net/route.c: revision 1.216
	sys/netinet6/in6.c: revision 1.270
	sys/net/route.h: revision 1.120
	sys/net/if.c: revision 1.440

Remove a wrong assertion in ifaref

 -

Doing ifref on an ifa with IFA_DESTROYING is not a problem; the reference should
be dropped during the destruction of the ifa.

 -

Use atomic operations for ifa_refcnt

 -

Avoid a dangling pointer during rt_replace_ifa

 -

Avoid double rt_replace_ifa on rtrequest1(RTM_ADD)

Some callers of rtrequest1(RTM_ADD) adjust rt_ifa of an rtentry created by
rtrequest1 that may change rt_ifa (in ifa_rtrequest) with another ifa that is
different from requested one.  It's wasteful and even worse introduces a race
condition.  rtrequest1 should just use a passed ifa as is if a caller hopes so.

 -

Use rt_update framework on updating a rtentry

Revision 1.440 / (download) - annotate - [select for diffs], Tue Oct 30 05:54:42 2018 UTC (4 years, 3 months ago) by ozaki-r
Branch: MAIN
Changes since 1.439: +7 -3 lines
Diff to previous 1.439 (colored)

Avoid double rt_replace_ifa on rtrequest1(RTM_ADD)

Some callers of rtrequest1(RTM_ADD) adjust rt_ifa of an rtentry created by
rtrequest1 that may change rt_ifa (in ifa_rtrequest) with another ifa that is
different from requested one.  It's wasteful and even worse introduces a race
condition.  rtrequest1 should just use a passed ifa as is if a caller hopes so.

Revision 1.439 / (download) - annotate - [select for diffs], Tue Oct 30 05:29:21 2018 UTC (4 years, 3 months ago) by ozaki-r
Branch: MAIN
Changes since 1.438: +4 -4 lines
Diff to previous 1.438 (colored)

Use atomic operations for ifa_refcnt

Revision 1.438 / (download) - annotate - [select for diffs], Tue Oct 30 05:27:51 2018 UTC (4 years, 3 months ago) by ozaki-r
Branch: MAIN
Changes since 1.437: +3 -3 lines
Diff to previous 1.437 (colored)

Remove a wrong assertion in ifaref

Doing ifref on an ifa with IFA_DESTROYING is not a problem; the reference should
be dropped during the destruction of the ifa.

Revision 1.419.2.16 / (download) - annotate - [select for diffs], Sat Oct 20 06:58:45 2018 UTC (4 years, 3 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.15: +3 -4 lines
Diff to previous 1.419.2.15 (colored) to branchpoint 1.419 (colored)

Sync with head

Revision 1.437 / (download) - annotate - [select for diffs], Thu Oct 18 11:34:54 2018 UTC (4 years, 3 months ago) by knakahara
Branch: MAIN
CVS Tags: pgoyette-compat-1020
Changes since 1.436: +3 -4 lines
Diff to previous 1.436 (colored)

fix panic when do ifconfig -vlanif and ifconfig vlanif again. advised by ozaki-r@.

e.g. do the following commands.
    ====================
    # ifconfig vlan0 create
    # ifconfig vlan0 vlan 100 vlanif wm0
    # ifconfig vlan0 -vlanif wm0
    # ifconfig vlan0 vlan 100 vlanif wm0
    ====================

ATF net/if_vlan do this type of test, however it cannot detect this bug.
Because the shmif(4)'s ifp->if_hwdl is always NULL as shmif(4)'s ethernet
address is set U/L bit.
See: https://nxr.netbsd.org/xref/src/sys/net/if_ethersubr.c#997

Revision 1.419.2.15 / (download) - annotate - [select for diffs], Sun Sep 30 01:45:56 2018 UTC (4 years, 4 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.14: +18 -11 lines
Diff to previous 1.419.2.14 (colored) to branchpoint 1.419 (colored)

Ssync with HEAD

Revision 1.419.2.14 / (download) - annotate - [select for diffs], Sat Sep 29 21:36:14 2018 UTC (4 years, 4 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.13: +6 -7 lines
Diff to previous 1.419.2.13 (colored) to branchpoint 1.419 (colored)

In MODULE_HOOK_CALL_DECL we don't need to provide the actual argument
list for calling the hook function, nor do we need to provide the
default value (for when the hook has not been set).

Revision 1.419.2.13 / (download) - annotate - [select for diffs], Fri Sep 21 02:56:22 2018 UTC (4 years, 4 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.12: +18 -28 lines
Diff to previous 1.419.2.12 (colored) to branchpoint 1.419 (colored)

Clean-up some pre-existing function-pointer code (related to if_43)
to use the new MP-safe mechanism.

Revision 1.419.2.12 / (download) - annotate - [select for diffs], Thu Sep 20 09:23:22 2018 UTC (4 years, 4 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.11: +4 -4 lines
Diff to previous 1.419.2.11 (colored) to branchpoint 1.419 (colored)

The uipc_syscalls_40 compat routine doesn't have a ``struct lwp *l''
argument - adjust hook parameter lists accordingly.

Revision 1.419.2.11 / (download) - annotate - [select for diffs], Thu Sep 20 07:34:10 2018 UTC (4 years, 4 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.10: +19 -6 lines
Diff to previous 1.419.2.10 (colored) to branchpoint 1.419 (colored)

Use the MP-safe hooks mechanism for the uipc_syscalls_40 and _50
routines.

Revision 1.436 / (download) - annotate - [select for diffs], Fri Sep 7 13:24:14 2018 UTC (4 years, 4 months ago) by christos
Branch: MAIN
CVS Tags: pgoyette-compat-0930
Changes since 1.435: +18 -10 lines
Diff to previous 1.435 (colored)

Flip the order of free'ing things to avoid crash (from ozaki-r). Tested
with a month's uptime. Used to crash once a week.

Revision 1.419.2.10 / (download) - annotate - [select for diffs], Thu Sep 6 06:56:44 2018 UTC (4 years, 4 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.9: +6 -4 lines
Diff to previous 1.419.2.9 (colored) to branchpoint 1.419 (colored)

Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)

Revision 1.435 / (download) - annotate - [select for diffs], Thu Sep 6 06:42:00 2018 UTC (4 years, 4 months ago) by maxv
Branch: MAIN
Changes since 1.434: +2 -3 lines
Diff to previous 1.434 (colored)

Remove the network ATM code.

Revision 1.394.2.14 / (download) - annotate - [select for diffs], Mon Aug 27 07:49:11 2018 UTC (4 years, 5 months ago) by martin
Branch: netbsd-8
Changes since 1.394.2.13: +3 -2 lines
Diff to previous 1.394.2.13 (colored) to branchpoint 1.394 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #991):

	sys/net/if.c: revision 1.434

Restore splx removed accidentally at v1.406
Pointed out by k-goda@IIJ

Revision 1.434 / (download) - annotate - [select for diffs], Mon Aug 27 04:53:24 2018 UTC (4 years, 5 months ago) by ozaki-r
Branch: MAIN
CVS Tags: pgoyette-compat-0906
Changes since 1.433: +3 -2 lines
Diff to previous 1.433 (colored)

Restore splx removed accidentally at v1.406

Pointed out by k-goda@IIJ

Revision 1.433 / (download) - annotate - [select for diffs], Fri Aug 10 10:31:01 2018 UTC (4 years, 5 months ago) by knakahara
Branch: MAIN
Changes since 1.432: +3 -2 lines
Diff to previous 1.432 (colored)

fix if_snd_is_used(), ifp->if_snd is also used by if.c::if_transmit().

Revision 1.432 / (download) - annotate - [select for diffs], Fri Aug 10 07:24:09 2018 UTC (4 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.431: +3 -3 lines
Diff to previous 1.431 (colored)

- Fix a bug that drop counter shows incorrect vaule like
  "net.inet.ip.ifq.drops = 72059810241052672"
- Change pktq's length sysctl to uint64_t.

Revision 1.431 / (download) - annotate - [select for diffs], Mon Aug 6 06:54:40 2018 UTC (4 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.430: +3 -3 lines
Diff to previous 1.430 (colored)

 Change pktq's drops count sysctl from CTLTYPE_INT to CTLTYPE_QUAD.

Revision 1.419.2.9 / (download) - annotate - [select for diffs], Sat Jul 28 04:38:09 2018 UTC (4 years, 6 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.8: +13 -7 lines
Diff to previous 1.419.2.8 (colored) to branchpoint 1.419 (colored)

Sync with HEAD

Revision 1.394.2.13 / (download) - annotate - [select for diffs], Fri Jul 13 16:01:12 2018 UTC (4 years, 6 months ago) by martin
Branch: netbsd-8
CVS Tags: netbsd-8-0-RELEASE
Changes since 1.394.2.12: +7 -2 lines
Diff to previous 1.394.2.12 (colored) to branchpoint 1.394 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #915):

	sys/net/if.c: revision 1.424

Print "NET_MPSAFE enabled" if it's enabled.

Revision 1.394.2.12 / (download) - annotate - [select for diffs], Fri Jul 13 15:49:55 2018 UTC (4 years, 6 months ago) by martin
Branch: netbsd-8
Changes since 1.394.2.11: +10 -4 lines
Diff to previous 1.394.2.11 (colored) to branchpoint 1.394 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #911):

	sys/kern/init_main.c: revision 1.498
	sys/rump/net/lib/libnet/net_component.c: revision 1.10
	sys/net/if.h: revision 1.264
	sys/net/if.c: revision 1.429

Fix net.inet6.ip6.ifq node doesn't exist

The node (and child nodes) is initialized in sysctl_net_pktq_setup, but the call
of sysctl_net_pktq_setup is skipped unexpectedly.
sysctl_net_pktq_setup is skipped if in6_present is false that indicates the
netinet6 component isn't loaded on rump kernels.  However the flag is
accidentally always false because the flag is turned on in in6_dom_init that is
called after if_sysctl_setup on both normal and rump kernels.

Fix the issue by moving if_sysctl_setup after in6_dom_init (domaininit on normal
kernels).  This fix is ad-hoc but good enough for netbsd-8.  We should refine
the initialization order of network components in the future.

Pointed out by hikaru@

Revision 1.430 / (download) - annotate - [select for diffs], Mon Jul 9 14:54:01 2018 UTC (4 years, 6 months ago) by christos
Branch: MAIN
CVS Tags: pgoyette-compat-0728
Changes since 1.429: +3 -3 lines
Diff to previous 1.429 (colored)

Calling rtinit(sa_family = AF_LINK, RTM_DELETE, 0) is guaranteed not to
work. Remove bogus call leaving a KASSERT behind.

Revision 1.429 / (download) - annotate - [select for diffs], Tue Jul 3 03:37:03 2018 UTC (4 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.428: +10 -4 lines
Diff to previous 1.428 (colored)

Fix net.inet6.ip6.ifq node doesn't exist

The node (and child nodes) is initialized in sysctl_net_pktq_setup, but the call
of sysctl_net_pktq_setup is skipped unexpectedly.

sysctl_net_pktq_setup is skipped if in6_present is false that indicates the
netinet6 component isn't loaded on rump kernels.  However the flag is
accidentally always false because the flag is turned on in in6_dom_init that is
called after if_sysctl_setup on both normal and rump kernels.

Fix the issue by moving if_sysctl_setup after in6_dom_init (domaininit on normal
kernels).  This fix is ad-hoc but good enough for netbsd-8.  We should refine
the initialization order of network components in the future.

Pointed out by hikaru@

Revision 1.428 / (download) - annotate - [select for diffs], Tue Jun 26 06:48:02 2018 UTC (4 years, 7 months ago) by msaitoh
Branch: MAIN
CVS Tags: phil-wifi-base
Branch point for: phil-wifi
Changes since 1.427: +4 -4 lines
Diff to previous 1.427 (colored)

 Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

 This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.

Revision 1.419.2.8 / (download) - annotate - [select for diffs], Mon Jun 25 07:26:06 2018 UTC (4 years, 7 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.7: +29 -10 lines
Diff to previous 1.419.2.7 (colored) to branchpoint 1.419 (colored)

Sync with HEAD

Revision 1.394.2.11 / (download) - annotate - [select for diffs], Thu Jun 7 17:50:54 2018 UTC (4 years, 7 months ago) by martin
Branch: netbsd-8
CVS Tags: netbsd-8-0-RC2
Changes since 1.394.2.10: +5 -2 lines
Diff to previous 1.394.2.10 (colored) to branchpoint 1.394 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #844):

	sys/net/if.c: revision 1.425

Relax a lock check in if_mcast_op unless NET_MPSAFE

It seems that there remain some paths that don't satisfy the constraint that is
required only if NET_MPSAFE.  So don't check it by default.

One known path is nd6_rtrequest => in6_addmulti => if_mcast_op, which is not
easy to address.

Revision 1.427 / (download) - annotate - [select for diffs], Fri Jun 1 07:16:23 2018 UTC (4 years, 8 months ago) by ozaki-r
Branch: MAIN
CVS Tags: pgoyette-compat-0625
Changes since 1.426: +10 -2 lines
Diff to previous 1.426 (colored)

Make sure to remove all AF_LINK addresses in if_detach

Revision 1.426 / (download) - annotate - [select for diffs], Fri Jun 1 07:14:13 2018 UTC (4 years, 8 months ago) by ozaki-r
Branch: MAIN
Changes since 1.425: +13 -10 lines
Diff to previous 1.425 (colored)

Make sure to not change if_hwdl once set

Revision 1.425 / (download) - annotate - [select for diffs], Thu May 31 02:10:23 2018 UTC (4 years, 8 months ago) by ozaki-r
Branch: MAIN
Changes since 1.424: +5 -2 lines
Diff to previous 1.424 (colored)

Relax a lock check in if_mcast_op unless NET_MPSAFE

It seems that there remain some paths that don't satisfy the constraint that is
required only if NET_MPSAFE.  So don't check it by default.

One known path is nd6_rtrequest => in6_addmulti => if_mcast_op, which is not
easy to address.

Revision 1.424 / (download) - annotate - [select for diffs], Thu May 24 05:27:29 2018 UTC (4 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.423: +7 -2 lines
Diff to previous 1.423 (colored)

 Print "NET_MPSAFE enabled" if it's enabled.

Revision 1.419.2.7 / (download) - annotate - [select for diffs], Mon May 21 04:36:15 2018 UTC (4 years, 8 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.6: +11 -8 lines
Diff to previous 1.419.2.6 (colored) to branchpoint 1.419 (colored)

Sync with HEAD

Revision 1.394.2.10 / (download) - annotate - [select for diffs], Tue May 15 13:48:37 2018 UTC (4 years, 8 months ago) by martin
Branch: netbsd-8
Changes since 1.394.2.9: +11 -8 lines
Diff to previous 1.394.2.9 (colored) to branchpoint 1.394 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #826):

	sys/net/if_bridge.c: revision 1.155
	sys/net/if.c: revision 1.421
	sys/net/bpf.c: revision 1.224
	sys/net/if.c: revision 1.422
	sys/net/if.c: revision 1.423

Use if_is_mpsafe (NFC)

Protect packet input routines with KERNEL_LOCK and splsoftnet
if_input, i.e, ether_input and friends, now runs in softint without any
protections.  It's ok for ether_input itself because it's already MP-safe,
however, subsequent routines called from it such as carp_input and agr_input
aren't safe because they're not MP-safe.  Protect if_input with KERNEL_LOCK.
if_input can be called from a normal LWP context.  In that case we need to
prevent interrupts (softint) from running by splsoftnet to protect
non-MP-safe
codes (e.g., carp_input and agr_input).

Pointed out by mlelstv@

Protect if_deferred_start_softint with KERNEL_LOCK if the interface isn't
MP-safe

Revision 1.423 / (download) - annotate - [select for diffs], Mon May 14 02:55:46 2018 UTC (4 years, 8 months ago) by ozaki-r
Branch: MAIN
CVS Tags: pgoyette-compat-0521
Changes since 1.422: +6 -4 lines
Diff to previous 1.422 (colored)

Protect if_deferred_start_softint with KERNEL_LOCK if the interface isn't MP-safe

Revision 1.422 / (download) - annotate - [select for diffs], Mon May 14 02:55:03 2018 UTC (4 years, 8 months ago) by ozaki-r
Branch: MAIN
Changes since 1.421: +6 -4 lines
Diff to previous 1.421 (colored)

Protect packet input routines with KERNEL_LOCK and splsoftnet

if_input, i.e, ether_input and friends, now runs in softint without any
protections.  It's ok for ether_input itself because it's already MP-safe,
however, subsequent routines called from it such as carp_input and agr_input
aren't safe because they're not MP-safe.  Protect if_input with KERNEL_LOCK.

if_input can be called from a normal LWP context.  In that case we need to
prevent interrupts (softint) from running by splsoftnet to protect non-MP-safe
codes (e.g., carp_input and agr_input).

Pointed out by mlelstv@

Revision 1.421 / (download) - annotate - [select for diffs], Mon May 14 02:53:29 2018 UTC (4 years, 8 months ago) by ozaki-r
Branch: MAIN
Changes since 1.420: +3 -4 lines
Diff to previous 1.420 (colored)

Use if_is_mpsafe (NFC)

Revision 1.419.2.6 / (download) - annotate - [select for diffs], Mon Apr 16 02:00:08 2018 UTC (4 years, 9 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.5: +3 -3 lines
Diff to previous 1.419.2.5 (colored) to branchpoint 1.419 (colored)

Sync with HEAD, resolve some conflicts

Revision 1.419.2.5 / (download) - annotate - [select for diffs], Thu Apr 12 22:33:41 2018 UTC (4 years, 9 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.4: +35 -80 lines
Diff to previous 1.419.2.4 (colored) to branchpoint 1.419 (colored)

Merge christos's recent changes on HEAD

Revision 1.420 / (download) - annotate - [select for diffs], Thu Apr 12 18:44:59 2018 UTC (4 years, 9 months ago) by christos
Branch: MAIN
CVS Tags: pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415
Changes since 1.419: +34 -45 lines
Diff to previous 1.419 (colored)

disentangle a bit more the compat ioctl code.

Revision 1.419.2.4 / (download) - annotate - [select for diffs], Thu Mar 8 00:25:30 2018 UTC (4 years, 10 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.3: +3 -2 lines
Diff to previous 1.419.2.3 (colored) to branchpoint 1.419 (colored)

Handle ifconf() compat vectors

Revision 1.419.2.3 / (download) - annotate - [select for diffs], Wed Mar 7 08:56:44 2018 UTC (4 years, 10 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.2: +2 -4 lines
Diff to previous 1.419.2.2 (colored) to branchpoint 1.419 (colored)

Remove redundant assignment

Revision 1.419.2.2 / (download) - annotate - [select for diffs], Tue Mar 6 23:46:14 2018 UTC (4 years, 10 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419.2.1: +4 -2 lines
Diff to previous 1.419.2.1 (colored) to branchpoint 1.419 (colored)

Allocate and initialize the vector for compat_ifconf()

Revision 1.419.2.1 / (download) - annotate - [select for diffs], Tue Mar 6 05:46:06 2018 UTC (4 years, 11 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.419: +40 -6 lines
Diff to previous 1.419 (colored)

Untangle some networking compat code so we can build a kernel with
networking and MODULAR, but without any actual COMPAT_* code (ie,
assuming that all the compat stuff can be added later via modules).

Revision 1.394.2.9 / (download) - annotate - [select for diffs], Wed Feb 28 18:54:43 2018 UTC (4 years, 11 months ago) by martin
Branch: netbsd-8
CVS Tags: netbsd-8-0-RC1
Changes since 1.394.2.8: +4 -3 lines
Diff to previous 1.394.2.8 (colored) to branchpoint 1.394 (colored)

Pull up following revision(s) (requested by mrg in ticket #595):
	sys/net/if.c: revision 1.398
	sys/net/rtsock.c: revision 1.231
remove useless cast, initialize family.
Avoid using a zero family mask.

Revision 1.394.2.8 / (download) - annotate - [select for diffs], Sun Feb 11 21:17:34 2018 UTC (4 years, 11 months ago) by snj
Branch: netbsd-8
Changes since 1.394.2.7: +39 -2 lines
Diff to previous 1.394.2.7 (colored) to branchpoint 1.394 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #536):
	distrib/sets/lists/base/shl.mi: 1.825
	distrib/sets/lists/comp/mi: 1.2168-1.2169
	distrib/sets/lists/comp/shl.mi: 1.310
	distrib/sets/lists/debug/mi: 1.234
	distrib/sets/lists/debug/shl.mi: 1.188
	distrib/sets/lists/man/mi: 1.1570
	distrib/sets/lists/tests/mi: 1.772
	etc/mtree/NetBSD.dist.tests: 1.150
	share/man/man4/Makefile: 1.650
	share/man/man4/ipsec.4: 1.42-1.43
	share/man/man4/ipsecif.4: 1.1-1.5
	sys/arch/amd64/conf/ALL: 1.77
	sys/arch/amd64/conf/GENERIC: 1.480
	sys/conf/files: 1.1191
	sys/net/Makefile: 1.34
	sys/net/files.net: 1.14
	sys/net/if.c: 1.404
	sys/net/if.h: 1.248
	sys/net/if_gif.c: 1.135
	sys/net/if_ipsec.c: 1.1-1.3
	sys/net/if_ipsec.h: 1.1
	sys/net/if_l2tp.c: 1.16
	sys/net/if_types.h: 1.28
	sys/netinet/in.c: 1.214
	sys/netinet/in.h: 1.103
	sys/netinet/in_gif.c: 1.92
	sys/netinet/ip_var.h: 1.122
	sys/netinet6/in6.c: 1.257
	sys/netinet6/in6.h: 1.88
	sys/netinet6/in6_gif.c: 1.90
	sys/netinet6/ip6_var.h: 1.75
	sys/netipsec/Makefile: 1.6
	sys/netipsec/files.netipsec: 1.13
	sys/netipsec/ipsec.h: 1.62
	sys/netipsec/ipsecif.c: 1.1
	sys/netipsec/ipsecif.h: 1.1
	sys/netipsec/key.c: 1.246-1.247
	sys/netipsec/key.h: 1.34
	sys/rump/net/Makefile.rumpnetcomp: 1.20
	sys/rump/net/lib/libipsec/IPSEC.ioconf: 1.1
	sys/rump/net/lib/libipsec/Makefile: 1.1
	sys/rump/net/lib/libipsec/ipsec_component.c: 1.1
	tests/net/Makefile: 1.34
	tests/net/if_ipsec/Makefile: 1.1
	tests/net/if_ipsec/t_ipsec.sh: 1.1-1.2
Don't touch an SP without a reference to it
unify processing to check nesting count for some tunnel protocols.
add ipsec(4) interface, which is used for route-based VPN.
man and ATF are added later, please see man for details.
reviewed by christos@n.o, joerg@n.o and ozaki-r@n.o, thanks.
https://mail-index.netbsd.org/tech-net/2017/12/18/msg006557.html
ipsec(4) interface supports rump now.
add ipsec(4) interface ATF.
add ipsec(4) interface man as ipsecif.4.
add ipsec(4) interface to amd64/GENERIC and amd64/ALL configs.
apply in{,6}_tunnel_validate() to gif(4).
Spell IPsec that way. Simplify macro usage. Sort SEE ALSO. Bump
date for previous.
Improve wording and macro use.
Some parts are not clear to me, so someone with knowledge of ipsecif(4)
should improve this some more.
Improve ipsecif.4. Default port ipsec(4) NAT-T is tested now.
pointed out by wiz@n.o and suggested by ozaki-r@n.o, thanks.
Change the prefix of test names to ipsecif_ to distinguish from tests for ipsec(4)
New sentence, new line. Remove empty macro.
Fix PR kern/52920. Pointed out by David Binderman, thanks.
Improve wording, and put a new drawing, from me and Kengo Nakahara.
apply a little more #ifdef INET/INET6.  fixes !INET6 builds.

Revision 1.394.2.7 / (download) - annotate - [select for diffs], Mon Feb 5 14:55:16 2018 UTC (4 years, 11 months ago) by martin
Branch: netbsd-8
Changes since 1.394.2.6: +3 -4 lines
Diff to previous 1.394.2.6 (colored) to branchpoint 1.394 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #528):
	sys/net/agr/if_agr.c: revision 1.42
	sys/netinet6/nd6_rtr.c: revision 1.137
	sys/netinet6/nd6_rtr.c: revision 1.138
	sys/net/agr/if_agr.c: revision 1.46
	sys/net/route.c: revision 1.206
	sys/net/if.c: revision 1.419
	sys/net/agr/if_agrether.c: revision 1.10
	sys/netinet6/nd6.c: revision 1.241
	sys/netinet6/nd6.c: revision 1.242
	sys/netinet6/nd6.c: revision 1.243
	sys/netinet6/nd6.c: revision 1.244
	sys/netinet6/nd6.c: revision 1.245
	sys/netipsec/ipsec_input.c: revision 1.52
	sys/netipsec/ipsec_input.c: revision 1.53
	sys/net/agr/if_agrsubr.h: revision 1.5
	sys/kern/subr_workqueue.c: revision 1.35
	sys/netipsec/ipsec.c: revision 1.124
	sys/net/agr/if_agrsubr.c: revision 1.11
	sys/net/agr/if_agrsubr.c: revision 1.12
Simplify; share agr_vlan_add and agr_vlan_del (NFCI)
Fix late NULL-checking (CID 1427782: Null pointer dereferences (REVERSE_INULL))
KNF: replace soft tabs with hard tabs
Add missing NULL-checking for m_pullup (CID 1427770: Null pointer dereferences (NULL_RETURNS))
Add locking.
Revert "Get rid of unnecessary splsoftnet" (v1.133)
It's not always true that softnet_lock is held these places.
See PR kern/52947.
Get rid of unnecessary splsoftnet (redo)
Unless NET_MPSAFE, splsoftnet is still needed for rt_* functions.
Use existing fill_[pd]rlist() functions to calculate size of buffer to
allocate, rather than relying on an arbitrary length passed in from
userland.
Allow copyout() of partial results if the user buffer is too small, to
be consistent with the way sysctl(3) is documented.
Garbage-collect now-unused third parrameter in the fill_[pd]rlist()
functions.
As discussed on IRC.
OK kamil@ and christos@
XXX Needs pull-up to netbsd-8 branch.
Simplify, from christos@
More simplification, this time from ozaki-r@
No need to break after return.
One more from christos@
No need to initialize fill_func
more cleanup (don't allow oldlenp == NULL)
Destroy ifq_lock at the end of if_detach
It still can be used in if_detach.
Prevent rt_free_global.wk from being enqueued to workqueue doubly
Check if a queued work is tried to be enqueued again, which is not allowed

Revision 1.419 / (download) - annotate - [select for diffs], Tue Jan 30 10:40:02 2018 UTC (5 years ago) by ozaki-r
Branch: MAIN
CVS Tags: pgoyette-compat-base, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315
Branch point for: pgoyette-compat
Changes since 1.418: +3 -4 lines
Diff to previous 1.418 (colored)

Destroy ifq_lock at the end of if_detach

It still can be used in if_detach.

Revision 1.394.2.6 / (download) - annotate - [select for diffs], Sat Jan 13 05:43:44 2018 UTC (5 years ago) by snj
Branch: netbsd-8
Changes since 1.394.2.5: +5 -5 lines
Diff to previous 1.394.2.5 (colored) to branchpoint 1.394 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #487):
	sys/net/if.c: revision 1.417
Suppress the assertion of IFNET_LOCK in if_mcast_op if MROUTING
MROUTING doesn't deal with IFNET_LOCK yet.
Reported by kardel@

Revision 1.394.2.5 / (download) - annotate - [select for diffs], Sat Jan 13 05:41:38 2018 UTC (5 years ago) by snj
Branch: netbsd-8
Changes since 1.394.2.4: +6 -4 lines
Diff to previous 1.394.2.4 (colored) to branchpoint 1.394 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #486):
	sys/net/if.c: revision 1.418
Check MP-safety in ifa_insert and ifa_remove only for IFEF_MPSAFE drivers
Eventually the assertions should pass for all drivers, however, at this point
it's too eager.
Fix PR kern/52895

Revision 1.418 / (download) - annotate - [select for diffs], Wed Jan 10 01:22:26 2018 UTC (5 years ago) by ozaki-r
Branch: MAIN
Changes since 1.417: +6 -4 lines
Diff to previous 1.417 (colored)

Check MP-safety in ifa_insert and ifa_remove only for IFEF_MPSAFE drivers

Eventually the assertions should pass for all drivers, however, at this point
it's too eager.

Fix PR kern/52895

Revision 1.394.2.4 / (download) - annotate - [select for diffs], Tue Jan 2 10:20:33 2018 UTC (5 years, 1 month ago) by snj
Branch: netbsd-8
Changes since 1.394.2.3: +203 -71 lines
Diff to previous 1.394.2.3 (colored) to branchpoint 1.394 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #456):
	sys/arch/arm/sunxi/sunxi_emac.c: 1.9
	sys/dev/ic/dwc_gmac.c: 1.43-1.44
	sys/dev/pci/if_iwm.c: 1.75
	sys/dev/pci/if_wm.c: 1.543
	sys/dev/pci/ixgbe/ixgbe.c: 1.112
	sys/dev/pci/ixgbe/ixv.c: 1.74
	sys/kern/sys_socket.c: 1.75
	sys/net/agr/if_agr.c: 1.43
	sys/net/bpf.c: 1.219
	sys/net/if.c: 1.397, 1.399, 1.401-1.403, 1.406-1.410, 1.412-1.416
	sys/net/if.h: 1.242-1.247, 1.250, 1.252-1.257
	sys/net/if_bridge.c: 1.140 via patch, 1.142-1.146
	sys/net/if_etherip.c: 1.40
	sys/net/if_ethersubr.c: 1.243, 1.246
	sys/net/if_faith.c: 1.57
	sys/net/if_gif.c: 1.132
	sys/net/if_l2tp.c: 1.15, 1.17
	sys/net/if_loop.c: 1.98-1.101
	sys/net/if_media.c: 1.35
	sys/net/if_pppoe.c: 1.131-1.132
	sys/net/if_spppsubr.c: 1.176-1.177
	sys/net/if_tun.c: 1.142
	sys/net/if_vlan.c: 1.107, 1.109, 1.114-1.121
	sys/net/npf/npf_ifaddr.c: 1.3
	sys/net/npf/npf_os.c: 1.8-1.9
	sys/net/rtsock.c: 1.230
	sys/netcan/if_canloop.c: 1.3-1.5
	sys/netinet/if_arp.c: 1.255
	sys/netinet/igmp.c: 1.65
	sys/netinet/in.c: 1.210-1.211
	sys/netinet/in_pcb.c: 1.180
	sys/netinet/ip_carp.c: 1.92, 1.94
	sys/netinet/ip_flow.c: 1.81
	sys/netinet/ip_input.c: 1.362
	sys/netinet/ip_mroute.c: 1.147
	sys/netinet/ip_output.c: 1.283, 1.285, 1.287
	sys/netinet6/frag6.c: 1.61
	sys/netinet6/in6.c: 1.251, 1.255
	sys/netinet6/in6_pcb.c: 1.162
	sys/netinet6/ip6_flow.c: 1.35
	sys/netinet6/ip6_input.c: 1.183
	sys/netinet6/ip6_output.c: 1.196
	sys/netinet6/mld6.c: 1.90
	sys/netinet6/nd6.c: 1.239-1.240
	sys/netinet6/nd6_nbr.c: 1.139
	sys/netinet6/nd6_rtr.c: 1.136
	sys/netipsec/ipsec_output.c: 1.65
	sys/rump/net/lib/libnetinet/netinet_component.c: 1.9-1.10
kmem_intr_free kmem_intr_[z]alloced memory
the underlying pools are the same but api-wise those should match
Unify IFEF_*_MPSAFE into IFEF_MPSAFE
There are already two flags for if_output and if_start, however, it seems such
MPSAFE flags are eventually needed for all if_XXX operations. Having discrete
flags for each operation is wasteful of if_extflags bits. So let's unify
the flags into one: IFEF_MPSAFE.
Fortunately IFEF_*_MPSAFE flags have never been included in any releases, so
we can change them without breaking backward compatibility of the releases
(though the kernel version of -current should be bumped).
Note that if an interface have both MP-safe and non-MP-safe operations at a
time, we have to set the IFEF_MPSAFE flag and let callees of non-MP-safe
opeartions take the kernel lock.
Proposed on tech-kern@ and tech-net@
Provide macros for softnet_lock and KERNEL_LOCK hiding NET_MPSAFE switch
It reduces C&P codes such as "#ifndef NET_MPSAFE KERNEL_LOCK(1, NULL); ..."
scattered all over the source code and makes it easy to identify remaining
KERNEL_LOCK and/or softnet_lock that are held even if NET_MPSAFE.
No functional change
Hold KERNEL_LOCK on if_ioctl selectively based on IFEF_MPSAFE
If IFEF_MPSAFE is set, hold the lock and otherwise don't hold.
This change requires additions of KERNEL_LOCK to subsequence functions from
if_ioctl such as ifmedia_ioctl and ifioctl_common to protect non-MP-safe
components.
Proposed on tech-kern@ and tech-net@
Ensure to hold if_ioctl_lock when calling if_flags_set
Fix locking against myself on ifpromisc
vlan_unconfig_locked could be called with holding if_ioctl_lock.
Ensure to not turn on IFF_RUNNING of an interface until its initialization completes
And ensure to turn off it before destruction as per IFF_RUNNING's description
"resource allocated". (The description is a bit doubtful though, I believe the
change is still proper.)
Ensure to hold if_ioctl_lock on if_up and if_down
One exception for if_down is if_detach; in the case the lock isn't needed
because it's guaranteed that no other one can access ifp at that point.
Make if_link_queue MP-safe if IFEF_MPSAFE
if_link_queue is a queue to store events of link state changes, which is
used to pass events from (typically) an interrupt handler to
if_link_state_change softint. The queue was protected by KERNEL_LOCK so far,
but if IFEF_MPSAFE is enabled, it becomes unsafe because (perhaps) an interrupt
handler of an interface with IFEF_MPSAFE doesn't take KERNEL_LOCK. Protect it
by a spin mutex.
Additionally with this change KERNEL_LOCK of if_link_state_change softint is
omitted if NET_MPSAFE is enabled.
Note that the spin mutex is now ifp->if_snd.ifq_lock as well as the case of
if_timer (see the comment).
Use IFADDR_WRITER_FOREACH instead of IFADDR_READER_FOREACH
At that point no other one modifies the list so IFADDR_READER_FOREACH
is unnecessary. Use of IFADDR_READER_FOREACH is harmless in general though,
if we try to detect contract violations of pserialize, using it violates
the contract. So avoid using it makes life easy.
Ensure to call if_addr_init with holding if_ioctl_lock
Get rid of outdated comments
Fix build of kernels without ether
By throwing out if_enable_vlan_mtu and if_disable_vlan_mtu that
created a unnecessary dependency from if.c to if_ethersubr.c.
PR kern/52790
Rename IFNET_LOCK to IFNET_GLOBAL_LOCK
IFNET_LOCK will be used in another lock, if_ioctl_lock (might be renamed then).
Wrap if_ioctl_lock with IFNET_* macros (NFC)
Also if_ioctl_lock perhaps needs to be renamed to something because it's now
not just for ioctl...
Reorder some destruction routines in if_detach
- Destroy if_ioctl_lock at the end of the if_detach because it's used in various
  destruction routines
- Move psref_target_destroy after pr_purgeif because we want to use psref in
  pr_purgeif (otherwise destruction procedures can be tricky)
Ensure to call if_mcast_op with holding IFNET_LOCK
Note that CARP doesn't deal with IFNET_LOCK yet.
Remove IFNET_GLOBAL_LOCK where it's unnecessary because IFNET_LOCK is held
Describe which lock is used to protect each member variable of struct ifnet
Requested by skrll@
Write a guideline for converting an interface to IFEF_MPSAFE
Requested by skrll@
Note that IFNET_LOCK must not be held in softint
Don't set IFEF_MPSAFE unless NET_MPSAFE at this point
Because recent investigations show that interfaces with IFEF_MPSAFE need to
follow additional restrictions to work with the flag safely. We should enable it
on an interface by default only if the interface surely satisfies the
restrictions, which are described in if.h.
Note that enabling IFEF_MPSAFE solely gains a few benefit on performance because
the network stack is still serialized by the big kernel locks by default.

Revision 1.417 / (download) - annotate - [select for diffs], Tue Dec 26 02:01:35 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.416: +5 -5 lines
Diff to previous 1.416 (colored)

Suppress the assertion of IFNET_LOCK in if_mcast_op if MROUTING

MROUTING doesn't deal with IFNET_LOCK yet.

Reported by kardel@

Revision 1.416 / (download) - annotate - [select for diffs], Fri Dec 15 04:04:58 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.415: +18 -6 lines
Diff to previous 1.415 (colored)

Remove IFNET_GLOBAL_LOCK where it's unnecessary because IFNET_LOCK is held

Revision 1.415 / (download) - annotate - [select for diffs], Fri Dec 15 04:03:46 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.414: +22 -3 lines
Diff to previous 1.414 (colored)

Ensure to call if_mcast_op with holding IFNET_LOCK

Note that CARP doesn't deal with IFNET_LOCK yet.

Revision 1.414 / (download) - annotate - [select for diffs], Thu Dec 14 05:46:54 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.413: +16 -17 lines
Diff to previous 1.413 (colored)

Reorder some destruction routines in if_detach

- Destroy if_ioctl_lock at the end of the if_detach because it's used in various
  destruction routines
- Move psref_target_destroy after pr_purgeif because we want to use psref in
  pr_purgeif (otherwise destruction procedures can be tricky)

Revision 1.413 / (download) - annotate - [select for diffs], Mon Dec 11 03:29:20 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.412: +19 -19 lines
Diff to previous 1.412 (colored)

Wrap if_ioctl_lock with IFNET_* macros (NFC)

Also if_ioctl_lock perhaps needs to be renamed to something because it's now
not just for ioctl...

Revision 1.412 / (download) - annotate - [select for diffs], Mon Dec 11 03:25:45 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.411: +12 -12 lines
Diff to previous 1.411 (colored)

Rename IFNET_LOCK to IFNET_GLOBAL_LOCK

IFNET_LOCK will be used in another lock, if_ioctl_lock (might be renamed then).

Revision 1.394.2.3 / (download) - annotate - [select for diffs], Sun Dec 10 10:10:24 2017 UTC (5 years, 1 month ago) by snj
Branch: netbsd-8
Changes since 1.394.2.2: +29 -7 lines
Diff to previous 1.394.2.2 (colored) to branchpoint 1.394 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #427):
	sys/arch/amiga/dev/if_bah_zbus.c: 1.17
	sys/arch/arm/broadcom/bcm53xx_eth.c: 1.30
	sys/arch/powerpc/booke/dev/pq3etsec.c: 1.32
	sys/arch/usermode/dev/if_veth.c: 1.9
	sys/dev/ic/an.c: 1.66
	sys/dev/ic/athn.c: 1.17
	sys/dev/ic/atw.c: 1.162
	sys/dev/ic/bwi.c: 1.33
	sys/dev/ic/dwc_gmac.c: 1.41-1.42
	sys/dev/ic/malo.c: 1.10
	sys/dev/ic/rt2560.c: 1.31
	sys/dev/ic/rt2661.c: 1.36
	sys/dev/ic/rt2860.c: 1.29
	sys/dev/ic/rtw.c: 1.127
	sys/dev/ic/rtwvar.h: 1.46
	sys/dev/ic/smc90cx6.c: 1.71
	sys/dev/ic/smc90cx6var.h: 1.12
	sys/dev/ic/wi.c: 1.244
	sys/dev/pci/if_ipw.c: 1.66
	sys/dev/pci/if_iwi.c: 1.104
	sys/dev/pci/if_iwm.c: 1.76
	sys/dev/pci/if_iwn.c: 1.86
	sys/dev/pci/if_rtwn.c: 1.13
	sys/dev/pci/if_wm.c: 1.541
	sys/dev/pci/if_wpi.c: 1.79
	sys/dev/pci/ixgbe/ixgbe.c: 1.106
	sys/dev/pci/ixgbe/ixv.c: 1.73 via patch
	sys/dev/pcmcia/if_malo_pcmcia.c: 1.15
	sys/dev/scsipi/if_se.c: 1.95
	sys/dev/usb/if_upl.c: 1.60
	sys/net/if.c: 1.396
	sys/net/if.h: 1.241
	sys/net/if_arc.h: 1.23
	sys/net/if_arcsubr.c: 1.78
	sys/net/if_bridge.c: 1.136-1.137
	sys/net/if_etherip.c: 1.39
	sys/net/if_faith.c: 1.56
	sys/net/if_gif.c: 1.131
	sys/net/if_loop.c: 1.96
	sys/net/if_mpls.c: 1.30
	sys/net/if_pppoe.c: 1.129
	sys/net/if_srt.c: 1.27
	sys/net/if_stf.c: 1.102
	sys/net/if_tap.c: 1.100
	sys/net/if_vlan.c: 1.105
	sys/netinet/ip_carp.c: 1.91
	sys/rump/net/lib/libshmif/if_shmem.c: 1.73-1.74
	sys/rump/net/lib/libvirtif/if_virt.c: 1.55-1.56
 if_initalize() and if_attach() failed when resource allocation failed
(e.g. allocating softint). Without this change, it panics. It's bad because
resource shortage really occured when a lot of pseudo interface is created.
To avoid this problem, don't panic and change return value of if_initialize()
and if_attach() to int. Caller fanction will be recover from error cleanly by
checking the return value.
 Return if bah_attach_subr() failed.
 If if_attach() failed in the attach function, return.
- If if_initialize() failed in the attach function, free resources and return.
- Add some missing frees in bridge_clone_destroy().
- KNF
 If error occured in bcmeth_ccb_attach(), free resources and return.
 If error occured in pq3etsec_attach(), free resources and return.
 If error occured in the attach function, free resources and return.
- If if_initialize() failed in athn_attach(), free resources and return.
- Add missing pmf_event_deregister() in athn_detach().
- Free resources correctly on some errors in atw_attach().
- Use apint*() insread of printf() in the attach function.
 If if_initialize() failed in the attach function, return.
- If if_initialize() failed in the attach function, free resources and return.
- Add missing dwc_gmac_free_dma_rings() and mutex_destroy() when attach
   failed.
- If if_initialize() failed in the attach function, free resources and return.
- ifp is always not NULL in iwi_detach(). Check correctly with ifp->if_softc.
- If if_initialize() failed in the attach function, free resources and return.
- Fix error path in the attach function correctly.
 If if_initialize() failed in the attach function, free resources and return.
 If if_attach() failed in the attach function, free resources and return.
 - If if_initialize() failed in the attach function, free resources and return.
 - KNF
 - If if_attach() failed in the attach function, free resources and return.
 - KNF
 Fix compile error.
 Fix compile error.
We don't need '&mii', but just 'mii' for mii_detach().
Don't free sc_rthash twice

Revision 1.411 / (download) - annotate - [select for diffs], Fri Dec 8 05:22:23 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.410: +5 -38 lines
Diff to previous 1.410 (colored)

Revert "Make if_timer MP-safe if IFEF_MPSAFE"

Because it has decreased the performance of wm. And also I found that
wm_watchdog doesn't work well with if_watchdog framework at all. Sharing one
counter (if_timer) with multiple instances (hardware multi-queues) can't detect
a single (or some) stall of them because other instances reset the counter even
if the stalled one want the watchdog to fire.

Interfaces without IFEF_MPSAFE works safely with the original if_watchdog thanks
to KENREL_LOCK. OTOH, interfaces with IFEF_MPSAFE shouldn't use if_watchdog and
should implement their own watchdog timer that works with multiple instances.

Revision 1.410 / (download) - annotate - [select for diffs], Fri Dec 8 04:03:51 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.409: +2 -26 lines
Diff to previous 1.409 (colored)

Fix build of kernels without ether

By throwing out if_enable_vlan_mtu and if_disable_vlan_mtu that
created a unnecessary dependency from if.c to if_ethersubr.c.

PR kern/52790

Revision 1.409 / (download) - annotate - [select for diffs], Thu Dec 7 10:05:42 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.408: +2 -4 lines
Diff to previous 1.408 (colored)

Get rid of outdated comments

Revision 1.408 / (download) - annotate - [select for diffs], Thu Dec 7 03:16:24 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.407: +3 -2 lines
Diff to previous 1.407 (colored)

Ensure to call if_addr_init with holding if_ioctl_lock

Revision 1.407 / (download) - annotate - [select for diffs], Thu Dec 7 01:23:53 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.406: +6 -4 lines
Diff to previous 1.406 (colored)

Use IFADDR_WRITER_FOREACH instead of IFADDR_READER_FOREACH

At that point no other one modifies the list so IFADDR_READER_FOREACH
is unnecessary. Use of IFADDR_READER_FOREACH is harmless in general though,
if we try to detect contract violations of pserialize, using it violates
the contract. So avoid using it makes life easy.

Revision 1.406 / (download) - annotate - [select for diffs], Wed Dec 6 09:54:47 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.405: +45 -13 lines
Diff to previous 1.405 (colored)

Make if_link_queue MP-safe if IFEF_MPSAFE

if_link_queue is a queue to store events of link state changes, which is
used to pass events from (typically) an interrupt handler to
if_link_state_change softint. The queue was protected by KERNEL_LOCK so far,
but if IFEF_MPSAFE is enabled, it becomes unsafe because (perhaps) an interrupt
handler of an interface with IFEF_MPSAFE doesn't take KERNEL_LOCK. Protect it
by a spin mutex.

Additionally with this change KERNEL_LOCK of if_link_state_change softint is
omitted if NET_MPSAFE is enabled.

Note that the spin mutex is now ifp->if_snd.ifq_lock as well as the case of
if_timer (see the comment).

Revision 1.405 / (download) - annotate - [select for diffs], Wed Dec 6 09:03:12 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.404: +38 -5 lines
Diff to previous 1.404 (colored)

Make if_timer MP-safe if IFEF_MPSAFE

if_timer, a counter used by if_watchdog (if_slowtimo), can be modified in
if_watchdog and if_start and/or interrupt handlers of some device drivers. All
such accesses were serialized by KERNEL_LOCK. If IFEF_MPSAFE is enabled,
KERNEL_LOCK of if_start (and perhaps interrupt handlers) is omitted and if_timer
becomes racy.

Fix the race condition by protecting if_timer by a spin mutex. if_watchdog_reset
and if_watchdog_stop are introduced to ensure to take the mutex on accessing
if_timer. Interface with IFEF_MPSAFE enabled must use the functions.

In addition, if_watchdog callout is now set CALLOUT_MPSAFE if IFEF_MPSAFE. It
means that if_watchdog implemented by a driver must be MP-safe if the driver is
set IFEF_MPSAFE.

Currenlty interfaces with IFEF_MPSAFE implementing if_watchdog and accessing
if_timer in if_start and interrupt handlers are only wm(4). wm is changed to
use the functions. (Its watchdog handler (wm_watchdog) is already MP-safe.

These contracts will be written somewhere in a further commit.

Note that the spin mutex is now ifp->if_snd.ifq_lock to avoid adding another
spin mutex to each interface. For now reusing it isn't problematic (see the
comment to know why) thought if that does matter in the future, feel free to
replace it with a new spin mutex. It's easy to do.

Revision 1.404 / (download) - annotate - [select for diffs], Wed Dec 6 08:23:17 2017 UTC (5 years, 1 month ago) by knakahara
Branch: MAIN
Changes since 1.403: +39 -2 lines
Diff to previous 1.403 (colored)

unify processing to check nesting count for some tunnel protocols.

Revision 1.403 / (download) - annotate - [select for diffs], Wed Dec 6 08:12:54 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.402: +58 -15 lines
Diff to previous 1.402 (colored)

Ensure to hold if_ioctl_lock on if_up and if_down

One exception for if_down is if_detach; in the case the lock isn't needed
because it's guaranteed that no other one can access ifp at that point.

Revision 1.402 / (download) - annotate - [select for diffs], Wed Dec 6 05:59:59 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.401: +16 -5 lines
Diff to previous 1.401 (colored)

Fix locking against myself on ifpromisc

vlan_unconfig_locked could be called with holding if_ioctl_lock.

Revision 1.401 / (download) - annotate - [select for diffs], Wed Dec 6 05:11:10 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.400: +39 -8 lines
Diff to previous 1.400 (colored)

Ensure to hold if_ioctl_lock when calling if_flags_set

Revision 1.260.6.4 / (download) - annotate - [select for diffs], Sun Dec 3 11:39:02 2017 UTC (5 years, 2 months ago) by jdolecek
Branch: tls-maxphys
Changes since 1.260.6.3: +1604 -426 lines
Diff to previous 1.260.6.3 (colored) to branchpoint 1.260 (colored) next main 1.261 (colored)

update from HEAD

Revision 1.394.2.2 / (download) - annotate - [select for diffs], Thu Nov 30 15:57:37 2017 UTC (5 years, 2 months ago) by martin
Branch: netbsd-8
Changes since 1.394.2.1: +9 -3 lines
Diff to previous 1.394.2.1 (colored) to branchpoint 1.394 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #407):
	sys/compat/linux32/common/linux32_socket.c: revision 1.28
	sys/net/if.c: revision 1.400
	sys/netipsec/key.c: revision 1.243
	sys/compat/linux/common/linux_socket.c: revision 1.139
	sys/netinet/ip_carp.c: revision 1.93
	sys/netinet6/in6.c: revision 1.252
	sys/netinet6/in6.c: revision 1.253
	sys/netinet6/in6.c: revision 1.254
	sys/net/if_spppsubr.c: revision 1.173
	sys/net/if_spppsubr.c: revision 1.174
	sys/compat/common/uipc_syscalls_40.c: revision 1.14
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref
Fix usage of FOREACH macro
key_sad.lock is held there so SAVLIST_WRITER_FOREACH is enough.
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref (more)
Fix and make consistent of usages of psz/psref in ifconf variants
Remove unnecessary goto because there is no cleanup code to share (NFC)
Tweak a condition; we don't need to care ifacount to be negative
Fix a race condition of in6_ifinit
in6_ifinit checks the number of IPv6 addresses on a given interface and
if it's zero (i.e., an IPv6 address being assigned to the interface
is the first one), call if_addr_init. However, the actual assignment of
the address (ifa_insert) is out of in6_ifinit. The check and the
assignment must be done atomically.
Fix it by holding in6_ifaddr_lock during in6_ifinit and ifa_insert.
And also add missing pserialize to IFADDR_READER_FOREACH.

Revision 1.400 / (download) - annotate - [select for diffs], Wed Nov 22 10:19:14 2017 UTC (5 years, 2 months ago) by ozaki-r
Branch: MAIN
CVS Tags: tls-maxphys-base-20171202
Changes since 1.399: +9 -3 lines
Diff to previous 1.399 (colored)

Fix and make consistent of usages of psz/psref in ifconf variants

Revision 1.399 / (download) - annotate - [select for diffs], Wed Nov 22 03:03:18 2017 UTC (5 years, 2 months ago) by ozaki-r
Branch: MAIN
Changes since 1.398: +16 -2 lines
Diff to previous 1.398 (colored)

Hold KERNEL_LOCK on if_ioctl selectively based on IFEF_MPSAFE

If IFEF_MPSAFE is set, hold the lock and otherwise don't hold.

This change requires additions of KERNEL_LOCK to subsequence functions from
if_ioctl such as ifmedia_ioctl and ifioctl_common to protect non-MP-safe
components.

Proposed on tech-kern@ and tech-net@

Revision 1.398 / (download) - annotate - [select for diffs], Sun Nov 19 16:59:25 2017 UTC (5 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.397: +4 -3 lines
Diff to previous 1.397 (colored)

remove useless cast, initialize family.

Revision 1.397 / (download) - annotate - [select for diffs], Fri Nov 17 07:37:12 2017 UTC (5 years, 2 months ago) by ozaki-r
Branch: MAIN
Changes since 1.396: +4 -10 lines
Diff to previous 1.396 (colored)

Provide macros for softnet_lock and KERNEL_LOCK hiding NET_MPSAFE switch

It reduces C&P codes such as "#ifndef NET_MPSAFE KERNEL_LOCK(1, NULL); ..."
scattered all over the source code and makes it easy to identify remaining
KERNEL_LOCK and/or softnet_lock that are held even if NET_MPSAFE.

No functional change

Revision 1.396 / (download) - annotate - [select for diffs], Mon Oct 23 09:21:20 2017 UTC (5 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.395: +29 -7 lines
Diff to previous 1.395 (colored)

 if_initalize() and if_attach() failed when resource allocation failed
(e.g. allocating softint). Without this change, it panics. It's bad because
resource shortage really occured when a lot of pseudo interface is created.
To avoid this problem, don't panic and change return value of if_initialize()
and if_attach() to int. Caller fanction will be recover from error cleanly by
checking the return value.

Revision 1.300.2.12 / (download) - annotate - [select for diffs], Mon Aug 28 17:53:11 2017 UTC (5 years, 5 months ago) by skrll
Branch: nick-nhusb
Changes since 1.300.2.11: +99 -70 lines
Diff to previous 1.300.2.11 (colored) to branchpoint 1.300 (colored) next main 1.301 (colored)

Sync with HEAD

Revision 1.394.2.1 / (download) - annotate - [select for diffs], Sat Jul 1 08:56:06 2017 UTC (5 years, 7 months ago) by snj
Branch: netbsd-8
CVS Tags: matt-nb8-mediatek-base, matt-nb8-mediatek
Changes since 1.394: +27 -4 lines
Diff to previous 1.394 (colored)

Pull up following revision(s) (requested by roy in ticket #77):
	sys/net/if.h: revision 1.240
	sys/netinet/if_arp.c: revision 1.253
	sys/net/if.c: revision 1.395
Introduce if_get_bylla to find an interface with the active
local link address.
--
Use if_get_bylla() instead of just looking at the lla of the interface
the address belongs to.
This allows any ARP message we receieved from another interface to
be correctly dropped.
While here, move the protocol length check higher up the food chain.

Revision 1.395 / (download) - annotate - [select for diffs], Tue Jun 27 12:17:27 2017 UTC (5 years, 7 months ago) by roy
Branch: MAIN
CVS Tags: perseant-stdc-iso10646-base, perseant-stdc-iso10646, nick-nhusb-base-20170825
Changes since 1.394: +27 -4 lines
Diff to previous 1.394 (colored)

Introduce if_get_bylla to find an interface with the active
local link address.

Revision 1.394 / (download) - annotate - [select for diffs], Thu Jun 1 02:45:14 2017 UTC (5 years, 8 months ago) by chs
Branch: MAIN
CVS Tags: netbsd-8-base
Branch point for: netbsd-8
Changes since 1.393: +2 -11 lines
Diff to previous 1.393 (colored)

remove checks for failure after memory allocation calls that cannot fail:

  kmem_alloc() with KM_SLEEP
  kmem_zalloc() with KM_SLEEP
  percpu_alloc()
  pserialize_create()
  psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.

Revision 1.393 / (download) - annotate - [select for diffs], Fri May 19 08:53:51 2017 UTC (5 years, 8 months ago) by ozaki-r
Branch: MAIN
Changes since 1.392: +12 -7 lines
Diff to previous 1.392 (colored)

Allow CARP to call the link_state_change handler immediately

If the handler is delayed because of the indirection call via softint,
some operations are executed in reverse and may cause unexpected
behaviors. For example, due to the issue a GARP packet wasn't sent on
a transition from the BACKUP state to the MASTER state; this happened
because IN_IFF_DETACHED flag wasn't cleared on arpannounce, which
had been cleared in the link_state_change handler.

This fixes an issue reported by sborrill@ on tech-net:
  http://mail-index.netbsd.org/tech-net/2017/03/14/msg006283.html

Revision 1.354.2.6 / (download) - annotate - [select for diffs], Wed Apr 26 02:53:29 2017 UTC (5 years, 9 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.354.2.5: +7 -7 lines
Diff to previous 1.354.2.5 (colored) to branchpoint 1.354 (colored) next main 1.355 (colored)

Sync with HEAD

Revision 1.371.2.1 / (download) - annotate - [select for diffs], Fri Apr 21 16:54:05 2017 UTC (5 years, 9 months ago) by bouyer
Branch: bouyer-socketcan
Changes since 1.371: +97 -66 lines
Diff to previous 1.371 (colored) next main 1.372 (colored)

Sync with HEAD

Revision 1.392 / (download) - annotate - [select for diffs], Thu Apr 6 09:20:07 2017 UTC (5 years, 9 months ago) by ozaki-r
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-20170426, jdolecek-ncq-base, jdolecek-ncq, bouyer-socketcan-base1
Changes since 1.391: +3 -5 lines
Diff to previous 1.391 (colored)

Prepare netipsec for rump-ification

- Include "opt_*.h" only if _KERNEL_OPT is defined
- Allow encapinit to be called twice (by ifinit and ipe4_attach)
  - ifinit didn't call encapinit if IPSEC is enabled (ipe4_attach called
    it instead), however, on a rump kernel ipe4_attach may not be called
    even if IPSEC is enabled. So we need to allow ifinit to call it anyway
- Setup sysctls in ipsec_attach explicitly instead of using SYSCTL_SETUP
- Call ip6flow_invalidate_all in key_spdadd only if in6_present
  - It's possible that a rump kernel loads the ipsec library but not
    the inet6 library

Revision 1.391 / (download) - annotate - [select for diffs], Thu Apr 6 03:54:59 2017 UTC (5 years, 9 months ago) by ozaki-r
Branch: MAIN
Changes since 1.390: +9 -62 lines
Diff to previous 1.390 (colored)

Revert "Make sure to hold if_ioctl_lock when calling ifp->if_ioctl"

As per pgoyette@ and riastradh@ requests; we shouldn't decide to
hold a lock based on if the lock is held or not.

Revision 1.390 / (download) - annotate - [select for diffs], Wed Apr 5 03:47:51 2017 UTC (5 years, 10 months ago) by ozaki-r
Branch: MAIN
Changes since 1.389: +62 -9 lines
Diff to previous 1.389 (colored)

Make sure to hold if_ioctl_lock when calling ifp->if_ioctl

Unfortunately callers of ifp->if_ioctl (if_addr_init, if_flags_set
and if_mcast_op) may or may not hold if_ioctl_lock, so we have to
hold the lock only if it's not held.

Revision 1.389 / (download) - annotate - [select for diffs], Tue Mar 28 08:47:19 2017 UTC (5 years, 10 months ago) by ozaki-r
Branch: MAIN
Changes since 1.388: +6 -4 lines
Diff to previous 1.388 (colored)

Avoid touching a mbuf after enqueuing it

Revision 1.388 / (download) - annotate - [select for diffs], Fri Mar 24 11:15:25 2017 UTC (5 years, 10 months ago) by ozaki-r
Branch: MAIN
Changes since 1.387: +3 -3 lines
Diff to previous 1.387 (colored)

Remove extra semicolon

Revision 1.354.2.5 / (download) - annotate - [select for diffs], Mon Mar 20 06:57:49 2017 UTC (5 years, 10 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.354.2.4: +114 -69 lines
Diff to previous 1.354.2.4 (colored) to branchpoint 1.354 (colored)

Sync with HEAD

Revision 1.387 / (download) - annotate - [select for diffs], Thu Mar 16 09:40:48 2017 UTC (5 years, 10 months ago) by ozaki-r
Branch: MAIN
CVS Tags: pgoyette-localcount-20170320
Changes since 1.386: +8 -26 lines
Diff to previous 1.386 (colored)

Simplify ifunit, if_get and if_get_byindex by reusing other functions

Inspired by kre@'s comment

Revision 1.386 / (download) - annotate - [select for diffs], Thu Mar 16 08:11:47 2017 UTC (5 years, 10 months ago) by ozaki-r
Branch: MAIN
Changes since 1.385: +7 -3 lines
Diff to previous 1.385 (colored)

Fix panic on ifconfig <number>

Pointed out by s-yamaguchi@IIJ

Revision 1.385 / (download) - annotate - [select for diffs], Tue Mar 14 09:03:08 2017 UTC (5 years, 10 months ago) by ozaki-r
Branch: MAIN
Changes since 1.384: +3 -3 lines
Diff to previous 1.384 (colored)

Use if_acquire and if_release instead of using psref API directly

- Provide if_release for consistency to if_acquire
- Use if_acquire and if_release for ifp iterations
- Make ifnet_psref_class static

Revision 1.384 / (download) - annotate - [select for diffs], Tue Mar 14 04:25:10 2017 UTC (5 years, 10 months ago) by ozaki-r
Branch: MAIN
Changes since 1.383: +3 -7 lines
Diff to previous 1.383 (colored)

Replace DIAGNOSTIC + panic with KASSERT

Revision 1.383 / (download) - annotate - [select for diffs], Thu Mar 9 09:57:36 2017 UTC (5 years, 10 months ago) by knakahara
Branch: MAIN
Changes since 1.382: +5 -2 lines
Diff to previous 1.382 (colored)

ifp->if_transmit() must free mbuf even if error occurred.

Add missing m_freem(m) to if_nulltransmit().
Below ifp->if_transmit() implementations are already added m_freem(m) properly.
    - wm(4)
    - ixg(4)
    - ixv(4)
    - pppoe(4)
    - gif(4)
    - l2tp(4)

pointed out by ozaki-r@n.o, thanks.

Revision 1.382 / (download) - annotate - [select for diffs], Tue Mar 7 01:32:03 2017 UTC (5 years, 10 months ago) by ozaki-r
Branch: MAIN
Changes since 1.381: +5 -2 lines
Diff to previous 1.381 (colored)

Add missing splnet to if_deferred_start_common

if_start should run in splnet to avoid running interrupt handlers.

Revision 1.381 / (download) - annotate - [select for diffs], Thu Feb 23 07:57:10 2017 UTC (5 years, 11 months ago) by ozaki-r
Branch: MAIN
Changes since 1.380: +3 -2 lines
Diff to previous 1.380 (colored)

Remove mkludge stuffs

For unknown reasons, IPv6 multicast addresses are linked to a first
IPv6 address assigned to an interface. Due to the design, when removing
a first address having multicast addresses, we need to save them to
somewhere and later restore them once a new IPv6 address is activated.
mkludge stuffs support the operations.

This change links multicast addresses to an interface directly and
throws the kludge away.

Note that as usual some obsolete member variables remain for kvm(3)
users. And also sysctl net.inet6.multicast_kludge remains to avoid
breaking old ifmcstat.

TODO: currently ifnet has a list of in6_multi but obviously the list
should be protocol independent. Provide a common structure (if_multi
or something) to handle in6_multi and in_multi together as well as
ifaddr does for in_ifaddr and in6_ifaddr.

Revision 1.380 / (download) - annotate - [select for diffs], Fri Feb 17 03:57:17 2017 UTC (5 years, 11 months ago) by ozaki-r
Branch: MAIN
Changes since 1.379: +6 -6 lines
Diff to previous 1.379 (colored)

Rename if_acquire_NOMPSAFE to if_acquire

It can be used in MP-safe ways. So let's remove the confusing postfix.
If it's used in a unsafe way, warn NOMPSAFE in a comment.

Revision 1.379 / (download) - annotate - [select for diffs], Thu Feb 16 08:13:43 2017 UTC (5 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.378: +18 -3 lines
Diff to previous 1.378 (colored)

support interface name which includes digit.

Revision 1.378 / (download) - annotate - [select for diffs], Wed Feb 15 01:48:44 2017 UTC (5 years, 11 months ago) by ozaki-r
Branch: MAIN
Changes since 1.377: +22 -5 lines
Diff to previous 1.377 (colored)

Avoid if_dl and if_sadl to be NULL

Calling if_deactivate_sadl and then if_sadl_setrefs exposes NULL-ed if_dl
and if_sadl to users for a moment. It's harmful because users expect that
they're always non-NULL. Fix it.

Note that a race condition still remains; if_dl and if_sald aren't updated
atomically so a user can see different data from if_dl and if_sadl.
Fortunately none uses both if_dl and if_sadl at the same time, so the race
condition doesn't hurt nobody for now. (In the first place exposing one
data with two ways is problematic?)

Revision 1.377 / (download) - annotate - [select for diffs], Fri Feb 10 20:56:21 2017 UTC (5 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.376: +4 -3 lines
Diff to previous 1.376 (colored)

make attach and detach locking symmetric (detaching cloners failed)

Revision 1.376 / (download) - annotate - [select for diffs], Thu Feb 9 09:30:26 2017 UTC (5 years, 11 months ago) by ozaki-r
Branch: MAIN
Changes since 1.375: +2 -14 lines
Diff to previous 1.375 (colored)

Make bpf MP-safe

By the change, bpf_mtap can run without any locks as long as its bpf filter
doesn't match a target packet. Pushing data to a bpf buffer still needs
a lock. Removing the lock requires big changes and it's a future work.

Another known issue is that we need to remain some obsolete variables to
avoid breaking kvm(3) users such as netstat and fstat. One problem for
MP-ification is that in order to keep statistic counters of bpf_d we need
to use atomic operations for them. Once we retire the kvm(3) users, we
should make the counters per-CPU and remove the atomic operations.

Revision 1.300.2.11 / (download) - annotate - [select for diffs], Sun Feb 5 13:40:58 2017 UTC (5 years, 11 months ago) by skrll
Branch: nick-nhusb
Changes since 1.300.2.10: +192 -31 lines
Diff to previous 1.300.2.10 (colored) to branchpoint 1.300 (colored)

Sync with HEAD

Revision 1.375 / (download) - annotate - [select for diffs], Wed Jan 25 03:04:21 2017 UTC (6 years ago) by christos
Branch: MAIN
CVS Tags: nick-nhusb-base-20170204
Changes since 1.374: +9 -4 lines
Diff to previous 1.374 (colored)

fix locking against myself in module autoload; module autoload calls
if_clone_attach which takes the lock again.

Revision 1.374 / (download) - annotate - [select for diffs], Tue Jan 24 07:58:58 2017 UTC (6 years ago) by ozaki-r
Branch: MAIN
Changes since 1.373: +3 -3 lines
Diff to previous 1.373 (colored)

Restore splnet for if_slowtimo

if_slowtimo (== if_watchdog) still requires splnet for most drivers.

Pointed out by nonaka@

Revision 1.373 / (download) - annotate - [select for diffs], Mon Jan 23 10:19:03 2017 UTC (6 years ago) by ozaki-r
Branch: MAIN
Changes since 1.372: +10 -10 lines
Diff to previous 1.372 (colored)

Replace some splnet with splsoftnet

Revision 1.372 / (download) - annotate - [select for diffs], Fri Jan 20 08:35:33 2017 UTC (6 years ago) by ozaki-r
Branch: MAIN
Changes since 1.371: +23 -7 lines
Diff to previous 1.371 (colored)

Protect if_clone data with if_clone_mtx

To this end, carpattach needs to be delayed from RUMP_COMPONENT_NET to
RUMP_COMPONENT_NET_IF on rump_server. Otherwise mutex_enter via carpattach
for if_clone_mtx is called before mutex_init for it in ifinit1.

Revision 1.371 / (download) - annotate - [select for diffs], Tue Jan 10 08:45:45 2017 UTC (6 years ago) by ozaki-r
Branch: MAIN
CVS Tags: bouyer-socketcan-base
Branch point for: bouyer-socketcan
Changes since 1.370: +10 -2 lines
Diff to previous 1.370 (colored)

Add softnet_lock to if_link_state_change_si

Fix
  panic: lock error: Mutex: mutex_vector_exit: assertion failed:
  MUTEX_OWNER(mtx->mtx_owner) == curthread
at callout_halt <= arp_dad_stop <= in_if_link_down.

Revision 1.370 / (download) - annotate - [select for diffs], Tue Jan 10 05:42:34 2017 UTC (6 years ago) by ozaki-r
Branch: MAIN
Changes since 1.369: +16 -10 lines
Diff to previous 1.369 (colored)

Enable some sysctl knobs on rump kernels for ifmcstat

Revision 1.354.2.4 / (download) - annotate - [select for diffs], Sat Jan 7 08:56:50 2017 UTC (6 years ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.354.2.3: +169 -39 lines
Diff to previous 1.354.2.3 (colored) to branchpoint 1.354 (colored)

Sync with HEAD.  (Note that most of these changes are simply $NetBSD$
tag issues.)

Revision 1.369 / (download) - annotate - [select for diffs], Mon Dec 26 23:21:49 2016 UTC (6 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: pgoyette-localcount-20170107
Changes since 1.368: +5 -7 lines
Diff to previous 1.368 (colored)

pfil(9) improvements to handle address changes:

Add:
  PFIL_IFADDR     call on interface reconfig (mbuf is ioctl #)
  PFIL_IFNET      call on interface attach/detach (mbuf is PFIL_IFNET_*)

from rmind@

Revision 1.368 / (download) - annotate - [select for diffs], Thu Dec 15 09:28:06 2016 UTC (6 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.367: +23 -3 lines
Diff to previous 1.367 (colored)

Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

The benefits of the change are:
- We can reduce codes
- We can provide the same behavior between drivers
  - Where/When if_ipackets is counted up
  - Note that some drivers still update packet statistics in their own
    way (periodical update)
- Moved bpf_mtap run in softint
  - This makes it easy to MP-ify bpf

Proposed on tech-kern and tech-net

Revision 1.367 / (download) - annotate - [select for diffs], Tue Dec 13 02:05:48 2016 UTC (6 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.366: +3 -3 lines
Diff to previous 1.366 (colored)

Constify ifp of if_is_deactivated

Revision 1.366 / (download) - annotate - [select for diffs], Mon Dec 12 03:55:57 2016 UTC (6 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.365: +10 -2 lines
Diff to previous 1.365 (colored)

Make the routing table and rtcaches MP-safe

See the following descriptions for details.

Proposed on tech-kern and tech-net


Overview
--------

We protect the routing table with a rwock and protect
rtcaches with another rwlock. Each rtentry is protected
from being freed or updated via reference counting and psref.

Global rwlocks
--------------

There are two rwlocks; one for the routing table (rt_lock) and
the other for rtcaches (rtcache_lock). rtcache_lock covers
all existing rtcaches; there may have room for optimizations
(future work).

The locking order is rtcache_lock first and rt_lock is next.

rtentry references
------------------

References to an rtentry is managed with reference counting
and psref. Either of the two mechanisms is used depending on
where a rtentry is obtained. Reference counting is used when
we obtain a rtentry from the routing table directly via
rtalloc1 and rtrequest{,1} while psref is used when we obtain
a rtentry from a rtcache via rtcache_* APIs. In both cases,
a caller can sleep/block with holding an obtained rtentry.

The reasons why we use two different mechanisms are (i) only
using reference counting hurts the performance due to atomic
instructions (rtcache case) (ii) ease of implementation;
applying psref to APIs such rtaloc1 and rtrequest{,1} requires
additional works (adding a local variable and an argument).

We will finally migrate to use only psref but we can do it
when we have a lockless routing table alternative.

Reference counting for rtentry
------------------------------

rt_refcnt now doesn't count permanent references such as for
rt_timers and rtcaches, instead it is used only for temporal
references when obtaining a rtentry via rtalloc1 and rtrequest{,1}.
We can do so because destroying a rtentry always involves
removing references of rt_timers and rtcaches to the rtentry
and we don't need to track such references. This also makes
it easy to wait for readers to release references on deleting
or updating a rtentry, i.e., we can simply wait until the
reference counter is 0 or 1. (If there are permanent references
the counter can be arbitrary.)

rt_ref increments a reference counter of a rtentry and rt_unref
decrements it. rt_ref is called inside APIs (rtalloc1 and
rtrequest{,1} so users don't need to care about it while
users must call rt_unref to an obtained rtentry after using it.

rtfree is removed and we use rt_unref and rt_free instead.
rt_unref now just decrements the counter of a given rtentry
and rt_free just tries to destroy a given rtentry.

See the next section for destructions of rtentries by rt_free.

Destructions of rtentries
-------------------------

We destroy a rtentry only when we call rtrequst{,1}(RTM_DELETE);
the original implementation can destroy in any rtfree where it's
the last reference. If we use reference counting or psref, it's
easy to understand if the place that a rtentry is destroyed is
fixed.

rt_free waits for references to a given rtentry to be released
before actually destroying the rtentry. rt_free uses a condition
variable (cv_wait) (and psref_target_destroy for psref) to wait.

Unfortunately rtrequst{,1}(RTM_DELETE) can be called in softint
that we cannot use cv_wait. In that case, we have to defer the
destruction to a workqueue.

rtentry#rt_cv, rtentry#rt_psref and global variables
(see rt_free_global) are added to conduct the procedure.

Updates of rtentries
--------------------

One difficulty to use refcnt/psref instead of rwlock for rtentry
is updates of rtentries. We need an additional mechanism to
prevent readers from seeing inconsistency of a rtentry being
updated.

We introduce RTF_UPDATING flag to rtentries that are updating.
While the flag is set to a rtentry, users cannot acquire the
rtentry. By doing so, we avoid users to see inconsistent
rtentries.

There are two options when a user tries to acquire a rtentry
with the RTF_UPDATING flag; if a user runs in softint context
the user fails to acquire a rtentry (NULL is returned).
Otherwise a user waits until the update completes by waiting
on cv.

The procedure of a updater is simpler to destruction of
a rtentry. Wait on cv (and psref) and after all readers left,
proceed with the update.

Global variables (see rt_update_global) are added to conduct
the procedure.

Currently we apply the mechanism to only RTM_CHANGE in
rtsock.c. We would have to apply other codes. See
"Known issues" section.

psref for rtentry
-----------------

When we obtain a rtentry from a rtcache via rtcache_* APIs,
psref is used to reference to the rtentry.

rtcache_ref acquires a reference to a rtentry with psref
and rtcache_unref releases the reference after using it.
rtcache_ref is called inside rtcache_* APIs and users don't
need to take care of it while users must call rtcache_unref
to release the reference.

struct psref and int bound that is needed for psref is
embedded into struct route. By doing so we don't need to
add local variables and additional argument to APIs.

However this adds another constraint to psref other than
reference counting one's; holding a reference of an rtentry
via a rtcache is allowed by just one caller at the same time.
So we must not acquire a rtentry via a rtcache twice and
avoid a recursive use of a rtcache. And also a rtcache must
be arranged to be used by a LWP/softint at the same time
somehow. For IP forwarding case, we have per-CPU rtcaches
used in softint so the constraint is guaranteed. For a h
rtcache of a PCB case, the constraint is guaranteed by the
solock of each PCB. Any other cases (pf, ipf, stf and ipsec)
are currently guaranteed by only the existence of the global
locks (softnet_lock and/or KERNEL_LOCK). If we've found the
cases that we cannot guarantee the constraint, we would need
to introduce other rtcache APIs that use simple reference
counting.

psref of rtcache is created with IPL_SOFTNET and so rtcache
shouldn't used at an IPL higher than IPL_SOFTNET.

Note that rtcache_free is used to invalidate a given rtcache.
We don't need another care by my change; just keep them as
they are.

Performance impact
------------------

When NET_MPSAFE is disabled the performance drop is 3% while
when it's enabled the drop is increased to 11%. The difference
comes from that currently we don't take any global locks and
don't use psref if NET_MPSAFE is disabled.

We can optimize the performance of the case of NET_MPSAFE
on by reducing lookups of rtcache that uses psref;
currently we do two lookups but we should be able to trim
one of two. This is a future work.

Known issues
------------

There are two known issues to be solved; one is that
a caller of rtrequest(RTM_ADD) may change rtentry (see rtinit).
We need to prevent new references during the update. Or
we may be able to remove the code (perhaps, need more
investigations).

The other is rtredirect that updates a rtentry. We need
to apply our update mechanism, however it's not easy because
rtredirect is called in softint and we cannot apply our
mechanism simply. One solution is to defer rtredirect to
a workqueue but it requires some code restructuring.

Revision 1.365 / (download) - annotate - [select for diffs], Fri Dec 9 02:38:14 2016 UTC (6 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.364: +2 -7 lines
Diff to previous 1.364 (colored)

This spams 100's of times during boot!

Revision 1.364 / (download) - annotate - [select for diffs], Thu Dec 8 01:06:35 2016 UTC (6 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.363: +106 -2 lines
Diff to previous 1.363 (colored)

Introduce deferred if_start framework

The framework provides a means to schedule if_start that will be executed
in softint later. It intends to be used to avoid calling if_start,
especially bpf_mtap, in hardware interrupt.

It adds a dedicated softint to a driver if the driver requests to use the
framework via if_deferred_start_init. The driver can schedule deferred
if_start by if_schedule_deferred_start.

Proposed and discussed on tech-kern and tech-net

Revision 1.363 / (download) - annotate - [select for diffs], Tue Dec 6 01:23:01 2016 UTC (6 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.362: +3 -2 lines
Diff to previous 1.362 (colored)

Fix memory leak of struct if_percpuq on interface destruction

Revision 1.300.2.10 / (download) - annotate - [select for diffs], Mon Dec 5 10:55:27 2016 UTC (6 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.300.2.9: +39 -35 lines
Diff to previous 1.300.2.9 (colored) to branchpoint 1.300 (colored)

Sync with HEAD

Revision 1.362 / (download) - annotate - [select for diffs], Tue Nov 15 01:50:06 2016 UTC (6 years, 2 months ago) by ozaki-r
Branch: MAIN
CVS Tags: nick-nhusb-base-20161204
Changes since 1.361: +10 -26 lines
Diff to previous 1.361 (colored)

Don't use rt_walktree to delete routes

Some functions use rt_walktree to scan the routing table and delete
matched routes. However, we shouldn't use rt_walktree to delete
routes because rt_walktree is recursive to the routing table (radix
tree) and isn't friendly to MP-ification. rt_walktree allows a caller
to pass a callback function to delete an matched entry. The callback
function is called from an API of the radix tree (rn_walktree) but
also calls an API of the radix tree to delete an entry.

This change adds a new API of the radix tree, rn_search_matched,
which returns a matched entry that is selected by a callback
function passed by a caller and the caller itself deletes the
entry. By using the API, we can avoid the recursive form.

Revision 1.361 / (download) - annotate - [select for diffs], Sat Nov 5 23:30:22 2016 UTC (6 years, 2 months ago) by pgoyette
Branch: MAIN
Changes since 1.360: +28 -8 lines
Diff to previous 1.360 (colored)

Move if_43.c back into the shared Makefile.sysio where it really
belongs.

Update the code to invoke the two routines compat_cvtcmd() and
compat_ifioctl() through indirect pointers.  Initialize those
pointers in sys/net/if.c and update them in the compat module's
initialization code.

Addresses the issue pointed out in PR kern/51598

Revision 1.354.2.3 / (download) - annotate - [select for diffs], Fri Nov 4 14:49:20 2016 UTC (6 years, 3 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.354.2.2: +6 -6 lines
Diff to previous 1.354.2.2 (colored) to branchpoint 1.354 (colored)

Sync with HEAD

Revision 1.360 / (download) - annotate - [select for diffs], Fri Oct 28 05:52:05 2016 UTC (6 years, 3 months ago) by ozaki-r
Branch: MAIN
CVS Tags: pgoyette-localcount-20161104
Changes since 1.359: +3 -3 lines
Diff to previous 1.359 (colored)

Fix the position of IFADDR_ENTRY_DESTROY

It must be called after all readers left, i.e, after pserialize_perform.

Revision 1.359 / (download) - annotate - [select for diffs], Tue Oct 18 07:30:30 2016 UTC (6 years, 3 months ago) by ozaki-r
Branch: MAIN
Changes since 1.358: +4 -4 lines
Diff to previous 1.358 (colored)

Don't hold global locks if NET_MPSAFE is enabled

If NET_MPSAFE is enabled, don't hold KERNEL_LOCK and softnet_lock in
part of the network stack such as IP forwarding paths. The aim of the
change is to make it easy to test the network stack without the locks
and reduce our local diffs.

By default (i.e., if NET_MPSAFE isn't enabled), the locks are held
as they used to be.

Reviewed by knakahara@

Revision 1.300.2.9 / (download) - annotate - [select for diffs], Wed Oct 5 20:56:08 2016 UTC (6 years, 3 months ago) by skrll
Branch: nick-nhusb
Changes since 1.300.2.8: +208 -49 lines
Diff to previous 1.300.2.8 (colored) to branchpoint 1.300 (colored)

Sync with HEAD

Revision 1.358 / (download) - annotate - [select for diffs], Mon Oct 3 11:06:06 2016 UTC (6 years, 4 months ago) by ozaki-r
Branch: MAIN
CVS Tags: nick-nhusb-base-20161004
Changes since 1.357: +3 -3 lines
Diff to previous 1.357 (colored)

Fix race condition on ifqueue used by traditional netisr

If a underlying network device driver supports MSI/MSI-X, RX interrupts
can be delivered to arbitrary CPUs. This means that Layer 2 subroutines
such as ether_input (softint) and subsequent Layer 3 subroutines (softint)
which are called via traditional netisr can be dispatched on an arbitrary
CPU. Layer 2 subroutines now run without any locks (expected) and so a
Layer 2 subroutine and a Layer 3 subroutine can run in parallel.

There is a shared data between a Layer 2 routine and a Layer 3 routine,
that is ifqueue and IF_ENQUEUE (from L2) and IF_DEQUEUE (from L3) on it
are racy now.

To fix the race condition, use ifqueue#ifq_lock to protect ifqueue
instead of splnet that is meaningless now.

The same race condition exists in route_intr. Fix it as well.

Reviewed by knakahara@

Revision 1.354.2.2 / (download) - annotate - [select for diffs], Sat Aug 6 00:19:10 2016 UTC (6 years, 5 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.354.2.1: +206 -32 lines
Diff to previous 1.354.2.1 (colored) to branchpoint 1.354 (colored)

Sync with HEAD

Revision 1.357 / (download) - annotate - [select for diffs], Mon Aug 1 03:15:30 2016 UTC (6 years, 6 months ago) by ozaki-r
Branch: MAIN
CVS Tags: pgoyette-localcount-20160806, localcount-20160914
Changes since 1.356: +206 -32 lines
Diff to previous 1.356 (colored)

Apply pserialize and psref to struct ifaddr and its variants

This change makes struct ifaddr and its variants (in_ifaddr and in6_ifaddr)
MP-safe by using pserialize and psref. At this moment, pserialize_perform
and psref_target_destroy are disabled because (1) we don't need them
because of softnet_lock (2) they cause a deadlock because of softnet_lock.
So we'll enable them when we remove softnet_lock in the future.

Revision 1.354.2.1 / (download) - annotate - [select for diffs], Tue Jul 26 03:24:23 2016 UTC (6 years, 6 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.354: +3 -18 lines
Diff to previous 1.354 (colored)

Sync with HEAD

Revision 1.356 / (download) - annotate - [select for diffs], Fri Jul 22 07:13:56 2016 UTC (6 years, 6 months ago) by knakahara
Branch: MAIN
CVS Tags: pgoyette-localcount-20160726
Changes since 1.355: +2 -12 lines
Diff to previous 1.355 (colored)

Reduce KERNEL_LOCK thereby ifq_lock is used by default.

if_snd is always excluded by ifq_lock now. So, the KERNEL_LOCK in if_transmit()
which serializes packet output processing is not needed now.

Revision 1.355 / (download) - annotate - [select for diffs], Fri Jul 22 07:09:40 2016 UTC (6 years, 6 months ago) by knakahara
Branch: MAIN
Changes since 1.354: +3 -8 lines
Diff to previous 1.354 (colored)

Toward NET_MPSAFE-on in future, if_snd uses if_snd->ifq_lock by default.

That can reduce confusing difference between NET_MPSAFE on and off.

Revision 1.300.2.8 / (download) - annotate - [select for diffs], Sat Jul 9 20:25:21 2016 UTC (6 years, 6 months ago) by skrll
Branch: nick-nhusb
Changes since 1.300.2.7: +231 -67 lines
Diff to previous 1.300.2.7 (colored) to branchpoint 1.300 (colored)

Sync with HEAD

Revision 1.354 / (download) - annotate - [select for diffs], Thu Jul 7 09:32:02 2016 UTC (6 years, 6 months ago) by ozaki-r
Branch: MAIN
CVS Tags: pgoyette-localcount-base, nick-nhusb-base-20160907
Branch point for: pgoyette-localcount
Changes since 1.353: +27 -19 lines
Diff to previous 1.353 (colored)

Switch the address list of intefaces to pslist(9)

As usual, we leave the old list to avoid breaking kvm(3) users.

Revision 1.353 / (download) - annotate - [select for diffs], Tue Jul 5 07:42:51 2016 UTC (6 years, 7 months ago) by knakahara
Branch: MAIN
Changes since 1.352: +3 -3 lines
Diff to previous 1.352 (colored)

fix evbsh3 build

Revision 1.352 / (download) - annotate - [select for diffs], Mon Jul 4 04:35:09 2016 UTC (6 years, 7 months ago) by knakahara
Branch: MAIN
Changes since 1.351: +10 -2 lines
Diff to previous 1.351 (colored)

make encap_lock_{enter,exit} interruptable.

Revision 1.351 / (download) - annotate - [select for diffs], Mon Jul 4 01:36:06 2016 UTC (6 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.350: +4 -4 lines
Diff to previous 1.350 (colored)

Tweak p2p_rtrequest as well for ifaddr initialization change

We need to set lo0ifp to rt->rt_ifp if the interface is RTF_LOCAL.

Fix PR kern/51301.

Revision 1.350 / (download) - annotate - [select for diffs], Fri Jul 1 05:22:33 2016 UTC (6 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.349: +4 -4 lines
Diff to previous 1.349 (colored)

Make sure to free all interface addresses in if_detach

Addresses of an interface (struct ifaddr) have a (reverse) pointer of an
interface object (ifa->ifa_ifp). If the addresses are surely freed when
their interface is destroyed, the pointer is always valid and we don't
need a tweak of replacing the pointer to if_index like mbuf.

In order to make sure the assumption, the following changes are required:
- Deactivate the interface at the firstish of if_detach. This prevents
  in6_unlink_ifa from saving multicast addresses (wrongly)
- Invalidate rtcache(s) and clear a rtentry referencing an address on
  RTM_DELETE. rtcache(s) may delay freeing an address
- Replace callout_stop with callout_halt of DAD timers to ensure stopping
  such timers in if_detach

Revision 1.349 / (download) - annotate - [select for diffs], Fri Jul 1 05:15:40 2016 UTC (6 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.348: +68 -2 lines
Diff to previous 1.348 (colored)

Add debug helper function for interface addresses

It checks whether all addresses of an interface being destroyed
are freed (no reference remains) at the end of if_detach.

Revision 1.348 / (download) - annotate - [select for diffs], Tue Jun 28 02:36:54 2016 UTC (6 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.347: +20 -13 lines
Diff to previous 1.347 (colored)

Introduce if_is_deactivated

Checking ifp->if_output == if_nulloutput is too implicit.

No functional change.

Revision 1.347 / (download) - annotate - [select for diffs], Mon Jun 27 10:09:02 2016 UTC (6 years, 7 months ago) by knakahara
Branch: MAIN
Changes since 1.346: +5 -5 lines
Diff to previous 1.346 (colored)

fix spelling mistake pointed out by roy@n.o

Revision 1.346 / (download) - annotate - [select for diffs], Mon Jun 27 08:58:50 2016 UTC (6 years, 7 months ago) by knakahara
Branch: MAIN
Changes since 1.345: +16 -7 lines
Diff to previous 1.345 (colored)

reduce link state changing softint if it is not required

ok by ozaki-r@n.o

Revision 1.345 / (download) - annotate - [select for diffs], Wed Jun 22 10:44:32 2016 UTC (6 years, 7 months ago) by knakahara
Branch: MAIN
Changes since 1.344: +36 -4 lines
Diff to previous 1.344 (colored)

fix: locking about IFQ_ENQUEUE and ALTQ

- If NET_MPSAFE is not defined, IFQ_LOCK is nop. Currently, that means
  IFQ_ENQUEUE() of some paths such as bridge_enqueue() is called parallel
  wrongly.
- If ALTQ is enabled, Tx processing should call if_transmit() (= IFQ_ENQUEUE
  + ifp->if_start()) instead of ifp->if_transmit() to call ALTQ_ENQUEUE()
  and ALTQ_DEQUEUE().
  Furthermore, ALTQ processing is always required KERNEL_LOCK currently.

Revision 1.344 / (download) - annotate - [select for diffs], Tue Jun 21 10:25:27 2016 UTC (6 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.343: +9 -5 lines
Diff to previous 1.343 (colored)

Make sure returning ifp from in6_select* functions psref-ed

To this end, callers need to pass struct psref to the functions
and the fuctions acquire a reference of ifp with it. In some cases,
we can simply use if_get_byindex, however, in other cases
(say rt->rt_ifp and ia->ifa_ifp), we have no MP-safe way for now.
In order to take a reference anyway we use non MP-safe function
if_acquire_NOMPSAFE for the latter cases. They should be fixed in
the future somehow.

Revision 1.343 / (download) - annotate - [select for diffs], Mon Jun 20 08:30:58 2016 UTC (6 years, 7 months ago) by knakahara
Branch: MAIN
Changes since 1.342: +3 -3 lines
Diff to previous 1.342 (colored)

apply if_start_lock() to L2 callers which call ifp->if_start() of device derivers

Revision 1.342 / (download) - annotate - [select for diffs], Mon Jun 20 06:41:30 2016 UTC (6 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.341: +6 -6 lines
Diff to previous 1.341 (colored)

Do psref_target_destroy after purging packets

Because purging packets may try to send packets, which requires psref yet.

Revision 1.341 / (download) - annotate - [select for diffs], Thu Jun 16 15:18:33 2016 UTC (6 years, 7 months ago) by riastradh
Branch: MAIN
Changes since 1.340: +7 -6 lines
Diff to previous 1.340 (colored)

Fix error branches of if_sdl_sysctl.

Can't release the psref if we didn't even find the interface!

Revision 1.340 / (download) - annotate - [select for diffs], Thu Jun 16 03:03:33 2016 UTC (6 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.339: +18 -8 lines
Diff to previous 1.339 (colored)

Use if_get_byindex instead of if_byindex for MP-safe

Revision 1.339 / (download) - annotate - [select for diffs], Thu Jun 16 02:38:40 2016 UTC (6 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.338: +15 -16 lines
Diff to previous 1.338 (colored)

Use curlwp_bind and curlwp_bindx instead of open-coding LP_BOUND

Revision 1.338 / (download) - annotate - [select for diffs], Fri Jun 10 13:31:44 2016 UTC (6 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.337: +23 -3 lines
Diff to previous 1.337 (colored)

Avoid storing a pointer of an interface in a mbuf

Having a pointer of an interface in a mbuf isn't safe if we remove big
kernel locks; an interface object (ifnet) can be destroyed anytime in any
packet processing and accessing such object via a pointer is racy. Instead
we have to get an object from the interface collection (ifindex2ifnet) via
an interface index (if_index) that is stored to a mbuf instead of an
pointer.

The change provides two APIs: m_{get,put}_rcvif_psref that use psref(9)
for sleep-able critical sections and m_{get,put}_rcvif that use
pserialize(9) for other critical sections. The change also adds another
API called m_get_rcvif_NOMPSAFE, that is NOT MP-safe and for transition
moratorium, i.e., it is intended to be used for places where are not
planned to be MP-ified soon.

The change adds some overhead due to psref to performance sensitive paths,
however the overhead is not serious, 2% down at worst.

Proposed on tech-kern and tech-net.

Revision 1.337 / (download) - annotate - [select for diffs], Tue May 31 04:05:01 2016 UTC (6 years, 8 months ago) by ozaki-r
Branch: MAIN
Changes since 1.336: +4 -4 lines
Diff to previous 1.336 (colored)

Optimize if_get_byindex by adding __predict_true

Revision 1.300.2.7 / (download) - annotate - [select for diffs], Sun May 29 08:44:38 2016 UTC (6 years, 8 months ago) by skrll
Branch: nick-nhusb
Changes since 1.300.2.6: +276 -179 lines
Diff to previous 1.300.2.6 (colored) to branchpoint 1.300 (colored)

Sync with HEAD

Revision 1.336 / (download) - annotate - [select for diffs], Mon May 16 01:16:24 2016 UTC (6 years, 8 months ago) by ozaki-r
Branch: MAIN
CVS Tags: nick-nhusb-base-20160529
Changes since 1.335: +60 -141 lines
Diff to previous 1.335 (colored)

Replace ifnet_lock with if_get and if_put

ifnet_lock is a dedicated method to safely destroy an interface over running
ioctl operations. Replace it with a more generic mechanism using psref(9).

Revision 1.335 / (download) - annotate - [select for diffs], Mon May 16 01:06:31 2016 UTC (6 years, 8 months ago) by ozaki-r
Branch: MAIN
Changes since 1.334: +82 -2 lines
Diff to previous 1.334 (colored)

Introduce if_get, if_get_byindex and if_put

The new API enables to obtain an ifnet object with protected by psref(9).
It is intended to be used where an obtained ifnet object is used over
sleepable operations.

Revision 1.334 / (download) - annotate - [select for diffs], Thu May 12 02:24:16 2016 UTC (6 years, 8 months ago) by ozaki-r
Branch: MAIN
Changes since 1.333: +101 -28 lines
Diff to previous 1.333 (colored)

Protect ifnet list with psz and psref

The change ensures that ifnet objects in the ifnet list aren't freed during
list iterations by using pserialize(9) and psref(9).

Note that the change adds a pslist(9) for ifnet but doesn't remove the
original ifnet list (ifnet_list) to avoid breaking kvm(3) users. We
shouldn't use the original list in the kernel anymore.

Revision 1.333 / (download) - annotate - [select for diffs], Mon May 2 08:03:23 2016 UTC (6 years, 9 months ago) by skrll
Branch: MAIN
Changes since 1.332: +3 -3 lines
Diff to previous 1.332 (colored)

Typo in comment

Revision 1.332 / (download) - annotate - [select for diffs], Thu Apr 28 01:37:17 2016 UTC (6 years, 9 months ago) by knakahara
Branch: MAIN
Changes since 1.331: +37 -12 lines
Diff to previous 1.331 (colored)

introduce new ifnet MP-scalable sending interface "if_transmit".

Revision 1.331 / (download) - annotate - [select for diffs], Thu Apr 28 00:16:56 2016 UTC (6 years, 9 months ago) by ozaki-r
Branch: MAIN
Changes since 1.330: +3 -3 lines
Diff to previous 1.330 (colored)

Constify rtentry of if_output

We no longer need to change rtentry below if_output.

The change makes it clear where rtentries are changed (or not)
and helps forthcoming locking (os psrefing) rtentries.

Revision 1.300.2.6 / (download) - annotate - [select for diffs], Fri Apr 22 15:44:17 2016 UTC (6 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.300.2.5: +109 -13 lines
Diff to previous 1.300.2.5 (colored) to branchpoint 1.300 (colored)

Sync with HEAD

Revision 1.330 / (download) - annotate - [select for diffs], Wed Apr 20 09:01:04 2016 UTC (6 years, 9 months ago) by knakahara
Branch: MAIN
CVS Tags: nick-nhusb-base-20160422
Changes since 1.329: +6 -8 lines
Diff to previous 1.329 (colored)

IFQ_ENQUEUE refactor (3/3) : eliminate pktattr argument from IFQ_ENQUEUE caller

Revision 1.329 / (download) - annotate - [select for diffs], Mon Apr 11 09:21:18 2016 UTC (6 years, 9 months ago) by ozaki-r
Branch: MAIN
Changes since 1.328: +4 -5 lines
Diff to previous 1.328 (colored)

Don't use radix tree API directly

Revision 1.328 / (download) - annotate - [select for diffs], Mon Apr 4 07:37:07 2016 UTC (6 years, 10 months ago) by ozaki-r
Branch: MAIN
Changes since 1.327: +2 -4 lines
Diff to previous 1.327 (colored)

Separate nexthop caches from the routing table

By this change, nexthop caches (IP-MAC address pair) are not stored
in the routing table anymore. Instead nexthop caches are stored in
each network interface; we already have lltable/llentry data structure
for this purpose. This change also obsoletes the concept of cloning/cloned
routes. Cloned routes no longer exist while cloning routes still exist
with renamed to connected routes.

Noticeable changes are:
- Nexthop caches aren't listed in route show/netstat -r
  - sysctl(NET_RT_DUMP) doesn't return them
  - If RTF_LLDATA is specified, it returns nexthop caches
- Several definitions of routing flags and messages are removed
  - RTF_CLONING, RTF_XRESOLVE, RTF_LLINFO, RTF_CLONED and RTM_RESOLVE
- RTF_CONNECTED is added
  - It has the same value of RTF_CLONING for backward compatibility
- route's -xresolve, -[no]cloned and -llinfo options are removed
  - -[no]cloning remains because it seems there are users
  - -[no]connected is introduced and recommended
    to be used instead of -[no]cloning
- route show/netstat -r drops some flags
  - 'L' and 'c' are not seen anymore
  - 'C' now indicates a connected route
- Gateway value of a route of an interface address is now not
  a L2 address but "link#N" like a connected (cloning) route
- Proxy ARP: "arp -s ... pub" doesn't create a route

You can know details of behavior changes by seeing diffs under tests/.

Proposed on tech-net and tech-kern:
  http://mail-index.netbsd.org/tech-net/2016/03/11/msg005701.html

Revision 1.327 / (download) - annotate - [select for diffs], Wed Mar 23 07:05:28 2016 UTC (6 years, 10 months ago) by knakahara
Branch: MAIN
Changes since 1.326: +103 -2 lines
Diff to previous 1.326 (colored)

add drop count which means the sum of struct if_percpuq's per-CPU queues.

ok by ozaki-r@n.o

Revision 1.300.2.5 / (download) - annotate - [select for diffs], Sat Mar 19 11:30:32 2016 UTC (6 years, 10 months ago) by skrll
Branch: nick-nhusb
Changes since 1.300.2.4: +302 -18 lines
Diff to previous 1.300.2.4 (colored) to branchpoint 1.300 (colored)

Sync with HEAD

Revision 1.326 / (download) - annotate - [select for diffs], Mon Mar 7 01:41:55 2016 UTC (6 years, 10 months ago) by ozaki-r
Branch: MAIN
CVS Tags: nick-nhusb-base-20160319
Changes since 1.325: +3 -2 lines
Diff to previous 1.325 (colored)

Add missing percpu_putref to error path

Revision 1.325 / (download) - annotate - [select for diffs], Fri Feb 19 20:05:43 2016 UTC (6 years, 11 months ago) by roy
Branch: MAIN
Changes since 1.324: +126 -23 lines
Diff to previous 1.324 (colored)

Implement a queue for if_link_state_change() calls to fix a race condition
introduced in the prior patch.

The queue has capacity to store 8 link state changes, if it overflows then
the oldest state change is lost, but the oldest DOWN state change is
preserved to ensure any subsequent UP state changes reflect properly.

Because there are only 3 states to queue, the queue itself is implemented
by storing 2-bit numbers in a bigger one.
To increase the size of the queue, just increase the size of the backing
store to a bigger number.

Revision 1.324 / (download) - annotate - [select for diffs], Mon Feb 15 08:08:04 2016 UTC (6 years, 11 months ago) by ozaki-r
Branch: MAIN
Changes since 1.323: +30 -5 lines
Diff to previous 1.323 (colored)

Run if_link_state_change in softint

if_link_state_change can execute the network stack that is expected to
not run in hardware interrupt (at least now), however network drivers
may call it in hardware interrupt. Avoid that by introducing a new
softint for if_link_state_change.

The original patch is provided by mlelstv@ and tweaked a bit by me.

Should fix PR kern/50602.

Revision 1.323 / (download) - annotate - [select for diffs], Tue Feb 9 08:32:12 2016 UTC (6 years, 11 months ago) by ozaki-r
Branch: MAIN
Changes since 1.322: +157 -4 lines
Diff to previous 1.322 (colored)

Introduce softint-based if_input

This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!

Revision 1.322 / (download) - annotate - [select for diffs], Thu Jan 21 15:41:29 2016 UTC (7 years ago) by riastradh
Branch: MAIN
Changes since 1.321: +3 -5 lines
Diff to previous 1.321 (colored)

Revert previous: ran cvs commit when I meant cvs diff.  Sorry!

Hit up-arrow one too few times.

Revision 1.321 / (download) - annotate - [select for diffs], Thu Jan 21 15:27:48 2016 UTC (7 years ago) by riastradh
Branch: MAIN
Changes since 1.320: +7 -5 lines
Diff to previous 1.320 (colored)

Give proper prototype to ip_output.

Revision 1.320 / (download) - annotate - [select for diffs], Mon Jan 4 09:08:38 2016 UTC (7 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.319: +4 -2 lines
Diff to previous 1.319 (colored)

Fix the destruction of the afdata lock

Pointed out by mlelstv@

Revision 1.300.2.4 / (download) - annotate - [select for diffs], Sun Dec 27 12:10:06 2015 UTC (7 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.300.2.3: +5 -6 lines
Diff to previous 1.300.2.3 (colored) to branchpoint 1.300 (colored)

Sync with HEAD (as of 26th Dec)

Revision 1.319 / (download) - annotate - [select for diffs], Fri Nov 20 08:10:36 2015 UTC (7 years, 2 months ago) by ozaki-r
Branch: MAIN
CVS Tags: nick-nhusb-base-20151226
Changes since 1.318: +5 -6 lines
Diff to previous 1.318 (colored)

Remove an ifnet object from the global list before destructing it

Revision 1.300.2.3 / (download) - annotate - [select for diffs], Tue Sep 22 12:06:10 2015 UTC (7 years, 4 months ago) by skrll
Branch: nick-nhusb
Changes since 1.300.2.2: +21 -35 lines
Diff to previous 1.300.2.2 (colored) to branchpoint 1.300 (colored)

Sync with HEAD

Revision 1.318 / (download) - annotate - [select for diffs], Mon Aug 31 08:02:44 2015 UTC (7 years, 5 months ago) by ozaki-r
Branch: MAIN
CVS Tags: nick-nhusb-base-20150921
Changes since 1.317: +4 -2 lines
Diff to previous 1.317 (colored)

Hook up lltable/llentry with the kernel (and rumpkernel)

It is built and initialized on bootup, but there is no user for now.

Most codes in in.c are imported from FreeBSD as well as lltable/llentry.

Revision 1.317 / (download) - annotate - [select for diffs], Fri Jul 17 02:21:08 2015 UTC (7 years, 6 months ago) by ozaki-r
Branch: MAIN
Changes since 1.316: +11 -8 lines
Diff to previous 1.316 (colored)

Reform use of rt_refcnt

rt_refcnt of rtentry was used in bad manners, for example, direct rt_refcnt++
and rt_refcnt-- outside route.c, "rt->rt_refcnt++; rtfree(rt);" idiom, and
touching rt after rt->rt_refcnt--.

These abuses seem to be needed because rt_refcnt manages only references
between rtentry and doesn't take care of references during packet processing
(IOW references from local variables). In order to reduce the above abuses,
the latter cases should be counted by rt_refcnt as well as the former cases.

This change improves consistency of use of rt_refcnt:
- rtentry is always accessed with rt_refcnt incremented
- rtentry's rt_refcnt is decremented after use (rtfree is always used instead
  of rt_refcnt--)
- functions returning rtentry increment its rt_refcnt (and caller rtfree it)

Note that rt_refcnt prevents rtentry from being freed but doesn't prevent
rtentry from being updated. Toward MP-safe, we need to provide another
protection for rtentry, e.g., locks. (Or introduce a better data structure
allowing concurrent readers during updates.)

Revision 1.316 / (download) - annotate - [select for diffs], Mon Jun 29 09:40:36 2015 UTC (7 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.315: +10 -29 lines
Diff to previous 1.315 (colored)

Remove ifnet_addrs

We can assume that ifnet_addrs[ifp->if_index] is always the same as
ifp->if_dl, so we can replace ifnet_addrs[ifp->if_index] with ifp->if_dl
and remove ifnet_addrs entirely.

ok martin@

Revision 1.300.2.2 / (download) - annotate - [select for diffs], Sat Jun 6 14:40:25 2015 UTC (7 years, 8 months ago) by skrll
Branch: nick-nhusb
Changes since 1.300.2.1: +126 -40 lines
Diff to previous 1.300.2.1 (colored) to branchpoint 1.300 (colored)

Sync with HEAD

Revision 1.315 / (download) - annotate - [select for diffs], Mon May 18 06:38:59 2015 UTC (7 years, 8 months ago) by martin
Branch: MAIN
CVS Tags: nick-nhusb-base-20150606
Changes since 1.314: +14 -11 lines
Diff to previous 1.314 (colored)

Implement SIOCIFGCLONERS for netbsd32, so ifconfig -C works.

Revision 1.314 / (download) - annotate - [select for diffs], Wed Apr 22 20:49:44 2015 UTC (7 years, 9 months ago) by roy
Branch: MAIN
Changes since 1.313: +3 -3 lines
Diff to previous 1.313 (colored)

This comment is no longer IPv6 specific.

Revision 1.313 / (download) - annotate - [select for diffs], Wed Apr 22 20:42:32 2015 UTC (7 years, 9 months ago) by roy
Branch: MAIN
Changes since 1.312: +4 -4 lines
Diff to previous 1.312 (colored)

Fix a copy n pasta error with prior.

Revision 1.312 / (download) - annotate - [select for diffs], Wed Apr 22 19:46:08 2015 UTC (7 years, 9 months ago) by roy
Branch: MAIN
Changes since 1.311: +26 -29 lines
Diff to previous 1.311 (colored)

Move INET6 specific in6_if_{up,down}() and in6_if_link_{up,down}()
into agnostic domain functions.

Revision 1.311 / (download) - annotate - [select for diffs], Tue Apr 21 10:39:41 2015 UTC (7 years, 9 months ago) by pooka
Branch: MAIN
Changes since 1.310: +4 -3 lines
Diff to previous 1.310 (colored)

Attach PF_INET6 pktq sysctls only when inet6 is present.

More modular initialization would be nicer, but at least this patch
prevents "sysctl -a" from crashing when INET6 is defined by inet6 has
not been attached.

Revision 1.310 / (download) - annotate - [select for diffs], Mon Apr 20 10:19:54 2015 UTC (7 years, 9 months ago) by roy
Branch: MAIN
Changes since 1.309: +54 -2 lines
Diff to previous 1.309 (colored)

Introduce p2p_rtrequest() so that IFF_POINTOPOINT interfaces can work
with RTF_LOCAL.
Fixes PR kern/49829.

Revision 1.309 / (download) - annotate - [select for diffs], Tue Apr 7 23:30:36 2015 UTC (7 years, 9 months ago) by roy
Branch: MAIN
Changes since 1.308: +35 -2 lines
Diff to previous 1.308 (colored)

Move in6if_do_dad() to if_do_dad() as the routine is not INET6 specific
and could equally be used by INET.

Revision 1.300.2.1 / (download) - annotate - [select for diffs], Mon Apr 6 15:18:22 2015 UTC (7 years, 10 months ago) by skrll
Branch: nick-nhusb
Changes since 1.300: +65 -32 lines
Diff to previous 1.300 (colored)

Sync with HEAD

Revision 1.308 / (download) - annotate - [select for diffs], Fri Jan 16 10:36:14 2015 UTC (8 years ago) by ozaki-r
Branch: MAIN
CVS Tags: nick-nhusb-base-20150406
Changes since 1.307: +5 -2 lines
Diff to previous 1.307 (colored)

Introduce defflag for NET_MPSAFE

Revision 1.307 / (download) - annotate - [select for diffs], Mon Dec 15 06:52:25 2014 UTC (8 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.306: +39 -12 lines
Diff to previous 1.306 (colored)

Introduce if_initialize and if_register as an alternative to if_attach

if_attach initializes an ifnet object and registers it to the system
(e.g., ifnet_list), however, if_attach doesn't complete the
initialization and the rest of it will be done by if_alloc_sadl
that is normally directly called by device drivers or called via
functions like ether_ifattach. So there is a race between
if_attach and if_alloc_sadl (A half-baked ifnet object may be
accessed, for example, via ioctl between them).

The aim of this fix is to register an initializing ifnet object
after completing its initializations. To this end, this fix
separates if_attach into an initialization part (if_initialize)
and a registration part (if_register) and call the latter after
if_alloc_sadl (ether_ifattach). So a typical usage of the two
new APIs is like this:

  if_initialize(ifp);  // was if_attach
  ether_ifattach(ifp, enaddr);
  if_register(ifp);

Nonetheless, changing every drivers to do so at once isn't
feasible. So we keep if_attach working as it used to be and
will change only some drivers that we need at this point.
Once we know the fix really works well, we'll change all
the others.

Some more information of the fix can be found here:
http://mail-index.netbsd.org/tech-kern/2014/12/10/msg018242.html

No objection on tech-kern and tech-net.

Revision 1.306 / (download) - annotate - [select for diffs], Sun Dec 14 08:57:14 2014 UTC (8 years, 1 month ago) by martin
Branch: MAIN
Changes since 1.305: +6 -4 lines
Diff to previous 1.305 (colored)

Avoid a race when the ifp->if_slowtimo pointer is changed while we are
running in if_slowtimo already. Suggested by Masao Uebayashi
in PR kern/49462.

Revision 1.305 / (download) - annotate - [select for diffs], Thu Dec 11 14:33:22 2014 UTC (8 years, 1 month ago) by martin
Branch: MAIN
Changes since 1.304: +10 -5 lines
Diff to previous 1.304 (colored)

Avoid scheduling more slow timeouts while we are in the process of detaching
the interface: set if_slowtimo to NULL before doing the callout_halt()
and test for that in the callout. Fixes PR kern/49462.

Revision 1.304 / (download) - annotate - [select for diffs], Mon Dec 8 04:55:47 2014 UTC (8 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.303: +12 -10 lines
Diff to previous 1.303 (colored)

Tweak ifconf (retry)

The tweak makes the code intention clear and further changes easy.

No functional change.

The first trial broke SIOCGIFCONF (PR 49437). So as not to repeat the mistake,
t_ifconf was added. It should warn if something goes wrong on ifconf.

Revision 1.303 / (download) - annotate - [select for diffs], Tue Dec 2 04:43:35 2014 UTC (8 years, 2 months ago) by ozaki-r
Branch: MAIN
Changes since 1.302: +2 -13 lines
Diff to previous 1.302 (colored)

Revert "Pull if_drain routine out of m_reclaim"

The commit broke dlopen()'d rumpnet on platforms where ld.so does not
override weak aliases (e.g. musl, Solaris, potentially OS X, ...).

Requested by pooka@.

Revision 1.302 / (download) - annotate - [select for diffs], Mon Dec 1 07:15:42 2014 UTC (8 years, 2 months ago) by ozaki-r
Branch: MAIN
Changes since 1.301: +10 -6 lines
Diff to previous 1.301 (colored)

Make more functions static

No functional change.

Revision 1.301 / (download) - annotate - [select for diffs], Mon Dec 1 00:27:05 2014 UTC (8 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.300: +10 -9 lines
Diff to previous 1.300 (colored)

PR/49437: jmcneill: revert broken changes that broke SIOCGIFCONF (mdnsd uses it)

Revision 1.300 / (download) - annotate - [select for diffs], Fri Nov 28 08:29:00 2014 UTC (8 years, 2 months ago) by ozaki-r
Branch: MAIN
CVS Tags: nick-nhusb-base
Branch point for: nick-nhusb
Changes since 1.299: +5 -5 lines
Diff to previous 1.299 (colored)

Remove dead codes and make if_free_sadl static

No functional change.

Revision 1.299 / (download) - annotate - [select for diffs], Thu Nov 27 03:15:51 2014 UTC (8 years, 2 months ago) by ozaki-r
Branch: MAIN
Changes since 1.298: +13 -2 lines
Diff to previous 1.298 (colored)

Pull if_drain routine out of m_reclaim

It's if-specific and should be in if.c.

No functional change.

Revision 1.298 / (download) - annotate - [select for diffs], Wed Nov 26 09:53:53 2014 UTC (8 years, 2 months ago) by ozaki-r
Branch: MAIN
Changes since 1.297: +9 -10 lines
Diff to previous 1.297 (colored)

Tweak ifconf variants

The tweaks make the code intention clear and make further changes easy.

No functional change.

Revision 1.297 / (download) - annotate - [select for diffs], Wed Nov 26 09:38:42 2014 UTC (8 years, 2 months ago) by ozaki-r
Branch: MAIN
Changes since 1.296: +10 -7 lines
Diff to previous 1.296 (colored)

Change if_slowtimo_ch to a pointer

One benefit to do so is to reduce memory used for struct callout;
we can avoid to allocate struct callout for interfaces that don't
use callout.

Requested by uebayasi@.

Revision 1.296 / (download) - annotate - [select for diffs], Wed Nov 26 07:43:04 2014 UTC (8 years, 2 months ago) by ozaki-r
Branch: MAIN
Changes since 1.295: +22 -17 lines
Diff to previous 1.295 (colored)

Create if_slowtimo (if_watchdog) callout for each interface

This change is to obviate the need to run if_slowtimo callbacks that
may sleep inside IFNET_FOREACH. And also by this change we can turn
on MPSAFE of callouts individually.

Discussed with uebayasi@ and riastradh@.

Revision 1.295 / (download) - annotate - [select for diffs], Wed Nov 26 07:22:05 2014 UTC (8 years, 2 months ago) by ozaki-r
Branch: MAIN
Changes since 1.294: +7 -7 lines
Diff to previous 1.294 (colored)

Rename if_watchdog to if_slowtimo

if_watchdog callbacks do a little more than what "watchdog" suggests.

Discussed with uebayasi@ (the idea originally from openbsd-tech).

Revision 1.294 / (download) - annotate - [select for diffs], Wed Nov 26 07:06:03 2014 UTC (8 years, 2 months ago) by ozaki-r
Branch: MAIN
Changes since 1.293: +4 -3 lines
Diff to previous 1.293 (colored)

Make if_slowtimo static

Revision 1.293 / (download) - annotate - [select for diffs], Mon Nov 17 13:58:53 2014 UTC (8 years, 2 months ago) by pooka
Branch: MAIN
Changes since 1.292: +4 -3 lines
Diff to previous 1.292 (colored)

Make ifconfig destroy work if INET6 is present but not attached

Revision 1.290.2.1 / (download) - annotate - [select for diffs], Tue Nov 11 12:20:28 2014 UTC (8 years, 2 months ago) by martin
Branch: netbsd-7
CVS Tags: netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE
Branch point for: netbsd-7-1, netbsd-7-0
Changes since 1.290: +9 -3 lines
Diff to previous 1.290 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #205):
	sys/net/if.c: revision 1.292
PR/49373: Ryota Ozaki: Running if_clone_create and if_clone_destroy in
parallel causes panic
XXX: Pullup 7.

Revision 1.292 / (download) - annotate - [select for diffs], Fri Nov 7 12:57:42 2014 UTC (8 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.291: +9 -3 lines
Diff to previous 1.291 (colored)

PR/49373: Ryota Ozaki: Running if_clone_create and if_clone_destroy in
parallel causes panic
XXX: Pullup 7.

Revision 1.291 / (download) - annotate - [select for diffs], Tue Sep 9 20:16:12 2014 UTC (8 years, 4 months ago) by rmind
Branch: MAIN
Changes since 1.290: +27 -10 lines
Diff to previous 1.290 (colored)

Eliminate IFAREF() and IFAFREE() macros in favour of functions.

Revision 1.260.6.3 / (download) - annotate - [select for diffs], Wed Aug 20 00:04:34 2014 UTC (8 years, 5 months ago) by tls
Branch: tls-maxphys
Changes since 1.260.6.2: +260 -159 lines
Diff to previous 1.260.6.2 (colored) to branchpoint 1.260 (colored)

Rebase to HEAD as of a few days ago.

Revision 1.272.2.1 / (download) - annotate - [select for diffs], Sun Aug 10 06:56:15 2014 UTC (8 years, 5 months ago) by tls
Branch: tls-earlyentropy
Changes since 1.272: +230 -116 lines
Diff to previous 1.272 (colored) next main 1.273 (colored)

Rebase.

Revision 1.290 / (download) - annotate - [select for diffs], Sat Aug 9 05:33:01 2014 UTC (8 years, 5 months ago) by rtr
Branch: MAIN
CVS Tags: tls-maxphys-base, tls-earlyentropy-base, netbsd-7-base
Branch point for: netbsd-7
Changes since 1.289: +4 -8 lines
Diff to previous 1.289 (colored)

split PRU_CONNECT2 & PRU_PURGEIF function out of pr_generic() usrreq
switches and put into separate functions

  - always KASSERT(solocked(so)) even if not implemented
    (for PRU_CONNECT2 only)

  - replace calls to pr_generic() with req = PRU_CONNECT2 with calls to
    pr_connect2()

  - replace calls to pr_generic() with req = PRU_PURGEIF with calls to
    pr_purgeif()

put common code from unp_connect2() (used by unp_connect() into
unp_connect1() and call out to it when needed

patch only briefly reviewed by rmind@

Revision 1.289 / (download) - annotate - [select for diffs], Thu Jul 31 06:35:47 2014 UTC (8 years, 6 months ago) by ozaki-r
Branch: MAIN
Changes since 1.288: +4 -4 lines
Diff to previous 1.288 (colored)

Define IFADDR_FOREACH_SAFE for on-the-fly element removal in a loop

We have to use it when we purge an address element in an ifaddr loop.

This change restores the original behavior that was accidentally degraded.

Revision 1.288 / (download) - annotate - [select for diffs], Wed Jul 30 13:32:09 2014 UTC (8 years, 6 months ago) by ozaki-r
Branch: MAIN
Changes since 1.287: +9 -2 lines
Diff to previous 1.287 (colored)

Call etherinit from ifinit1 only when it is required

This unbreaks the builds of kernels that don't build if_ethersubr.c.

Revision 1.287 / (download) - annotate - [select for diffs], Tue Jul 29 05:56:58 2014 UTC (8 years, 6 months ago) by ozaki-r
Branch: MAIN
Changes since 1.286: +4 -5 lines
Diff to previous 1.286 (colored)

Use IFADDR_FOREACH

Revision 1.286 / (download) - annotate - [select for diffs], Mon Jul 28 14:24:48 2014 UTC (8 years, 6 months ago) by ozaki-r
Branch: MAIN
Changes since 1.285: +4 -2 lines
Diff to previous 1.285 (colored)

Add a mutex for global variables of if_ethersubr.c

To initialize the mutex, we introduce etherinit that is called from ifinit1.

Revision 1.285 / (download) - annotate - [select for diffs], Tue Jul 1 10:16:02 2014 UTC (8 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.284: +11 -2 lines
Diff to previous 1.284 (colored)

Lock IFQ operations when NET_MPSAFE

- Introduce NET_MPSAFE
  - not defined by default
- Add ifq_lock to protect ifnet#if_snd
- Initialize ifq_lock and lock IFQ operations
  when NET_MPSAFE

When NET_MPSAFE isn't defined, this modification
doesn't change its behavior and adds trivial
performance overheads.

Discussed with matt@ on tech-net

Revision 1.284 / (download) - annotate - [select for diffs], Tue Jul 1 05:49:18 2014 UTC (8 years, 7 months ago) by rtr
Branch: MAIN
Changes since 1.283: +5 -7 lines
Diff to previous 1.283 (colored)

fix parameter types in pr_ioctl, called xx_control() functions and remove
abuse of pointer to struct mbuf type.

param2 changed to u_long type and uses parameter name 'cmd' (ioctl command)
param3 changed to void * type and uses parameter name 'data'
param4 changed to struct ifnet * and uses parameter name 'ifp'
param5 has been removed (formerly struct lwp *) and uses of 'l' have been
       replaced with curlwp from curproc(9).

callers have had (now unnecessary) casts to struct mbuf * removed, called
code has had (now unnecessary) casts to u_long, void * and struct ifnet *
respectively removed.

reviewed by rmind@

Revision 1.283 / (download) - annotate - [select for diffs], Sun Jun 22 08:10:18 2014 UTC (8 years, 7 months ago) by rtr
Branch: MAIN
Changes since 1.282: +4 -4 lines
Diff to previous 1.282 (colored)

* split PRU_CONTROL functionality out of xxx_userreq() switches and place
  into separate xxx_ioctl() functions.
* place KASSERT(req != PRU_CONTROL) inside xxx_userreq() as it is now
  inappropriate for req = PRU_CONTROL in xxx_userreq().
* replace calls to pr_generic() with req = PRU_CONTROL with pr_ioctl().
* remove & fixup references to PRU_CONTROL xxx_userreq() function comments.
* fix various comments references for xxx_userreq() that mentioned
  PRU_CONTROL as xxx_userreq() no longer handles the request.

a further change will follow to fix parameter and naming inconsistencies
retained from original code.

Reviewed by rmind@

Revision 1.282 / (download) - annotate - [select for diffs], Mon Jun 16 00:40:10 2014 UTC (8 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.281: +2 -25 lines
Diff to previous 1.281 (colored)

Move sysctl_pktq_{maxlen,count} to pktqueue.c and make them global

They will be used by bridge.

ok rmind@

Revision 1.281 / (download) - annotate - [select for diffs], Fri Jun 13 13:54:08 2014 UTC (8 years, 7 months ago) by rmind
Branch: MAIN
Changes since 1.280: +5 -2 lines
Diff to previous 1.280 (colored)

if_detach: drain ip6_pktq as well.

Revision 1.280 / (download) - annotate - [select for diffs], Tue Jun 10 09:38:30 2014 UTC (8 years, 7 months ago) by joerg
Branch: MAIN
Changes since 1.279: +43 -2 lines
Diff to previous 1.279 (colored)

Introduce new sysctls for obtaining interface-specific addresses:
- net.sdl for the active link-layer adddress (the MAC)
- net.ether.multicast for the Ethernet multicast addresses
- net.inet6.multicast for the IPv6 multicast groups
- net.inet6.multicast_kludge for temporarily removed multicast groups

Use this sysctls for replacing the kmem grovelling in ifmcstat(8).

Revision 1.279 / (download) - annotate - [select for diffs], Mon Jun 9 12:57:04 2014 UTC (8 years, 7 months ago) by rmind
Branch: MAIN
Changes since 1.278: +27 -4 lines
Diff to previous 1.278 (colored)

Implement pktq_set_maxlen() and let sysctl net.inet.{ip,ip6}.ifq.maxlen be
changed on the fly again.

Revision 1.278 / (download) - annotate - [select for diffs], Sat Jun 7 13:25:33 2014 UTC (8 years, 7 months ago) by he
Branch: MAIN
Changes since 1.277: +5 -3 lines
Diff to previous 1.277 (colored)

Include <netinet/in.h> before <netinet/in_var.h> to avoid build failure
for the COMPUTEX7750 kernel of evbsh3-eb.
Also, don't reference ip_pktq if INET isn't defined (found by the same
kernel).

Revision 1.277 / (download) - annotate - [select for diffs], Fri Jun 6 01:02:47 2014 UTC (8 years, 8 months ago) by rmind
Branch: MAIN
Changes since 1.276: +3 -3 lines
Diff to previous 1.276 (colored)

- Eliminate RTFREE() macro in favour of rtfree() function.
- Make rtcache() function static.

Revision 1.276 / (download) - annotate - [select for diffs], Thu Jun 5 23:48:16 2014 UTC (8 years, 8 months ago) by rmind
Branch: MAIN
Changes since 1.275: +78 -29 lines
Diff to previous 1.275 (colored)

- Implement pktqueue interface for lockless IP input queue.
- Replace ipintrq and ip6intrq with the pktqueue mechanism.
- Eliminate kernel-lock from ipintr() and ip6intr().
- Some preparation work to push softnet_lock out of ipintr().

Discussed on tech-net.

Revision 1.256.2.3 / (download) - annotate - [select for diffs], Thu May 22 11:41:08 2014 UTC (8 years, 8 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.256.2.2: +99 -53 lines
Diff to previous 1.256.2.2 (colored) to branchpoint 1.256 (colored) next main 1.257 (colored)

sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")

Revision 1.264.2.4 / (download) - annotate - [select for diffs], Sun May 18 17:46:12 2014 UTC (8 years, 8 months ago) by rmind
Branch: rmind-smpnet
Changes since 1.264.2.3: +42 -34 lines
Diff to previous 1.264.2.3 (colored) next main 1.265 (colored)

sync with head

Revision 1.275 / (download) - annotate - [select for diffs], Sun May 18 14:46:16 2014 UTC (8 years, 8 months ago) by rmind
Branch: MAIN
CVS Tags: rmind-smpnet-nbase, rmind-smpnet-base
Changes since 1.274: +10 -9 lines
Diff to previous 1.274 (colored)

Add struct pr_usrreqs with a pr_generic function and prepare for the
dismantling of pr_usrreq in the protocols; no functional change intended.
PRU_ATTACH/PRU_DETACH changes will follow soon.

Bump for struct protosw.  Welcome to 6.99.62!

Revision 1.274 / (download) - annotate - [select for diffs], Sun May 18 00:33:20 2014 UTC (8 years, 8 months ago) by rmind
Branch: MAIN
Changes since 1.273: +74 -71 lines
Diff to previous 1.273 (colored)

- Move ifnet_list (and lo0ifp while here) under #ifdef _KERNEL.
- Make ifindex2ifnet, if_indexlim and some other variables static.
- Move if_index generation into its own function.
- if_alloc/if_free: replace malloc with kmem.

Revision 1.273 / (download) - annotate - [select for diffs], Sat Apr 26 11:16:22 2014 UTC (8 years, 9 months ago) by pooka
Branch: MAIN
CVS Tags: yamt-pagecache-base9
Changes since 1.272: +8 -4 lines
Diff to previous 1.272 (colored)

Decouple sockets linkage from interface code by making ifioctl() a pointer.

Revision 1.272 / (download) - annotate - [select for diffs], Tue Feb 25 18:30:12 2014 UTC (8 years, 11 months ago) by pooka
Branch: MAIN
CVS Tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3
Branch point for: tls-earlyentropy
Changes since 1.271: +3 -15 lines
Diff to previous 1.271 (colored)

Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.

Revision 1.271 / (download) - annotate - [select for diffs], Fri Jan 3 12:49:59 2014 UTC (9 years, 1 month ago) by pooka
Branch: MAIN
Changes since 1.270: +4 -3 lines
Diff to previous 1.270 (colored)

missed one inet6 check

Revision 1.270 / (download) - annotate - [select for diffs], Thu Jan 2 18:29:01 2014 UTC (9 years, 1 month ago) by pooka
Branch: MAIN
Changes since 1.269: +14 -10 lines
Diff to previous 1.269 (colored)

Allow kernels compiled with INET+INET6 to be booted as IPv4-only or IPv6-only.

Revision 1.269 / (download) - annotate - [select for diffs], Sat Oct 19 21:39:12 2013 UTC (9 years, 3 months ago) by mrg
Branch: MAIN
Changes since 1.268: +4 -4 lines
Diff to previous 1.268 (colored)

adjust previous; old_link_state is also used in INET6.

Revision 1.268 / (download) - annotate - [select for diffs], Sat Oct 19 18:39:30 2013 UTC (9 years, 3 months ago) by martin
Branch: MAIN
Changes since 1.267: +8 -3 lines
Diff to previous 1.267 (colored)

Ifdef a variable like its use

Revision 1.267 / (download) - annotate - [select for diffs], Sun Oct 6 01:21:24 2013 UTC (9 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.266: +3 -3 lines
Diff to previous 1.266 (colored)

remove unrelated diff.

Revision 1.266 / (download) - annotate - [select for diffs], Sat Oct 5 23:16:54 2013 UTC (9 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.265: +8 -3 lines
Diff to previous 1.265 (colored)

Add SIOCGIFINDEX from Ty Sarna and Matthew Sporleder.

Revision 1.264.2.3 / (download) - annotate - [select for diffs], Wed Aug 28 23:59:36 2013 UTC (9 years, 5 months ago) by rmind
Branch: rmind-smpnet
Changes since 1.264.2.2: +11 -26 lines
Diff to previous 1.264.2.2 (colored)

sync with head

Revision 1.264.2.2 / (download) - annotate - [select for diffs], Wed Aug 28 15:21:48 2013 UTC (9 years, 5 months ago) by rmind
Branch: rmind-smpnet
Changes since 1.264.2.1: +10 -9 lines
Diff to previous 1.264.2.1 (colored)

Checkpoint work in progress:
- Initial split of the protocol user-request method into the following
  methods: pr_attach, pr_detach and pr_generic for old the pr_usrreq.
- Adjust socreate(9) and sonewconn(9) to call pr_attach without the
  socket lock held (as a preparation for the locking scheme adjustment).
- Adjust all pr_attach routines to assert that PCB is not set.
- Sprinkle various comments, document some routines and their locking.
- Remove M_PCB, replace with kmem(9).
- Fix few bugs spotted on the way.

Revision 1.264.2.1 / (download) - annotate - [select for diffs], Wed Jul 17 03:16:31 2013 UTC (9 years, 6 months ago) by rmind
Branch: rmind-smpnet
Changes since 1.264: +71 -70 lines
Diff to previous 1.264 (colored)

Checkpoint work in progress:
- Move PCB structures under __INPCB_PRIVATE, adjust most of the callers
  and thus make IPv4 PCB structures mostly opaque.  Any volunteers for
  merging in6pcb with inpcb (see rpaulo-netinet-merge-pcb branch)?
- Move various global vars to the modules where they belong, make them static.
- Some preliminary work for IPv4 PCB locking scheme.
- Make raw IP code mostly MP-safe.  Simplify some of it.
- Rework "fast" IP forwarding (ipflow) code to be mostly MP-safe.  It should
  run from a software interrupt, rather than hard.
- Rework tun(4) pseudo interface to be MP-safe.
- Work towards making some other interfaces more strict.

Revision 1.265 / (download) - annotate - [select for diffs], Sat Jun 29 21:06:58 2013 UTC (9 years, 7 months ago) by rmind
Branch: MAIN
CVS Tags: riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2
Changes since 1.264: +10 -26 lines
Diff to previous 1.264 (colored)

- Rewrite parts of pfil(9): use array to store hooks and thus be more cache
  friendly (there are only few hooks in the system).  Make the structures
  opaque and the interface more strict.
- Remove PFIL_HOOKS option by making pfil(9) mandatory.

Revision 1.260.6.2 / (download) - annotate - [select for diffs], Sun Jun 23 06:20:25 2013 UTC (9 years, 7 months ago) by tls
Branch: tls-maxphys
Changes since 1.260.6.1: +66 -11 lines
Diff to previous 1.260.6.1 (colored) to branchpoint 1.260 (colored)

resync from head

Revision 1.264 / (download) - annotate - [select for diffs], Thu Jun 20 13:56:29 2013 UTC (9 years, 7 months ago) by roy
Branch: MAIN
Branch point for: rmind-smpnet
Changes since 1.263: +15 -8 lines
Diff to previous 1.263 (colored)

Move the detaching and making tentative addresses out if in6_if_up
and into in6_if_link_up.

This fixes a possible panic where link is up but not the interface.
Note that a better solution would be to listen to the routing socket
in the kernel, but I don't know how to do that.

Reachable Router tests for IFF_UP as well.

Revision 1.263 / (download) - annotate - [select for diffs], Tue Jun 11 12:08:29 2013 UTC (9 years, 7 months ago) by roy
Branch: MAIN
Changes since 1.262: +42 -2 lines
Diff to previous 1.262 (colored)

When an interface link state changes to down, mark all attached IPv6
addresses as detached.
Likewise, when the link state changes to up, mark all detached IPv6
as tentative and start DAD on them.

Advertised router reachability now checks that link state is not down.
This means that when an interface link state changes, the default IPv6
router may change as well.

Revision 1.262 / (download) - annotate - [select for diffs], Sun Mar 10 19:46:12 2013 UTC (9 years, 10 months ago) by christos
Branch: MAIN
CVS Tags: khorben-n900, agc-symver-base, agc-symver
Changes since 1.261: +18 -10 lines
Diff to previous 1.261 (colored)

allow cloners as modules.

Revision 1.256.2.2 / (download) - annotate - [select for diffs], Wed Jan 16 05:33:48 2013 UTC (10 years ago) by yamt
Branch: yamt-pagecache
CVS Tags: yamt-pagecache-tag8
Changes since 1.256.2.1: +10 -2 lines
Diff to previous 1.256.2.1 (colored) to branchpoint 1.256 (colored)

sync with (a bit old) head

Revision 1.260.6.1 / (download) - annotate - [select for diffs], Tue Nov 20 03:02:46 2012 UTC (10 years, 2 months ago) by tls
Branch: tls-maxphys
Changes since 1.260: +10 -2 lines
Diff to previous 1.260 (colored)

Resync to 2012-11-19 00:00:00 UTC

Revision 1.260.2.1 / (download) - annotate - [select for diffs], Mon Nov 19 20:04:22 2012 UTC (10 years, 2 months ago) by riz
Branch: netbsd-6
CVS Tags: netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1
Changes since 1.260: +10 -2 lines
Diff to previous 1.260 (colored) next main 1.261 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #669):
	sys/net/if.c: revision 1.261
Fix a bug that SIOCZIFDATA clears if_lastchage by zero.
Update if_lastchange with getnanotime().

Revision 1.261 / (download) - annotate - [select for diffs], Thu Nov 1 06:36:30 2012 UTC (10 years, 3 months ago) by msaitoh
Branch: MAIN
CVS Tags: yamt-pagecache-base8, yamt-pagecache-base7
Changes since 1.260: +10 -2 lines
Diff to previous 1.260 (colored)

Fix a bug that SIOCZIFDATA clears if_lastchage by zero.
Update if_lastchange with getnanotime().

Revision 1.256.2.1 / (download) - annotate - [select for diffs], Tue Apr 17 00:08:38 2012 UTC (10 years, 9 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.256: +29 -22 lines
Diff to previous 1.256 (colored)

sync with head

Revision 1.258.2.1 / (download) - annotate - [select for diffs], Sat Feb 18 07:35:37 2012 UTC (10 years, 11 months ago) by mrg
Branch: jmcneill-usbmp
Changes since 1.258: +27 -22 lines
Diff to previous 1.258 (colored) next main 1.259 (colored)

merge to -current.

Revision 1.260 / (download) - annotate - [select for diffs], Fri Feb 3 03:35:30 2012 UTC (11 years ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, netbsd-6-base, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, jmcneill-usbmp-base9, jmcneill-usbmp-base8, jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base5, jmcneill-usbmp-base4, jmcneill-usbmp-base3, jmcneill-usbmp-base2, jmcneill-usbmp-base10
Branch point for: tls-maxphys, netbsd-6
Changes since 1.259: +14 -7 lines
Diff to previous 1.259 (colored)

PR/45764, PR/45914
Part 2:
Arrange so that the pointers that we free (ifp->if_afdata, dom->dom_ifqueues[i])
are set to NULL.
While I am here, add a continue.

Revision 1.230.4.6 / (download) - annotate - [select for diffs], Thu Jan 5 09:47:38 2012 UTC (11 years, 1 month ago) by sborrill
Branch: netbsd-5
CVS Tags: netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2
Changes since 1.230.4.5: +3 -3 lines
Diff to previous 1.230.4.5 (colored) to branchpoint 1.230 (colored) next main 1.231 (colored)

Pull up the following revisions(s) (requested by obache in ticket #1708):
	sys/net/if.c:	revision 1.246

PR/44030: ifreqn2o gets called with the parameters the wrong way around.
Reverts fix for PR 42585 (ticket #1416) as the root cause of the crash is
addressed by PR 44054 (pullup #1541).

Revision 1.259 / (download) - annotate - [select for diffs], Wed Dec 28 02:14:57 2011 UTC (11 years, 1 month ago) by dyoung
Branch: MAIN
Changes since 1.258: +15 -17 lines
Diff to previous 1.258 (colored)

Fix ifpromisc() regression: if ifpromisc(ifp, 1) is called, do set
IFF_PROMISC whether ifp is IFF_UP or not, but do not call ifp->if_ioctl
unless ifp is IFF_UP.

Revision 1.258 / (download) - annotate - [select for diffs], Sun Nov 27 14:55:57 2011 UTC (11 years, 2 months ago) by jakllsch
Branch: MAIN
CVS Tags: jmcneill-usbmp-pre-base2, jmcneill-usbmp-base
Branch point for: jmcneill-usbmp
Changes since 1.257: +3 -2 lines
Diff to previous 1.257 (colored)

We need a cv_destroy() here too.  Fixes LOCKDEBUG panic on interface detachment.

Revision 1.257 / (download) - annotate - [select for diffs], Wed Nov 16 06:09:37 2011 UTC (11 years, 2 months ago) by dyoung
Branch: MAIN
CVS Tags: jmcneill-audiomp3-base, jmcneill-audiomp3
Changes since 1.256: +3 -2 lines
Diff to previous 1.256 (colored)

Before freeing an ifnet_lock, destroy its mutex.  Should help with
kern/43294.

Revision 1.256 / (download) - annotate - [select for diffs], Fri Oct 28 20:11:58 2011 UTC (11 years, 3 months ago) by dyoung
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base
Branch point for: yamt-pagecache
Changes since 1.255: +14 -4 lines
Diff to previous 1.255 (colored)

Userland may not change the IFF_CANTCHANGE flags, however, the kernel
may, so make sure if_flags_set() takes care of them.  Fixes a regression
in ifpromisc().

Revision 1.255 / (download) - annotate - [select for diffs], Tue Oct 25 22:26:18 2011 UTC (11 years, 3 months ago) by dyoung
Branch: MAIN
Changes since 1.254: +45 -3 lines
Diff to previous 1.254 (colored)

Document the ifioctl locking in comments.

Add a missing percpu_free(9) call.

Revision 1.254 / (download) - annotate - [select for diffs], Wed Oct 19 21:29:51 2011 UTC (11 years, 3 months ago) by dyoung
Branch: MAIN
Changes since 1.253: +42 -25 lines
Diff to previous 1.253 (colored)

Fix userland compilation: pull the ifioctl lock-related data members
into a struct ifnet_lock that the ifnet has a pointer to.  In a
non-_KERNEL environment, don't #include <sys/percpu.h> et cetera, and
don't define the struct ifnet_lock but *do* declare it.

Revision 1.253 / (download) - annotate - [select for diffs], Wed Oct 19 01:46:43 2011 UTC (11 years, 3 months ago) by dyoung
Branch: MAIN
Changes since 1.252: +22 -8 lines
Diff to previous 1.252 (colored)

Extract subroutines ifioctl_enter() and ifioctl_exit().

Revision 1.252 / (download) - annotate - [select for diffs], Wed Oct 19 01:34:37 2011 UTC (11 years, 3 months ago) by dyoung
Branch: MAIN
Changes since 1.251: +112 -15 lines
Diff to previous 1.251 (colored)

Start to untangle the ifnet ioctls mess.

Add ifnet functions, if_mcast_op(), if_flags_set(), and if_addr_init()
for adding/deleting multicast addresses, modifying the if_flags,
and initializing local/remote addresses.  Make ifpromisc() use
if_flags_set().  Protocols and network drivers should use these
instead of ifp->if_ioctl() calls.  Subsequent commits will
replace ifp->if_ioctl(SIOCADDMULTI| SIOCDELMULTI| SIOCSIFDSTADDR|
SIOCINITIFADDR| SIOCSIFFLAGS) calls with calls to the new functions.

Use a mutex(9) to synchronize ifp->if_ioctl() calls originating in
userland.  Also synchronize ifp->if_ioctl() calls with ifnet detachment
and reclamation.

Revision 1.251 / (download) - annotate - [select for diffs], Fri Aug 12 22:09:36 2011 UTC (11 years, 5 months ago) by dyoung
Branch: MAIN
Changes since 1.250: +8 -2 lines
Diff to previous 1.250 (colored)

Define if_free() for ixg(4) to use.

Revision 1.230.4.1.2.1 / (download) - annotate - [select for diffs], Mon Aug 8 19:36:02 2011 UTC (11 years, 5 months ago) by riz
Branch: netbsd-5-0
Changes since 1.230.4.1: +7 -5 lines
Diff to previous 1.230.4.1 (colored) next main 1.230.4.2 (colored)

Pull up following revision(s) (requested by sborrill in ticket #1643):
	sys/net/if.c: revision 1.243
Prevent if_detach() from crashing while it walks the routing table
to find and unlink routes that reference the detached ifnet: make
if_rt_walktree() return ERESTART whenever it has deleted a route.
Whenever rt_walktree() returns ERESTART, if_detach() restarts it.
I believe that this fix resembles one by Jonathan Kollasch or by someone
else, which has languished in a PR for too long.  Sorry!
Tested by me and by Jeff Rizzo.
XXX It's supposed to be safe for rn_walktree() to apply to the routing
XXX table a routine that may delete routes.  Why isn't it safe in
XXX practice?

Revision 1.230.4.3.2.1 / (download) - annotate - [select for diffs], Mon Aug 8 19:35:15 2011 UTC (11 years, 5 months ago) by riz
Branch: netbsd-5-1
CVS Tags: netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE
Changes since 1.230.4.3: +5 -3 lines
Diff to previous 1.230.4.3 (colored) next main 1.230.4.4 (colored)

Pull up following revision(s) (requested by sborrill in ticket #1643):
	sys/net/if.c: revision 1.243
Prevent if_detach() from crashing while it walks the routing table
to find and unlink routes that reference the detached ifnet: make
if_rt_walktree() return ERESTART whenever it has deleted a route.
Whenever rt_walktree() returns ERESTART, if_detach() restarts it.
I believe that this fix resembles one by Jonathan Kollasch or by someone
else, which has languished in a PR for too long.  Sorry!
Tested by me and by Jeff Rizzo.
XXX It's supposed to be safe for rn_walktree() to apply to the routing
XXX table a routine that may delete routes.  Why isn't it safe in
XXX practice?

Revision 1.230.4.5 / (download) - annotate - [select for diffs], Mon Aug 8 19:33:34 2011 UTC (11 years, 5 months ago) by riz
Branch: netbsd-5
Changes since 1.230.4.4: +7 -5 lines
Diff to previous 1.230.4.4 (colored) to branchpoint 1.230 (colored)

Pull up following revision(s) (requested by sborrill in ticket #1643):
	sys/net/if.c: revision 1.243
Prevent if_detach() from crashing while it walks the routing table
to find and unlink routes that reference the detached ifnet: make
if_rt_walktree() return ERESTART whenever it has deleted a route.
Whenever rt_walktree() returns ERESTART, if_detach() restarts it.
I believe that this fix resembles one by Jonathan Kollasch or by someone
else, which has languished in a PR for too long.  Sorry!
Tested by me and by Jeff Rizzo.
XXX It's supposed to be safe for rn_walktree() to apply to the routing
XXX table a routine that may delete routes.  Why isn't it safe in
XXX practice?

Revision 1.249.2.1 / (download) - annotate - [select for diffs], Mon Jun 6 09:09:52 2011 UTC (11 years, 8 months ago) by jruoho
Branch: jruoho-x86intr
Changes since 1.249: +9 -2 lines
Diff to previous 1.249 (colored) next main 1.250 (colored)

Sync with HEAD.

Revision 1.230.4.1.4.2 / (download) - annotate - [select for diffs], Fri May 20 08:11:29 2011 UTC (11 years, 8 months ago) by matt
Branch: matt-nb5-mips64
Changes since 1.230.4.1.4.1: +3 -3 lines
Diff to previous 1.230.4.1.4.1 (colored) to branchpoint 1.230.4.1 (colored) next main 1.230.4.2 (colored)

bring matt-nb5-mips64 up to date with netbsd-5-1-RELEASE (except compat).

Revision 1.242.4.2 / (download) - annotate - [select for diffs], Sat Mar 5 20:55:51 2011 UTC (11 years, 11 months ago) by rmind
Branch: rmind-uvmplock
Changes since 1.242.4.1: +32 -14 lines
Diff to previous 1.242.4.1 (colored) to branchpoint 1.242 (colored) next main 1.243 (colored)

sync with head

Revision 1.230.4.4 / (download) - annotate - [select for diffs], Wed Feb 16 20:37:47 2011 UTC (11 years, 11 months ago) by bouyer
Branch: netbsd-5
Changes since 1.230.4.3: +22 -8 lines
Diff to previous 1.230.4.3 (colored) to branchpoint 1.230 (colored)

Pull up following revision(s) (requested by chs in ticket #1541):
	sys/compat/common/if_43.c: revision 1.3 via patch
	sys/net/if.c: revision 1.247 via patch
PR/44054: Onno van der Linden: Stacksmashing in handling of ioctl OOSIO*
parameter.
can't map the old and the new SIO calls the way we did before because the
numbers have changed. Instead provide a switch. Keep the old code there,
to handle cases we did not handle in the first switch, but this is a hack
and should be removed.

Revision 1.250 / (download) - annotate - [select for diffs], Tue Jan 18 20:33:45 2011 UTC (12 years ago) by rmind
Branch: MAIN
CVS Tags: rmind-uvmplock-nbase, rmind-uvmplock-base, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Changes since 1.249: +9 -2 lines
Diff to previous 1.249 (colored)

NPF checkpoint:
- Add the concept of rule procedure: separate normalization, logging and
  potentially other functions from the rule structure.  Rule procedure can be
  shared amongst the rules.  Separation is both at kernel level (npf_rproc_t)
  and configuration ("procedure" + "apply").
- Fix portmap sharing for NAT policy.
- Update TCP state tracking logic.  Use TCP FSM definitions.
- Add if_byindex(), OK by matt@.  Use in logging for the lookup.
- Fix traceroute ALG and many other bugs; misc clean-up.

Revision 1.249 / (download) - annotate - [select for diffs], Mon Nov 15 22:42:36 2010 UTC (12 years, 2 months ago) by pooka
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231, jruoho-x86intr-base
Branch point for: jruoho-x86intr
Changes since 1.248: +3 -2 lines
Diff to previous 1.248 (colored)

Implement ifconfig linkstr as proposed on tech-net.

Revision 1.248 / (download) - annotate - [select for diffs], Sat Nov 6 23:28:58 2010 UTC (12 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.247: +2 -6 lines
Diff to previous 1.247 (colored)

remove unused variables.

Revision 1.247 / (download) - annotate - [select for diffs], Sat Nov 6 17:17:13 2010 UTC (12 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.246: +22 -8 lines
Diff to previous 1.246 (colored)

PR/44054: Onno van der Linden: Stacksmashing in handling of ioctl OOSIO*
parameter.

Revision 1.242.2.3 / (download) - annotate - [select for diffs], Sat Nov 6 08:08:49 2010 UTC (12 years, 3 months ago) by uebayasi
Branch: uebayasi-xip
Changes since 1.242.2.2: +3 -3 lines
Diff to previous 1.242.2.2 (colored) to branchpoint 1.242 (colored) next main 1.243 (colored)

Sync with HEAD.

Revision 1.246 / (download) - annotate - [select for diffs], Tue Nov 2 22:34:21 2010 UTC (12 years, 3 months ago) by christos
Branch: MAIN
CVS Tags: uebayasi-xip-base4
Changes since 1.245: +3 -3 lines
Diff to previous 1.245 (colored)

PR/44030: Onno van der Linden: ifreqn2o gets called with the parameters the
wrong way around in /sys/net/if.c

Revision 1.242.2.2 / (download) - annotate - [select for diffs], Fri Oct 22 07:22:38 2010 UTC (12 years, 3 months ago) by uebayasi
Branch: uebayasi-xip
Changes since 1.242.2.1: +1 -1 lines
Diff to previous 1.242.2.1 (colored) to branchpoint 1.242 (colored)

Sync with HEAD (-D20101022).

Revision 1.220.2.7 / (download) - annotate - [select for diffs], Sat Oct 9 03:32:36 2010 UTC (12 years, 3 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.220.2.6: +3 -3 lines
Diff to previous 1.220.2.6 (colored) to branchpoint 1.220 (colored) next main 1.221 (colored)

sync with head

Revision 1.245 / (download) - annotate - [select for diffs], Thu Sep 23 21:16:42 2010 UTC (12 years, 4 months ago) by christos
Branch: MAIN
CVS Tags: yamt-nfs-mp-base11, uebayasi-xip-base3
Changes since 1.244: +3 -3 lines
Diff to previous 1.244 (colored)

prevent integer oveflow. From Maksymilian Arciemowicz

Revision 1.242.2.1 / (download) - annotate - [select for diffs], Tue Aug 17 06:47:43 2010 UTC (12 years, 5 months ago) by uebayasi
Branch: uebayasi-xip
Changes since 1.242: +8 -6 lines
Diff to previous 1.242 (colored)

Sync with HEAD.

Revision 1.220.2.6 / (download) - annotate - [select for diffs], Wed Aug 11 22:54:53 2010 UTC (12 years, 5 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.220.2.5: +8 -6 lines
Diff to previous 1.220.2.5 (colored) to branchpoint 1.220 (colored)

sync with head.

Revision 1.242.4.1 / (download) - annotate - [select for diffs], Sat Jul 3 01:19:59 2010 UTC (12 years, 7 months ago) by rmind
Branch: rmind-uvmplock
Changes since 1.242: +8 -6 lines
Diff to previous 1.242 (colored)

sync with head

Revision 1.230.4.3 / (download) - annotate - [select for diffs], Sat Jun 12 16:37:55 2010 UTC (12 years, 7 months ago) by riz
Branch: netbsd-5
CVS Tags: netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, matt-nb5-pq3-base, matt-nb5-pq3
Branch point for: netbsd-5-1
Changes since 1.230.4.2: +1 -1 lines
Diff to previous 1.230.4.2 (colored) to branchpoint 1.230 (colored)

Pull up following revision(s) (requested by skrll in ticket #1416):
	sys/net/if.c: revision 1.244
Correct the argument order of ifreqn2o conversion.
Fixes PR/42585.

Revision 1.244 / (download) - annotate - [select for diffs], Sat Jun 12 08:12:03 2010 UTC (12 years, 7 months ago) by skrll
Branch: MAIN
CVS Tags: yamt-nfs-mp-base10, uebayasi-xip-base2
Changes since 1.243: +3 -3 lines
Diff to previous 1.243 (colored)

Correct the argument order of ifreqn2o conversion.

Fixes PR/42585.

Revision 1.243 / (download) - annotate - [select for diffs], Wed Jun 2 23:41:14 2010 UTC (12 years, 8 months ago) by dyoung
Branch: MAIN
Changes since 1.242: +7 -5 lines
Diff to previous 1.242 (colored)

Prevent if_detach() from crashing while it walks the routing table
to find and unlink routes that reference the detached ifnet: make
if_rt_walktree() return ERESTART whenever it has deleted a route.
Whenever rt_walktree() returns ERESTART, if_detach() restarts it.

I believe that this fix resembles one by Jonathan Kollasch or by someone
else, which has languished in a PR for too long.  Sorry!

Tested by me and by Jeff Rizzo.

XXX It's supposed to be safe for rn_walktree() to apply to the routing
XXX table a routine that may delete routes.  Why isn't it safe in
XXX practice?

Revision 1.230.4.1.4.1 / (download) - annotate - [select for diffs], Wed Apr 21 00:28:21 2010 UTC (12 years, 9 months ago) by matt
Branch: matt-nb5-mips64
CVS Tags: matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-k15
Changes since 1.230.4.1: +5 -11 lines
Diff to previous 1.230.4.1 (colored)

sync to netbsd-5

Revision 1.220.2.5 / (download) - annotate - [select for diffs], Thu Mar 11 15:04:26 2010 UTC (12 years, 10 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.220.2.4: +48 -35 lines
Diff to previous 1.220.2.4 (colored) to branchpoint 1.220 (colored)

sync with head

Revision 1.242 / (download) - annotate - [select for diffs], Thu Jan 28 14:12:11 2010 UTC (13 years ago) by mbalmer
Branch: MAIN
CVS Tags: yamt-nfs-mp-base9, uebayasi-xip-base1, uebayasi-xip-base
Branch point for: uebayasi-xip, rmind-uvmplock
Changes since 1.241: +3 -3 lines
Diff to previous 1.241 (colored)

fix language

Revision 1.230.4.2 / (download) - annotate - [select for diffs], Sat Nov 28 15:47:05 2009 UTC (13 years, 2 months ago) by bouyer
Branch: netbsd-5
CVS Tags: netbsd-5-1-RC2, netbsd-5-1-RC1
Changes since 1.230.4.1: +5 -11 lines
Diff to previous 1.230.4.1 (colored) to branchpoint 1.230 (colored)

Pull up following revision(s) (requested by joerg in ticket #1148):
	sys/net/if.c: revision 1.241
Simplify ifreq_setaddr:
- Drop the INET6 block. The commands are never given to this function
  and truncating the sockaddr is arguably not the desired result anyway.
- Clear the address before copying. This fixes SIOCGIFNETMASK and possible
  other ioctls for users that don't check sa_len. This includes
  COMPAT_43 and Linux emulation.
OK dyoung@

Revision 1.241 / (download) - annotate - [select for diffs], Fri Nov 13 23:11:08 2009 UTC (13 years, 2 months ago) by joerg
Branch: MAIN
CVS Tags: matt-premerge-20091211
Changes since 1.240: +5 -11 lines
Diff to previous 1.240 (colored)

Simplify ifreq_setaddr:
- Drop the INET6 block. The commands are never given to this function
  and truncating the sockaddr is arguably not the desired result anyway.
- Clear the address before copying. This fixes SIOCGIFNETMASK and possible
  other ioctls for users that don't check sa_len. This includes
  COMPAT_43 and Linux emulation.

OK dyoung@

Revision 1.240 / (download) - annotate - [select for diffs], Mon Oct 26 16:41:35 2009 UTC (13 years, 3 months ago) by cegger
Branch: MAIN
CVS Tags: jym-xensuspend-nbase
Changes since 1.239: +4 -2 lines
Diff to previous 1.239 (colored)

buildfix: only declare sysctl_net_ifq_setup() if INET or INET6 is defined

Revision 1.239 / (download) - annotate - [select for diffs], Sat Oct 3 01:46:39 2009 UTC (13 years, 4 months ago) by elad
Branch: MAIN
Changes since 1.238: +27 -2 lines
Diff to previous 1.238 (colored)

Move default network interface policy back to the subsystem.

Revision 1.238 / (download) - annotate - [select for diffs], Sat Sep 19 11:02:07 2009 UTC (13 years, 4 months ago) by skrll
Branch: MAIN
Changes since 1.237: +4 -3 lines
Diff to previous 1.237 (colored)

Initialise index_gen_mtx before use.

Revision 1.237 / (download) - annotate - [select for diffs], Wed Sep 16 15:23:04 2009 UTC (13 years, 4 months ago) by pooka
Branch: MAIN
Changes since 1.236: +15 -24 lines
Diff to previous 1.236 (colored)

Replace a large number of link set based sysctl node creations with
calls from subsystem constructors.  Benefits both future kernel
modules and rump.

no change to sysctl nodes on i386/MONOLITHIC & build tested i386/ALL

Revision 1.220.2.4 / (download) - annotate - [select for diffs], Wed Sep 16 13:38:01 2009 UTC (13 years, 4 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.220.2.3: +66 -2 lines
Diff to previous 1.220.2.3 (colored) to branchpoint 1.220 (colored)

sync with head

Revision 1.236 / (download) - annotate - [select for diffs], Tue Sep 15 23:24:34 2009 UTC (13 years, 4 months ago) by jakllsch
Branch: MAIN
CVS Tags: yamt-nfs-mp-base8
Changes since 1.235: +6 -4 lines
Diff to previous 1.235 (colored)

When working with address preferences, sockaddr_externalize() both
addresses before comparing them.

This allows IPv6 link-local addresses (which have an embedded scope id)
to have a preference set on them.

ok dyoung

Revision 1.235 / (download) - annotate - [select for diffs], Fri Sep 11 22:06:29 2009 UTC (13 years, 4 months ago) by dyoung
Branch: MAIN
Changes since 1.234: +64 -2 lines
Diff to previous 1.234 (colored)

Make ifconfig(8) set and display preference numbers for IPv6
addresses.  Make the kernel support SIOC[SG]IFADDRPREF for IPv6
interface addresses.

In in6ifa_ifpforlinklocal(), consult preference numbers before
making an otherwise arbitrary choice of in6_ifaddr.  Otherwise,
preference numbers are *not* consulted by the kernel, but that will
be rather easy for somebody with a little bit of free time to fix.

Please note that setting the preference number for a link-local
IPv6 address does not work right, yet, but that ought to be fixed
soon.

In support of the changes above,

1 Add a method to struct domain for "externalizing" a sockaddr, and
  provide an implementation for IPv6.  Expect more work in this area: it
  may be more proper to say that the IPv6 implementation "internalizes"
  a sockaddr.  Add sockaddr_externalize().

2 Add a subroutine, sofamily(), that returns a struct socket's address
  family or AF_UNSPEC.

3 Make a lot of IPv4-specific code generic, and move it from
  sys/netinet/ to sys/net/ for re-use by IPv6 parts of the kernel and
  ifconfig(8).

Revision 1.220.2.3 / (download) - annotate - [select for diffs], Wed Aug 19 18:48:23 2009 UTC (13 years, 5 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.220.2.2: +83 -2 lines
Diff to previous 1.220.2.2 (colored) to branchpoint 1.220 (colored)

sync with head.

Revision 1.234 / (download) - annotate - [select for diffs], Thu Aug 13 00:23:31 2009 UTC (13 years, 5 months ago) by dyoung
Branch: MAIN
CVS Tags: yamt-nfs-mp-base7
Changes since 1.233: +83 -2 lines
Diff to previous 1.233 (colored)

Use sysctl(9) to expose to userland each interface transmission
queue's maximum length, current length, and number of drops.  E.g.,

% sysctl net.interfaces.bnx0
net.interfaces.bnx0.sndq.len = 0
net.interfaces.bnx0.sndq.maxlen = 509
net.interfaces.bnx0.sndq.drops = 0

Let userland adjust the maximum queue length.

While I'm here, add a 64-bit generation number, if_index_gen, to
ifnet; the pair [ifp->if_index, ifp->if_index_gen] can serve to
identify an ifnet for the lifetime of the system.  I will use this
in an upcoming change.

Ok matt@.

Revision 1.232.2.1 / (download) - annotate - [select for diffs], Wed May 13 17:22:19 2009 UTC (13 years, 8 months ago) by jym
Branch: jym-xensuspend
Changes since 1.232: +5 -2 lines
Diff to previous 1.232 (colored) next main 1.233 (colored)

Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.

Revision 1.220.2.2 / (download) - annotate - [select for diffs], Mon May 4 08:14:14 2009 UTC (13 years, 9 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.220.2.1: +64 -55 lines
Diff to previous 1.220.2.1 (colored) to branchpoint 1.220 (colored)

sync with head.

Revision 1.230.2.2 / (download) - annotate - [select for diffs], Tue Mar 3 18:33:38 2009 UTC (13 years, 11 months ago) by skrll
Branch: nick-hppapmap
Changes since 1.230.2.1: +5 -2 lines
Diff to previous 1.230.2.1 (colored) to branchpoint 1.230 (colored) next main 1.231 (colored)

Sync with HEAD.

Revision 1.230.4.1 / (download) - annotate - [select for diffs], Tue Feb 24 02:26:42 2009 UTC (13 years, 11 months ago) by snj
Branch: netbsd-5
CVS Tags: netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20091211, matt-nb4-mips64-k7-u2a-k9b
Branch point for: netbsd-5-0, matt-nb5-mips64
Changes since 1.230: +5 -2 lines
Diff to previous 1.230 (colored)

Pull up following revision(s) (requested by christos in ticket #459):
	sys/net/if.c: revision 1.233
PR/40603: Christoph Badura: unprivileged users can add and delete interface
link addresses. Fixed by centralizing the test as suggested. Will pull up
to 5.0 once submitter tests the fix.

Revision 1.233 / (download) - annotate - [select for diffs], Thu Feb 12 19:05:36 2009 UTC (13 years, 11 months ago) by christos
Branch: MAIN
CVS Tags: yamt-nfs-mp-base6, yamt-nfs-mp-base5, yamt-nfs-mp-base4, yamt-nfs-mp-base3, nick-hppapmap-base4, nick-hppapmap-base3, nick-hppapmap-base2, nick-hppapmap-base, jymxensuspend-base, jym-xensuspend-base
Changes since 1.232: +5 -2 lines
Diff to previous 1.232 (colored)

PR/40603: Christoph Badura: unprivileged users can add and delete interface
link addresses. Fixed by centralizing the test as suggested. Will pull up
to 5.0 once submitter tests the fix.

Revision 1.230.2.1 / (download) - annotate - [select for diffs], Mon Jan 19 13:20:11 2009 UTC (14 years ago) by skrll
Branch: nick-hppapmap
Changes since 1.230: +31 -48 lines
Diff to previous 1.230 (colored)

Sync with HEAD.

Revision 1.217.6.4 / (download) - annotate - [select for diffs], Sat Jan 17 13:29:30 2009 UTC (14 years ago) by mjf
Branch: mjf-devfs2
Changes since 1.217.6.3: +36 -53 lines
Diff to previous 1.217.6.3 (colored) to branchpoint 1.217 (colored) next main 1.218 (colored)

Sync with HEAD.

Revision 1.232 / (download) - annotate - [select for diffs], Sun Jan 11 02:45:54 2009 UTC (14 years ago) by christos
Branch: MAIN
CVS Tags: mjf-devfs2-base
Branch point for: jym-xensuspend
Changes since 1.231: +9 -4 lines
Diff to previous 1.231 (colored)

merge christos-time_t

Revision 1.227.2.1 / (download) - annotate - [select for diffs], Sat Dec 13 01:15:25 2008 UTC (14 years, 1 month ago) by haad
Branch: haad-dm
Changes since 1.227: +31 -53 lines
Diff to previous 1.227 (colored) next main 1.228 (colored)

Update haad-dm branch to haad-dm-base2.

Revision 1.218.2.5 / (download) - annotate - [select for diffs], Fri Nov 28 20:32:43 2008 UTC (14 years, 2 months ago) by christos
Branch: christos-time_t
Changes since 1.218.2.4: +7 -2 lines
Diff to previous 1.218.2.4 (colored) to branchpoint 1.218 (colored) next main 1.219 (colored)

handle old IFDATAREQ; this makes ifconfig work and now my machine
comes up multi-user with new libc/new kernel old binaries.

Revision 1.218.2.4 / (download) - annotate - [select for diffs], Mon Nov 10 00:03:37 2008 UTC (14 years, 2 months ago) by christos
Branch: christos-time_t
Changes since 1.218.2.3: +2 -6 lines
Diff to previous 1.218.2.3 (colored) to branchpoint 1.218 (colored)

resolve conflicts.

Revision 1.218.2.3 / (download) - annotate - [select for diffs], Sun Nov 9 23:57:23 2008 UTC (14 years, 2 months ago) by christos
Branch: christos-time_t
Changes since 1.218.2.2: +28 -46 lines
Diff to previous 1.218.2.2 (colored) to branchpoint 1.218 (colored)

merge with head.

Revision 1.231 / (download) - annotate - [select for diffs], Fri Nov 7 00:20:13 2008 UTC (14 years, 3 months ago) by dyoung
Branch: MAIN
CVS Tags: haad-nbase2, haad-dm-base2, haad-dm-base, christos-time_t-nbase, christos-time_t-base, ad-audiomp2-base, ad-audiomp2
Changes since 1.230: +24 -46 lines
Diff to previous 1.230 (colored)

*** Summary ***

When a link-layer address changes (e.g., ifconfig ex0 link
02:de:ad:be:ef:02 active), send a gratuitous ARP and/or a Neighbor
Advertisement to update the network-/link-layer address bindings
on our LAN peers.

Refuse a change of ethernet address to the address 00:00:00:00:00:00
or to any multicast/broadcast address.  (Thanks matt@.)

Reorder ifnet ioctl operations so that driver ioctls may inherit
the functions of their "class"---ether_ioctl(), fddi_ioctl(), et
cetera---and the class ioctls may inherit from the generic ioctl,
ifioctl_common(), but both driver- and class-ioctls may override
the generic behavior.  Make network drivers share more code.

Distinguish a "factory" link-layer address from others for the
purposes of both protecting that address from deletion and computing
EUI64.

Return consistent, appropriate error codes from network drivers.

Improve readability.  KNF.

*** Details ***

In if_attach(), always initialize the interface ioctl routine,
ifnet->if_ioctl, if the driver has not already initialized it.
Delete if_ioctl == NULL tests everywhere else, because it cannot
happen.

In the ioctl routines of network interfaces, inherit common ioctl
behaviors by calling either ifioctl_common() or whichever ioctl
routine is appropriate for the class of interface---e.g., ether_ioctl()
for ethernets.

Stop (ab)using SIOCSIFADDR and start to use SIOCINITIFADDR.  In
the user->kernel interface, SIOCSIFADDR's argument was an ifreq,
but on the protocol->ifnet interface, SIOCSIFADDR's argument was
an ifaddr.  That was confusing, and it would work against me as I
make it possible for a network interface to overload most ioctls.
On the protocol->ifnet interface, replace SIOCSIFADDR with
SIOCINITIFADDR.  In ifioctl(), return EPERM if userland tries to
invoke SIOCINITIFADDR.

In ifioctl(), give the interface the first shot at handling most
interface ioctls, and give the protocol the second shot, instead
of the other way around. Finally, let compatibility code (COMPAT_OSOCK)
take a shot.

Pull device initialization out of switch statements under
SIOCINITIFADDR.  For example, pull ..._init() out of any switch
statement that looks like this:

        switch (...->sa_family) {
        case ...:
                ..._init();
                ...
                break;
        ...
        default:
                ..._init();
                ...
                break;
        }

Rewrite many if-else clauses that handle all permutations of IFF_UP
and IFF_RUNNING to use a switch statement,

        switch (x & (IFF_UP|IFF_RUNNING)) {
        case 0:
                ...
                break;
        case IFF_RUNNING:
                ...
                break;
        case IFF_UP:
                ...
                break;
        case IFF_UP|IFF_RUNNING:
                ...
                break;
        }

unifdef lots of code containing #ifdef FreeBSD, #ifdef NetBSD, and
#ifdef SIOCSIFMTU, especially in fwip(4) and in ndis(4).

In ipw(4), remove an if_set_sadl() call that is out of place.

In nfe(4), reuse the jumbo MTU logic in ether_ioctl().

Let ethernets register a callback for setting h/w state such as
promiscuous mode and the multicast filter in accord with a change
in the if_flags: ether_set_ifflags_cb() registers a callback that
returns ENETRESET if the caller should reset the ethernet by calling
if_init(), 0 on success, != 0 on failure.  Pull common code from
ex(4), gem(4), nfe(4), sip(4), tlp(4), vge(4) into ether_ioctl(),
and register if_flags callbacks for those drivers.

Return ENOTTY instead of EINVAL for inappropriate ioctls.  In
zyd(4), use ENXIO instead of ENOTTY to indicate that the device is
not any longer attached.

Add to if_set_sadl() a boolean 'factory' argument that indicates
whether a link-layer address was assigned by the factory or some
other source.  In a comment, recommend using the factory address
for generating an EUI64, and update in6_get_hw_ifid() to prefer a
factory address to any other link-layer address.

Add a routing message, RTM_LLINFO_UPD, that tells protocols to
update the binding of network-layer addresses to link-layer addresses.
Implement this message in IPv4 and IPv6 by sending a gratuitous
ARP or a neighbor advertisement, respectively.  Generate RTM_LLINFO_UPD
messages on a change of an interface's link-layer address.

In ether_ioctl(), do not let SIOCALIFADDR set a link-layer address
that is broadcast/multicast or equal to 00:00:00:00:00:00.

Make ether_ioctl() call ifioctl_common() to handle ioctls that it
does not understand.

In gif(4), initialize if_softc and use it, instead of assuming that
the gif_softc and ifp overlap.

Let ifioctl_common() handle SIOCGIFADDR.

Sprinkle rtcache_invariants(), which checks on DIAGNOSTIC kernels
that certain invariants on a struct route are satisfied.

In agr(4), rewrite agr_ioctl_filter() to be a bit more explicit
about the ioctls that we do not allow on an agr(4) member interface.

bzero -> memset.  Delete unnecessary casts to void *.  Use
sockaddr_in_init() and sockaddr_in6_init().  Compare pointers with
NULL instead of "testing truth".  Replace some instances of (type
*)0 with NULL.  Change some K&R prototypes to ANSI C, and join
lines.

Revision 1.218.2.2 / (download) - annotate - [select for diffs], Sat Nov 1 21:22:28 2008 UTC (14 years, 3 months ago) by christos
Branch: christos-time_t
Changes since 1.218.2.1: +86 -34 lines
Diff to previous 1.218.2.1 (colored) to branchpoint 1.218 (colored)

Sync with head.

Revision 1.230 / (download) - annotate - [select for diffs], Fri Oct 24 21:46:09 2008 UTC (14 years, 3 months ago) by dyoung
Branch: MAIN
CVS Tags: netbsd-5-base, netbsd-5-0-RC2, netbsd-5-0-RC1, matt-mips64-base2
Branch point for: nick-hppapmap, netbsd-5
Changes since 1.229: +8 -8 lines
Diff to previous 1.229 (colored)

Do not gratuitously cast to void *.

Revision 1.229 / (download) - annotate - [select for diffs], Fri Oct 24 17:14:29 2008 UTC (14 years, 3 months ago) by dyoung
Branch: MAIN
Changes since 1.228: +2 -7 lines
Diff to previous 1.228 (colored)

Undo a change in my last commit that was not suppsoed to be committed.

Revision 1.228 / (download) - annotate - [select for diffs], Fri Oct 24 17:07:33 2008 UTC (14 years, 3 months ago) by dyoung
Branch: MAIN
Changes since 1.227: +8 -3 lines
Diff to previous 1.227 (colored)

Constify the rt_addrinfo argument to the ifa_rtrequest member
function of struct ifaddr.

Revision 1.217.6.3 / (download) - annotate - [select for diffs], Sun Jun 29 09:33:18 2008 UTC (14 years, 7 months ago) by mjf
Branch: mjf-devfs2
Changes since 1.217.6.2: +23 -0 lines
Diff to previous 1.217.6.2 (colored) to branchpoint 1.217 (colored)

Sync with HEAD.

Revision 1.222.2.1 / (download) - annotate - [select for diffs], Mon Jun 23 04:31:57 2008 UTC (14 years, 7 months ago) by wrstuden
Branch: wrstuden-revivesa
Changes since 1.222: +76 -17 lines
Diff to previous 1.222 (colored) next main 1.223 (colored)

Sync w/ -current. 34 merge conflicts to follow.

Revision 1.225.2.1 / (download) - annotate - [select for diffs], Wed Jun 18 16:33:50 2008 UTC (14 years, 7 months ago) by simonb
Branch: simonb-wapbl
Changes since 1.225: +25 -2 lines
Diff to previous 1.225 (colored) next main 1.226 (colored)

Sync with head.

Revision 1.227 / (download) - annotate - [select for diffs], Wed Jun 18 09:06:28 2008 UTC (14 years, 7 months ago) by yamt
Branch: MAIN
CVS Tags: wrstuden-revivesa-base-4, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, simonb-wapbl-nbase, simonb-wapbl-base, haad-dm-base1
Branch point for: haad-dm
Changes since 1.226: +12 -2 lines
Diff to previous 1.226 (colored)

merge yamt-pf42 branch.
(import newer pf from OpenBSD 4.2)

ok'ed by peter@.  requested by core@

Revision 1.218.4.3 / (download) - annotate - [select for diffs], Tue Jun 17 09:15:13 2008 UTC (14 years, 7 months ago) by yamt
Branch: yamt-pf42
Changes since 1.218.4.2: +15 -2 lines
Diff to previous 1.218.4.2 (colored) to branchpoint 1.218 (colored) next main 1.219 (colored)

sync with head.

Revision 1.226 / (download) - annotate - [select for diffs], Sun Jun 15 16:37:21 2008 UTC (14 years, 7 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pf42-base4
Changes since 1.225: +15 -2 lines
Diff to previous 1.225 (colored)

- add if_alloc (ours just mallocs), and if_initname and use them (from FreeBSD)
- kill memsets where M_ZERO can be used.

Revision 1.217.6.2 / (download) - annotate - [select for diffs], Mon Jun 2 13:24:21 2008 UTC (14 years, 8 months ago) by mjf
Branch: mjf-devfs2
Changes since 1.217.6.1: +54 -25 lines
Diff to previous 1.217.6.1 (colored) to branchpoint 1.217 (colored)

Sync with HEAD.

Revision 1.218.4.2 / (download) - annotate - [select for diffs], Sun May 18 12:35:26 2008 UTC (14 years, 8 months ago) by yamt
Branch: yamt-pf42
Changes since 1.218.4.1: +56 -27 lines
Diff to previous 1.218.4.1 (colored) to branchpoint 1.218 (colored)

sync with head.

Revision 1.220.2.1 / (download) - annotate - [select for diffs], Fri May 16 02:25:40 2008 UTC (14 years, 8 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.220: +53 -26 lines
Diff to previous 1.220 (colored)

sync with head.

Revision 1.225 / (download) - annotate - [select for diffs], Tue May 13 20:40:33 2008 UTC (14 years, 8 months ago) by dyoung
Branch: MAIN
CVS Tags: yamt-pf42-base3, yamt-pf42-base2, yamt-nfs-mp-base2, hpcarm-cleanup-nbase
Branch point for: simonb-wapbl
Changes since 1.224: +4 -4 lines
Diff to previous 1.224 (colored)

Cosmetic; reduce excessive parenthesization.

Revision 1.224 / (download) - annotate - [select for diffs], Tue May 13 18:09:22 2008 UTC (14 years, 8 months ago) by dyoung
Branch: MAIN
Changes since 1.223: +4 -110 lines
Diff to previous 1.223 (colored)

Let us call ioctl(SIOC[ADG]LIFADDR) with a link-layer address on
an AF_LINK socket, only, to be consistent with SIOC[ADG]LIFADDR
behavior on AF_INET and AF_INET6 sockets.  Let us create AF_LINK
sockets for this purpose.  Note that most operations on AF_LINK
sockets are not implemented.

Revision 1.223 / (download) - annotate - [select for diffs], Sun May 11 23:48:07 2008 UTC (14 years, 8 months ago) by dyoung
Branch: MAIN
Changes since 1.222: +158 -16 lines
Diff to previous 1.222 (colored)

Add kernel support for adding/removing link-layer addresses using
SIOCALIFADDR AND SIOCDLIFADDR, respectively.  Corresponding
ifconfig(8) changes are coming soon.

Revision 1.222 / (download) - annotate - [select for diffs], Tue Apr 29 18:42:26 2008 UTC (14 years, 9 months ago) by ad
Branch: MAIN
Branch point for: wrstuden-revivesa
Changes since 1.221: +2 -4 lines
Diff to previous 1.221 (colored)

kern/38502 ifconfig wi0 hangs

Don't acquire the socket lock for PRU_CONTROL.

Revision 1.221 / (download) - annotate - [select for diffs], Mon Apr 28 20:24:09 2008 UTC (14 years, 9 months ago) by martin
Branch: MAIN
Changes since 1.220: +2 -9 lines
Diff to previous 1.220 (colored)

Remove clause 3 and 4 from TNF licenses

Revision 1.220 / (download) - annotate - [select for diffs], Thu Apr 24 13:30:52 2008 UTC (14 years, 9 months ago) by martin
Branch: MAIN
CVS Tags: yamt-nfs-mp-base
Branch point for: yamt-nfs-mp
Changes since 1.219: +3 -3 lines
Diff to previous 1.219 (colored)

Make it compile if !COMPAT_OSOCK

Revision 1.219 / (download) - annotate - [select for diffs], Thu Apr 24 11:38:37 2008 UTC (14 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.218: +6 -4 lines
Diff to previous 1.218 (colored)

Merge the socket locking patch:

- Socket layer becomes MP safe.
- Unix protocols become MP safe.
- Allows protocol processing interrupts to safely block on locks.
- Fixes a number of race conditions.

With much feedback from matt@ and plunky@.

Revision 1.218.4.1 / (download) - annotate - [select for diffs], Sat Apr 19 08:33:27 2008 UTC (14 years, 9 months ago) by yamt
Branch: yamt-pf42
Changes since 1.218: +12 -2 lines
Diff to previous 1.218 (colored)

Peter Postma's work-in-progress pf import from OpenBSD 4.2.
updated to -current by me.

Revision 1.217.6.1 / (download) - annotate - [select for diffs], Thu Apr 3 12:43:07 2008 UTC (14 years, 10 months ago) by mjf
Branch: mjf-devfs2
Changes since 1.217: +25 -31 lines
Diff to previous 1.217 (colored)

Sync with HEAD.

Revision 1.218.2.1 / (download) - annotate - [select for diffs], Sat Mar 29 20:47:02 2008 UTC (14 years, 10 months ago) by christos
Branch: christos-time_t
Changes since 1.218: +4 -4 lines
Diff to previous 1.218 (colored)

Welcome to the time_t=long long dev_t=uint64_t branch.

Revision 1.217.2.1 / (download) - annotate - [select for diffs], Mon Mar 24 07:16:23 2008 UTC (14 years, 10 months ago) by keiichi
Branch: keiichi-mipv6
Changes since 1.217: +25 -31 lines
Diff to previous 1.217 (colored) next main 1.218 (colored)

sync with head.

Revision 1.196.2.3 / (download) - annotate - [select for diffs], Sun Mar 23 02:05:04 2008 UTC (14 years, 10 months ago) by matt
Branch: matt-armv6
Changes since 1.196.2.2: +204 -186 lines
Diff to previous 1.196.2.2 (colored) next main 1.197 (colored)

sync with HEAD

Revision 1.159.2.11 / (download) - annotate - [select for diffs], Mon Mar 17 09:15:41 2008 UTC (14 years, 10 months ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.159.2.10: +25 -31 lines
Diff to previous 1.159.2.10 (colored) next main 1.160 (colored)

sync with head.

Revision 1.218 / (download) - annotate - [select for diffs], Fri Feb 29 21:23:55 2008 UTC (14 years, 11 months ago) by dyoung
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base, yamt-lazymbuf-base15, yamt-lazymbuf-base14, matt-armv6-nbase, keiichi-mipv6-nbase, keiichi-mipv6-base, ad-socklock-base1
Branch point for: yamt-pf42, christos-time_t
Changes since 1.217: +25 -31 lines
Diff to previous 1.217 (colored)

Cosmetic: shorten staircases.  Join some lines.

Revision 1.203.2.3 / (download) - annotate - [select for diffs], Mon Feb 18 21:07:01 2008 UTC (14 years, 11 months ago) by mjf
Branch: mjf-devfs
Changes since 1.203.2.2: +181 -157 lines
Diff to previous 1.203.2.2 (colored) to branchpoint 1.203 (colored) next main 1.204 (colored)

Sync with HEAD.

Revision 1.159.2.10 / (download) - annotate - [select for diffs], Mon Feb 11 14:59:59 2008 UTC (14 years, 11 months ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.159.2.9: +38 -54 lines
Diff to previous 1.159.2.9 (colored)

sync with head.

Revision 1.217 / (download) - annotate - [select for diffs], Thu Feb 7 08:48:16 2008 UTC (14 years, 11 months ago) by martin
Branch: MAIN
CVS Tags: nick-net80211-sync-base, nick-net80211-sync, mjf-devfs-base, hpcarm-cleanup-base
Branch point for: mjf-devfs2, keiichi-mipv6
Changes since 1.216: +4 -4 lines
Diff to previous 1.216 (colored)

Make it compile w/o INET6

Revision 1.216 / (download) - annotate - [select for diffs], Thu Feb 7 04:44:21 2008 UTC (15 years ago) by xtraeme
Branch: MAIN
Changes since 1.215: +2 -7 lines
Diff to previous 1.215 (colored)

Remove neticp (network info commpage) stuff that dyoung added
accidentally to make this build again.

Revision 1.215 / (download) - annotate - [select for diffs], Thu Feb 7 01:21:59 2008 UTC (15 years ago) by dyoung
Branch: MAIN
Changes since 1.214: +41 -52 lines
Diff to previous 1.214 (colored)

Start patching up the kernel so that a network driver always has
the opportunity to handle an ioctl before generic ifioctl handling
occurs.  This will ease extending the kernel and sharing of code
between drivers.

First steps:  Make the signature of ifioctl_common() match struct
ifinet->if_ioctl.  Convert SIOCSIFCAP and SIOCSIFMTU to the new
ifioctl() regime, throughout the kernel.

Revision 1.159.2.9 / (download) - annotate - [select for diffs], Mon Feb 4 09:24:36 2008 UTC (15 years ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.159.2.8: +158 -118 lines
Diff to previous 1.159.2.8 (colored)

sync with head.

Revision 1.208.4.2 / (download) - annotate - [select for diffs], Wed Jan 23 19:27:44 2008 UTC (15 years ago) by bouyer
Branch: bouyer-xeni386
Changes since 1.208.4.1: +156 -116 lines
Diff to previous 1.208.4.1 (colored) to branchpoint 1.208 (colored) next main 1.209 (colored)

Sync with HEAD.

Revision 1.214 / (download) - annotate - [select for diffs], Wed Jan 23 16:51:19 2008 UTC (15 years ago) by dyoung
Branch: MAIN
CVS Tags: bouyer-xeni386-nbase
Changes since 1.213: +3 -2 lines
Diff to previous 1.213 (colored)

Fix more fall-out from extracting ifioctl_common(): don't return
ENETRESET from ifioctl().

Revision 1.213 / (download) - annotate - [select for diffs], Tue Jan 22 22:26:30 2008 UTC (15 years ago) by dyoung
Branch: MAIN
Changes since 1.212: +38 -38 lines
Diff to previous 1.212 (colored)

Functional: return ENTRESET from ifioctl_common(), if SIOCSIFCAP
    changed anything.

Cosmetic: shorten staircase.

Revision 1.212 / (download) - annotate - [select for diffs], Tue Jan 22 22:09:59 2008 UTC (15 years ago) by dyoung
Branch: MAIN
Changes since 1.211: +3 -2 lines
Diff to previous 1.211 (colored)

Add missing break statement.

Revision 1.211 / (download) - annotate - [select for diffs], Tue Jan 22 16:25:15 2008 UTC (15 years ago) by dyoung
Branch: MAIN
Changes since 1.210: +156 -118 lines
Diff to previous 1.210 (colored)

Take two steps toward adding and deleting link-layer addresses.

1 Extract subroutine if_dl_create() from if_alloc_sadl().
  if_dl_create() allocates a link-layer ifaddr.

2 Extract subroutine ifioctl_common() from ifioctl().  ifioctl_common()
  will be the basis for an ifnet "superclass" whose functions
  drivers may inherit.  Very simple drivers may set ifnet->if_ioctl
  = ifioctl_common.  More sophisticated drivers will set ifnet->if_ioctl
  = driver_ioctl.  driver_ioctl() will call ifioctl_common() to
  re-use the common code.

Revision 1.159.2.8 / (download) - annotate - [select for diffs], Mon Jan 21 09:46:59 2008 UTC (15 years ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.159.2.7: +22 -2 lines
Diff to previous 1.159.2.7 (colored)

sync with head

Revision 1.196.2.2 / (download) - annotate - [select for diffs], Wed Jan 9 01:57:08 2008 UTC (15 years ago) by matt
Branch: matt-armv6
Changes since 1.196.2.1: +65 -18 lines
Diff to previous 1.196.2.1 (colored)

sync with HEAD

Revision 1.208.4.1 / (download) - annotate - [select for diffs], Wed Jan 2 21:57:01 2008 UTC (15 years, 1 month ago) by bouyer
Branch: bouyer-xeni386
CVS Tags: bouyer-xeni386-merge1
Changes since 1.208: +22 -2 lines
Diff to previous 1.208 (colored)

Sync with HEAD

Revision 1.203.2.2 / (download) - annotate - [select for diffs], Thu Dec 27 00:46:26 2007 UTC (15 years, 1 month ago) by mjf
Branch: mjf-devfs
Changes since 1.203.2.1: +22 -2 lines
Diff to previous 1.203.2.1 (colored) to branchpoint 1.203 (colored)

Sync with HEAD.

Revision 1.203.4.2 / (download) - annotate - [select for diffs], Wed Dec 26 21:39:50 2007 UTC (15 years, 1 month ago) by ad
Branch: vmlocking2
Changes since 1.203.4.1: +22 -2 lines
Diff to previous 1.203.4.1 (colored) to branchpoint 1.203 (colored) next main 1.204 (colored)

Sync with head.

Revision 1.210 / (download) - annotate - [select for diffs], Thu Dec 20 21:08:20 2007 UTC (15 years, 1 month ago) by dyoung
Branch: MAIN
CVS Tags: vmlocking2-base3, matt-armv6-base, bouyer-xeni386-base
Changes since 1.209: +16 -2 lines
Diff to previous 1.209 (colored)

Constify struct ifnet->if_sadl and every use throughout the tree.
Add if_set_sadl() that both sets the link-layer address length and
replaces the current link-layer address with a new one, and use it
throughout the tree.

Revision 1.209 / (download) - annotate - [select for diffs], Thu Dec 20 19:53:30 2007 UTC (15 years, 1 month ago) by dyoung
Branch: MAIN
Changes since 1.208: +8 -2 lines
Diff to previous 1.208 (colored)

Poison struct route->ro_rt uses in the kernel by changing the name
to _ro_rt.  Use rtcache_getrt() to access a route cache's struct
rtentry *.

Introduce struct ifnet->if_dl that always points at the interface
identifier/link-layer address.  Make code that treated the first
ifaddr on struct ifnet->if_addrlist as the interface address use
if_dl, instead.

Remove stale debugging code from net/route.c.  Move the rtflush()
code into rtcache_clear() and delete rtflush().  Delete rtalloc(),
because nothing uses it any more.

Make ND6_HINT an inline, lowercase subroutine, nd6_hint.

I've done my best to convert IP Filter, the ISO stack, and the
AppleTalk stack to rtcache_getrt().  They compile, but I have not
tested them.  I have given the changes to PF, GRE, IPv4 and IPv6
stacks a lot of exercise.

Revision 1.194.4.6 / (download) - annotate - [select for diffs], Sun Dec 9 19:38:33 2007 UTC (15 years, 1 month ago) by jmcneill
Branch: jmcneill-pm
Changes since 1.194.4.5: +45 -18 lines
Diff to previous 1.194.4.5 (colored) to branchpoint 1.194 (colored) next main 1.195 (colored)

Sync with HEAD.

Revision 1.203.2.1 / (download) - annotate - [select for diffs], Sat Dec 8 18:21:05 2007 UTC (15 years, 1 month ago) by mjf
Branch: mjf-devfs
Changes since 1.203: +45 -18 lines
Diff to previous 1.203 (colored)

Sync with HEAD.

Revision 1.203.4.1 / (download) - annotate - [select for diffs], Sat Dec 8 17:57:52 2007 UTC (15 years, 1 month ago) by ad
Branch: vmlocking2
Changes since 1.203: +45 -18 lines
Diff to previous 1.203 (colored)

Sync with head.

Revision 1.159.2.7 / (download) - annotate - [select for diffs], Fri Dec 7 17:34:14 2007 UTC (15 years, 2 months ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.159.2.6: +45 -18 lines
Diff to previous 1.159.2.6 (colored)

sync with head

Revision 1.208 / (download) - annotate - [select for diffs], Thu Dec 6 02:23:42 2007 UTC (15 years, 2 months ago) by dyoung
Branch: MAIN
CVS Tags: yamt-kmem-base3, yamt-kmem-base2, yamt-kmem-base, yamt-kmem, vmlocking2-base2, reinoud-bufcleanup-nbase, reinoud-bufcleanup-base, jmcneill-pm-base, cube-autoconf-base, cube-autoconf
Branch point for: bouyer-xeni386
Changes since 1.207: +3 -3 lines
Diff to previous 1.207 (colored)

Fix a serious regression: insert new ifaddrs at the end of if_addrlist,
not at the front, because the first ifaddr on the list has special
significance (grrr).

Revision 1.207 / (download) - annotate - [select for diffs], Thu Dec 6 00:23:09 2007 UTC (15 years, 2 months ago) by dyoung
Branch: MAIN
Changes since 1.206: +21 -8 lines
Diff to previous 1.206 (colored)

Add ifa_insert() and ifa_remove() that add/remove an ifaddr to/from
an interface and increase/decrease its reference count.

Revision 1.206 / (download) - annotate - [select for diffs], Wed Dec 5 23:47:17 2007 UTC (15 years, 2 months ago) by dyoung
Branch: MAIN
Changes since 1.205: +16 -2 lines
Diff to previous 1.205 (colored)

Extract common code, creating a subroutine if_purgeaddrs(ifp,
family, purgeaddr) which applies function `purgeaddr' to each
address on `ifp' belonging to `family'.

Revision 1.205 / (download) - annotate - [select for diffs], Wed Dec 5 22:54:18 2007 UTC (15 years, 2 months ago) by dyoung
Branch: MAIN
Changes since 1.204: +3 -3 lines
Diff to previous 1.204 (colored)

Use IFADDR_EMPTY().

Revision 1.204 / (download) - annotate - [select for diffs], Tue Dec 4 10:34:30 2007 UTC (15 years, 2 months ago) by dyoung
Branch: MAIN
Changes since 1.203: +11 -11 lines
Diff to previous 1.203 (colored)

Use IFADDR_FOREACH().

Revision 1.159.2.6 / (download) - annotate - [select for diffs], Thu Nov 15 11:45:01 2007 UTC (15 years, 2 months ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.159.2.5: +5 -8 lines
Diff to previous 1.159.2.5 (colored)

sync with head.

Revision 1.202.2.1 / (download) - annotate - [select for diffs], Tue Nov 13 16:02:45 2007 UTC (15 years, 2 months ago) by bouyer
Branch: bouyer-xenamd64
Changes since 1.202: +5 -8 lines
Diff to previous 1.202 (colored) next main 1.203 (colored)

Sync with HEAD

Revision 1.196.2.1 / (download) - annotate - [select for diffs], Tue Nov 6 23:33:25 2007 UTC (15 years, 3 months ago) by matt
Branch: matt-armv6
CVS Tags: matt-armv6-prevmlocking
Changes since 1.196: +83 -40 lines
Diff to previous 1.196 (colored)

sync with HEAD

Revision 1.194.4.5 / (download) - annotate - [select for diffs], Sun Nov 4 21:03:35 2007 UTC (15 years, 3 months ago) by jmcneill
Branch: jmcneill-pm
Changes since 1.194.4.4: +5 -8 lines
Diff to previous 1.194.4.4 (colored) to branchpoint 1.194 (colored)

Sync with HEAD.

Revision 1.203 / (download) - annotate - [select for diffs], Thu Nov 1 20:37:48 2007 UTC (15 years, 3 months ago) by dyoung
Branch: MAIN
CVS Tags: vmlocking2-base1, vmlocking-nbase, jmcneill-base, bouyer-xenamd64-base2, bouyer-xenamd64-base
Branch point for: vmlocking2, mjf-devfs
Changes since 1.202: +5 -8 lines
Diff to previous 1.202 (colored)

Change a few malloc(9) + memset(3) pairs to malloc(..., ...|M_ZERO).

Revision 1.159.2.5 / (download) - annotate - [select for diffs], Sat Oct 27 11:35:58 2007 UTC (15 years, 3 months ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.159.2.4: +57 -31 lines
Diff to previous 1.159.2.4 (colored)

sync with head.

Revision 1.194.4.4 / (download) - annotate - [select for diffs], Fri Oct 26 15:48:58 2007 UTC (15 years, 3 months ago) by joerg
Branch: jmcneill-pm
Changes since 1.194.4.3: +5 -5 lines
Diff to previous 1.194.4.3 (colored) to branchpoint 1.194 (colored)

Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.

Revision 1.201.2.1 / (download) - annotate - [select for diffs], Sun Oct 14 11:48:58 2007 UTC (15 years, 3 months ago) by yamt
Branch: yamt-x86pmap
Changes since 1.201: +5 -5 lines
Diff to previous 1.201 (colored) next main 1.202 (colored)

sync with head.

Revision 1.183.2.7 / (download) - annotate - [select for diffs], Fri Oct 12 17:03:21 2007 UTC (15 years, 3 months ago) by ad
Branch: vmlocking
Changes since 1.183.2.6: +5 -5 lines
Diff to previous 1.183.2.6 (colored) next main 1.184 (colored)

Sync with head.

Revision 1.202 / (download) - annotate - [select for diffs], Thu Oct 11 20:47:27 2007 UTC (15 years, 3 months ago) by dyoung
Branch: MAIN
CVS Tags: yamt-x86pmap-base4, yamt-x86pmap-base3, vmlocking-base
Branch point for: bouyer-xenamd64
Changes since 1.201: +5 -5 lines
Diff to previous 1.201 (colored)

In ifreq_setaddr(), use the right buffer sizes for compat v.
non-compat commands.

Revision 1.183.2.6 / (download) - annotate - [select for diffs], Tue Oct 9 13:44:38 2007 UTC (15 years, 3 months ago) by ad
Branch: vmlocking
Changes since 1.183.2.5: +80 -34 lines
Diff to previous 1.183.2.5 (colored)

Sync with head.

Revision 1.194.4.3 / (download) - annotate - [select for diffs], Tue Oct 2 18:29:13 2007 UTC (15 years, 4 months ago) by joerg
Branch: jmcneill-pm
Changes since 1.194.4.2: +54 -28 lines
Diff to previous 1.194.4.2 (colored) to branchpoint 1.194 (colored)

Sync with HEAD.

Revision 1.201 / (download) - annotate - [select for diffs], Thu Sep 13 18:54:57 2007 UTC (15 years, 4 months ago) by gdt
Branch: MAIN
CVS Tags: yamt-x86pmap-base2, yamt-x86pmap-base
Branch point for: yamt-x86pmap
Changes since 1.200: +3 -3 lines
Diff to previous 1.200 (colored)

Add a define for the ifru_space union member.

Copy the entire sockaddr to the buffer to be written to user space,
according to its length, not just the part that fits in struct
sockaddr.

This fixes the 'bad MAC address' problem in dhclient.

Revision 1.200 / (download) - annotate - [select for diffs], Tue Sep 11 19:31:22 2007 UTC (15 years, 4 months ago) by gdt
Branch: MAIN
Changes since 1.199: +53 -27 lines
Diff to previous 1.199 (colored)

Fix bug in SIOCGIFCONF where the wrong length was calculated for
sockaddrs bigger than struct sockaddr.  Tightly bind decrementing
available space and using it, avoiding incorrect accounting in an
error case.  Document invariants.  Document calling convention for
SIOCGIFCONF.  Simplify by removing code to handle sockaddrs that don't
fit in struct ifreq; with sockaddr_storage this can no longer occur.
Add several KASSERTs.

This commit resolves the problem with racoon failing to list
interfaces.

Proposed on tech-net@ with no objections.

Revision 1.194.4.2 / (download) - annotate - [select for diffs], Mon Sep 3 16:48:53 2007 UTC (15 years, 5 months ago) by jmcneill
Branch: jmcneill-pm
Changes since 1.194.4.1: +38 -14 lines
Diff to previous 1.194.4.1 (colored) to branchpoint 1.194 (colored)

Sync with HEAD.

Revision 1.159.2.4 / (download) - annotate - [select for diffs], Mon Sep 3 14:42:01 2007 UTC (15 years, 5 months ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.159.2.3: +261 -254 lines
Diff to previous 1.159.2.3 (colored)

sync with head.

Revision 1.193.2.2 / (download) - annotate - [select for diffs], Mon Sep 3 10:23:07 2007 UTC (15 years, 5 months ago) by skrll
Branch: nick-csl-alignment
Changes since 1.193.2.1: +38 -14 lines
Diff to previous 1.193.2.1 (colored) to branchpoint 1.193 (colored) next main 1.194 (colored)

Sync with HEAD.

Revision 1.199 / (download) - annotate - [select for diffs], Sat Sep 1 07:03:32 2007 UTC (15 years, 5 months ago) by dyoung
Branch: MAIN
CVS Tags: nick-csl-alignment-base5
Changes since 1.198: +6 -3 lines
Diff to previous 1.198 (colored)

Fix compilation if !defined(INET6).  Thanks, Geoff Wing, for the
bug report & patch.

Revision 1.198 / (download) - annotate - [select for diffs], Fri Aug 31 21:02:15 2007 UTC (15 years, 5 months ago) by dyoung
Branch: MAIN
Changes since 1.197: +22 -2 lines
Diff to previous 1.197 (colored)

Per discussion in 30 May 2007 on tech-net, add accessors for
ifreq->ifr_addr, ifreq_getaddr() and ifreq_setaddr().

Revision 1.197 / (download) - annotate - [select for diffs], Thu Aug 30 02:17:34 2007 UTC (15 years, 5 months ago) by dyoung
Branch: MAIN
Changes since 1.196: +5 -8 lines
Diff to previous 1.196 (colored)

Use malloc(9) for sockaddrs instead of pool(9), and remove dom_sa_pool
and dom_sa_len members from struct domain.  Pools of fixed-size
objects are too rigid for sockaddr_dls, whose size can vary over
a wide range.

Return sockaddr_dl to its "historical" size.  Now that I'm using
malloc(9) instead of pool(9) to allocate sockaddr_dl, I can create
a sockaddr_dl of any size in the kernel, so expanding sockaddr_dl
is useless.

Avoid using sizeof(struct sockaddr_dl) in the kernel.

Introduce sockaddr_dl_alloc() for allocating & initializing an
arbitrary sockaddr_dl on the heap.

Add an argument, the sockaddr length, to sockaddr_alloc(),
sockaddr_copy(), and sockaddr_dl_setaddr().

Constify: LLADDR() -> CLLADDR().

Where the kernel overwrites LLADDR(), use sockaddr_dl_setaddr(),
instead.  Used properly, sockaddr_dl_setaddr() will not overrun
the end of the sockaddr.

Revision 1.183.2.5 / (download) - annotate - [select for diffs], Mon Aug 20 21:27:52 2007 UTC (15 years, 5 months ago) by ad
Branch: vmlocking
Changes since 1.183.2.4: +39 -36 lines
Diff to previous 1.183.2.4 (colored)

Sync with HEAD.

Revision 1.196 / (download) - annotate - [select for diffs], Mon Aug 20 04:49:40 2007 UTC (15 years, 5 months ago) by skd
Branch: MAIN
Branch point for: matt-armv6
Changes since 1.195: +12 -8 lines
Diff to previous 1.195 (colored)

Clean up net compat ioctls, and clean up handling of wireless ioctls.

Revision 1.193.2.1 / (download) - annotate - [select for diffs], Wed Aug 15 13:49:38 2007 UTC (15 years, 5 months ago) by skrll
Branch: nick-csl-alignment
Changes since 1.193: +29 -30 lines
Diff to previous 1.193 (colored)

Sync with HEAD.

Revision 1.194.4.1 / (download) - annotate - [select for diffs], Thu Aug 9 02:37:22 2007 UTC (15 years, 5 months ago) by jmcneill
Branch: jmcneill-pm
Changes since 1.194: +20 -24 lines
Diff to previous 1.194 (colored)

Sync with HEAD.

Revision 1.195.2.2 / (download) - annotate - [select for diffs], Tue Aug 7 04:14:38 2007 UTC (15 years, 6 months ago) by dyoung
Branch: matt-mips64
Changes since 1.195.2.1: +1806 -0 lines
Diff to previous 1.195.2.1 (colored) to branchpoint 1.195 (colored) next main 1.196 (colored)

In if_alloc_sadl(), use sockaddr_dl_init() and satocsdl().  Introduce
variable 'mask' for the netmask, and use it instead of assigning
to 'sdl' twice.

In ifa_ifwithnet(), use satocsdl().

Revision 1.195.2.1, Tue Aug 7 04:14:37 2007 UTC (15 years, 6 months ago) by dyoung
Branch: matt-mips64
Changes since 1.195: +0 -1806 lines
FILE REMOVED

file if.c was added on branch matt-mips64 on 2007-08-07 04:14:38 +0000

Revision 1.195 / (download) - annotate - [select for diffs], Tue Aug 7 04:14:37 2007 UTC (15 years, 6 months ago) by dyoung
Branch: MAIN
CVS Tags: matt-mips64-base
Branch point for: matt-mips64
Changes since 1.194: +20 -24 lines
Diff to previous 1.194 (colored)

In if_alloc_sadl(), use sockaddr_dl_init() and satocsdl().  Introduce
variable 'mask' for the netmask, and use it instead of assigning
to 'sdl' twice.

In ifa_ifwithnet(), use satocsdl().

Revision 1.194 / (download) - annotate - [select for diffs], Thu Jul 19 20:48:52 2007 UTC (15 years, 6 months ago) by dyoung
Branch: MAIN
CVS Tags: hpcarm-cleanup
Branch point for: jmcneill-pm
Changes since 1.193: +11 -8 lines
Diff to previous 1.193 (colored)

Take steps to hide the radix_node implementation of the forwarding table
from the forwarding table's users:

        Introduce rt_walktree() for walking the routing table and
        applying a function to each rtentry.  Replace most
        rn_walktree() calls with it.

        Use rt_getkey()/rt_setkey() to get/set a route's destination.
        Keep a pointer to the sockaddr key in the rtentry, so that
        rtentry users do not have to grovel in the radix_node for
        the key.

        Add a RTM_GET method to rtrequest.  Use that instead of
        radix_node lookups in, e.g., carp(4).

Add sys/net/link_proto.c, which supplies sockaddr routines for
link-layer socket addresses (sockaddr_dl).

Cosmetic:

        Constify.  KNF.  Stop open-coding LIST_FOREACH, TAILQ_FOREACH,
        et cetera.  Use NULL instead of 0 for null pointers.  Use
        __arraycount().  Reduce gratuitous parenthesization.

        Stop using variadic arguments for rip6_output(), it is
        unnecessary.

        Remove the unnecessary rtentry member rt_genmask and the
        code to maintain it, since nothing actually used it.

        Make rt_maskedcopy() easier to read by using meaningful variable
        names.

        Extract a subroutine intern_netmask() for looking up a netmask in
        the masks table.

        Start converting backslash-ridden IPv6 macros in
        sys/netinet6/in6_var.h into inline subroutines that one
        can read without special eyeglasses.

One functional change: when the kernel serves an RTM_GET, RTM_LOCK,
or RTM_CHANGE request, it applies the netmask (if supplied) to a
destination before searching for it in the forwarding table.

I have changed sys/netinet/ip_carp.c, carp_setroute(), to remove
the unlawful radix_node knowledge.

Apart from the changes to carp(4), netiso, ATM, and strip(4), I
have run the changes on three nodes in my wireless routing testbed,
which involves IPv4 + IPv6 dynamic routing acrobatics, and it's
working beautifully so far.

Revision 1.183.2.4 / (download) - annotate - [select for diffs], Sun Jul 15 13:27:52 2007 UTC (15 years, 6 months ago) by ad
Branch: vmlocking
Changes since 1.183.2.3: +6 -10 lines
Diff to previous 1.183.2.3 (colored)

Sync with head.

Revision 1.183.4.1 / (download) - annotate - [select for diffs], Wed Jul 11 20:10:52 2007 UTC (15 years, 6 months ago) by mjf
Branch: mjf-ufs-trans
Changes since 1.183: +199 -215 lines
Diff to previous 1.183 (colored) next main 1.184 (colored)

Sync with head.

Revision 1.193 / (download) - annotate - [select for diffs], Mon Jul 9 21:10:59 2007 UTC (15 years, 6 months ago) by ad
Branch: MAIN
CVS Tags: nick-csl-alignment-base, mjf-ufs-trans-base
Branch point for: nick-csl-alignment
Changes since 1.192: +4 -4 lines
Diff to previous 1.192 (colored)

Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements

Revision 1.183.2.3 / (download) - annotate - [select for diffs], Sun Jul 1 21:50:42 2007 UTC (15 years, 7 months ago) by ad
Branch: vmlocking
Changes since 1.183.2.2: +4 -4 lines
Diff to previous 1.183.2.2 (colored)

Adapt to callout API change.

Revision 1.183.2.2 / (download) - annotate - [select for diffs], Sat Jun 9 23:58:10 2007 UTC (15 years, 7 months ago) by ad
Branch: vmlocking
Changes since 1.183.2.1: +56 -60 lines
Diff to previous 1.183.2.1 (colored)

Sync with head.

Revision 1.192 / (download) - annotate - [select for diffs], Sat Jun 9 03:07:21 2007 UTC (15 years, 7 months ago) by dyoung
Branch: MAIN
Changes since 1.191: +6 -10 lines
Diff to previous 1.191 (colored)

Get rid of radix_node_head.rnh_walktree, because it is only ever
set to rn_walktree.

Introduce rt_walktree(), which applies a subroutine to every route
in a particular address family.  Use it instead of rn_walktree()
virtually everywhere.  This helps to hide the routing table
implementation.

Revision 1.191 / (download) - annotate - [select for diffs], Fri Jun 1 15:41:15 2007 UTC (15 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.190: +6 -8 lines
Diff to previous 1.190 (colored)

- fix unused variable when none of the compat options are defined.
- remove debugging

Revision 1.190 / (download) - annotate - [select for diffs], Fri Jun 1 09:35:47 2007 UTC (15 years, 8 months ago) by enami
Branch: MAIN
Changes since 1.189: +26 -32 lines
Diff to previous 1.189 (colored)

Fix some bugs in ifconf():
- maintain space left correctly.  the pointer is advanced by the size
  of struct ifreq when length of address is small.
- single sizeof operator is enough to take the size of struct.
- the type of `sz' must be singed type since it is/was compared against to
  the variable which may become negative.
- no need to traverse rest of interfaces once we got an error.  note that
  the latter `break' statement was inside inner loop.

Revision 1.189 / (download) - annotate - [select for diffs], Thu May 31 02:56:50 2007 UTC (15 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.188: +5 -4 lines
Diff to previous 1.188 (colored)

provide the minimum ifreq size (when sockaddr is empty)

Revision 1.188 / (download) - annotate - [select for diffs], Wed May 30 21:02:03 2007 UTC (15 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.187: +2 -18 lines
Diff to previous 1.187 (colored)

Move the nasty ifdefs in one place. Requested by ad and dyoung.

Revision 1.187 / (download) - annotate - [select for diffs], Tue May 29 22:05:01 2007 UTC (15 years, 8 months ago) by xtraeme
Branch: MAIN
Changes since 1.186: +3 -3 lines
Diff to previous 1.186 (colored)

Initialize oifr to fix build with COMPAT_40.

Revision 1.186 / (download) - annotate - [select for diffs], Tue May 29 21:32:29 2007 UTC (15 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.185: +44 -25 lines
Diff to previous 1.185 (colored)

Add a sockaddr_storage member to "struct ifreq" maintaining backwards
compatibility with the older ioctls. This avoids stack smashing and
abuse of "struct sockaddr" when ioctls placed "struct sockaddr_foo's" that
were longer than "struct sockaddr".
XXX: Some of the emulations might be broken; I tried to add code for
them but I did not test them.

Revision 1.183.2.1 / (download) - annotate - [select for diffs], Tue Apr 10 13:26:46 2007 UTC (15 years, 9 months ago) by ad
Branch: vmlocking
Changes since 1.183: +140 -148 lines
Diff to previous 1.183 (colored)

Sync with head.

Revision 1.183.6.1 / (download) - annotate - [select for diffs], Thu Mar 29 19:27:58 2007 UTC (15 years, 10 months ago) by reinoud
Branch: reinoud-bufcleanup
Changes since 1.183: +140 -148 lines
Diff to previous 1.183 (colored) next main 1.184 (colored)

Pullup to -current

Revision 1.180.2.3 / (download) - annotate - [select for diffs], Sat Mar 24 14:56:08 2007 UTC (15 years, 10 months ago) by yamt
Branch: yamt-idlelwp
Changes since 1.180.2.2: +140 -148 lines
Diff to previous 1.180.2.2 (colored) to branchpoint 1.180 (colored) next main 1.181 (colored)

sync with head.

Revision 1.185 / (download) - annotate - [select for diffs], Sun Mar 18 20:59:38 2007 UTC (15 years, 10 months ago) by dyoung
Branch: MAIN
CVS Tags: yamt-idlelwp-base8, thorpej-atomic-base, thorpej-atomic
Changes since 1.184: +134 -142 lines
Diff to previous 1.184 (colored)

KNF: compare pointers with NULL instead of 0, and do not "test
     truth" of either integers or pointers, so that it's clear
     what's going on.  Remove superfluous () from return statements.
     bcmp -> memcmp, bcopy -> memcpy.

Misc. cosmetic: join some lines, remove a few empty lines, remove
spaces from type casts.  Don't open-code IFNET_FOREACH().  Shorten
some staircases.

Revision 1.184 / (download) - annotate - [select for diffs], Sun Mar 18 20:05:52 2007 UTC (15 years, 10 months ago) by dyoung
Branch: MAIN
Changes since 1.183: +8 -8 lines
Diff to previous 1.183 (colored)

The departure of IPv6 interfaces does not agree with pf.  The pfil
hooks that signal the interface's departure run before IPv6 sends
messages to indicate that it is leaving its multicast groups; when
pf filters the departure messages, it does not recognize the output
interface, so it complains at the departure of gre65, for example:

pf_test6: kif == NULL, if_xname gre65

I have changed if_detach() so that it calls pr_usrreq(PRU_PURGEIF)
before pfil_run_hooks(PFIL_IFNET_DETACH), instead of the other way
around.  That quiets the pf_test6: messages.

Revision 1.180.2.2 / (download) - annotate - [select for diffs], Mon Mar 12 05:59:09 2007 UTC (15 years, 10 months ago) by rmind
Branch: yamt-idlelwp
Changes since 1.180.2.1: +19 -19 lines
Diff to previous 1.180.2.1 (colored) to branchpoint 1.180 (colored)

Sync with HEAD.

Revision 1.183 / (download) - annotate - [select for diffs], Sun Mar 4 06:03:15 2007 UTC (15 years, 11 months ago) by christos
Branch: MAIN
Branch point for: vmlocking, reinoud-bufcleanup, mjf-ufs-trans
Changes since 1.182: +19 -19 lines
Diff to previous 1.182 (colored)

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.

Revision 1.180.2.1 / (download) - annotate - [select for diffs], Tue Feb 27 16:54:39 2007 UTC (15 years, 11 months ago) by yamt
Branch: yamt-idlelwp
Changes since 1.180: +5 -5 lines
Diff to previous 1.180 (colored)

- sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.

Revision 1.159.2.3 / (download) - annotate - [select for diffs], Mon Feb 26 09:11:32 2007 UTC (15 years, 11 months ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.159.2.2: +5 -5 lines
Diff to previous 1.159.2.2 (colored)

sync with head.

Revision 1.182 / (download) - annotate - [select for diffs], Thu Feb 22 09:23:38 2007 UTC (15 years, 11 months ago) by dyoung
Branch: MAIN
CVS Tags: ad-audiomp-base, ad-audiomp
Changes since 1.181: +4 -4 lines
Diff to previous 1.181 (colored)

Cosmetic: use TAILQ_EMPTY, TAILQ_FOREACH.

Revision 1.181 / (download) - annotate - [select for diffs], Sat Feb 17 22:34:07 2007 UTC (15 years, 11 months ago) by dyoung
Branch: MAIN
Changes since 1.180: +3 -3 lines
Diff to previous 1.180 (colored)

KNF: de-__P, bzero -> memset, bcmp -> memcmp.  Remove extraneous
   parentheses in return statements.

Cosmetic: don't open-code TAILQ_FOREACH().

Cosmetic: change types of variables to avoid oodles of casts: in
   in6_src.c, avoid casts by changing several route_in6 pointers
   to struct route pointers.  Remove unnecessary casts to caddr_t
   elsewhere.

Pave the way for eliminating address family-specific route caches:
   soon, struct route will not embed a sockaddr, but it will hold
   a reference to an external sockaddr, instead.  We will set the
   destination sockaddr using rtcache_setdst().  (I created a stub
   for it, but it isn't used anywhere, yet.)  rtcache_free() will
   free the sockaddr.  I have extracted from rtcache_free() a helper
   subroutine, rtcache_clear().  rtcache_clear() will "forget" a
   cached route, but it will not forget the destination by releasing
   the sockaddr.  I use rtcache_clear() instead of rtcache_free()
   in rtcache_update(), because rtcache_update() is not supposed
   to forget the destination.

Constify:

   1 Introduce const accessor for route->ro_dst, rtcache_getdst().

   2 Constify the 'dst' argument to ifnet->if_output().  This
     led me to constify a lot of code called by output routines.

   3 Constify the sockaddr argument to protosw->pr_ctlinput.  This
     led me to constify a lot of code called by ctlinput routines.

   4 Introduce const macros for converting from a generic sockaddr
     to family-specific sockaddrs, e.g., sockaddr_in: satocsin6,
     satocsin, et cetera.

Revision 1.168.2.2 / (download) - annotate - [select for diffs], Fri Jan 12 01:04:11 2007 UTC (16 years ago) by ad
Branch: newlock2
Changes since 1.168.2.1: +38 -39 lines
Diff to previous 1.168.2.1 (colored) to branchpoint 1.168 (colored) next main 1.169 (colored)

Sync with head.

Revision 1.159.2.2 / (download) - annotate - [select for diffs], Sat Dec 30 20:50:20 2006 UTC (16 years, 1 month ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.159.2.1: +71 -105 lines
Diff to previous 1.159.2.1 (colored)

sync with head.

Revision 1.168.4.2 / (download) - annotate - [select for diffs], Sun Dec 10 07:19:00 2006 UTC (16 years, 1 month ago) by yamt
Branch: yamt-splraiseipl
Changes since 1.168.4.1: +72 -67 lines
Diff to previous 1.168.4.1 (colored) to branchpoint 1.168 (colored) next main 1.169 (colored)

sync with head.

Revision 1.180 / (download) - annotate - [select for diffs], Sun Dec 3 19:17:41 2006 UTC (16 years, 2 months ago) by dyoung
Branch: MAIN
CVS Tags: yamt-splraiseipl-base5, yamt-splraiseipl-base4, yamt-splraiseipl-base3, post-newlock2-merge, newlock2-nbase, newlock2-base
Branch point for: yamt-idlelwp
Changes since 1.179: +3 -3 lines
Diff to previous 1.179 (colored)

Fix spelling, s/straglers/stragglers/.

Revision 1.179 / (download) - annotate - [select for diffs], Sat Dec 2 20:48:13 2006 UTC (16 years, 2 months ago) by dyoung
Branch: MAIN
Changes since 1.178: +6 -2 lines
Diff to previous 1.178 (colored)

In if_rt_walktree(), make absolutely certain not to leave a dangling
pointer, rt_ifp, from an rtentry to an interface that we are going
to destroy.

Revision 1.178 / (download) - annotate - [select for diffs], Mon Nov 20 04:09:25 2006 UTC (16 years, 2 months ago) by dyoung
Branch: MAIN
CVS Tags: wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4, matt-nb4-arm-base, matt-nb4-arm
Changes since 1.177: +33 -38 lines
Diff to previous 1.177 (colored)

"Reform" TAILQ usage:

Obey the TAILQ abstraction while removing ifaddrs from an interface
in if_detach; just restart the loop after removing one or more
ifaddrs from the interface.

Convert a bunch of for (ifa = TAILQ_FIRST(); ifa; ifa = TAILQ_NEXT())
loops to TAILQ_FOREACH().

Remove some superfluous parentheses while I am here.

Revision 1.139.2.1.4.1 / (download) - annotate - [select for diffs], Sun Nov 19 17:30:11 2006 UTC (16 years, 2 months ago) by bouyer
Branch: netbsd-2-1
Changes since 1.139.2.1: +10 -6 lines
Diff to previous 1.139.2.1 (colored) next main 1.139.2.2 (colored)

Pull up following revision(s) (requested by adrianp in ticket #10759):
	sys/net/if.c: revision 1.172 via patch
	sys/net/if.c: revision 1.173 via patch
	sys/net/if.c: revision 1.175 via patch
Avoid kernel memory disclose in if_clone_list().

Revision 1.139.2.2 / (download) - annotate - [select for diffs], Sun Nov 19 17:29:30 2006 UTC (16 years, 2 months ago) by bouyer
Branch: netbsd-2-0
Changes since 1.139.2.1: +10 -6 lines
Diff to previous 1.139.2.1 (colored) to branchpoint 1.139 (colored) next main 1.140 (colored)

Pull up following revision(s) (requested by adrianp in ticket #10759):
	sys/net/if.c: revision 1.172 via patch
	sys/net/if.c: revision 1.173 via patch
	sys/net/if.c: revision 1.175 via patch
Avoid kernel memory disclose in if_clone_list().

Revision 1.139.2.1.2.1 / (download) - annotate - [select for diffs], Sun Nov 19 17:28:42 2006 UTC (16 years, 2 months ago) by bouyer
Branch: netbsd-2
Changes since 1.139.2.1: +10 -6 lines
Diff to previous 1.139.2.1 (colored) next main 1.139.2.2 (colored)

Pull up following revision(s) (requested by adrianp in ticket #10759):
	sys/net/if.c: revision 1.172 via patch
	sys/net/if.c: revision 1.173 via patch
	sys/net/if.c: revision 1.175 via patch
Avoid kernel memory disclose in if_clone_list().

Revision 1.168.2.1 / (download) - annotate - [select for diffs], Sat Nov 18 21:39:29 2006 UTC (16 years, 2 months ago) by ad
Branch: newlock2
Changes since 1.168: +27 -21 lines
Diff to previous 1.168 (colored)

Sync with head.

Revision 1.177 / (download) - annotate - [select for diffs], Thu Nov 16 01:33:40 2006 UTC (16 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.176: +13 -13 lines
Diff to previous 1.176 (colored)

__unused removal on arguments; approved by core.

Revision 1.176 / (download) - annotate - [select for diffs], Mon Nov 13 05:13:40 2006 UTC (16 years, 2 months ago) by dyoung
Branch: MAIN
Changes since 1.175: +4 -7 lines
Diff to previous 1.175 (colored)

Add a source-address selection policy mechanism to the kernel.

Also, add ioctls SIOCGIFADDRPREF/SIOCSIFADDRPREF to get/set preference
numbers for addresses.  Make ifconfig(8) set/display preference
numbers.

To activate source-address selection policies in your kernel, add
'options IPSELSRC' to your kernel configuration.

Miscellaneous changes in support of source-address selection:

        1 Factor out some common code, producing rt_replace_ifa().

        2 Abbreviate a for-loop with TAILQ_FOREACH().

        3 Add the predicates on IPv4 addresses IN_LINKLOCAL() and
          IN_PRIVATE(), that are true for link-local unicast
          (169.254/16) and RFC1918 private addresses, respectively.
          Add the predicate IN_ANY_LOCAL() that is true for link-local
          unicast and multicast.

        4 Add IPv4-specific interface attach/detach routines,
          in_domifattach and in_domifdetach, which build #ifdef
          IPSELSRC.

See in_getifa(9) for a more thorough description of source-address
selection policy.

Revision 1.154.2.3 / (download) - annotate - [select for diffs], Fri Oct 27 18:55:16 2006 UTC (16 years, 3 months ago) by ghen
Branch: netbsd-3
CVS Tags: netbsd-3-1-RELEASE, netbsd-3-1-1-RELEASE, netbsd-3-1
Changes since 1.154.2.2: +8 -4 lines
Diff to previous 1.154.2.2 (colored) to branchpoint 1.154 (colored) next main 1.155 (colored)

Pull up following revision(s) (requested by christos in ticket #1572):
	sys/net/if.c: revision 1.175
Use strncpy to copy out interface names so that the trailing part of the
buffer is zeroed, and check for overflow.

Revision 1.154.2.1.2.2 / (download) - annotate - [select for diffs], Fri Oct 27 18:55:11 2006 UTC (16 years, 3 months ago) by ghen
Branch: netbsd-3-0
CVS Tags: netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE
Changes since 1.154.2.1.2.1: +8 -4 lines
Diff to previous 1.154.2.1.2.1 (colored) to branchpoint 1.154.2.1 (colored) next main 1.154.2.2 (colored)

Pull up following revision(s) (requested by christos in ticket #1572):
	sys/net/if.c: revision 1.175
Use strncpy to copy out interface names so that the trailing part of the
buffer is zeroed, and check for overflow.

Revision 1.175 / (download) - annotate - [select for diffs], Fri Oct 27 15:33:11 2006 UTC (16 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.174: +8 -4 lines
Diff to previous 1.174 (colored)

Use strncpy to copy out interface names so that the trailing part of the
buffer is zeroed, and check for overflow.

Revision 1.154.2.2 / (download) - annotate - [select for diffs], Thu Oct 26 10:53:07 2006 UTC (16 years, 3 months ago) by ghen
Branch: netbsd-3
Changes since 1.154.2.1: +4 -4 lines
Diff to previous 1.154.2.1 (colored) to branchpoint 1.154 (colored)

Pull up following revision(s) (requested by christos in ticket #1563):
	sys/net/if.c: revision 1.172
	sys/net/if.c: revision 1.173
use strlcpy instead of strncpy or bcopy to copy the interface name.
fix typo.

Revision 1.154.2.1.2.1 / (download) - annotate - [select for diffs], Thu Oct 26 10:52:57 2006 UTC (16 years, 3 months ago) by ghen
Branch: netbsd-3-0
Changes since 1.154.2.1: +4 -4 lines
Diff to previous 1.154.2.1 (colored)

Pull up following revision(s) (requested by christos in ticket #1563):
	sys/net/if.c: revision 1.172
	sys/net/if.c: revision 1.173
use strlcpy instead of strncpy or bcopy to copy the interface name.
fix typo.

Revision 1.174 / (download) - annotate - [select for diffs], Wed Oct 25 20:28:45 2006 UTC (16 years, 3 months ago) by elad
Branch: MAIN
Changes since 1.173: +12 -7 lines
Diff to previous 1.173 (colored)

Kill some KAUTH_GENERIC_ISSUSER uses.

Revision 1.173 / (download) - annotate - [select for diffs], Sun Oct 22 19:21:26 2006 UTC (16 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.172: +4 -3 lines
Diff to previous 1.172 (colored)

fix typo.

Revision 1.172 / (download) - annotate - [select for diffs], Sun Oct 22 18:24:02 2006 UTC (16 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.171: +5 -6 lines
Diff to previous 1.171 (colored)

use strlcpy instead of strncpy or bcopy to copy the interface name.

Revision 1.171 / (download) - annotate - [select for diffs], Sun Oct 22 13:25:54 2006 UTC (16 years, 3 months ago) by pooka
Branch: MAIN
Changes since 1.170: +5 -5 lines
Diff to previous 1.170 (colored)

be appropriately const poisonous

Revision 1.168.4.1 / (download) - annotate - [select for diffs], Sun Oct 22 06:07:24 2006 UTC (16 years, 3 months ago) by yamt
Branch: yamt-splraiseipl
Changes since 1.168: +13 -13 lines
Diff to previous 1.168 (colored)

sync with head

Revision 1.170 / (download) - annotate - [select for diffs], Fri Oct 13 10:29:41 2006 UTC (16 years, 3 months ago) by hannken
Branch: MAIN
CVS Tags: yamt-splraiseipl-base2
Changes since 1.169: +3 -3 lines
Diff to previous 1.169 (colored)

More __unused (COMPAT_OSOCK not defined).

Revision 1.169 / (download) - annotate - [select for diffs], Thu Oct 12 01:32:27 2006 UTC (16 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.168: +12 -12 lines
Diff to previous 1.168 (colored)

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386

Revision 1.163.4.1 / (download) - annotate - [select for diffs], Sat Sep 9 02:58:06 2006 UTC (16 years, 4 months ago) by rpaulo
Branch: rpaulo-netinet-merge-pcb
Changes since 1.163: +39 -51 lines
Diff to previous 1.163 (colored) next main 1.164 (colored)

sync with head

Revision 1.163.8.3 / (download) - annotate - [select for diffs], Sun Sep 3 15:25:35 2006 UTC (16 years, 5 months ago) by yamt
Branch: yamt-pdpolicy
Changes since 1.163.8.2: +10 -47 lines
Diff to previous 1.163.8.2 (colored) to branchpoint 1.163 (colored) next main 1.164 (colored)

sync with head.

Revision 1.168 / (download) - annotate - [select for diffs], Fri Aug 25 19:33:50 2006 UTC (16 years, 5 months ago) by matt
Branch: MAIN
CVS Tags: yamt-splraiseipl-base, yamt-pdpolicy-base9, yamt-pdpolicy-base8, rpaulo-netinet-merge-pcb-base
Branch point for: yamt-splraiseipl, newlock2
Changes since 1.167: +10 -47 lines
Diff to previous 1.167 (colored)

One step closer to loadable domains.  Store pointers to a domain's soft
interrupt queues so if_detach can remove packets to removed interfaces from
them.  This eliminates a lot of conditional ugly code in if.c

Revision 1.163.8.2 / (download) - annotate - [select for diffs], Fri Aug 11 15:46:14 2006 UTC (16 years, 5 months ago) by yamt
Branch: yamt-pdpolicy
Changes since 1.163.8.1: +6 -8 lines
Diff to previous 1.163.8.1 (colored) to branchpoint 1.163 (colored)

sync with head

Revision 1.167 / (download) - annotate - [select for diffs], Sun Jul 23 22:06:12 2006 UTC (16 years, 6 months ago) by ad
Branch: MAIN
CVS Tags: yamt-pdpolicy-base7, abandoned-netbsd-4-base, abandoned-netbsd-4
Changes since 1.166: +6 -8 lines
Diff to previous 1.166 (colored)

Use the LWP cached credentials where sane.

Revision 1.159.2.1 / (download) - annotate - [select for diffs], Wed Jun 21 15:10:26 2006 UTC (16 years, 7 months ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.159: +122 -159 lines
Diff to previous 1.159 (colored)

sync with head.

Revision 1.163.6.1 / (download) - annotate - [select for diffs], Thu Jun 1 22:38:37 2006 UTC (16 years, 8 months ago) by kardel
Branch: simonb-timecounters
CVS Tags: simonb-timcounters-final
Changes since 1.163: +33 -6 lines
Diff to previous 1.163 (colored) next main 1.164 (colored)

Sync with head.

Revision 1.163.12.1 / (download) - annotate - [select for diffs], Wed May 24 15:50:43 2006 UTC (16 years, 8 months ago) by tron
Branch: peter-altq
Changes since 1.163: +33 -6 lines
Diff to previous 1.163 (colored) next main 1.164 (colored)

Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.

Revision 1.163.8.1 / (download) - annotate - [select for diffs], Wed May 24 10:58:56 2006 UTC (16 years, 8 months ago) by yamt
Branch: yamt-pdpolicy
Changes since 1.163: +33 -6 lines
Diff to previous 1.163 (colored)

sync with head.

Revision 1.166 / (download) - annotate - [select for diffs], Thu May 18 09:05:51 2006 UTC (16 years, 8 months ago) by liamjfoy
Branch: MAIN
CVS Tags: yamt-pdpolicy-base6, yamt-pdpolicy-base5, simonb-timecounters-base, gdamore-uart-base, gdamore-uart, chap-midi-nbase, chap-midi-base, chap-midi
Changes since 1.165: +26 -2 lines
Diff to previous 1.165 (colored)

Integrate Common Address Redundancy Procotol (CARP) from OpenBSD

'pseudo-device	carp'

Thanks to: joerg@ christos@ riz@ and others who tested
Ok: core@

Revision 1.165 / (download) - annotate - [select for diffs], Sun May 14 21:19:33 2006 UTC (16 years, 8 months ago) by elad
Branch: MAIN
Changes since 1.164: +9 -4 lines
Diff to previous 1.164 (colored)

integrate kauth.

Revision 1.163.10.4 / (download) - annotate - [select for diffs], Thu May 11 23:31:08 2006 UTC (16 years, 8 months ago) by elad
Branch: elad-kernelauth
Changes since 1.163.10.3: +2 -4 lines
Diff to previous 1.163.10.3 (colored) to branchpoint 1.163 (colored) next main 1.164 (colored)

sync with head

Revision 1.163.10.3 / (download) - annotate - [select for diffs], Sat May 6 23:31:58 2006 UTC (16 years, 9 months ago) by christos
Branch: elad-kernelauth
Changes since 1.163.10.2: +3 -2 lines
Diff to previous 1.163.10.2 (colored) to branchpoint 1.163 (colored)

- Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
  that need it.

Approved by core.

Revision 1.164 / (download) - annotate - [select for diffs], Mon May 1 18:17:42 2006 UTC (16 years, 9 months ago) by dyoung
Branch: MAIN
CVS Tags: elad-kernelauth-base
Changes since 1.163: +2 -4 lines
Diff to previous 1.163 (colored)

Remove needless "link state changed to DOWN/UP" message.

Revision 1.163.10.2 / (download) - annotate - [select for diffs], Fri Mar 10 15:05:22 2006 UTC (16 years, 10 months ago) by elad
Branch: elad-kernelauth
Changes since 1.163.10.1: +4 -4 lines
Diff to previous 1.163.10.1 (colored) to branchpoint 1.163 (colored)

generic_authorize() -> kauth_authorize_generic().

Revision 1.163.10.1 / (download) - annotate - [select for diffs], Wed Mar 8 01:11:55 2006 UTC (16 years, 11 months ago) by elad
Branch: elad-kernelauth
Changes since 1.163: +8 -4 lines
Diff to previous 1.163 (colored)

Adapt to kernel authorization KPI.

Revision 1.163 / (download) - annotate - [select for diffs], Sun Dec 11 23:05:24 2005 UTC (17 years, 1 month ago) by thorpej
Branch: MAIN
CVS Tags: yamt-uio_vmspace-base5, yamt-uio_vmspace, yamt-pdpolicy-base4, yamt-pdpolicy-base3, yamt-pdpolicy-base2, yamt-pdpolicy-base, peter-altq-base
Branch point for: yamt-pdpolicy, simonb-timecounters, rpaulo-netinet-merge-pcb, peter-altq, elad-kernelauth
Changes since 1.162: +48 -99 lines
Diff to previous 1.162 (colored)

ANSI function decls and application of static.

Revision 1.162 / (download) - annotate - [select for diffs], Sun Dec 11 12:24:51 2005 UTC (17 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.161: +12 -12 lines
Diff to previous 1.161 (colored)

merge ktrace-lwp.

Revision 1.123.2.12 / (download) - annotate - [select for diffs], Thu Nov 10 14:10:32 2005 UTC (17 years, 2 months ago) by skrll
Branch: ktrace-lwp
Changes since 1.123.2.11: +78 -67 lines
Diff to previous 1.123.2.11 (colored) next main 1.124 (colored)

Sync with HEAD. Here we go again...

Revision 1.161 / (download) - annotate - [select for diffs], Sat Sep 24 15:52:03 2005 UTC (17 years, 4 months ago) by christos
Branch: MAIN
CVS Tags: yamt-vop-base3, yamt-vop-base2, yamt-vop-base, yamt-vop, yamt-readahead-pervnode, yamt-readahead-perfile, yamt-readahead-base3, yamt-readahead-base2, yamt-readahead-base, yamt-readahead, thorpej-vnode-attr-base, thorpej-vnode-attr, ktrace-lwp-base
Changes since 1.160: +11 -54 lines
Diff to previous 1.160 (colored)

It is now ``later''. Follow cgd's 1993 wish and move struct osockaddr
and struct omsghdr to a compat header.

Revision 1.154.2.1 / (download) - annotate - [select for diffs], Mon Aug 15 19:04:56 2005 UTC (17 years, 5 months ago) by tron
Branch: netbsd-3
CVS Tags: netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-1-RELEASE
Branch point for: netbsd-3-0
Changes since 1.154: +32 -2 lines
Diff to previous 1.154 (colored)

Pull up revision 1.160 (requested by gdt in ticket #661):
Add PR_PURGEIF flag for protocols to indicate that the protocol might
store a struct ifnet *, and define it for udp/tcp/rawip for INET and
INET6.  When deleting a struct ifnet, invoke PRU_PURGEIF on all
protocols marked with PR_PURGEIF.  Closes PR kern/29580 (mine).

Revision 1.160 / (download) - annotate - [select for diffs], Tue Jul 19 12:58:24 2005 UTC (17 years, 6 months ago) by gdt
Branch: MAIN
Changes since 1.159: +32 -2 lines
Diff to previous 1.159 (colored)

Add PR_PURGEIF flag for protocols to indicate that the protocol might
store a struct ifnet *, and define it for udp/tcp/rawip for INET and
INET6.  When deleting a struct ifnet, invoke PRU_PURGEIF on all
protocols marked with PR_PURGEIF.  Closes PR kern/29580 (mine).

Revision 1.159 / (download) - annotate - [select for diffs], Wed Jun 22 06:16:02 2005 UTC (17 years, 7 months ago) by dyoung
Branch: MAIN
Branch point for: yamt-lazymbuf
Changes since 1.158: +18 -2 lines
Diff to previous 1.158 (colored)

Resolve conflicts in importation of 18-May-2005 ath(4) / net80211(9)
from FreeBSD.  Introduce compatibility shims (sys/dev/ic/ath_netbsd.[ch],
sys/net80211/ieee80211_netbsd.[ch]).  Update drivers (an, atu, atw,
awi, ipw, iwi, rtw, wi) for the new net80211(9) API.

Revision 1.158 / (download) - annotate - [select for diffs], Sun May 29 21:22:52 2005 UTC (17 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.157: +6 -6 lines
Diff to previous 1.157 (colored)

- sprinkle const
- remove unneeded casts
- use more mem*() instead of b*() funcs.

Revision 1.157 / (download) - annotate - [select for diffs], Mon May 2 15:34:32 2005 UTC (17 years, 9 months ago) by yamt
Branch: MAIN
Changes since 1.156: +19 -11 lines
Diff to previous 1.156 (colored)

split IFCAP_CSUM_xxx to IFCAP_CSUM_xxx_Rx and IFCAP_CSUM_xxx_Tx.

Revision 1.151.2.1 / (download) - annotate - [select for diffs], Fri Apr 29 11:29:31 2005 UTC (17 years, 9 months ago) by kent
Branch: kent-audio2
Changes since 1.151: +72 -12 lines
Diff to previous 1.151 (colored) next main 1.152 (colored)

sync with -current

Revision 1.123.2.11 / (download) - annotate - [select for diffs], Fri Apr 1 14:31:34 2005 UTC (17 years, 10 months ago) by skrll
Branch: ktrace-lwp
Changes since 1.123.2.10: +62 -2 lines
Diff to previous 1.123.2.10 (colored)

Sync with HEAD.

Revision 1.156 / (download) - annotate - [select for diffs], Thu Mar 31 21:14:52 2005 UTC (17 years, 10 months ago) by christos
Branch: MAIN
CVS Tags: kent-audio2-base
Changes since 1.155: +4 -4 lines
Diff to previous 1.155 (colored)

fix compiling with -DALTQ

Revision 1.155 / (download) - annotate - [select for diffs], Thu Mar 31 15:48:13 2005 UTC (17 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.154: +62 -2 lines
Diff to previous 1.154 (colored)

factor out the interface queueing code into two functions. One used by
the non point-to-point interfaces that has one queue, and one used by
the point to point interfaces that has two queues. No functional changes.
XXX: The ALTQ stuff makes the code ugly.
XXX: More cleanup to come

Revision 1.153.2.1 / (download) - annotate - [select for diffs], Sat Mar 19 08:36:31 2005 UTC (17 years, 10 months ago) by yamt
Branch: yamt-km
Changes since 1.153: +8 -8 lines
Diff to previous 1.153 (colored) next main 1.154 (colored)

sync with head.  xen and whitespace.  xen part is not finished.

Revision 1.123.2.10 / (download) - annotate - [select for diffs], Fri Mar 4 16:52:56 2005 UTC (17 years, 11 months ago) by skrll
Branch: ktrace-lwp
Changes since 1.123.2.9: +8 -8 lines
Diff to previous 1.123.2.9 (colored)

Sync with HEAD.

Hi Perry!

Revision 1.154 / (download) - annotate - [select for diffs], Sat Feb 26 22:45:09 2005 UTC (17 years, 11 months ago) by perry
Branch: MAIN
CVS Tags: yamt-km-base4, yamt-km-base3, netbsd-3-base
Branch point for: netbsd-3
Changes since 1.153: +8 -8 lines
Diff to previous 1.153 (colored)

nuke trailing whitespace

Revision 1.123.2.9 / (download) - annotate - [select for diffs], Fri Feb 4 11:47:42 2005 UTC (18 years ago) by skrll
Branch: ktrace-lwp
Changes since 1.123.2.8: +3 -3 lines
Diff to previous 1.123.2.8 (colored)

Sync with HEAD.

Revision 1.153 / (download) - annotate - [select for diffs], Mon Jan 24 21:25:09 2005 UTC (18 years ago) by matt
Branch: MAIN
CVS Tags: yamt-km-base2, yamt-km-base
Branch point for: yamt-km
Changes since 1.152: +3 -3 lines
Diff to previous 1.152 (colored)

Add IFNET_FOREACH and IFADDR_FOREACH macros and start using them.

Revision 1.123.2.8 / (download) - annotate - [select for diffs], Mon Jan 24 08:35:53 2005 UTC (18 years ago) by skrll
Branch: ktrace-lwp
Changes since 1.123.2.7: +5 -5 lines
Diff to previous 1.123.2.7 (colored)

Sync with HEAD.

Revision 1.152 / (download) - annotate - [select for diffs], Sun Jan 23 18:41:56 2005 UTC (18 years ago) by matt
Branch: MAIN
Changes since 1.151: +5 -5 lines
Diff to previous 1.151 (colored)

Change initialzie of domains to use link sets.  Switch to using STAILQ.
Add a convenience macro DOMAIN_FOREACH to interate through the domain.

Revision 1.123.2.7 / (download) - annotate - [select for diffs], Mon Jan 17 19:32:38 2005 UTC (18 years ago) by skrll
Branch: ktrace-lwp
Changes since 1.123.2.6: +36 -28 lines
Diff to previous 1.123.2.6 (colored)

Sync with HEAD.

Revision 1.151 / (download) - annotate - [select for diffs], Sun Jan 9 12:18:46 2005 UTC (18 years ago) by yamt
Branch: MAIN
CVS Tags: kent-audio1-beforemerge
Branch point for: kent-audio2
Changes since 1.150: +36 -27 lines
Diff to previous 1.150 (colored)

ifioctl: don't use super user priviledge unless it's needed.

Revision 1.123.2.6 / (download) - annotate - [select for diffs], Sat Dec 18 09:32:50 2004 UTC (18 years, 1 month ago) by skrll
Branch: ktrace-lwp
Changes since 1.123.2.5: +5 -5 lines
Diff to previous 1.123.2.5 (colored)

Sync with HEAD.

Revision 1.150 / (download) - annotate - [select for diffs], Sat Dec 4 23:03:33 2004 UTC (18 years, 2 months ago) by peter
Branch: MAIN
CVS Tags: kent-audio1-base, kent-audio1
Changes since 1.149: +3 -3 lines
Diff to previous 1.149 (colored)

Fix a typo in Bill Studenmund's name.

Revision 1.149 / (download) - annotate - [select for diffs], Sat Dec 4 18:31:43 2004 UTC (18 years, 2 months ago) by peter
Branch: MAIN
Changes since 1.148: +3 -4 lines
Diff to previous 1.148 (colored)

Change ifc_destroy to return an int instead of void, so that it
can pass back errors to ifconfig.

Revision 1.148 / (download) - annotate - [select for diffs], Sat Dec 4 16:10:25 2004 UTC (18 years, 2 months ago) by peter
Branch: MAIN
Changes since 1.147: +3 -2 lines
Diff to previous 1.147 (colored)

Convert lo(4) to a clonable device.

This also removes the loif array and changes all code to use the new
lo0ifp pointer which points to the lo0 ifnet structure.

Approved by christos.

Revision 1.147 / (download) - annotate - [select for diffs], Thu Oct 7 20:06:58 2004 UTC (18 years, 4 months ago) by tron
Branch: MAIN
Changes since 1.146: +6 -13 lines
Diff to previous 1.146 (colored)

Backout last two revision:
1.) There is objection against this change by at least one developer.
2.) These changes cause repeatable system lockups and crashes for
    at least four people.

Revision 1.146 / (download) - annotate - [select for diffs], Wed Oct 6 03:49:03 2004 UTC (18 years, 4 months ago) by itojun
Branch: MAIN
Changes since 1.145: +3 -9 lines
Diff to previous 1.145 (colored)

use ifunit()

Revision 1.145 / (download) - annotate - [select for diffs], Wed Oct 6 02:44:32 2004 UTC (18 years, 4 months ago) by itojun
Branch: MAIN
Changes since 1.144: +19 -6 lines
Diff to previous 1.144 (colored)

call dom_ifattach[] at consistent state.  before this commit, dom_ifattach[]
was called after interface attach is completely done for non-cloning interface,
and from within if_attach() for cloning interface (which was wrong).

Revision 1.123.2.5 / (download) - annotate - [select for diffs], Tue Sep 21 13:36:35 2004 UTC (18 years, 4 months ago) by skrll
Branch: ktrace-lwp
Changes since 1.123.2.4: +9 -8 lines
Diff to previous 1.123.2.4 (colored)

Fix the sync with head I botched.

Revision 1.123.2.4 / (download) - annotate - [select for diffs], Sat Sep 18 14:54:16 2004 UTC (18 years, 4 months ago) by skrll
Branch: ktrace-lwp
Changes since 1.123.2.3: +8 -9 lines
Diff to previous 1.123.2.3 (colored)

Sync with HEAD.

Revision 1.123.2.3 / (download) - annotate - [select for diffs], Tue Aug 3 10:54:11 2004 UTC (18 years, 6 months ago) by skrll
Branch: ktrace-lwp
Changes since 1.123.2.2: +220 -92 lines
Diff to previous 1.123.2.2 (colored)

Sync with HEAD

Revision 1.144 / (download) - annotate - [select for diffs], Tue Jul 27 12:22:59 2004 UTC (18 years, 6 months ago) by yamt
Branch: MAIN
Changes since 1.143: +7 -4 lines
Diff to previous 1.143 (colored)

- rename PFIL_NEWIF to PFIL_IFNET, and handle interface detach events
  as well.
- use it for pf(4).

mostly from Peter Postma.  PR/26403.

Revision 1.143 / (download) - annotate - [select for diffs], Tue Jun 22 12:50:41 2004 UTC (18 years, 7 months ago) by itojun
Branch: MAIN
Changes since 1.142: +14 -2 lines
Diff to previous 1.142 (colored)

prepare PF-related hooks.  reviewed by matt, perry, christos

Revision 1.139.2.1 / (download) - annotate - [select for diffs], Fri May 28 07:24:37 2004 UTC (18 years, 8 months ago) by tron
Branch: netbsd-2-0
CVS Tags: netbsd-2-base, netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE
Branch point for: netbsd-2-1, netbsd-2
Changes since 1.139: +12 -7 lines
Diff to previous 1.139 (colored)

Pull up revision 1.142 (requested by atatat in ticket #391):
Sysctl descriptions under net subtree (net.key not done)

Revision 1.142 / (download) - annotate - [select for diffs], Tue May 25 04:33:59 2004 UTC (18 years, 8 months ago) by atatat
Branch: MAIN
Changes since 1.141: +12 -7 lines
Diff to previous 1.141 (colored)

Sysctl descriptions under net subtree (net.key not done)

Revision 1.141 / (download) - annotate - [select for diffs], Thu Apr 22 01:01:40 2004 UTC (18 years, 9 months ago) by matt
Branch: MAIN
Changes since 1.140: +3 -3 lines
Diff to previous 1.140 (colored)

Constify protosw arrays.  This can reduce the kernel .data section by
over 4K (if all the network protocols) are loaded.

Revision 1.140 / (download) - annotate - [select for diffs], Wed Apr 21 04:17:28 2004 UTC (18 years, 9 months ago) by matt
Branch: MAIN
Changes since 1.139: +33 -28 lines
Diff to previous 1.139 (colored)

Constify if.c radix.c and route.c (and fix related fallout).

Revision 1.139 / (download) - annotate - [select for diffs], Wed Mar 24 15:34:54 2004 UTC (18 years, 10 months ago) by atatat
Branch: MAIN
CVS Tags: netbsd-2-0-base
Branch point for: netbsd-2-0
Changes since 1.138: +25 -16 lines
Diff to previous 1.138 (colored)

Tango on sysctl_createv() and flags.  The flags have all been renamed,
and sysctl_createv() now uses more arguments.

Revision 1.104.4.4 / (download) - annotate - [select for diffs], Fri Mar 12 06:00:37 2004 UTC (18 years, 10 months ago) by jmc
Branch: netbsd-1-6
Changes since 1.104.4.3: +10 -6 lines
Diff to previous 1.104.4.3 (colored) to branchpoint 1.104 (colored) next main 1.105 (colored)

Pullup rev 1.131 (requested by briggs in ticket #1560)

Fix out-of-bounds access to ifindex2ifnet[].

Revision 1.138 / (download) - annotate - [select for diffs], Thu Jan 29 16:33:14 2004 UTC (19 years ago) by drochner
Branch: MAIN
Changes since 1.137: +4 -2 lines
Diff to previous 1.137 (colored)

make it compile with !(INET || INET6)

Revision 1.137 / (download) - annotate - [select for diffs], Wed Dec 10 11:46:33 2003 UTC (19 years, 1 month ago) by itojun
Branch: MAIN
Changes since 1.136: +7 -6 lines
Diff to previous 1.136 (colored)

use if_indexlim (instead of if_index) and ifindex2ifnet[x] != NULL
to check if interface exists, as (1) if_index has different meaning
(2) ifindex2ifnet could become NULL when interface gets destroyed,
since when we have introduced dynamically-created interfaces.  from kame

Revision 1.136 / (download) - annotate - [select for diffs], Thu Dec 4 19:38:24 2003 UTC (19 years, 2 months ago) by atatat
Branch: MAIN
Changes since 1.135: +63 -35 lines
Diff to previous 1.135 (colored)

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al.  Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded.  Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment.  I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.

Revision 1.135 / (download) - annotate - [select for diffs], Fri Nov 28 08:56:48 2003 UTC (19 years, 2 months ago) by keihan
Branch: MAIN
Changes since 1.134: +3 -3 lines
Diff to previous 1.134 (colored)

s/netbsd.org/NetBSD.org/g

Revision 1.134 / (download) - annotate - [select for diffs], Tue Nov 11 20:33:46 2003 UTC (19 years, 2 months ago) by drochner
Branch: MAIN
Changes since 1.133: +9 -6 lines
Diff to previous 1.133 (colored)

fix interface address list traversal in if_detach():
The code was assuming that interface addresses are removed one-by-one.
With IPv6 and multicasts, removal of one address can remove other
addresses as side effect, which caused accesses of free()d memory.

Revision 1.133 / (download) - annotate - [select for diffs], Mon Nov 10 20:03:29 2003 UTC (19 years, 2 months ago) by jonathan
Branch: MAIN
Changes since 1.132: +40 -2 lines
Diff to previous 1.132 (colored)

Make per-protocol network input queue stats visible to userland via
sysctl. Add a protocol-independent sysctl handler to show the per-protocol
"struct ifq' statistics. Add IP(v4) specific call to the handler.
Other protocols can show their per-protocol input statistics by
allocating a sysclt node and calling sysctl_ifq() with their own struct ifq *.

As posted to tech-kern plus improvements/cleanup suggested by Andrew Brown.

Revision 1.132 / (download) - annotate - [select for diffs], Mon Oct 13 08:02:56 2003 UTC (19 years, 3 months ago) by dyoung
Branch: MAIN
Changes since 1.131: +4 -3 lines
Diff to previous 1.131 (colored)

Use new 802.11 header files.

Revision 1.131 / (download) - annotate - [select for diffs], Wed Oct 1 04:22:33 2003 UTC (19 years, 4 months ago) by itojun
Branch: MAIN
Changes since 1.130: +10 -6 lines
Diff to previous 1.130 (colored)

fix out-of-bounds access to ifindex2ifnet[].  found by iij seil team.

Revision 1.104.4.3 / (download) - annotate - [select for diffs], Wed Sep 10 19:00:09 2003 UTC (19 years, 4 months ago) by tron
Branch: netbsd-1-6
CVS Tags: netbsd-1-6-PATCH002-RELEASE, netbsd-1-6-PATCH002-RC4, netbsd-1-6-PATCH002-RC3, netbsd-1-6-PATCH002-RC2, netbsd-1-6-PATCH002-RC1, netbsd-1-6-PATCH002
Changes since 1.104.4.2: +23 -18 lines
Diff to previous 1.104.4.2 (colored) to branchpoint 1.104 (colored)

Pull up revision 1.128-1.130 via patch (requested by itojun in ticket #1406):
correct if_clone_lookup().  based on diff from Quentin Garnier
fix INT_MAX check in if_clone_lookup
correct number range handling.  David Young

Revision 1.130 / (download) - annotate - [select for diffs], Thu Aug 14 07:39:22 2003 UTC (19 years, 5 months ago) by itojun
Branch: MAIN
Changes since 1.129: +3 -3 lines
Diff to previous 1.129 (colored)

correct number range handling.  David Young

Revision 1.129 / (download) - annotate - [select for diffs], Thu Aug 14 00:19:43 2003 UTC (19 years, 5 months ago) by itojun
Branch: MAIN
Changes since 1.128: +4 -5 lines
Diff to previous 1.128 (colored)

fix INT_MAX check in if_clone_lookup

Revision 1.128 / (download) - annotate - [select for diffs], Thu Aug 14 00:13:34 2003 UTC (19 years, 5 months ago) by itojun
Branch: MAIN
Changes since 1.127: +22 -16 lines
Diff to previous 1.127 (colored)

correct if_clone_lookup().  based on diff from Quentin Garnier

Revision 1.127 / (download) - annotate - [select for diffs], Sat Aug 9 18:13:03 2003 UTC (19 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.126: +40 -28 lines
Diff to previous 1.126 (colored)

Fix problem with OSIOCIFCONF where it tried to copyout addresses that
did not fit in struct osockaddr. Fixes linux emulation issue where bogus
addresses where returned for the interfaces [AF_LINK, AF_INET6]. While
I am here, change ioctl, so if the ifconf buffer passed is NULL, then it
computes how much space is needed and returns it in ifc_len.

Revision 1.126 / (download) - annotate - [select for diffs], Thu Aug 7 16:32:49 2003 UTC (19 years, 6 months ago) by agc
Branch: MAIN
Changes since 1.125: +3 -7 lines
Diff to previous 1.125 (colored)

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.

Revision 1.125 / (download) - annotate - [select for diffs], Tue Jul 15 06:24:38 2003 UTC (19 years, 6 months ago) by itojun
Branch: MAIN
Changes since 1.124: +6 -3 lines
Diff to previous 1.124 (colored)

decnetintrq is still in fddi/tokenring (is it needed?).

Revision 1.124 / (download) - annotate - [select for diffs], Sun Jul 6 07:54:43 2003 UTC (19 years, 7 months ago) by dyoung
Branch: MAIN
Changes since 1.123: +3 -2 lines
Diff to previous 1.123 (colored)

Prepare to consolidate 802.11 media handling (which is handled in
code duplicated by each driver, now) into the 802.11 framework.

Revision 1.123.2.2 / (download) - annotate - [select for diffs], Wed Jul 2 21:48:15 2003 UTC (19 years, 7 months ago) by wrstuden
Branch: ktrace-lwp
Changes since 1.123.2.1: +3 -3 lines
Diff to previous 1.123.2.1 (colored)

Check in lwp-ification changes needed to get the evbarm/IQ80321 kernel
to compile.

only question I have is over the:
l->l_proc->p_stats->p_ru.ru_msgsnd++;
command at line 245 of dev/kttcp.c. Should we be doing per-lwp or
per-proc accounting?

Revision 1.123.2.1 / (download) - annotate - [select for diffs], Wed Jul 2 15:26:56 2003 UTC (19 years, 7 months ago) by darrenr
Branch: ktrace-lwp
Changes since 1.123: +8 -7 lines
Diff to previous 1.123 (colored)

Apply the aborted ktrace-lwp changes to a specific branch.  This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it.  This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.

Revision 1.123 / (download) - annotate - [select for diffs], Sun Jun 29 22:31:50 2003 UTC (19 years, 7 months ago) by fvdl
Branch: MAIN
Branch point for: ktrace-lwp
Changes since 1.122: +7 -8 lines
Diff to previous 1.122 (colored)

Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.

Revision 1.122 / (download) - annotate - [select for diffs], Sun Jun 29 10:13:11 2003 UTC (19 years, 7 months ago) by ichiro
Branch: MAIN
Changes since 1.121: +3 -3 lines
Diff to previous 1.121 (colored)

missing ')'

Revision 1.121 / (download) - annotate - [select for diffs], Sat Jun 28 14:22:06 2003 UTC (19 years, 7 months ago) by darrenr
Branch: MAIN
Changes since 1.120: +8 -7 lines
Diff to previous 1.120 (colored)

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V

Revision 1.120 / (download) - annotate - [select for diffs], Mon Jun 23 11:02:08 2003 UTC (19 years, 7 months ago) by martin
Branch: MAIN
Changes since 1.119: +4 -2 lines
Diff to previous 1.119 (colored)

Make sure to include opt_foo.h if a defflag option FOO is used.

Revision 1.104.4.2 / (download) - annotate - [select for diffs], Thu Jun 19 02:39:52 2003 UTC (19 years, 7 months ago) by grant
Branch: netbsd-1-6
Changes since 1.104.4.1: +30 -37 lines
Diff to previous 1.104.4.1 (colored) to branchpoint 1.104 (colored)

Apply patch (requested by itojun in ticket #1290):

AF_LINK sockaddr has to be attached to ifp->if_addrlist until the end,
as many of the code assumes that TAILQ_FIRST(ifp->if_addrlist) is
non-null.

Revision 1.119 / (download) - annotate - [select for diffs], Mon May 19 22:17:24 2003 UTC (19 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.118: +5 -4 lines
Diff to previous 1.118 (colored)

add COMPAT_ULTRIX where necessary. Thanks gimpy!

Revision 1.118 / (download) - annotate - [select for diffs], Fri May 16 16:57:09 2003 UTC (19 years, 8 months ago) by itojun
Branch: MAIN
Changes since 1.117: +30 -37 lines
Diff to previous 1.117 (colored)

AF_LINK sockaddr has to be attached to ifp->if_addrlist until the end,
as many of the code assumes that TAILQ_FIRST(ifp->if_addrlist) is non-null.

Revision 1.117 / (download) - annotate - [select for diffs], Sat Feb 1 06:23:46 2003 UTC (20 years ago) by thorpej
Branch: MAIN
Changes since 1.116: +5 -2 lines
Diff to previous 1.116 (colored)

Add extensible malloc types, adapted from FreeBSD.  This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant.  Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.

Revision 1.86.2.16 / (download) - annotate - [select for diffs], Mon Nov 11 22:14:56 2002 UTC (20 years, 2 months ago) by nathanw
Branch: nathanw_sa
CVS Tags: nathanw_sa_end
Changes since 1.86.2.15: +1 -1 lines
Diff to previous 1.86.2.15 (colored) next main 1.87 (colored)

Catch up to -current

Revision 1.116 / (download) - annotate - [select for diffs], Sat Nov 2 07:26:53 2002 UTC (20 years, 3 months ago) by perry
Branch: MAIN
CVS Tags: nathanw_sa_before_merge, nathanw_sa_base, gmcgarry_ucred_base, gmcgarry_ucred, gmcgarry_ctxsw_base, gmcgarry_ctxsw, fvdl_fs64_base
Changes since 1.115: +3 -3 lines
Diff to previous 1.115 (colored)

/*CONTCOND*/ while (0)'ed macros

Revision 1.104.4.1 / (download) - annotate - [select for diffs], Fri Nov 1 10:56:17 2002 UTC (20 years, 3 months ago) by tron
Branch: netbsd-1-6
CVS Tags: netbsd-1-6-PATCH001-RELEASE, netbsd-1-6-PATCH001-RC3, netbsd-1-6-PATCH001-RC2, netbsd-1-6-PATCH001-RC1, netbsd-1-6-PATCH001
Changes since 1.104: +42 -2 lines
Diff to previous 1.104 (colored)

Pull up revision 1.105 (requested by martin in ticket #32):
Add SIOCGIFDATA and SIOCZIFDATA ioctl's to get interface data.  (the Z
variant also zeroes the counters after copying them).  In ifunit, add
support for dealing all numeric ifname by treating them as an ifindex
which is used to look up the interface.

Revision 1.86.2.15 / (download) - annotate - [select for diffs], Fri Oct 18 02:45:10 2002 UTC (20 years, 3 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.86.2.14: +3 -1 lines
Diff to previous 1.86.2.14 (colored)

Catch up to -current.

Revision 1.91.2.6 / (download) - annotate - [select for diffs], Thu Oct 10 18:43:39 2002 UTC (20 years, 3 months ago) by jdolecek
Branch: kqueue
Changes since 1.91.2.5: +5 -3 lines
Diff to previous 1.91.2.5 (colored) next main 1.92 (colored)

sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work

Revision 1.115 / (download) - annotate - [select for diffs], Fri Sep 27 15:37:50 2002 UTC (20 years, 4 months ago) by provos
Branch: MAIN
CVS Tags: kqueue-beforemerge, kqueue-base, kqueue-aftermerge
Changes since 1.114: +3 -3 lines
Diff to previous 1.114 (colored)

remove trailing \n in panic().  approved perry.

Revision 1.114 / (download) - annotate - [select for diffs], Fri Sep 27 04:08:40 2002 UTC (20 years, 4 months ago) by onoe
Branch: MAIN
Changes since 1.113: +4 -2 lines
Diff to previous 1.113 (colored)

Add check suser() for SIOCS80211BSSID, SIOCS80211CHANNEL.

Revision 1.91.2.5 / (download) - annotate - [select for diffs], Fri Sep 6 08:48:48 2002 UTC (20 years, 5 months ago) by jdolecek
Branch: kqueue
Changes since 1.91.2.4: +5 -5 lines
Diff to previous 1.91.2.4 (colored)

sync kqueue branch with HEAD

Revision 1.104.2.3 / (download) - annotate - [select for diffs], Thu Aug 29 00:56:40 2002 UTC (20 years, 5 months ago) by gehenna
Branch: gehenna-devsw
Changes since 1.104.2.2: +5 -5 lines
Diff to previous 1.104.2.2 (colored) to branchpoint 1.104 (colored) next main 1.105 (colored)

catch up with -current.

Revision 1.86.2.14 / (download) - annotate - [select for diffs], Tue Aug 27 23:47:49 2002 UTC (20 years, 5 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.86.2.13: +2 -2 lines
Diff to previous 1.86.2.13 (colored)

Catch up to -current.

Revision 1.113 / (download) - annotate - [select for diffs], Mon Aug 26 01:36:37 2002 UTC (20 years, 5 months ago) by thorpej
Branch: MAIN
CVS Tags: gehenna-devsw-base
Changes since 1.112: +4 -4 lines
Diff to previous 1.112 (colored)

Fix signed/unsigned comparison warnings from GCC 3.3.

Revision 1.86.2.13 / (download) - annotate - [select for diffs], Thu Aug 1 02:46:36 2002 UTC (20 years, 6 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.86.2.12: +3 -3 lines
Diff to previous 1.86.2.12 (colored)

Catch up to -current.

Revision 1.112 / (download) - annotate - [select for diffs], Fri Jul 26 14:11:35 2002 UTC (20 years, 6 months ago) by wiz
Branch: MAIN
Changes since 1.111: +3 -3 lines
Diff to previous 1.111 (colored)

Spell '[Rr]ight' correctly. From Jim Bernard.

Revision 1.86.2.12 / (download) - annotate - [select for diffs], Mon Jul 15 20:29:01 2002 UTC (20 years, 6 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.86.2.11: +3 -4 lines
Diff to previous 1.86.2.11 (colored)

Whitespace.

Revision 1.86.2.11 / (download) - annotate - [select for diffs], Fri Jul 12 01:40:27 2002 UTC (20 years, 6 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.86.2.10: +2 -3 lines
Diff to previous 1.86.2.10 (colored)

No longer need to pull in lwp.h; proc.h pulls it in for us.

Revision 1.86.2.10 / (download) - annotate - [select for diffs], Mon Jun 24 22:11:26 2002 UTC (20 years, 7 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.86.2.9: +3 -3 lines
Diff to previous 1.86.2.9 (colored)

Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).

Revision 1.91.2.4 / (download) - annotate - [select for diffs], Sun Jun 23 17:50:21 2002 UTC (20 years, 7 months ago) by jdolecek
Branch: kqueue
Changes since 1.91.2.3: +88 -12 lines
Diff to previous 1.91.2.3 (colored)

catch up with -current on kqueue branch

Revision 1.104.2.2 / (download) - annotate - [select for diffs], Thu Jun 20 15:52:05 2002 UTC (20 years, 7 months ago) by gehenna
Branch: gehenna-devsw
Changes since 1.104.2.1: +11 -3 lines
Diff to previous 1.104.2.1 (colored) to branchpoint 1.104 (colored)

catch up with -current.

Revision 1.86.2.9 / (download) - annotate - [select for diffs], Thu Jun 20 03:48:08 2002 UTC (20 years, 7 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.86.2.8: +87 -12 lines
Diff to previous 1.86.2.8 (colored)

Catch up to -current.

Revision 1.111 / (download) - annotate - [select for diffs], Thu Jun 13 05:12:12 2002 UTC (20 years, 7 months ago) by itojun
Branch: MAIN
Changes since 1.110: +3 -3 lines
Diff to previous 1.110 (colored)

typo

Revision 1.110 / (download) - annotate - [select for diffs], Sat Jun 8 11:58:50 2002 UTC (20 years, 8 months ago) by itojun
Branch: MAIN
Changes since 1.109: +5 -2 lines
Diff to previous 1.109 (colored)

need to protect if_attachdomain() too

Revision 1.109 / (download) - annotate - [select for diffs], Sat Jun 8 11:54:24 2002 UTC (20 years, 8 months ago) by itojun
Branch: MAIN
Changes since 1.108: +7 -2 lines
Diff to previous 1.108 (colored)

protect dom_ifattach by splnet

Revision 1.104.2.1 / (download) - annotate - [select for diffs], Thu May 30 13:52:24 2002 UTC (20 years, 8 months ago) by gehenna
Branch: gehenna-devsw
Changes since 1.104: +76 -11 lines
Diff to previous 1.104 (colored)

Catch up with -current.

Revision 1.108 / (download) - annotate - [select for diffs], Thu May 30 05:06:28 2002 UTC (20 years, 8 months ago) by itojun
Branch: MAIN
Changes since 1.107: +3 -11 lines
Diff to previous 1.107 (colored)

improve nd6_setmtu(), to warn too-small MTU on SIOCSIFMTU.  sync w/kame

Revision 1.107 / (download) - annotate - [select for diffs], Mon May 27 13:46:45 2002 UTC (20 years, 8 months ago) by itojun
Branch: MAIN
Changes since 1.106: +24 -6 lines
Diff to previous 1.106 (colored)

re-scan all ifnet after domaininit() for if_afdata initialization.

Revision 1.106 / (download) - annotate - [select for diffs], Mon May 27 02:53:49 2002 UTC (20 years, 8 months ago) by itojun
Branch: MAIN
Changes since 1.105: +17 -2 lines
Diff to previous 1.105 (colored)

framework to add af-dependent data structure to struct ifnet.
as discussed at bsd-api-discuss.  sync w/kame

Revision 1.105 / (download) - annotate - [select for diffs], Thu May 23 21:34:39 2002 UTC (20 years, 8 months ago) by matt
Branch: MAIN
Changes since 1.104: +42 -2 lines
Diff to previous 1.104 (colored)

Add SIOCGIFDATA and SIOCZIFDATA ioctl's to get interface data.  (the Z
variant also zeroes the counters after copying them).  In ifunit, add
support for dealing all numeric ifname by treating them as an ifindex
which is used to look up the interface.

Revision 1.104 / (download) - annotate - [select for diffs], Sun May 12 20:40:11 2002 UTC (20 years, 8 months ago) by matt
Branch: MAIN
CVS Tags: netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1
Branch point for: netbsd-1-6, gehenna-devsw
Changes since 1.103: +6 -4 lines
Diff to previous 1.103 (colored)

Eliminate more commons.

Revision 1.86.2.8 / (download) - annotate - [select for diffs], Mon Apr 1 07:48:18 2002 UTC (20 years, 10 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.86.2.7: +3 -2 lines
Diff to previous 1.86.2.7 (colored)

Catch up to -current.
(CVS: It's not just a program. It's an adventure!)

Revision 1.103 / (download) - annotate - [select for diffs], Sun Mar 17 10:21:42 2002 UTC (20 years, 10 months ago) by simonb
Branch: MAIN
CVS Tags: eeh-devprop-base, eeh-devprop
Changes since 1.102: +3 -2 lines
Diff to previous 1.102 (colored)

Make the 'ifnet' variable an extern and declare it in if.c.

Revision 1.91.2.3 / (download) - annotate - [select for diffs], Sat Mar 16 16:02:04 2002 UTC (20 years, 10 months ago) by jdolecek
Branch: kqueue
Changes since 1.91.2.2: +38 -6 lines
Diff to previous 1.91.2.2 (colored)

Catch up with -current.

Revision 1.86.2.7 / (download) - annotate - [select for diffs], Thu Feb 28 04:14:59 2002 UTC (20 years, 11 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.86.2.6: +38 -6 lines
Diff to previous 1.86.2.6 (colored)

Catch up to -current.

Revision 1.102 / (download) - annotate - [select for diffs], Sat Feb 9 05:56:34 2002 UTC (20 years, 11 months ago) by atatat
Branch: MAIN
CVS Tags: newlock-base, newlock, ifpoll-base
Changes since 1.101: +38 -6 lines
Diff to previous 1.101 (colored)

(1) Make if_index "wrap" at USHRT_MAX instead of going above it so
that other parts of the kernel won't lose gratuitously.  There are
places where it's assumed that it won't grow that large.

(2) Avoid accidental reuse of occupied slots in the ifindex2ifnet[]
table.

Revision 1.91.2.2 / (download) - annotate - [select for diffs], Thu Jan 10 20:02:00 2002 UTC (21 years ago) by thorpej
Branch: kqueue
Changes since 1.91.2.1: +43 -16 lines
Diff to previous 1.91.2.1 (colored)

Sync kqueue branch with -current.

Revision 1.86.2.6 / (download) - annotate - [select for diffs], Tue Jan 8 00:33:51 2002 UTC (21 years, 1 month ago) by nathanw
Branch: nathanw_sa
Changes since 1.86.2.5: +8 -2 lines
Diff to previous 1.86.2.5 (colored)

Catch up to -current.

Revision 1.101 / (download) - annotate - [select for diffs], Sun Dec 2 19:44:25 2001 UTC (21 years, 2 months ago) by abs
Branch: MAIN
Changes since 1.100: +5 -2 lines
Diff to previous 1.100 (colored)

Add an #if defined(INET) ... around if_detach_queues's declaration to match the
one around its definition.

Revision 1.100 / (download) - annotate - [select for diffs], Tue Nov 27 17:32:57 2001 UTC (21 years, 2 months ago) by augustss
Branch: MAIN
Changes since 1.99: +5 -2 lines
Diff to previous 1.99 (colored)

Make it compile in the absence of networks.  Closes PR 14274 (mine).

Revision 1.86.2.5 / (download) - annotate - [select for diffs], Wed Nov 14 19:17:19 2001 UTC (21 years, 2 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.86.2.4: +7 -4 lines
Diff to previous 1.86.2.4 (colored)

Catch up to -current.

Revision 1.99 / (download) - annotate - [select for diffs], Mon Nov 12 23:49:34 2001 UTC (21 years, 2 months ago) by lukem
Branch: MAIN
Changes since 1.98: +4 -1 lines
Diff to previous 1.98 (colored)

add RCSIDs

Revision 1.97.2.1 / (download) - annotate - [select for diffs], Mon Nov 12 21:19:17 2001 UTC (21 years, 2 months ago) by thorpej
Branch: thorpej-mips-cache
Changes since 1.97: +4 -4 lines
Diff to previous 1.97 (colored) next main 1.98 (colored)

Sync the thorpej-mips-cache branch with -current.

Revision 1.98 / (download) - annotate - [select for diffs], Mon Nov 5 18:02:15 2001 UTC (21 years, 3 months ago) by matt
Branch: MAIN
CVS Tags: thorpej-mips-cache-base
Changes since 1.97: +4 -4 lines
Diff to previous 1.97 (colored)

Switch to using queue access macros instead of refering to the member
fields explicitly.

Revision 1.96.2.1 / (download) - annotate - [select for diffs], Mon Oct 1 12:47:32 2001 UTC (21 years, 4 months ago) by fvdl
Branch: thorpej-devvp
Changes since 1.96: +31 -13 lines
Diff to previous 1.96 (colored) next main 1.97 (colored)

Catch up with -current.

Revision 1.86.2.4 / (download) - annotate - [select for diffs], Fri Sep 21 22:36:44 2001 UTC (21 years, 4 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.86.2.3: +31 -13 lines
Diff to previous 1.86.2.3 (colored)

Catch up to -current.

Revision 1.97 / (download) - annotate - [select for diffs], Mon Sep 17 17:26:59 2001 UTC (21 years, 4 months ago) by thorpej
Branch: MAIN
CVS Tags: thorpej-devvp-base3, thorpej-devvp-base2
Branch point for: thorpej-mips-cache
Changes since 1.96: +31 -13 lines
Diff to previous 1.96 (colored)

Split the pre-computed ifnet checksum flags into Tx and Rx directions.
Add capabilities bits that indicate an interface can only perform
in-bound TCPv4 or UDPv4 checksums.  There is at least one Gig-E chip
for which this is true (Level One LXT-1001), and this is also the
case for the Intel i82559 10/100 Ethernet chips.

Revision 1.86.2.3 / (download) - annotate - [select for diffs], Fri Aug 24 00:12:06 2001 UTC (21 years, 5 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.86.2.2: +84 -6 lines
Diff to previous 1.86.2.2 (colored)

Catch up with -current.

Revision 1.91.2.1 / (download) - annotate - [select for diffs], Fri Aug 3 04:13:49 2001 UTC (21 years, 6 months ago) by lukem
Branch: kqueue
Changes since 1.91: +84 -6 lines
Diff to previous 1.91 (colored)

update to -current

Revision 1.96 / (download) - annotate - [select for diffs], Thu Aug 2 01:42:38 2001 UTC (21 years, 6 months ago) by itojun
Branch: MAIN
CVS Tags: thorpej-devvp-base, pre-chs-ubcperf, post-chs-ubcperf
Branch point for: thorpej-devvp
Changes since 1.95: +8 -4 lines
Diff to previous 1.95 (colored)

fix logic to free up ifqueue on if_detach().  prev pointer was incorrectly set.

Revision 1.95 / (download) - annotate - [select for diffs], Sun Jul 29 03:28:30 2001 UTC (21 years, 6 months ago) by itojun
Branch: MAIN
Changes since 1.94: +73 -1 lines
Diff to previous 1.94 (colored)

make sure to cleanup software interrupt queues (like ipintrq)
on interface detach, otherwise we will have a dangling pointer
from m->m_pkthdr.rcvif.

Revision 1.94 / (download) - annotate - [select for diffs], Sat Jul 28 01:13:56 2001 UTC (21 years, 6 months ago) by itojun
Branch: MAIN
Changes since 1.93: +2 -2 lines
Diff to previous 1.93 (colored)

indent fix

Revision 1.93 / (download) - annotate - [select for diffs], Tue Jul 24 16:35:29 2001 UTC (21 years, 6 months ago) by itojun
Branch: MAIN
Changes since 1.92: +3 -1 lines
Diff to previous 1.92 (colored)

clear ifindex2ifnet[] on if_detach.

Revision 1.92 / (download) - annotate - [select for diffs], Wed Jul 18 16:43:09 2001 UTC (21 years, 6 months ago) by thorpej
Branch: MAIN
Changes since 1.91: +5 -5 lines
Diff to previous 1.91 (colored)

bzero -> memset

Revision 1.86.2.2 / (download) - annotate - [select for diffs], Thu Jun 21 20:07:55 2001 UTC (21 years, 7 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.86.2.1: +77 -11 lines
Diff to previous 1.86.2.1 (colored)

Catch up to -current.

Revision 1.91 / (download) - annotate - [select for diffs], Thu Jun 14 05:44:23 2001 UTC (21 years, 7 months ago) by itojun
Branch: MAIN
Branch point for: kqueue
Changes since 1.90: +3 -1 lines
Diff to previous 1.90 (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.90 / (download) - annotate - [select for diffs], Thu Jun 7 13:26:48 2001 UTC (21 years, 8 months ago) by mrg
Branch: MAIN
Changes since 1.89: +2 -2 lines
Diff to previous 1.89 (colored)

make ifioctl() compat lkm friendly.

Revision 1.89 / (download) - annotate - [select for diffs], Sat Jun 2 16:17:08 2001 UTC (21 years, 8 months ago) by thorpej
Branch: MAIN
Changes since 1.88: +57 -6 lines
Diff to previous 1.88 (colored)

Implement support for IP/TCP/UDP checksum offloading provided by
network interfaces.  This works by pre-computing the pseudo-header
checksum and caching it, delaying the actual checksum to ip_output()
if the hardware cannot perform the sum for us.  In-bound checksums
can either be fully-checked by hardware, or summed up for final
verification by software.  This method was modeled after how this
is done in FreeBSD, although the code is significantly different in
most places.

We don't delay checksums for IPv6/TCP, but we do take advantage of the
cached pseudo-header checksum.

Note: hardware-assisted checksumming defaults to "off".  It is
enabled with ifconfig(8).  See the manual page for details.

Implement hardware-assisted checksumming on the DP83820 Gigabit Ethernet,
3c90xB/3c90xC 10/100 Ethernet, and Alteon Tigon/Tigon2 Gigabit Ethernet.

Revision 1.52.2.7 / (download) - annotate - [select for diffs], Sat Apr 21 17:46:36 2001 UTC (21 years, 9 months ago) by bouyer
Branch: thorpej_scsipi
Changes since 1.52.2.6: +21 -8 lines
Diff to previous 1.52.2.6 (colored) to branchpoint 1.52 (colored) next main 1.53 (colored)

Sync with HEAD

Revision 1.88 / (download) - annotate - [select for diffs], Fri Apr 13 23:30:11 2001 UTC (21 years, 9 months ago) by thorpej
Branch: MAIN
CVS Tags: thorpej_scsipi_nbase, thorpej_scsipi_beforemerge, thorpej_scsipi_base
Changes since 1.87: +8 -8 lines
Diff to previous 1.87 (colored)

Remove the use of splimp() from the NetBSD kernel.  splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.

Revision 1.87 / (download) - annotate - [select for diffs], Tue Apr 10 21:45:39 2001 UTC (21 years, 9 months ago) by thorpej
Branch: MAIN
Changes since 1.86: +14 -1 lines
Diff to previous 1.86 (colored)

Add a PFIL_HOOKS filtering point to every network interface.

Revision 1.52.2.6 / (download) - annotate - [select for diffs], Mon Mar 12 13:31:47 2001 UTC (21 years, 10 months ago) by bouyer
Branch: thorpej_scsipi
Changes since 1.52.2.5: +18 -1 lines
Diff to previous 1.52.2.5 (colored) to branchpoint 1.52 (colored)

Sync with HEAD.

Revision 1.86.2.1 / (download) - annotate - [select for diffs], Mon Mar 5 22:49:53 2001 UTC (21 years, 11 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.86: +4 -2 lines
Diff to previous 1.86 (colored)

Initial commit of scheduler activations and lightweight process support.

Revision 1.86 / (download) - annotate - [select for diffs], Sat Mar 3 03:29:20 2001 UTC (21 years, 11 months ago) by thorpej
Branch: MAIN
Branch point for: nathanw_sa
Changes since 1.85: +16 -1 lines
Diff to previous 1.85 (colored)

Add some missing ALTQ initialization, pointed out by
Kenjiro Cho <kjc@csl.sony.co.jp>.

Revision 1.85 / (download) - annotate - [select for diffs], Tue Feb 20 15:35:20 2001 UTC (21 years, 11 months ago) by itojun
Branch: MAIN
Changes since 1.84: +3 -1 lines
Diff to previous 1.84 (colored)

add SIOC[SG]LIFPHYADDR ioctl.  greatly simplify tunnel address settings.
sync with kame.  old ioctls are supplied but not recommended for new code.

Revision 1.52.2.5 / (download) - annotate - [select for diffs], Sun Feb 11 19:17:08 2001 UTC (21 years, 11 months ago) by bouyer
Branch: thorpej_scsipi
Changes since 1.52.2.4: +9 -1 lines
Diff to previous 1.52.2.4 (colored) to branchpoint 1.52 (colored)

Sync with HEAD.

Revision 1.84 / (download) - annotate - [select for diffs], Mon Jan 29 01:49:43 2001 UTC (22 years ago) by thorpej
Branch: MAIN
Changes since 1.83: +9 -1 lines
Diff to previous 1.83 (colored)

if_alloc_sadl(): if the interface already has a link name, free
it before assigning a new one.  This is useful for interfaces
that may change their link names in the course of their existence.

Revision 1.52.2.4 / (download) - annotate - [select for diffs], Thu Jan 18 09:23:48 2001 UTC (22 years ago) by bouyer
Branch: thorpej_scsipi
Changes since 1.52.2.3: +91 -42 lines
Diff to previous 1.52.2.3 (colored) to branchpoint 1.52 (colored)

Sync with head (for UBC+NFS fixes, mostly).

Revision 1.83 / (download) - annotate - [select for diffs], Wed Jan 17 09:34:48 2001 UTC (22 years ago) by itojun
Branch: MAIN
Changes since 1.82: +2 -1 lines
Diff to previous 1.82 (colored)

configure sdl_alen properly

Revision 1.82 / (download) - annotate - [select for diffs], Wed Jan 17 04:05:41 2001 UTC (22 years ago) by itojun
Branch: MAIN
Changes since 1.81: +4 -4 lines
Diff to previous 1.81 (colored)

pull post-4.4BSD change to sys/net/route.c from BSD/OS 4.2 (UCB copyrighted).

have sys/net/route.c:rtrequest1(), which takes rt_addrinfo * as the argument.
pass rt_addrinfo all the way down to rtrequest, and ifa->ifa_rtrequest.
3rd arg of ifa->ifa_rtrequest is now rt_addrinfo * instead of sockaddr *
(almost noone is using it anyways).

benefit: the follwoing command now works.  previously we need two route(8)
invocations, "add" then "change".
# route add -inet6 default ::1 -ifp gif0

remove unsafe typecast in rtrequest(), from rtentry * to sockaddr *.  it was
introduced by 4.3BSD-reno and never corrected.

XXX is eon_rtrequest() change correct regarding to 3rd arg?
eon_rtrequest() and rtrequest() were incorrect since 4.3BSD-reno,
so i do not have correct answer in the source code.
someone with more clue about netiso-over-ip, please help.

Revision 1.81 / (download) - annotate - [select for diffs], Wed Jan 17 00:30:50 2001 UTC (22 years ago) by thorpej
Branch: MAIN
Changes since 1.80: +88 -40 lines
Diff to previous 1.80 (colored)

Fix a rather annoying problem where the sockaddr_dl which holds
the link level name for the interface (ifp->if_sadl) is allocated
before ifp->if_addrlen is initialized, which could lead to allocating
too little space for the link level address.

Do this by splitting allocation of the link level name out of
if_attach() and into if_alloc_sadl(), which is normally called
by functions like ether_ifattach().  Network interfaces which
don't have a link-specific attach routine must call if_alloc_sadl()
themselves (example: gif).

Link level names are freed by if_free_sadl(), which can be called
from e.g. ether_ifdetach().  Drivers never need call if_free_sadl()
themselves as if_detach() will do it if it is not already done.

While here, add the ability to pass an AF_LINK address to
SIOCSIFADDR in ether_ioctl() (this is what caused me to notice
the problem that the above fixes).

Revision 1.52.2.3 / (download) - annotate - [select for diffs], Fri Jan 5 17:36:49 2001 UTC (22 years, 1 month ago) by bouyer
Branch: thorpej_scsipi
Changes since 1.52.2.2: +5 -20 lines
Diff to previous 1.52.2.2 (colored) to branchpoint 1.52 (colored)

Sync with HEAD

Revision 1.62.4.6 / (download) - annotate - [select for diffs], Sun Dec 31 17:57:40 2000 UTC (22 years, 1 month ago) by jhawk
Branch: netbsd-1-5
CVS Tags: netbsd-1-5-PATCH003, netbsd-1-5-PATCH002, netbsd-1-5-PATCH001
Changes since 1.62.4.5: +164 -1 lines
Diff to previous 1.62.4.5 (colored) to branchpoint 1.62 (colored) next main 1.63 (colored)

Pull up revisions 1.63-1.64, 1.67 (requested by bouyer):
  Support cloning of network pseudo-interfaces.

Revision 1.80 / (download) - annotate - [select for diffs], Mon Dec 18 21:05:04 2000 UTC (22 years, 1 month ago) by thorpej
Branch: MAIN
Changes since 1.79: +5 -1 lines
Diff to previous 1.79 (colored)

Add SIOCGIFDLT, which will fetch the data link type (DLT_* constant)
for a given network interface.

Revision 1.79 / (download) - annotate - [select for diffs], Mon Dec 18 18:54:47 2000 UTC (22 years, 1 month ago) by thorpej
Branch: MAIN
Changes since 1.78: +1 -12 lines
Diff to previous 1.78 (colored)

Commit to the ALTQ glue.

Revision 1.78 / (download) - annotate - [select for diffs], Thu Dec 14 17:47:26 2000 UTC (22 years, 1 month ago) by thorpej
Branch: MAIN
Changes since 1.77: +2 -2 lines
Diff to previous 1.77 (colored)

Change an if_qflush() to an IFQ_PURGE() to deal with ALTQ correctly.

Revision 1.77 / (download) - annotate - [select for diffs], Wed Dec 13 22:06:05 2000 UTC (22 years, 1 month ago) by thorpej
Branch: MAIN
Changes since 1.76: +2 -10 lines
Diff to previous 1.76 (colored)

In if_qflush(), use IFQ_PURGE() rathen than an open-coded version.

Revision 1.52.2.2 / (download) - annotate - [select for diffs], Wed Dec 13 15:50:28 2000 UTC (22 years, 1 month ago) by bouyer
Branch: thorpej_scsipi
Changes since 1.52.2.1: +2 -1 lines
Diff to previous 1.52.2.1 (colored) to branchpoint 1.52 (colored)

Sync with HEAD (for UBC fixes).

Revision 1.76 / (download) - annotate - [select for diffs], Tue Dec 12 17:48:29 2000 UTC (22 years, 1 month ago) by thorpej
Branch: MAIN
Changes since 1.75: +2 -1 lines
Diff to previous 1.75 (colored)

Only allow superuser to change 802.11 power params.

Revision 1.52.2.1 / (download) - annotate - [select for diffs], Mon Nov 20 18:09:56 2000 UTC (22 years, 2 months ago) by bouyer
Branch: thorpej_scsipi
Changes since 1.52: +682 -146 lines
Diff to previous 1.52 (colored)

Update thorpej_scsipi to -current as of a month ago

Revision 1.75 / (download) - annotate - [select for diffs], Wed Oct 11 16:52:34 2000 UTC (22 years, 3 months ago) by thorpej
Branch: MAIN
Changes since 1.74: +13 -3 lines
Diff to previous 1.74 (colored)

Change the if_reset vector to if_init, and add an if_stop.  if_stop
also takes an argument indicating whether or not the interface should
also be disabled (i.e. power removed, resources freed, etc.)

Revision 1.62.4.5 / (download) - annotate - [select for diffs], Sat Oct 7 23:09:44 2000 UTC (22 years, 4 months ago) by itojun
Branch: netbsd-1-5
CVS Tags: netbsd-1-5-RELEASE, netbsd-1-5-BETA2, netbsd-1-5-BETA
Changes since 1.62.4.4: +3 -1 lines
Diff to previous 1.62.4.4 (colored) to branchpoint 1.62 (colored)

pullup 1.73 -> 1.74 (approved by eleng-1-5)
repair SIOCGIFP{DST,SRC}ADDR.

Revision 1.74 / (download) - annotate - [select for diffs], Sat Oct 7 03:41:38 2000 UTC (22 years, 4 months ago) by itojun
Branch: MAIN
Changes since 1.73: +3 -1 lines
Diff to previous 1.73 (colored)

repair SIOCGIFP{DST,SRC}ADDR.

Revision 1.62.4.4 / (download) - annotate - [select for diffs], Fri Oct 6 07:00:31 2000 UTC (22 years, 4 months ago) by itojun
Branch: netbsd-1-5
Changes since 1.62.4.3: +7 -1 lines
Diff to previous 1.62.4.3 (colored) to branchpoint 1.62 (colored)

pullup (approved by releng-1-5)
move privilege check for SIOCSIFPHY* from in{,6}_control to ifioctl.
fix privilege check mistakes (which allows non-root user to modify gif
physical address in some cases).  sync with kame.
 > cvs rdiff -r1.62 -r1.63 syssrc/sys/netinet/in.c
 > cvs rdiff -r1.34 -r1.35 syssrc/sys/netinet6/in6.c
 > cvs rdiff -r1.71 -r1.73 syssrc/sys/net/if.c

Revision 1.73 / (download) - annotate - [select for diffs], Wed Oct 4 22:37:41 2000 UTC (22 years, 4 months ago) by itojun
Branch: MAIN
Changes since 1.72: +1 -6 lines
Diff to previous 1.72 (colored)

ifp->if_ioctl may be NULL, so check it for SIOCSIFPHY*.

Revision 1.72 / (download) - annotate - [select for diffs], Wed Oct 4 21:12:40 2000 UTC (22 years, 4 months ago) by thorpej
Branch: MAIN
Changes since 1.71: +12 -1 lines
Diff to previous 1.71 (colored)

Make sure we're super-user for SIOCSIFPHYADDR, SIOCDIFPHYADDR,
and SIOCSIFPHYADDR_IN6.

Revision 1.62.4.3 / (download) - annotate - [select for diffs], Mon Oct 2 20:54:46 2000 UTC (22 years, 4 months ago) by mellon
Branch: netbsd-1-5
Changes since 1.62.4.2: +34 -23 lines
Diff to previous 1.62.4.2 (colored) to branchpoint 1.62 (colored)

Pull up 1.69-1.70 - kernel portion of fix for PR#10968 (jhawk approved)

Revision 1.71 / (download) - annotate - [select for diffs], Sun Oct 1 23:16:07 2000 UTC (22 years, 4 months ago) by thorpej
Branch: MAIN
Changes since 1.70: +6 -5 lines
Diff to previous 1.70 (colored)

Change the behavior of ifpromisc() slightly.  If interface is not IFF_UP,
attempting to enable promisc would result in ENETDOWN.  Change this to
allow the interface to always be placed in promiscuous mode, regardless
of IFF_UP.  When the interface does come up, the IFF_PROMISC flag will
be consulted, and this matches the behavior that disabling promiscuous
mode has.

Revision 1.70 / (download) - annotate - [select for diffs], Fri Sep 29 00:37:37 2000 UTC (22 years, 4 months ago) by mellon
Branch: MAIN
Changes since 1.69: +34 -23 lines
Diff to previous 1.69 (colored)

- Figure out how long if list buffer needs to be if it's too short (fixes
  PR#10968).

Revision 1.62.4.2 / (download) - annotate - [select for diffs], Fri Jul 21 18:56:02 2000 UTC (22 years, 6 months ago) by onoe
Branch: netbsd-1-5
CVS Tags: netbsd-1-5-ALPHA2
Changes since 1.62.4.1: +2 -1 lines
Diff to previous 1.62.4.1 (colored) to branchpoint 1.62 (colored)

Pullup 802.11 stuff (approved by jhawk)
- add support for nwkey to ifconfig
	basesrc/sbin/ifconfig/ifconfig.c		1.88
	basesrc/sbin/ifconfig/ifconfig.8		1.39
	syssrc/sys/dev/ic/awi.c				1.26
	syssrc/sys/dev/ic/awi_wep.c			1.3
	syssrc/sys/dev/ic/awivar.h			1.12
	syssrc/sys/dev/pcmcia/if_wi.c			1.26
	syssrc/sys/net/if.c				1.69
	syssrc/sys/net/if_ieee80211.h			1.5

Revision 1.62.4.1 / (download) - annotate - [select for diffs], Fri Jul 21 18:49:22 2000 UTC (22 years, 6 months ago) by onoe
Branch: netbsd-1-5
Changes since 1.62: +4 -1 lines
Diff to previous 1.62 (colored)

Pull up 802.11 stuff (approved by jhawk)
- check priviledge for SIOCS80211NWID
	syssrc/sys/dev/ic/awi.c				1.23, 1.25
	syssrc/sys/net/if.c				1.66

Revision 1.69 / (download) - annotate - [select for diffs], Fri Jul 21 04:47:40 2000 UTC (22 years, 6 months ago) by onoe
Branch: MAIN
Changes since 1.68: +2 -1 lines
Diff to previous 1.68 (colored)

add following two ioctls to handle WEP key for IEEE 802.11 wireless
LAN drivers: SIOCS80211NWKEY and SIOCG80211NWKEY.

Revision 1.68 / (download) - annotate - [select for diffs], Thu Jul 20 22:00:48 2000 UTC (22 years, 6 months ago) by pk
Branch: MAIN
Changes since 1.67: +2 -2 lines
Diff to previous 1.67 (colored)

Missing increment on ifp->if_pcount.

Revision 1.67 / (download) - annotate - [select for diffs], Thu Jul 20 18:40:27 2000 UTC (22 years, 6 months ago) by thorpej
Branch: MAIN
Changes since 1.66: +43 -1 lines
Diff to previous 1.66 (colored)

Add a SIOCGIFCLONERS ioctl, which fetches a list of network
interface cloners from the kernel.

Revision 1.66 / (download) - annotate - [select for diffs], Wed Jul 19 06:00:39 2000 UTC (22 years, 6 months ago) by onoe
Branch: MAIN
Changes since 1.65: +4 -1 lines
Diff to previous 1.65 (colored)

moved the check priviledge for SIOCS80211NWID from each driver to ifioctl().
it also fixes the problem that non-priviledged user can change nwid
for wi and ray drivers.

Revision 1.65 / (download) - annotate - [select for diffs], Tue Jul 4 18:46:49 2000 UTC (22 years, 7 months ago) by thorpej
Branch: MAIN
Changes since 1.64: +52 -1 lines
Diff to previous 1.64 (colored)

Move ifpromimsc() to if.c

Revision 1.64 / (download) - annotate - [select for diffs], Tue Jul 4 01:51:22 2000 UTC (22 years, 7 months ago) by thorpej
Branch: MAIN
Changes since 1.63: +6 -3 lines
Diff to previous 1.63 (colored)

Oops, restrict SIOCIF{CREATE,DESTROY} to super-user.

Revision 1.63 / (download) - annotate - [select for diffs], Sun Jul 2 00:20:48 2000 UTC (22 years, 7 months ago) by thorpej
Branch: MAIN
Changes since 1.62: +119 -1 lines
Diff to previous 1.62 (colored)

Add the notion of "cloning" of network pseudo-interface (e.g. `gif').
This allows them to be created and destroyed on the fly via ifconfig(8),
rather than specifying the count in the kernel configuration file.

Revision 1.48.2.2 / (download) - annotate - [select for diffs], Sun Apr 30 12:51:05 2000 UTC (22 years, 9 months ago) by he
Branch: netbsd-1-4
CVS Tags: netbsd-1-4-PATCH003
Changes since 1.48.2.1: +16 -6 lines
Diff to previous 1.48.2.1 (colored) to branchpoint 1.48 (colored) next main 1.49 (colored)

Pull up revision 1.62 (via patch, requested by bouyer):
  Fix ifa_ifwithnet() for the netatalk case to properly return the
  best match and not the first match.  Makes netatalk work again
  on networks without AppleTalk routers.  Fixes PR#9957.

Revision 1.62 / (download) - annotate - [select for diffs], Wed Apr 26 13:38:13 2000 UTC (22 years, 9 months ago) by bouyer
Branch: MAIN
CVS Tags: netbsd-1-5-base, minoura-xpg4dl-base, minoura-xpg4dl
Branch point for: netbsd-1-5
Changes since 1.61: +13 -4 lines
Diff to previous 1.61 (colored)

ifa_ifwithnet(): for the netatalk case, don't blindly return the first match
but try to find a exact match first. Closes kern/9957.

Revision 1.61 / (download) - annotate - [select for diffs], Thu Mar 30 09:45:34 2000 UTC (22 years, 10 months ago) by augustss
Branch: MAIN
Changes since 1.60: +36 -36 lines
Diff to previous 1.60 (colored)

Kill some more register declarations.

Revision 1.60 / (download) - annotate - [select for diffs], Thu Mar 30 02:31:59 2000 UTC (22 years, 10 months ago) by simonb
Branch: MAIN
Changes since 1.59: +1 -11 lines
Diff to previous 1.59 (colored)

Delete redundant decls of if_slowtimo and if_null{output,input,start,
ioctl,reset,watchdog,drain} - they're in <net/if.h>.

Revision 1.59 / (download) - annotate - [select for diffs], Thu Mar 23 07:03:24 2000 UTC (22 years, 10 months ago) by thorpej
Branch: MAIN
Changes since 1.58: +7 -2 lines
Diff to previous 1.58 (colored)

New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
  resource allocation.
- Insertion and removal of callouts is constant time, important as
  this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.

Revision 1.58 / (download) - annotate - [select for diffs], Wed Mar 22 11:34:15 2000 UTC (22 years, 10 months ago) by itojun
Branch: MAIN
Changes since 1.57: +1 -30 lines
Diff to previous 1.57 (colored)

remove if_withname, which was merged in by mistake during KAME merge.

Revision 1.57 / (download) - annotate - [select for diffs], Mon Mar 6 20:49:00 2000 UTC (22 years, 11 months ago) by thorpej
Branch: MAIN
Changes since 1.56: +9 -1 lines
Diff to previous 1.56 (colored)

- Add link status to if_data, so that routing daemons and other interested
  parties can easily know the state of a link.
- Define an interface announcement message for the routing socket so that
  routing daemons and other interested parties know when an interface
  is attached/detached.

Revision 1.56 / (download) - annotate - [select for diffs], Sun Feb 6 16:43:33 2000 UTC (23 years ago) by thorpej
Branch: MAIN
CVS Tags: chs-ubc2-newbase
Changes since 1.55: +38 -28 lines
Diff to previous 1.55 (colored)

In if_detach(), call PRU_PURGEIF for *every* protocol within a domain
that has a usrreq entry point.  Each protocol may have its own PCB
tables that need to be purged of references to the interface.

Revision 1.55 / (download) - annotate - [select for diffs], Sat Feb 5 07:58:54 2000 UTC (23 years ago) by itojun
Branch: MAIN
Changes since 1.54: +2 -2 lines
Diff to previous 1.54 (colored)

fix route cleanup on interface removal. (not sure why -Wall did not catch it)

Revision 1.54 / (download) - annotate - [select for diffs], Wed Feb 2 23:28:08 2000 UTC (23 years ago) by thorpej
Branch: MAIN
Changes since 1.53: +6 -8 lines
Diff to previous 1.53 (colored)

PRU_PURGEADDR -> PRU_PURGEIF, per a discussion w/ itojun.  In the IPv4
and IPv6 code, also use this to traverse PCB tables, looking for cached
routes referencing the dying ifnet, forcing them to be refreshed.

Revision 1.53 / (download) - annotate - [select for diffs], Tue Feb 1 22:52:04 2000 UTC (23 years ago) by thorpej
Branch: MAIN
Changes since 1.52: +358 -61 lines
Diff to previous 1.52 (colored)

First-draft if_detach() implementation, originally from Bill Studnemund,
although this version has been changed somewhat:
- reference counting on ifaddrs isn't as complete as Bill's original
  work was.  This is hard to get right, and we should attack one
  protocol at a time.
- This doesn't do reference counting or dynamic allocation of ifnets yet.
- This version introduces a new PRU -- PRU_PURGEADDR, which is used to
  purge an ifaddr from a protocol.  The old method Bill used didn't work
  on all protocols, and it only worked on some because it was Very Lucky.

This mostly works ... i.e. works for my USB Ethernet, except for a dangling
ifaddr reference left by the IPv6 code; have not yet tracked this down.

Revision 1.48.6.2 / (download) - annotate - [select for diffs], Tue Nov 30 13:34:58 1999 UTC (23 years, 2 months ago) by itojun
Branch: kame
CVS Tags: kame_141_19991130
Changes since 1.48.6.1: +4 -2 lines
Diff to previous 1.48.6.1 (colored) to branchpoint 1.48 (colored) next main 1.49 (colored)

bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code).  Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.

Revision 1.52 / (download) - annotate - [select for diffs], Wed Sep 29 22:42:02 1999 UTC (23 years, 4 months ago) by thorpej
Branch: MAIN
CVS Tags: wrstuden-devbsize-base, wrstuden-devbsize-19991221, wrstuden-devbsize, fvdl-softdep-base, fvdl-softdep, comdex-fall-1999-base, comdex-fall-1999
Branch point for: thorpej_scsipi
Changes since 1.51: +2 -2 lines
Diff to previous 1.51 (colored)

const poison ifunit().

Revision 1.48.2.1 / (download) - annotate - [select for diffs], Tue Aug 24 19:19:30 1999 UTC (23 years, 5 months ago) by he
Branch: netbsd-1-4
CVS Tags: netbsd-1-4-PATCH002
Changes since 1.48: +17 -1 lines
Diff to previous 1.48 (colored)

Pull up revision 1.51:
  Fix a problem in ifa_ifwithnet() for netatalk, making atalkd
  work in more configurations.  (bouyer)

Revision 1.51 / (download) - annotate - [select for diffs], Tue Aug 24 16:02:27 1999 UTC (23 years, 5 months ago) by bouyer
Branch: MAIN
Changes since 1.50: +17 -1 lines
Diff to previous 1.50 (colored)

Fix ifa_ifwithnet() for the netatalk case: netatalk uses blocks of addresses
which can't be handled by netmask, and ifa_ifwithnet() didn't find the
interface associated with an adress if it was in the same block but not with
the same prefix. This prevented 'route add' and atalkd to work properly
with some network configs.
This has been discussed on tech-net some weeks ago.

Revision 1.48.4.2 / (download) - annotate - [select for diffs], Mon Aug 2 22:32:28 1999 UTC (23 years, 6 months ago) by thorpej
Branch: chs-ubc2
Changes since 1.48.4.1: +3 -1 lines
Diff to previous 1.48.4.1 (colored) to branchpoint 1.48 (colored) next main 1.49 (colored)

Update from trunk.

Revision 1.50 / (download) - annotate - [select for diffs], Fri Jul 9 23:41:16 1999 UTC (23 years, 7 months ago) by thorpej
Branch: MAIN
CVS Tags: chs-ubc2-base
Changes since 1.49: +3 -1 lines
Diff to previous 1.49 (colored)

defopt INET6, and put it in opt_inet.h (most places already include this
file, which is why the file list is so short).

Revision 1.48.4.1 / (download) - annotate - [select for diffs], Thu Jul 1 23:45:18 1999 UTC (23 years, 7 months ago) by thorpej
Branch: chs-ubc2
Changes since 1.48: +157 -18 lines
Diff to previous 1.48 (colored)

Sync w/ -current.

Revision 1.49 / (download) - annotate - [select for diffs], Thu Jul 1 08:12:47 1999 UTC (23 years, 7 months ago) by itojun
Branch: MAIN
Changes since 1.48: +157 -18 lines
Diff to previous 1.48 (colored)

IPv6 kernel code, based on KAME/NetBSD 1.4, SNAP kit 19990628.
(Sorry for a big commit, I can't separate this into several pieces...)
Pls check sys/netinet6/TODO and sys/netinet6/IMPLEMENTATION for details.

- sys/kern: do not assume single mbuf, accept chained mbuf on passing
  data from userland to kernel (or other way round).
- "midway" ATM card: ATM PVC pseudo device support, like those done in ALTQ
  package (ftp://ftp.csl.sony.co.jp/pub/kjc/).
- sys/netinet/tcp*: IPv4/v6 dual stack tcp support.
- sys/netinet/{ip6,icmp6}.h, sys/net/pfkeyv2.h: IETF document assumes those
  file to be there so we patch it up.
- sys/netinet: IPsec additions are here and there.
- sys/netinet6/*: most of IPv6 code sits here.
- sys/netkey: IPsec key management code
- dev/pci/pcidevs: regen

In my understanding no code here is subject to export control so it
should be safe.

Revision 1.48.6.1 / (download) - annotate - [select for diffs], Mon Jun 28 06:36:55 1999 UTC (23 years, 7 months ago) by itojun
Branch: kame
CVS Tags: kame_14_19990705, kame_14_19990628
Changes since 1.48: +157 -18 lines
Diff to previous 1.48 (colored)

KAME/NetBSD 1.4 SNAP kit, dated 19990628.

NOTE: this branch (kame) is used just for refernce.  this may not compile
due to multiple reasons.

Revision 1.47.6.1 / (download) - annotate - [select for diffs], Fri Dec 11 04:53:04 1998 UTC (24 years, 1 month ago) by kenh
Branch: kenh-if-detach
Changes since 1.47: +490 -33 lines
Diff to previous 1.47 (colored) next main 1.48 (colored)

The beginnings of interface detach support.  Still some bugs, but mostly
works for me.

This work was originally by Bill Studenmund, and cleaned up by me.

Revision 1.48 / (download) - annotate - [select for diffs], Thu Dec 10 15:10:48 1998 UTC (24 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: netbsd-1-4-base, netbsd-1-4-RELEASE, netbsd-1-4-PATCH001
Branch point for: netbsd-1-4, kame, chs-ubc2
Changes since 1.47: +2 -1 lines
Diff to previous 1.47 (colored)

defopt COMPAT_43

Revision 1.47 / (download) - annotate - [select for diffs], Fri Jun 26 00:08:01 1998 UTC (24 years, 7 months ago) by thorpej
Branch: MAIN
CVS Tags: kenh-if-detach-base, eeh-paddr_t-base, eeh-paddr_t, chs-ubc-base, chs-ubc
Branch point for: kenh-if-detach
Changes since 1.46: +2 -1 lines
Diff to previous 1.46 (colored)

defopt COMPAT_SVR4

Revision 1.46 / (download) - annotate - [select for diffs], Thu Jun 25 23:19:21 1998 UTC (24 years, 7 months ago) by thorpej
Branch: MAIN
Changes since 1.45: +3 -1 lines
Diff to previous 1.45 (colored)

defopt COMPAT_LINUX

Revision 1.45 / (download) - annotate - [select for diffs], Thu May 14 00:04:58 1998 UTC (24 years, 8 months ago) by kml
Branch: MAIN
Changes since 1.44: +6 -1 lines
Diff to previous 1.44 (colored)

Driver for Essential Communications' RoadRunner HIPPI (800 Mb/sec network)
card.  With some modification, this could probably also work for their
Gigabit Ethernet card based on the same chipset...

Revision 1.44 / (download) - annotate - [select for diffs], Sun Mar 1 02:25:04 1998 UTC (24 years, 11 months ago) by fvdl
Branch: MAIN
Changes since 1.43: +2 -2 lines
Diff to previous 1.43 (colored)

Merge with Lite2 + local changes

Revision 1.1.1.3 / (download) - annotate - [select for diffs] (vendor branch), Sun Mar 1 02:13:22 1998 UTC (24 years, 11 months ago) by fvdl
Branch: WFJ-920714, CSRG
CVS Tags: lite-2
Changes since 1.1.1.2: +4 -3 lines
Diff to previous 1.1.1.2 (colored)

Import 4.4BSD-Lite2

Revision 1.1.1.2 / (download) - annotate - [select for diffs] (vendor branch), Sun Mar 1 02:10:06 1998 UTC (24 years, 11 months ago) by fvdl
Branch: WFJ-920714, CSRG
CVS Tags: lite-1, date-03-may-96
Changes since 1.1.1.1: +122 -86 lines
Diff to previous 1.1.1.1 (colored)

Import 4.4BSD-Lite for reference

Revision 1.43 / (download) - annotate - [select for diffs], Wed Jan 28 02:35:30 1998 UTC (25 years ago) by thorpej
Branch: MAIN
Changes since 1.42: +2 -3 lines
Diff to previous 1.42 (colored)

Use offsetof() from libkern.h

Revision 1.39.4.3 / (download) - annotate - [select for diffs], Tue Oct 14 10:29:03 1997 UTC (25 years, 3 months ago) by thorpej
Branch: marc-pcmcia
Changes since 1.39.4.2: +2 -1 lines
Diff to previous 1.39.4.2 (colored) to branchpoint 1.39 (colored) next main 1.40 (colored)

Update marc-pcmcia branch from trunk.

Revision 1.42 / (download) - annotate - [select for diffs], Thu Oct 2 19:41:56 1997 UTC (25 years, 4 months ago) by is
Branch: MAIN
CVS Tags: netbsd-1-3-base, netbsd-1-3-RELEASE, netbsd-1-3-PATCH003-CANDIDATE2, netbsd-1-3-PATCH003-CANDIDATE1, netbsd-1-3-PATCH003-CANDIDATE0, netbsd-1-3-PATCH003, netbsd-1-3-PATCH002, netbsd-1-3-PATCH001, netbsd-1-3-BETA, netbsd-1-3, marc-pcmcia-base
Changes since 1.41: +2 -1 lines
Diff to previous 1.41 (colored)

Reimplement a test for broadcast addresses advertized, which was left out
when rewriting the ARP system.

Revision 1.39.4.2 / (download) - annotate - [select for diffs], Fri Aug 29 00:59:31 1997 UTC (25 years, 5 months ago) by thorpej
Branch: marc-pcmcia
Changes since 1.39.4.1: +1 -7 lines
Diff to previous 1.39.4.1 (colored) to branchpoint 1.39 (colored)

Update from trunk.

Revision 1.41 / (download) - annotate - [select for diffs], Fri Aug 29 00:57:54 1997 UTC (25 years, 5 months ago) by thorpej
Branch: MAIN
CVS Tags: thorpej-signal-base, thorpej-signal
Changes since 1.40: +1 -7 lines
Diff to previous 1.40 (colored)

Garbage-collect.

Revision 1.40 / (download) - annotate - [select for diffs], Fri Aug 29 00:57:28 1997 UTC (25 years, 5 months ago) by thorpej
Branch: MAIN
Changes since 1.39: +5 -1 lines
Diff to previous 1.39 (colored)

Bring changes from marc-pcmcia branch down to the trunk.

Revision 1.39.4.1 / (download) - annotate - [select for diffs], Wed Jul 30 07:29:41 1997 UTC (25 years, 6 months ago) by marc
Branch: marc-pcmcia
Changes since 1.39: +5 -1 lines
Diff to previous 1.39 (colored)

set up the inteface send queue when the if is attached, not when the
if layer is initialized.  Otherwise, interfaces attached after the
autoconfiguration won't be set up properly.

Revision 1.39 / (download) - annotate - [select for diffs], Mon Mar 17 02:55:12 1997 UTC (25 years, 10 months ago) by thorpej
Branch: MAIN
CVS Tags: marc-pcmcia-bp, bouyer-scsipi
Branch point for: marc-pcmcia
Changes since 1.38: +4 -1 lines
Diff to previous 1.38 (colored)

BSD/OS-style network interface media selection, implemented by
Jonathan Stone and myself.  Many thanks to Matt Thomas for providing
the information necessary to implement this interface, and for helping
to shake out the bugs.

Revision 1.38 / (download) - annotate - [select for diffs], Sat Mar 15 18:12:20 1997 UTC (25 years, 10 months ago) by is
Branch: MAIN
Changes since 1.37: +2 -1 lines
Diff to previous 1.37 (colored)

New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.

Revision 1.37.4.1 / (download) - annotate - [select for diffs], Fri Feb 7 18:06:54 1997 UTC (26 years ago) by is
Branch: is-newarp
Changes since 1.37: +2 -1 lines
Diff to previous 1.37 (colored) next main 1.38 (colored)

Snapshot of new ARP code.

Our old ARP code was hardwired for 6-byte length medium
addresses, while the protocol is designed for any size.

This snapshot contains a first hack at getting rid of
Ethernet specific data structures. The ep driver is updated
(and tested on the PCI bus), the iy and fpa drivers have been
updated, but not real life tested yet.

If you want to test this with other drivers, you have to update
them first yourself, and probably tag the relevant directories.
Better contact me if you want to do this.

Revision 1.35.4.1 / (download) - annotate - [select for diffs], Wed Dec 11 03:43:49 1996 UTC (26 years, 1 month ago) by mycroft
Branch: netbsd-1-2
CVS Tags: netbsd-1-2-PATCH001
Changes since 1.35: +11 -6 lines
Diff to previous 1.35 (colored) next main 1.36 (colored)

From trunk:
Eliminate SS_PRIV; instead, pass down a proc pointer to the usrreq methods
that need it.
Fix numerous memory leaks and bogus return values.

Revision 1.37 / (download) - annotate - [select for diffs], Thu Jun 13 21:49:43 1996 UTC (26 years, 7 months ago) by cgd
Branch: MAIN
CVS Tags: thorpej-setroot, mrg-vm-swap, is-newarp-before-merge, is-newarp-base
Branch point for: is-newarp
Changes since 1.36: +3 -4 lines
Diff to previous 1.36 (colored)

implement SIOCGIFMTU in a generic manner, by pulling the MTU out of
each netif's if_data structure.  There's no point in making each
driver implement this ioctl.

Revision 1.36 / (download) - annotate - [select for diffs], Wed May 22 13:55:08 1996 UTC (26 years, 8 months ago) by mycroft
Branch: MAIN
Changes since 1.35: +11 -6 lines
Diff to previous 1.35 (colored)

Pass a proc pointer down to the usrreq and pcbbind functions for PRU_ATTACH, PRU_BIND and
PRU_CONTROL.  The usrreq interface really needs to be split up, but this will have to wait.
Remove SS_PRIV completely.

Revision 1.35 / (download) - annotate - [select for diffs], Tue May 7 05:26:04 1996 UTC (26 years, 9 months ago) by thorpej
Branch: MAIN
CVS Tags: netbsd-1-2-base, netbsd-1-2-RELEASE, netbsd-1-2-BETA
Branch point for: netbsd-1-2
Changes since 1.34: +2 -6 lines
Diff to previous 1.34 (colored)

Kill a couple of unnecessary calls to strlen().

Revision 1.34 / (download) - annotate - [select for diffs], Tue May 7 02:40:25 1996 UTC (26 years, 9 months ago) by thorpej
Branch: MAIN
Changes since 1.33: +17 -67 lines
Diff to previous 1.33 (colored)

Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit.  Updated interface to (*if_watchdog)() and (*if_reset)()
to take a struct ifnet *, rather than a unit number.

Revision 1.33 / (download) - annotate - [select for diffs], Mon Apr 22 01:20:34 1996 UTC (26 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.32: +5 -5 lines
Diff to previous 1.32 (colored)

- Fix fencepost error in ifconf() where if space = n * sizeof(struct ifreq),
  only n - 1 interfaces would be obtained. This bug is present in the Lite2
  sources too.
- Support COMPAT_SVR4 in ifconf()

Revision 1.32 / (download) - annotate - [select for diffs], Tue Mar 12 13:07:52 1996 UTC (26 years, 10 months ago) by mrg
Branch: MAIN
Changes since 1.31: +4 -3 lines
Diff to previous 1.31 (colored)

oops; back out previous change and add comment describing what the weird goto does.

Revision 1.31 / (download) - annotate - [select for diffs], Tue Mar 12 13:01:20 1996 UTC (26 years, 10 months ago) by mrg
Branch: MAIN
Changes since 1.30: +3 -3 lines
Diff to previous 1.30 (colored)

eliminate stupid use of "goto next;" where next was: "next: continue;"

Revision 1.30 / (download) - annotate - [select for diffs], Tue Mar 12 12:55:52 1996 UTC (26 years, 10 months ago) by mrg
Branch: MAIN
Changes since 1.29: +3 -2 lines
Diff to previous 1.29 (colored)

test for null ifa_dstaddr before using it.  (pr#2183 from chuck cranor)

Revision 1.29 / (download) - annotate - [select for diffs], Tue Mar 5 01:56:37 1996 UTC (26 years, 11 months ago) by thorpej
Branch: MAIN
Changes since 1.28: +5 -2 lines
Diff to previous 1.28 (colored)

Handle more than 10 interfaces of a given type (well, up to `if99', anyhow).
From Neil McRae, PR #1992.

Revision 1.28 / (download) - annotate - [select for diffs], Tue Feb 27 08:17:08 1996 UTC (26 years, 11 months ago) by mycroft
Branch: MAIN
Changes since 1.27: +3 -3 lines
Diff to previous 1.27 (colored)

Emulate OSIOCGIFADDR, et al, if COMPAT_LINUX is defined.

Revision 1.27 / (download) - annotate - [select for diffs], Tue Feb 27 07:28:38 1996 UTC (26 years, 11 months ago) by mycroft
Branch: MAIN
Changes since 1.26: +2 -2 lines
Diff to previous 1.26 (colored)

Handle OSIOCGIFCONF if COMPAT_LINUX is defined.

Revision 1.26 / (download) - annotate - [select for diffs], Mon Feb 26 23:16:42 1996 UTC (26 years, 11 months ago) by mrg
Branch: MAIN
Changes since 1.25: +15 -1 lines
Diff to previous 1.25 (colored)

two more local addr changes, all done differently now (idea from charles)

Revision 1.25 / (download) - annotate - [select for diffs], Wed Feb 21 14:28:33 1996 UTC (26 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.24: +3 -2 lines
Diff to previous 1.24 (colored</