History log of /netbsd-current/sys/net/if_sl.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.136 26-Oct-2022 riastradh

sl(4): Convert to ttylock/ttyunlock.


Revision tags: bouyer-sunxi-drm-base
# 1.135 03-Sep-2022 thorpej

Garbage-collect the remaining vestiges of netisr.


# 1.134 27-Aug-2022 thorpej

Ensure that all queues passed to ifq_enqueue2() have a valid ifq_lock.


# 1.133 27-Aug-2022 thorpej

Use IFQ_SET_MAXLEN() rather than open-coding it.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.132 29-Jan-2020 thorpej

Adopt <net/if_stats.h>.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127
# 1.131 24-Jan-2019 knakahara

branches: 1.131.6;
Add comments about D_MPSAFE to functions called as struct linesw.l_ioctl.


Revision tags: pgoyette-compat-20190118 pgoyette-compat-1226
# 1.130 22-Dec-2018 maxv

Replace: M_MOVE_PKTHDR -> m_move_pkthdr. No functional change, since the
former is a macro to the latter.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422
# 1.129 20-Apr-2018 knakahara

branches: 1.129.2;
SIOCSIFDSTADDR uses struct ifreq instead of struct ifaddr or struct in_aliasreq.

SIOCSIFDSTADDR is not used by base package commands...

I checked sys/net*/* only.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.128 13-Apr-2017 maya

branches: 1.128.10;
if MGETHDR fails, don't try to copy to single mbuf and deref null.

reduce ifdefs.


Revision tags: jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 1.127 02-Oct-2016 christos

branches: 1.127.2;
MFREE -> m_free


Revision tags: localcount-20160914
# 1.126 07-Aug-2016 christos

modularize some more drivers and merge the module glue


# 1.125 06-Aug-2016 christos

make strip and slip modular, and cosmetic for ppp.


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.124 10-Jun-2016 ozaki-r

branches: 1.124.2;
Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.123 28-Apr-2016 ozaki-r

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 tags: nick-nhusb-base-20160422
# 1.122 20-Apr-2016 knakahara

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


Revision tags: nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.121 24-Aug-2015 pooka

sprinkle _KERNEL_OPT


# 1.120 20-Aug-2015 uebayasi

Honor pseudo attach decl generated by config(1).


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.119 05-Jun-2014 rmind

branches: 1.119.4;
- 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 tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.118 23-Sep-2011 christos

branches: 1.118.12; 1.118.26;
Change obsolete CBSIZE constant (48), to a power of two constant (64) that
is close enough to match the original assumptions.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base
# 1.117 05-Apr-2010 joerg

Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.116 19-Jan-2010 pooka

branches: 1.116.2; 1.116.4;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase jym-xensuspend-base
# 1.115 07-May-2009 elad

Introduce actions/requests to handle authorization for ppp(4), sl(4),
strip(4), btuart(4) and bcsp(4) network interfaces and devices.

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004955.html


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.114 17-Dec-2008 cegger

branches: 1.114.2;
kill MALLOC and FREE macros.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.113 07-Nov-2008 dyoung

*** 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 tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base
# 1.112 15-Jun-2008 christos

branches: 1.112.2; 1.112.4;
- add if_alloc (ours just mallocs), and if_initname and use them (from FreeBSD)
- kill memsets where M_ZERO can be used.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.111 24-Apr-2008 ad

branches: 1.111.2; 1.111.4; 1.111.6;
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 tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.110 07-Feb-2008 dyoung

branches: 1.110.6; 1.110.8;
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 tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.109 10-Nov-2007 ad

Call ttyflush() with tty_lock held.


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 vmlocking-base
# 1.108 08-Oct-2007 ad

branches: 1.108.2; 1.108.4;
Use the softint API.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base2 yamt-x86pmap-base
# 1.107 01-Sep-2007 dyoung

branches: 1.107.2;
Use ifreq_setaddr(), ifreq_getaddr(), sockaddr_in_init(), and
sockaddr_copy(). Constify. Compare pointers with NULL, not 0.
Don't "test truth" of pointers, but compare with NULL.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.106 14-Jul-2007 ad

branches: 1.106.2; 1.106.6; 1.106.8;
Generic soft interrupts are mandatory.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.105 04-Mar-2007 christos

branches: 1.105.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.104 17-Feb-2007 dyoung

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 tags: post-newlock2-merge newlock2-nbase newlock2-base
# 1.103 04-Jan-2007 elad

branches: 1.103.2;
Consistent usage of KAUTH_GENERIC_ISSUSER.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 netbsd-4-base
# 1.102 16-Nov-2006 christos

__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.101 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.100 23-Jul-2006 ad

branches: 1.100.4; 1.100.6;
Use the LWP cached credentials where sane.


# 1.99 08-Jul-2006 tsutsui

KNF.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.98 07-Jun-2006 kardel

branches: 1.98.2;
merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html


Revision tags: yamt-pdpolicy-base5 simonb-timecounters-base
# 1.97 14-May-2006 elad

branches: 1.97.2;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base
# 1.96 02-Mar-2006 christos

branches: 1.96.2; 1.96.4; 1.96.6;
Provide ppp like statistics instead of grovelling through the kernel
symbols.


Revision tags: yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 thorpej

branches: 1.95.4; 1.95.6;
ANSI function decls and application of static.


# 1.94 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 ktrace-lwp-base
# 1.93 27-Nov-2005 thorpej

Overhaul how TTY line disciplines are handled:
- Replace references to linesw[0] with a ttyldisc_default() function
that returns the default ("termios") line discipline.
- The linesw[] array is gone, replaced by a linked list.
- ttyldisc_add() and ttyldisc_remove() have been replaced by
ttyldisc_attach() and ttyldisc_detach().
- Things that provide line disciplines are now responsible for
registering those disciplines with the system. The linesw
structures are no longer declared in tty_conf.c
- Line disciplines are now refcounted; a lookup causes a reference to
be held. ttyldisc_release() releases the reference. Attempts to
detach an in-use line discipline result in EBUSY.
- Fix function signature lossage in if_sl.c, if_strip.c, and tty_tb.c
that was masked by the old tty_conf.c
- tty_init() is no longer necessary; delete it and its call from main().


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.92 18-Aug-2005 yamt

branches: 1.92.6;
- introduce M_MOVE_PKTHDR and use it where appropriate.
intended to be mostly API compatible with openbsd/freebsd.
- remove a glue #define in netipsec/ipsec_osdep.h.


Revision tags: kent-audio2-base
# 1.91 31-Mar-2005 christos

branches: 1.91.2;
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 tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE 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 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.90 06-Dec-2004 christos

branches: 1.90.4;
Sprinkle #ifdef INET to make a GENERIC kernel compile with INET undefined.


# 1.89 05-Dec-2004 peter

Don't forget to call bpfdetach in the clone destroy function.
While here, add a missing static and change some spaces to tabs.


# 1.88 05-Dec-2004 he

Fix what must have been an omission: missing brace and a leftover
use of `i', which is no longer defined. Fixes build problem for ports
not defining __HAVE_GENERIC_SOFT_INTERRUPTS.


# 1.87 05-Dec-2004 christos

clonify strip and sl.


# 1.86 19-Aug-2004 christos

Factor out the hand-crafting of mbufs from the interface files. Reviewed by
gimpy. XXX: I could have used bpf_mtap2 on some of the new functions, but I
chose not to, because I just wanted to do what amounts to a code move.


# 1.85 21-Apr-2004 itojun

kill sprintf, use snprintf


Revision tags: netbsd-2-0-3-RELEASE 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-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base 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-base
# 1.84 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.83 01-May-2003 itojun

branches: 1.83.2;
bpf_mtap() does not care about M_PKTHDR at the top. M_COPY_PKTHDR has some
consequences, so avoid it. if we need to attach dummy headers, we should
use M_PREPEND instead.


# 1.82 26-Feb-2003 matt

Add MBUFTRACE kernel option.
Do a little mbuf rework while here. Change all uses of MGET*(*, M_WAIT, *)
to m_get*(M_WAIT, *). These are not performance critical and making them
call m_get saves considerable space. Add m_clget analogue of MCLGET and
make corresponding change for M_WAIT uses.
Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE.
Begin to change netstat to use sysctl.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.81 11-Sep-2002 itojun

KNF - return is not a function.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base
# 1.80 17-Mar-2002 atatat

Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.


Revision tags: newlock-base ifpoll-base
# 1.79 14-Jan-2002 kleink

Include <machine/intr.h> unconditionally, instead of only doing so if
__HAVE_GENERIC_SOFT_INTERRUPTS and relying on <sys/param.h> to provide it
otherwise; pointed out by Aymeric Vincent.


# 1.78 12-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.77 15-Jul-2001 martin

branches: 1.77.2;
Fix slight glitch from rev. 1.70: bp is not adjusted for next loop after
outputting some data.
Fix provided by isaki@par.odn.ne.jp in PR kern/13472.


# 1.76 14-Jun-2001 itojun

branches: 1.76.2;
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.


# 1.75 30-May-2001 itojun

fix mbuf leak due to meaningless MGETHDR. from niels provos


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.74 13-Apr-2001 thorpej

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.


# 1.73 31-Mar-2001 enami

Remove unnecessary test of tp->t_linesw against NULL; they are results
of confusion while correcting compilation error after t_line is
replaced with t_linesw.


# 1.72 17-Jan-2001 thorpej

branches: 1.72.2;
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).


# 1.71 15-Jan-2001 thorpej

For SLIP/STRIP/PPP, use generic soft interrupts, if available.


# 1.70 12-Jan-2001 thorpej

After freeing the input buffer, set the pointer to it to NULL.


# 1.69 12-Jan-2001 thorpej

Don't use splimp() to block both net and tty interrupts. Instead,
block both interrupt levels as appropriate.


# 1.68 11-Jan-2001 thorpej

Plug a memory leak.


# 1.67 11-Jan-2001 thorpej

Defer output processing to the software interrupt.


# 1.66 10-Jan-2001 thorpej

Move the VJ uncompress code into the software interrupt.


# 1.65 09-Jan-2001 thorpej

Once we have a complete frame, schedule a SLIP software interrupt,
and manipulate ipintrq from there. This will allow us to clean up
the use of splimp() in this file later.


# 1.64 09-Jan-2001 thorpej

Make the buffer management in SLIP just a little less evil.


# 1.63 18-Dec-2000 thorpej

ALTQ'ify.


# 1.62 18-Dec-2000 thorpej

Fill in if_dlt.


# 1.61 12-Dec-2000 thorpej

Adapt to bpfattach() changes, and further centralize the bpfattach()
and bpfdetach() calls into link-type subroutines where possible.


# 1.60 02-Nov-2000 itohy

Set the default line discipline to t_linesw, rather than just NULL it.


# 1.59 02-Nov-2000 itohy

Adapt to the new line discipline scheme.


# 1.58 12-Jul-2000 thorpej

NetBSD -> __NetBSD__ in an #ifdef, and nuke sc_bpf; there's one in
the ifnet already.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 1.57 30-Mar-2000 augustss

Kill some more register declarations.


# 1.56 29-Mar-2000 simonb

Don't need to include <sys/conf.h> here.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base kame_141_19991130 comdex-fall-1999-base fvdl-softdep-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.55 27-Mar-1999 dbj

branches: 1.55.8;
fixes to compile if NBPFILTER == 0


# 1.54 25-Mar-1999 tron

Make it possible to set MTU via "ifconfig" at run time. "SLMTU" is now
used to set the initial value.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.53 06-Oct-1998 kleink

branches: 1.53.4;
Use #error instead of causing parse errors; noticed by Heiko.


# 1.52 26-Aug-1998 mrg

use __NetBSD__ not NetBSD


Revision tags: eeh-paddr_t-base
# 1.51 06-Jul-1998 jtk

use #ifdef INET so this compiles again


# 1.50 05-Jul-1998 jonathan

defopt INET, NETATALK.


# 1.49 23-Mar-1998 enami

Add missing comma.


# 1.48 23-Mar-1998 fair

add the ability to run SLIP with CLOCAL set, per PR#3586


# 1.47 01-Mar-1998 fvdl

Merge with Lite2 + local changes


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.46 17-May-1997 christos

Update to ppp-2.3b5


# 1.45 27-Mar-1997 thorpej

Update for the new mbuf code, in a slighly kludgy way. Basically, these
drivers played a somewhat evil trick with clusters, which is now
replaced by a somewhat evil trick with regular malloc'd memory.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.44 13-Oct-1996 christos

backout previous kprintf change


# 1.43 10-Oct-1996 christos

- printf -> kprintf, sprintf -> ksprintf


# 1.42 09-Aug-1996 mrg

use sc_unit instead of pointer arthimetic.


# 1.41 10-Jul-1996 cgd

print difference between pointers with %ld, so that -Wformat works
on the Alpha and for consistency. Also, other minor formatting cleanups.


# 1.40 02-Jun-1996 thorpej

Move a mis-placed line on slattach() so that SLIOCGUNIT works properly.
From Jonathan O'Brien <obrien@phoenix.sfsu.edu>.


Revision tags: netbsd-1-2-base
# 1.39 07-May-1996 thorpej

branches: 1.39.4;
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.


# 1.38 13-Feb-1996 christos

Net prototypes


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.37 12-Aug-1995 mycroft

splnet --> splsoftnet


# 1.36 13-Jun-1995 mycroft

There's no reason to set if_next here.


# 1.35 21-Mar-1995 mycroft

Update to use timer{add,sub}().


# 1.34 08-Mar-1995 cgd

fixed sized types, where appropriate. when casting pointers to
integers to do math on them, cast to long. ioctl commands are
u_longs.


# 1.33 11-Dec-1994 mycroft

timevalsub --> __timersub


# 1.32 30-Oct-1994 cgd

be more careful with types, also pull in headers where necessary.


# 1.31 16-Jul-1994 cgd

use NetBSD (defined in param.h) not __NetBSD__ to allow x-compilation
with native compiler.


# 1.30 15-Jul-1994 cgd

kill bogus external declaration of time


Revision tags: netbsd-1-0-base
# 1.29 29-Jun-1994 cgd

branches: 1.29.2;
New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'


# 1.28 13-May-1994 mycroft

Update to 4.4-Lite networking code, with a few local changes.


# 1.27 08-Mar-1994 cgd

Some stability/safety/extensibility patches. Inspired by Christoph Badura.
Always make sure our buffer is large enough, and restart hung lines.


# 1.26 10-Feb-1994 cgd

mccanne convinced me that slip.h *should* exist. this is what
i "implemented" for 4.4, and the adjustments to the other files to
match.


# 1.25 05-Feb-1994 mycroft

Remove an #ifdef we no longer need.


# 1.24 02-Feb-1994 hpeyerl

Multicast is no longer optional


# 1.23 08-Jan-1994 cgd

quench the grammar flames!


# 1.22 20-Dec-1993 cgd

serious cleanup


# 1.21 19-Dec-1993 cgd

include machine/cpu.h, for machines which define soft interrupt stuff
there. marked XXX; they prolly shouldn't do that...


# 1.20 18-Dec-1993 mycroft

Canonicalize all #includes.


# 1.19 10-Dec-1993 cgd

move slip compression configuration into the interface flags,
and diddle a couple of related things.


# 1.18 06-Dec-1993 hpeyerl

multicast support.
From Chris Maeda, cmaeda@cs.washington.edu
These patches are derived from the IP Multicast patches for BSDI.


# 1.17 09-Nov-1993 glass

T_LINEP member of struct tty becomes t_sc. This replaces the
#define t_sc T_LINEP
that appear in tty_tb.c, if_sl.c, and if_ppp.h


# 1.16 31-Oct-1993 glass

removed slip and ppp specific prototypes from tty.h where they didn't belong.
moved them to tty_conf.c within #if Nwhatever > 0 where they do belong.
made sure that if_sl.c, and if_ppp.c still compile quietly.


# 1.15 02-Oct-1993 mycroft

Call output routine redundantly to possible avoid some hangs due to missed
interrupts.


# 1.14 02-Oct-1993 mycroft

Ignore carrier if not using hardware carrier detect (i.e. CLOCAL is set).


# 1.13 23-Sep-1993 mycroft

Ignore TS_CARR_ON when CLOCAL is set.


Revision tags: magnum-base
# 1.12 09-Aug-1993 deraadt

branches: 1.12.2;
add an additional suser() check.
regular users should not be able to change slip interface characteristics!


# 1.11 01-Aug-1993 mycroft

Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.


Revision tags: netbsd-0-9-patch-001 netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.10 12-Jul-1993 mycroft

Change tty code to use clist interface, but with ring buffer implementation.
Also, fix a couple of bugs in tty.c and pccons.c, and some gross kluginess
in the hp300 stuff.


# 1.9 27-Jun-1993 andrew

ANSIfications - removed all implicit function return types and argument
definitions. Ensured that all files include "systm.h" to gain access to
general prototypes. Casts where necessary.


# 1.8 22-May-1993 cgd

add include of select.h if necessary for protos, or delete if extraneous


# 1.7 18-May-1993 cgd

make kernel select interface be one-stop shopping & clean it all up.


# 1.6 10-May-1993 deraadt

ring buffer now uses rbchar's (shorts) instead of chars.


Revision tags: netbsd-0-8 netbsd-alpha-1
# 1.5 09-Apr-1993 cgd

bump slip MTU back down to 296...


# 1.4 25-Mar-1993 cgd

one line got botched during bpf patch installation


# 1.3 25-Mar-1993 cgd

added BPF support, as provided by David Greenman (davidg@implode.rain.com)


Revision tags: patchkit-0-2-2
# 1.2 21-Mar-1993 cgd

after 0.2.2 "stable" patches applied


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


# 1.135 03-Sep-2022 thorpej

Garbage-collect the remaining vestiges of netisr.


# 1.134 27-Aug-2022 thorpej

Ensure that all queues passed to ifq_enqueue2() have a valid ifq_lock.


# 1.133 27-Aug-2022 thorpej

Use IFQ_SET_MAXLEN() rather than open-coding it.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.132 29-Jan-2020 thorpej

Adopt <net/if_stats.h>.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127
# 1.131 24-Jan-2019 knakahara

branches: 1.131.6;
Add comments about D_MPSAFE to functions called as struct linesw.l_ioctl.


Revision tags: pgoyette-compat-20190118 pgoyette-compat-1226
# 1.130 22-Dec-2018 maxv

Replace: M_MOVE_PKTHDR -> m_move_pkthdr. No functional change, since the
former is a macro to the latter.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422
# 1.129 20-Apr-2018 knakahara

branches: 1.129.2;
SIOCSIFDSTADDR uses struct ifreq instead of struct ifaddr or struct in_aliasreq.

SIOCSIFDSTADDR is not used by base package commands...

I checked sys/net*/* only.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.128 13-Apr-2017 maya

branches: 1.128.10;
if MGETHDR fails, don't try to copy to single mbuf and deref null.

reduce ifdefs.


Revision tags: jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 1.127 02-Oct-2016 christos

branches: 1.127.2;
MFREE -> m_free


Revision tags: localcount-20160914
# 1.126 07-Aug-2016 christos

modularize some more drivers and merge the module glue


# 1.125 06-Aug-2016 christos

make strip and slip modular, and cosmetic for ppp.


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.124 10-Jun-2016 ozaki-r

branches: 1.124.2;
Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.123 28-Apr-2016 ozaki-r

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 tags: nick-nhusb-base-20160422
# 1.122 20-Apr-2016 knakahara

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


Revision tags: nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.121 24-Aug-2015 pooka

sprinkle _KERNEL_OPT


# 1.120 20-Aug-2015 uebayasi

Honor pseudo attach decl generated by config(1).


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.119 05-Jun-2014 rmind

branches: 1.119.4;
- 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 tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.118 23-Sep-2011 christos

branches: 1.118.12; 1.118.26;
Change obsolete CBSIZE constant (48), to a power of two constant (64) that
is close enough to match the original assumptions.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base
# 1.117 05-Apr-2010 joerg

Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.116 19-Jan-2010 pooka

branches: 1.116.2; 1.116.4;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase jym-xensuspend-base
# 1.115 07-May-2009 elad

Introduce actions/requests to handle authorization for ppp(4), sl(4),
strip(4), btuart(4) and bcsp(4) network interfaces and devices.

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004955.html


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.114 17-Dec-2008 cegger

branches: 1.114.2;
kill MALLOC and FREE macros.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.113 07-Nov-2008 dyoung

*** 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 tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base
# 1.112 15-Jun-2008 christos

branches: 1.112.2; 1.112.4;
- add if_alloc (ours just mallocs), and if_initname and use them (from FreeBSD)
- kill memsets where M_ZERO can be used.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.111 24-Apr-2008 ad

branches: 1.111.2; 1.111.4; 1.111.6;
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 tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.110 07-Feb-2008 dyoung

branches: 1.110.6; 1.110.8;
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 tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.109 10-Nov-2007 ad

Call ttyflush() with tty_lock held.


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 vmlocking-base
# 1.108 08-Oct-2007 ad

branches: 1.108.2; 1.108.4;
Use the softint API.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base2 yamt-x86pmap-base
# 1.107 01-Sep-2007 dyoung

branches: 1.107.2;
Use ifreq_setaddr(), ifreq_getaddr(), sockaddr_in_init(), and
sockaddr_copy(). Constify. Compare pointers with NULL, not 0.
Don't "test truth" of pointers, but compare with NULL.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.106 14-Jul-2007 ad

branches: 1.106.2; 1.106.6; 1.106.8;
Generic soft interrupts are mandatory.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.105 04-Mar-2007 christos

branches: 1.105.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.104 17-Feb-2007 dyoung

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 tags: post-newlock2-merge newlock2-nbase newlock2-base
# 1.103 04-Jan-2007 elad

branches: 1.103.2;
Consistent usage of KAUTH_GENERIC_ISSUSER.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 netbsd-4-base
# 1.102 16-Nov-2006 christos

__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.101 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.100 23-Jul-2006 ad

branches: 1.100.4; 1.100.6;
Use the LWP cached credentials where sane.


# 1.99 08-Jul-2006 tsutsui

KNF.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.98 07-Jun-2006 kardel

branches: 1.98.2;
merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html


Revision tags: yamt-pdpolicy-base5 simonb-timecounters-base
# 1.97 14-May-2006 elad

branches: 1.97.2;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base
# 1.96 02-Mar-2006 christos

branches: 1.96.2; 1.96.4; 1.96.6;
Provide ppp like statistics instead of grovelling through the kernel
symbols.


Revision tags: yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 thorpej

branches: 1.95.4; 1.95.6;
ANSI function decls and application of static.


# 1.94 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 ktrace-lwp-base
# 1.93 27-Nov-2005 thorpej

Overhaul how TTY line disciplines are handled:
- Replace references to linesw[0] with a ttyldisc_default() function
that returns the default ("termios") line discipline.
- The linesw[] array is gone, replaced by a linked list.
- ttyldisc_add() and ttyldisc_remove() have been replaced by
ttyldisc_attach() and ttyldisc_detach().
- Things that provide line disciplines are now responsible for
registering those disciplines with the system. The linesw
structures are no longer declared in tty_conf.c
- Line disciplines are now refcounted; a lookup causes a reference to
be held. ttyldisc_release() releases the reference. Attempts to
detach an in-use line discipline result in EBUSY.
- Fix function signature lossage in if_sl.c, if_strip.c, and tty_tb.c
that was masked by the old tty_conf.c
- tty_init() is no longer necessary; delete it and its call from main().


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.92 18-Aug-2005 yamt

branches: 1.92.6;
- introduce M_MOVE_PKTHDR and use it where appropriate.
intended to be mostly API compatible with openbsd/freebsd.
- remove a glue #define in netipsec/ipsec_osdep.h.


Revision tags: kent-audio2-base
# 1.91 31-Mar-2005 christos

branches: 1.91.2;
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 tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE 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 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.90 06-Dec-2004 christos

branches: 1.90.4;
Sprinkle #ifdef INET to make a GENERIC kernel compile with INET undefined.


# 1.89 05-Dec-2004 peter

Don't forget to call bpfdetach in the clone destroy function.
While here, add a missing static and change some spaces to tabs.


# 1.88 05-Dec-2004 he

Fix what must have been an omission: missing brace and a leftover
use of `i', which is no longer defined. Fixes build problem for ports
not defining __HAVE_GENERIC_SOFT_INTERRUPTS.


# 1.87 05-Dec-2004 christos

clonify strip and sl.


# 1.86 19-Aug-2004 christos

Factor out the hand-crafting of mbufs from the interface files. Reviewed by
gimpy. XXX: I could have used bpf_mtap2 on some of the new functions, but I
chose not to, because I just wanted to do what amounts to a code move.


# 1.85 21-Apr-2004 itojun

kill sprintf, use snprintf


Revision tags: netbsd-2-0-3-RELEASE 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-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base 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-base
# 1.84 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.83 01-May-2003 itojun

branches: 1.83.2;
bpf_mtap() does not care about M_PKTHDR at the top. M_COPY_PKTHDR has some
consequences, so avoid it. if we need to attach dummy headers, we should
use M_PREPEND instead.


# 1.82 26-Feb-2003 matt

Add MBUFTRACE kernel option.
Do a little mbuf rework while here. Change all uses of MGET*(*, M_WAIT, *)
to m_get*(M_WAIT, *). These are not performance critical and making them
call m_get saves considerable space. Add m_clget analogue of MCLGET and
make corresponding change for M_WAIT uses.
Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE.
Begin to change netstat to use sysctl.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.81 11-Sep-2002 itojun

KNF - return is not a function.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base
# 1.80 17-Mar-2002 atatat

Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.


Revision tags: newlock-base ifpoll-base
# 1.79 14-Jan-2002 kleink

Include <machine/intr.h> unconditionally, instead of only doing so if
__HAVE_GENERIC_SOFT_INTERRUPTS and relying on <sys/param.h> to provide it
otherwise; pointed out by Aymeric Vincent.


# 1.78 12-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.77 15-Jul-2001 martin

branches: 1.77.2;
Fix slight glitch from rev. 1.70: bp is not adjusted for next loop after
outputting some data.
Fix provided by isaki@par.odn.ne.jp in PR kern/13472.


# 1.76 14-Jun-2001 itojun

branches: 1.76.2;
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.


# 1.75 30-May-2001 itojun

fix mbuf leak due to meaningless MGETHDR. from niels provos


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.74 13-Apr-2001 thorpej

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.


# 1.73 31-Mar-2001 enami

Remove unnecessary test of tp->t_linesw against NULL; they are results
of confusion while correcting compilation error after t_line is
replaced with t_linesw.


# 1.72 17-Jan-2001 thorpej

branches: 1.72.2;
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).


# 1.71 15-Jan-2001 thorpej

For SLIP/STRIP/PPP, use generic soft interrupts, if available.


# 1.70 12-Jan-2001 thorpej

After freeing the input buffer, set the pointer to it to NULL.


# 1.69 12-Jan-2001 thorpej

Don't use splimp() to block both net and tty interrupts. Instead,
block both interrupt levels as appropriate.


# 1.68 11-Jan-2001 thorpej

Plug a memory leak.


# 1.67 11-Jan-2001 thorpej

Defer output processing to the software interrupt.


# 1.66 10-Jan-2001 thorpej

Move the VJ uncompress code into the software interrupt.


# 1.65 09-Jan-2001 thorpej

Once we have a complete frame, schedule a SLIP software interrupt,
and manipulate ipintrq from there. This will allow us to clean up
the use of splimp() in this file later.


# 1.64 09-Jan-2001 thorpej

Make the buffer management in SLIP just a little less evil.


# 1.63 18-Dec-2000 thorpej

ALTQ'ify.


# 1.62 18-Dec-2000 thorpej

Fill in if_dlt.


# 1.61 12-Dec-2000 thorpej

Adapt to bpfattach() changes, and further centralize the bpfattach()
and bpfdetach() calls into link-type subroutines where possible.


# 1.60 02-Nov-2000 itohy

Set the default line discipline to t_linesw, rather than just NULL it.


# 1.59 02-Nov-2000 itohy

Adapt to the new line discipline scheme.


# 1.58 12-Jul-2000 thorpej

NetBSD -> __NetBSD__ in an #ifdef, and nuke sc_bpf; there's one in
the ifnet already.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 1.57 30-Mar-2000 augustss

Kill some more register declarations.


# 1.56 29-Mar-2000 simonb

Don't need to include <sys/conf.h> here.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base kame_141_19991130 comdex-fall-1999-base fvdl-softdep-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.55 27-Mar-1999 dbj

branches: 1.55.8;
fixes to compile if NBPFILTER == 0


# 1.54 25-Mar-1999 tron

Make it possible to set MTU via "ifconfig" at run time. "SLMTU" is now
used to set the initial value.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.53 06-Oct-1998 kleink

branches: 1.53.4;
Use #error instead of causing parse errors; noticed by Heiko.


# 1.52 26-Aug-1998 mrg

use __NetBSD__ not NetBSD


Revision tags: eeh-paddr_t-base
# 1.51 06-Jul-1998 jtk

use #ifdef INET so this compiles again


# 1.50 05-Jul-1998 jonathan

defopt INET, NETATALK.


# 1.49 23-Mar-1998 enami

Add missing comma.


# 1.48 23-Mar-1998 fair

add the ability to run SLIP with CLOCAL set, per PR#3586


# 1.47 01-Mar-1998 fvdl

Merge with Lite2 + local changes


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.46 17-May-1997 christos

Update to ppp-2.3b5


# 1.45 27-Mar-1997 thorpej

Update for the new mbuf code, in a slighly kludgy way. Basically, these
drivers played a somewhat evil trick with clusters, which is now
replaced by a somewhat evil trick with regular malloc'd memory.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.44 13-Oct-1996 christos

backout previous kprintf change


# 1.43 10-Oct-1996 christos

- printf -> kprintf, sprintf -> ksprintf


# 1.42 09-Aug-1996 mrg

use sc_unit instead of pointer arthimetic.


# 1.41 10-Jul-1996 cgd

print difference between pointers with %ld, so that -Wformat works
on the Alpha and for consistency. Also, other minor formatting cleanups.


# 1.40 02-Jun-1996 thorpej

Move a mis-placed line on slattach() so that SLIOCGUNIT works properly.
From Jonathan O'Brien <obrien@phoenix.sfsu.edu>.


Revision tags: netbsd-1-2-base
# 1.39 07-May-1996 thorpej

branches: 1.39.4;
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.


# 1.38 13-Feb-1996 christos

Net prototypes


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.37 12-Aug-1995 mycroft

splnet --> splsoftnet


# 1.36 13-Jun-1995 mycroft

There's no reason to set if_next here.


# 1.35 21-Mar-1995 mycroft

Update to use timer{add,sub}().


# 1.34 08-Mar-1995 cgd

fixed sized types, where appropriate. when casting pointers to
integers to do math on them, cast to long. ioctl commands are
u_longs.


# 1.33 11-Dec-1994 mycroft

timevalsub --> __timersub


# 1.32 30-Oct-1994 cgd

be more careful with types, also pull in headers where necessary.


# 1.31 16-Jul-1994 cgd

use NetBSD (defined in param.h) not __NetBSD__ to allow x-compilation
with native compiler.


# 1.30 15-Jul-1994 cgd

kill bogus external declaration of time


Revision tags: netbsd-1-0-base
# 1.29 29-Jun-1994 cgd

branches: 1.29.2;
New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'


# 1.28 13-May-1994 mycroft

Update to 4.4-Lite networking code, with a few local changes.


# 1.27 08-Mar-1994 cgd

Some stability/safety/extensibility patches. Inspired by Christoph Badura.
Always make sure our buffer is large enough, and restart hung lines.


# 1.26 10-Feb-1994 cgd

mccanne convinced me that slip.h *should* exist. this is what
i "implemented" for 4.4, and the adjustments to the other files to
match.


# 1.25 05-Feb-1994 mycroft

Remove an #ifdef we no longer need.


# 1.24 02-Feb-1994 hpeyerl

Multicast is no longer optional


# 1.23 08-Jan-1994 cgd

quench the grammar flames!


# 1.22 20-Dec-1993 cgd

serious cleanup


# 1.21 19-Dec-1993 cgd

include machine/cpu.h, for machines which define soft interrupt stuff
there. marked XXX; they prolly shouldn't do that...


# 1.20 18-Dec-1993 mycroft

Canonicalize all #includes.


# 1.19 10-Dec-1993 cgd

move slip compression configuration into the interface flags,
and diddle a couple of related things.


# 1.18 06-Dec-1993 hpeyerl

multicast support.
From Chris Maeda, cmaeda@cs.washington.edu
These patches are derived from the IP Multicast patches for BSDI.


# 1.17 09-Nov-1993 glass

T_LINEP member of struct tty becomes t_sc. This replaces the
#define t_sc T_LINEP
that appear in tty_tb.c, if_sl.c, and if_ppp.h


# 1.16 31-Oct-1993 glass

removed slip and ppp specific prototypes from tty.h where they didn't belong.
moved them to tty_conf.c within #if Nwhatever > 0 where they do belong.
made sure that if_sl.c, and if_ppp.c still compile quietly.


# 1.15 02-Oct-1993 mycroft

Call output routine redundantly to possible avoid some hangs due to missed
interrupts.


# 1.14 02-Oct-1993 mycroft

Ignore carrier if not using hardware carrier detect (i.e. CLOCAL is set).


# 1.13 23-Sep-1993 mycroft

Ignore TS_CARR_ON when CLOCAL is set.


Revision tags: magnum-base
# 1.12 09-Aug-1993 deraadt

branches: 1.12.2;
add an additional suser() check.
regular users should not be able to change slip interface characteristics!


# 1.11 01-Aug-1993 mycroft

Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.


Revision tags: netbsd-0-9-patch-001 netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.10 12-Jul-1993 mycroft

Change tty code to use clist interface, but with ring buffer implementation.
Also, fix a couple of bugs in tty.c and pccons.c, and some gross kluginess
in the hp300 stuff.


# 1.9 27-Jun-1993 andrew

ANSIfications - removed all implicit function return types and argument
definitions. Ensured that all files include "systm.h" to gain access to
general prototypes. Casts where necessary.


# 1.8 22-May-1993 cgd

add include of select.h if necessary for protos, or delete if extraneous


# 1.7 18-May-1993 cgd

make kernel select interface be one-stop shopping & clean it all up.


# 1.6 10-May-1993 deraadt

ring buffer now uses rbchar's (shorts) instead of chars.


Revision tags: netbsd-0-8 netbsd-alpha-1
# 1.5 09-Apr-1993 cgd

bump slip MTU back down to 296...


# 1.4 25-Mar-1993 cgd

one line got botched during bpf patch installation


# 1.3 25-Mar-1993 cgd

added BPF support, as provided by David Greenman (davidg@implode.rain.com)


Revision tags: patchkit-0-2-2
# 1.2 21-Mar-1993 cgd

after 0.2.2 "stable" patches applied


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


# 1.134 27-Aug-2022 thorpej

Ensure that all queues passed to ifq_enqueue2() have a valid ifq_lock.


# 1.133 27-Aug-2022 thorpej

Use IFQ_SET_MAXLEN() rather than open-coding it.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.132 29-Jan-2020 thorpej

Adopt <net/if_stats.h>.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127
# 1.131 24-Jan-2019 knakahara

branches: 1.131.6;
Add comments about D_MPSAFE to functions called as struct linesw.l_ioctl.


Revision tags: pgoyette-compat-20190118 pgoyette-compat-1226
# 1.130 22-Dec-2018 maxv

Replace: M_MOVE_PKTHDR -> m_move_pkthdr. No functional change, since the
former is a macro to the latter.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422
# 1.129 20-Apr-2018 knakahara

branches: 1.129.2;
SIOCSIFDSTADDR uses struct ifreq instead of struct ifaddr or struct in_aliasreq.

SIOCSIFDSTADDR is not used by base package commands...

I checked sys/net*/* only.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.128 13-Apr-2017 maya

branches: 1.128.10;
if MGETHDR fails, don't try to copy to single mbuf and deref null.

reduce ifdefs.


Revision tags: jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 1.127 02-Oct-2016 christos

branches: 1.127.2;
MFREE -> m_free


Revision tags: localcount-20160914
# 1.126 07-Aug-2016 christos

modularize some more drivers and merge the module glue


# 1.125 06-Aug-2016 christos

make strip and slip modular, and cosmetic for ppp.


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.124 10-Jun-2016 ozaki-r

branches: 1.124.2;
Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.123 28-Apr-2016 ozaki-r

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 tags: nick-nhusb-base-20160422
# 1.122 20-Apr-2016 knakahara

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


Revision tags: nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.121 24-Aug-2015 pooka

sprinkle _KERNEL_OPT


# 1.120 20-Aug-2015 uebayasi

Honor pseudo attach decl generated by config(1).


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.119 05-Jun-2014 rmind

branches: 1.119.4;
- 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 tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.118 23-Sep-2011 christos

branches: 1.118.12; 1.118.26;
Change obsolete CBSIZE constant (48), to a power of two constant (64) that
is close enough to match the original assumptions.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base
# 1.117 05-Apr-2010 joerg

Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.116 19-Jan-2010 pooka

branches: 1.116.2; 1.116.4;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase jym-xensuspend-base
# 1.115 07-May-2009 elad

Introduce actions/requests to handle authorization for ppp(4), sl(4),
strip(4), btuart(4) and bcsp(4) network interfaces and devices.

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004955.html


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.114 17-Dec-2008 cegger

branches: 1.114.2;
kill MALLOC and FREE macros.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.113 07-Nov-2008 dyoung

*** 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 tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base
# 1.112 15-Jun-2008 christos

branches: 1.112.2; 1.112.4;
- add if_alloc (ours just mallocs), and if_initname and use them (from FreeBSD)
- kill memsets where M_ZERO can be used.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.111 24-Apr-2008 ad

branches: 1.111.2; 1.111.4; 1.111.6;
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 tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.110 07-Feb-2008 dyoung

branches: 1.110.6; 1.110.8;
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 tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.109 10-Nov-2007 ad

Call ttyflush() with tty_lock held.


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 vmlocking-base
# 1.108 08-Oct-2007 ad

branches: 1.108.2; 1.108.4;
Use the softint API.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base2 yamt-x86pmap-base
# 1.107 01-Sep-2007 dyoung

branches: 1.107.2;
Use ifreq_setaddr(), ifreq_getaddr(), sockaddr_in_init(), and
sockaddr_copy(). Constify. Compare pointers with NULL, not 0.
Don't "test truth" of pointers, but compare with NULL.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.106 14-Jul-2007 ad

branches: 1.106.2; 1.106.6; 1.106.8;
Generic soft interrupts are mandatory.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.105 04-Mar-2007 christos

branches: 1.105.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.104 17-Feb-2007 dyoung

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 tags: post-newlock2-merge newlock2-nbase newlock2-base
# 1.103 04-Jan-2007 elad

branches: 1.103.2;
Consistent usage of KAUTH_GENERIC_ISSUSER.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 netbsd-4-base
# 1.102 16-Nov-2006 christos

__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.101 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.100 23-Jul-2006 ad

branches: 1.100.4; 1.100.6;
Use the LWP cached credentials where sane.


# 1.99 08-Jul-2006 tsutsui

KNF.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.98 07-Jun-2006 kardel

branches: 1.98.2;
merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html


Revision tags: yamt-pdpolicy-base5 simonb-timecounters-base
# 1.97 14-May-2006 elad

branches: 1.97.2;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base
# 1.96 02-Mar-2006 christos

branches: 1.96.2; 1.96.4; 1.96.6;
Provide ppp like statistics instead of grovelling through the kernel
symbols.


Revision tags: yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 thorpej

branches: 1.95.4; 1.95.6;
ANSI function decls and application of static.


# 1.94 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 ktrace-lwp-base
# 1.93 27-Nov-2005 thorpej

Overhaul how TTY line disciplines are handled:
- Replace references to linesw[0] with a ttyldisc_default() function
that returns the default ("termios") line discipline.
- The linesw[] array is gone, replaced by a linked list.
- ttyldisc_add() and ttyldisc_remove() have been replaced by
ttyldisc_attach() and ttyldisc_detach().
- Things that provide line disciplines are now responsible for
registering those disciplines with the system. The linesw
structures are no longer declared in tty_conf.c
- Line disciplines are now refcounted; a lookup causes a reference to
be held. ttyldisc_release() releases the reference. Attempts to
detach an in-use line discipline result in EBUSY.
- Fix function signature lossage in if_sl.c, if_strip.c, and tty_tb.c
that was masked by the old tty_conf.c
- tty_init() is no longer necessary; delete it and its call from main().


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.92 18-Aug-2005 yamt

branches: 1.92.6;
- introduce M_MOVE_PKTHDR and use it where appropriate.
intended to be mostly API compatible with openbsd/freebsd.
- remove a glue #define in netipsec/ipsec_osdep.h.


Revision tags: kent-audio2-base
# 1.91 31-Mar-2005 christos

branches: 1.91.2;
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 tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE 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 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.90 06-Dec-2004 christos

branches: 1.90.4;
Sprinkle #ifdef INET to make a GENERIC kernel compile with INET undefined.


# 1.89 05-Dec-2004 peter

Don't forget to call bpfdetach in the clone destroy function.
While here, add a missing static and change some spaces to tabs.


# 1.88 05-Dec-2004 he

Fix what must have been an omission: missing brace and a leftover
use of `i', which is no longer defined. Fixes build problem for ports
not defining __HAVE_GENERIC_SOFT_INTERRUPTS.


# 1.87 05-Dec-2004 christos

clonify strip and sl.


# 1.86 19-Aug-2004 christos

Factor out the hand-crafting of mbufs from the interface files. Reviewed by
gimpy. XXX: I could have used bpf_mtap2 on some of the new functions, but I
chose not to, because I just wanted to do what amounts to a code move.


# 1.85 21-Apr-2004 itojun

kill sprintf, use snprintf


Revision tags: netbsd-2-0-3-RELEASE 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-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base 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-base
# 1.84 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.83 01-May-2003 itojun

branches: 1.83.2;
bpf_mtap() does not care about M_PKTHDR at the top. M_COPY_PKTHDR has some
consequences, so avoid it. if we need to attach dummy headers, we should
use M_PREPEND instead.


# 1.82 26-Feb-2003 matt

Add MBUFTRACE kernel option.
Do a little mbuf rework while here. Change all uses of MGET*(*, M_WAIT, *)
to m_get*(M_WAIT, *). These are not performance critical and making them
call m_get saves considerable space. Add m_clget analogue of MCLGET and
make corresponding change for M_WAIT uses.
Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE.
Begin to change netstat to use sysctl.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.81 11-Sep-2002 itojun

KNF - return is not a function.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base
# 1.80 17-Mar-2002 atatat

Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.


Revision tags: newlock-base ifpoll-base
# 1.79 14-Jan-2002 kleink

Include <machine/intr.h> unconditionally, instead of only doing so if
__HAVE_GENERIC_SOFT_INTERRUPTS and relying on <sys/param.h> to provide it
otherwise; pointed out by Aymeric Vincent.


# 1.78 12-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.77 15-Jul-2001 martin

branches: 1.77.2;
Fix slight glitch from rev. 1.70: bp is not adjusted for next loop after
outputting some data.
Fix provided by isaki@par.odn.ne.jp in PR kern/13472.


# 1.76 14-Jun-2001 itojun

branches: 1.76.2;
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.


# 1.75 30-May-2001 itojun

fix mbuf leak due to meaningless MGETHDR. from niels provos


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.74 13-Apr-2001 thorpej

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.


# 1.73 31-Mar-2001 enami

Remove unnecessary test of tp->t_linesw against NULL; they are results
of confusion while correcting compilation error after t_line is
replaced with t_linesw.


# 1.72 17-Jan-2001 thorpej

branches: 1.72.2;
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).


# 1.71 15-Jan-2001 thorpej

For SLIP/STRIP/PPP, use generic soft interrupts, if available.


# 1.70 12-Jan-2001 thorpej

After freeing the input buffer, set the pointer to it to NULL.


# 1.69 12-Jan-2001 thorpej

Don't use splimp() to block both net and tty interrupts. Instead,
block both interrupt levels as appropriate.


# 1.68 11-Jan-2001 thorpej

Plug a memory leak.


# 1.67 11-Jan-2001 thorpej

Defer output processing to the software interrupt.


# 1.66 10-Jan-2001 thorpej

Move the VJ uncompress code into the software interrupt.


# 1.65 09-Jan-2001 thorpej

Once we have a complete frame, schedule a SLIP software interrupt,
and manipulate ipintrq from there. This will allow us to clean up
the use of splimp() in this file later.


# 1.64 09-Jan-2001 thorpej

Make the buffer management in SLIP just a little less evil.


# 1.63 18-Dec-2000 thorpej

ALTQ'ify.


# 1.62 18-Dec-2000 thorpej

Fill in if_dlt.


# 1.61 12-Dec-2000 thorpej

Adapt to bpfattach() changes, and further centralize the bpfattach()
and bpfdetach() calls into link-type subroutines where possible.


# 1.60 02-Nov-2000 itohy

Set the default line discipline to t_linesw, rather than just NULL it.


# 1.59 02-Nov-2000 itohy

Adapt to the new line discipline scheme.


# 1.58 12-Jul-2000 thorpej

NetBSD -> __NetBSD__ in an #ifdef, and nuke sc_bpf; there's one in
the ifnet already.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 1.57 30-Mar-2000 augustss

Kill some more register declarations.


# 1.56 29-Mar-2000 simonb

Don't need to include <sys/conf.h> here.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base kame_141_19991130 comdex-fall-1999-base fvdl-softdep-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.55 27-Mar-1999 dbj

branches: 1.55.8;
fixes to compile if NBPFILTER == 0


# 1.54 25-Mar-1999 tron

Make it possible to set MTU via "ifconfig" at run time. "SLMTU" is now
used to set the initial value.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.53 06-Oct-1998 kleink

branches: 1.53.4;
Use #error instead of causing parse errors; noticed by Heiko.


# 1.52 26-Aug-1998 mrg

use __NetBSD__ not NetBSD


Revision tags: eeh-paddr_t-base
# 1.51 06-Jul-1998 jtk

use #ifdef INET so this compiles again


# 1.50 05-Jul-1998 jonathan

defopt INET, NETATALK.


# 1.49 23-Mar-1998 enami

Add missing comma.


# 1.48 23-Mar-1998 fair

add the ability to run SLIP with CLOCAL set, per PR#3586


# 1.47 01-Mar-1998 fvdl

Merge with Lite2 + local changes


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.46 17-May-1997 christos

Update to ppp-2.3b5


# 1.45 27-Mar-1997 thorpej

Update for the new mbuf code, in a slighly kludgy way. Basically, these
drivers played a somewhat evil trick with clusters, which is now
replaced by a somewhat evil trick with regular malloc'd memory.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.44 13-Oct-1996 christos

backout previous kprintf change


# 1.43 10-Oct-1996 christos

- printf -> kprintf, sprintf -> ksprintf


# 1.42 09-Aug-1996 mrg

use sc_unit instead of pointer arthimetic.


# 1.41 10-Jul-1996 cgd

print difference between pointers with %ld, so that -Wformat works
on the Alpha and for consistency. Also, other minor formatting cleanups.


# 1.40 02-Jun-1996 thorpej

Move a mis-placed line on slattach() so that SLIOCGUNIT works properly.
From Jonathan O'Brien <obrien@phoenix.sfsu.edu>.


Revision tags: netbsd-1-2-base
# 1.39 07-May-1996 thorpej

branches: 1.39.4;
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.


# 1.38 13-Feb-1996 christos

Net prototypes


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.37 12-Aug-1995 mycroft

splnet --> splsoftnet


# 1.36 13-Jun-1995 mycroft

There's no reason to set if_next here.


# 1.35 21-Mar-1995 mycroft

Update to use timer{add,sub}().


# 1.34 08-Mar-1995 cgd

fixed sized types, where appropriate. when casting pointers to
integers to do math on them, cast to long. ioctl commands are
u_longs.


# 1.33 11-Dec-1994 mycroft

timevalsub --> __timersub


# 1.32 30-Oct-1994 cgd

be more careful with types, also pull in headers where necessary.


# 1.31 16-Jul-1994 cgd

use NetBSD (defined in param.h) not __NetBSD__ to allow x-compilation
with native compiler.


# 1.30 15-Jul-1994 cgd

kill bogus external declaration of time


Revision tags: netbsd-1-0-base
# 1.29 29-Jun-1994 cgd

branches: 1.29.2;
New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'


# 1.28 13-May-1994 mycroft

Update to 4.4-Lite networking code, with a few local changes.


# 1.27 08-Mar-1994 cgd

Some stability/safety/extensibility patches. Inspired by Christoph Badura.
Always make sure our buffer is large enough, and restart hung lines.


# 1.26 10-Feb-1994 cgd

mccanne convinced me that slip.h *should* exist. this is what
i "implemented" for 4.4, and the adjustments to the other files to
match.


# 1.25 05-Feb-1994 mycroft

Remove an #ifdef we no longer need.


# 1.24 02-Feb-1994 hpeyerl

Multicast is no longer optional


# 1.23 08-Jan-1994 cgd

quench the grammar flames!


# 1.22 20-Dec-1993 cgd

serious cleanup


# 1.21 19-Dec-1993 cgd

include machine/cpu.h, for machines which define soft interrupt stuff
there. marked XXX; they prolly shouldn't do that...


# 1.20 18-Dec-1993 mycroft

Canonicalize all #includes.


# 1.19 10-Dec-1993 cgd

move slip compression configuration into the interface flags,
and diddle a couple of related things.


# 1.18 06-Dec-1993 hpeyerl

multicast support.
From Chris Maeda, cmaeda@cs.washington.edu
These patches are derived from the IP Multicast patches for BSDI.


# 1.17 09-Nov-1993 glass

T_LINEP member of struct tty becomes t_sc. This replaces the
#define t_sc T_LINEP
that appear in tty_tb.c, if_sl.c, and if_ppp.h


# 1.16 31-Oct-1993 glass

removed slip and ppp specific prototypes from tty.h where they didn't belong.
moved them to tty_conf.c within #if Nwhatever > 0 where they do belong.
made sure that if_sl.c, and if_ppp.c still compile quietly.


# 1.15 02-Oct-1993 mycroft

Call output routine redundantly to possible avoid some hangs due to missed
interrupts.


# 1.14 02-Oct-1993 mycroft

Ignore carrier if not using hardware carrier detect (i.e. CLOCAL is set).


# 1.13 23-Sep-1993 mycroft

Ignore TS_CARR_ON when CLOCAL is set.


Revision tags: magnum-base
# 1.12 09-Aug-1993 deraadt

branches: 1.12.2;
add an additional suser() check.
regular users should not be able to change slip interface characteristics!


# 1.11 01-Aug-1993 mycroft

Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.


Revision tags: netbsd-0-9-patch-001 netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.10 12-Jul-1993 mycroft

Change tty code to use clist interface, but with ring buffer implementation.
Also, fix a couple of bugs in tty.c and pccons.c, and some gross kluginess
in the hp300 stuff.


# 1.9 27-Jun-1993 andrew

ANSIfications - removed all implicit function return types and argument
definitions. Ensured that all files include "systm.h" to gain access to
general prototypes. Casts where necessary.


# 1.8 22-May-1993 cgd

add include of select.h if necessary for protos, or delete if extraneous


# 1.7 18-May-1993 cgd

make kernel select interface be one-stop shopping & clean it all up.


# 1.6 10-May-1993 deraadt

ring buffer now uses rbchar's (shorts) instead of chars.


Revision tags: netbsd-0-8 netbsd-alpha-1
# 1.5 09-Apr-1993 cgd

bump slip MTU back down to 296...


# 1.4 25-Mar-1993 cgd

one line got botched during bpf patch installation


# 1.3 25-Mar-1993 cgd

added BPF support, as provided by David Greenman (davidg@implode.rain.com)


Revision tags: patchkit-0-2-2
# 1.2 21-Mar-1993 cgd

after 0.2.2 "stable" patches applied


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


# 1.132 29-Jan-2020 thorpej

Adopt <net/if_stats.h>.


Revision tags: ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127
# 1.131 24-Jan-2019 knakahara

Add comments about D_MPSAFE to functions called as struct linesw.l_ioctl.


Revision tags: pgoyette-compat-20190118 pgoyette-compat-1226
# 1.130 22-Dec-2018 maxv

Replace: M_MOVE_PKTHDR -> m_move_pkthdr. No functional change, since the
former is a macro to the latter.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422
# 1.129 20-Apr-2018 knakahara

branches: 1.129.2;
SIOCSIFDSTADDR uses struct ifreq instead of struct ifaddr or struct in_aliasreq.

SIOCSIFDSTADDR is not used by base package commands...

I checked sys/net*/* only.


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.128 13-Apr-2017 maya

branches: 1.128.10;
if MGETHDR fails, don't try to copy to single mbuf and deref null.

reduce ifdefs.


Revision tags: jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 1.127 02-Oct-2016 christos

branches: 1.127.2;
MFREE -> m_free


Revision tags: localcount-20160914
# 1.126 07-Aug-2016 christos

modularize some more drivers and merge the module glue


# 1.125 06-Aug-2016 christos

make strip and slip modular, and cosmetic for ppp.


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.124 10-Jun-2016 ozaki-r

branches: 1.124.2;
Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.123 28-Apr-2016 ozaki-r

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 tags: nick-nhusb-base-20160422
# 1.122 20-Apr-2016 knakahara

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


Revision tags: nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.121 24-Aug-2015 pooka

sprinkle _KERNEL_OPT


# 1.120 20-Aug-2015 uebayasi

Honor pseudo attach decl generated by config(1).


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.119 05-Jun-2014 rmind

branches: 1.119.4;
- 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 tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.118 23-Sep-2011 christos

branches: 1.118.12; 1.118.26;
Change obsolete CBSIZE constant (48), to a power of two constant (64) that
is close enough to match the original assumptions.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base
# 1.117 05-Apr-2010 joerg

Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.116 19-Jan-2010 pooka

branches: 1.116.2; 1.116.4;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase jym-xensuspend-base
# 1.115 07-May-2009 elad

Introduce actions/requests to handle authorization for ppp(4), sl(4),
strip(4), btuart(4) and bcsp(4) network interfaces and devices.

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004955.html


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.114 17-Dec-2008 cegger

branches: 1.114.2;
kill MALLOC and FREE macros.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.113 07-Nov-2008 dyoung

*** 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 tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base
# 1.112 15-Jun-2008 christos

branches: 1.112.2; 1.112.4;
- add if_alloc (ours just mallocs), and if_initname and use them (from FreeBSD)
- kill memsets where M_ZERO can be used.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.111 24-Apr-2008 ad

branches: 1.111.2; 1.111.4; 1.111.6;
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 tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.110 07-Feb-2008 dyoung

branches: 1.110.6; 1.110.8;
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 tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.109 10-Nov-2007 ad

Call ttyflush() with tty_lock held.


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 vmlocking-base
# 1.108 08-Oct-2007 ad

branches: 1.108.2; 1.108.4;
Use the softint API.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base2 yamt-x86pmap-base
# 1.107 01-Sep-2007 dyoung

branches: 1.107.2;
Use ifreq_setaddr(), ifreq_getaddr(), sockaddr_in_init(), and
sockaddr_copy(). Constify. Compare pointers with NULL, not 0.
Don't "test truth" of pointers, but compare with NULL.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.106 14-Jul-2007 ad

branches: 1.106.2; 1.106.6; 1.106.8;
Generic soft interrupts are mandatory.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.105 04-Mar-2007 christos

branches: 1.105.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.104 17-Feb-2007 dyoung

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 tags: post-newlock2-merge newlock2-nbase newlock2-base
# 1.103 04-Jan-2007 elad

branches: 1.103.2;
Consistent usage of KAUTH_GENERIC_ISSUSER.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 netbsd-4-base
# 1.102 16-Nov-2006 christos

__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.101 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.100 23-Jul-2006 ad

branches: 1.100.4; 1.100.6;
Use the LWP cached credentials where sane.


# 1.99 08-Jul-2006 tsutsui

KNF.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.98 07-Jun-2006 kardel

branches: 1.98.2;
merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html


Revision tags: yamt-pdpolicy-base5 simonb-timecounters-base
# 1.97 14-May-2006 elad

branches: 1.97.2;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base
# 1.96 02-Mar-2006 christos

branches: 1.96.2; 1.96.4; 1.96.6;
Provide ppp like statistics instead of grovelling through the kernel
symbols.


Revision tags: yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 thorpej

branches: 1.95.4; 1.95.6;
ANSI function decls and application of static.


# 1.94 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 ktrace-lwp-base
# 1.93 27-Nov-2005 thorpej

Overhaul how TTY line disciplines are handled:
- Replace references to linesw[0] with a ttyldisc_default() function
that returns the default ("termios") line discipline.
- The linesw[] array is gone, replaced by a linked list.
- ttyldisc_add() and ttyldisc_remove() have been replaced by
ttyldisc_attach() and ttyldisc_detach().
- Things that provide line disciplines are now responsible for
registering those disciplines with the system. The linesw
structures are no longer declared in tty_conf.c
- Line disciplines are now refcounted; a lookup causes a reference to
be held. ttyldisc_release() releases the reference. Attempts to
detach an in-use line discipline result in EBUSY.
- Fix function signature lossage in if_sl.c, if_strip.c, and tty_tb.c
that was masked by the old tty_conf.c
- tty_init() is no longer necessary; delete it and its call from main().


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.92 18-Aug-2005 yamt

branches: 1.92.6;
- introduce M_MOVE_PKTHDR and use it where appropriate.
intended to be mostly API compatible with openbsd/freebsd.
- remove a glue #define in netipsec/ipsec_osdep.h.


Revision tags: kent-audio2-base
# 1.91 31-Mar-2005 christos

branches: 1.91.2;
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 tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE 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 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.90 06-Dec-2004 christos

branches: 1.90.4;
Sprinkle #ifdef INET to make a GENERIC kernel compile with INET undefined.


# 1.89 05-Dec-2004 peter

Don't forget to call bpfdetach in the clone destroy function.
While here, add a missing static and change some spaces to tabs.


# 1.88 05-Dec-2004 he

Fix what must have been an omission: missing brace and a leftover
use of `i', which is no longer defined. Fixes build problem for ports
not defining __HAVE_GENERIC_SOFT_INTERRUPTS.


# 1.87 05-Dec-2004 christos

clonify strip and sl.


# 1.86 19-Aug-2004 christos

Factor out the hand-crafting of mbufs from the interface files. Reviewed by
gimpy. XXX: I could have used bpf_mtap2 on some of the new functions, but I
chose not to, because I just wanted to do what amounts to a code move.


# 1.85 21-Apr-2004 itojun

kill sprintf, use snprintf


Revision tags: netbsd-2-0-3-RELEASE 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-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base 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-base
# 1.84 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.83 01-May-2003 itojun

branches: 1.83.2;
bpf_mtap() does not care about M_PKTHDR at the top. M_COPY_PKTHDR has some
consequences, so avoid it. if we need to attach dummy headers, we should
use M_PREPEND instead.


# 1.82 26-Feb-2003 matt

Add MBUFTRACE kernel option.
Do a little mbuf rework while here. Change all uses of MGET*(*, M_WAIT, *)
to m_get*(M_WAIT, *). These are not performance critical and making them
call m_get saves considerable space. Add m_clget analogue of MCLGET and
make corresponding change for M_WAIT uses.
Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE.
Begin to change netstat to use sysctl.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.81 11-Sep-2002 itojun

KNF - return is not a function.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base
# 1.80 17-Mar-2002 atatat

Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.


Revision tags: newlock-base ifpoll-base
# 1.79 14-Jan-2002 kleink

Include <machine/intr.h> unconditionally, instead of only doing so if
__HAVE_GENERIC_SOFT_INTERRUPTS and relying on <sys/param.h> to provide it
otherwise; pointed out by Aymeric Vincent.


# 1.78 12-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.77 15-Jul-2001 martin

branches: 1.77.2;
Fix slight glitch from rev. 1.70: bp is not adjusted for next loop after
outputting some data.
Fix provided by isaki@par.odn.ne.jp in PR kern/13472.


# 1.76 14-Jun-2001 itojun

branches: 1.76.2;
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.


# 1.75 30-May-2001 itojun

fix mbuf leak due to meaningless MGETHDR. from niels provos


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.74 13-Apr-2001 thorpej

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.


# 1.73 31-Mar-2001 enami

Remove unnecessary test of tp->t_linesw against NULL; they are results
of confusion while correcting compilation error after t_line is
replaced with t_linesw.


# 1.72 17-Jan-2001 thorpej

branches: 1.72.2;
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).


# 1.71 15-Jan-2001 thorpej

For SLIP/STRIP/PPP, use generic soft interrupts, if available.


# 1.70 12-Jan-2001 thorpej

After freeing the input buffer, set the pointer to it to NULL.


# 1.69 12-Jan-2001 thorpej

Don't use splimp() to block both net and tty interrupts. Instead,
block both interrupt levels as appropriate.


# 1.68 11-Jan-2001 thorpej

Plug a memory leak.


# 1.67 11-Jan-2001 thorpej

Defer output processing to the software interrupt.


# 1.66 10-Jan-2001 thorpej

Move the VJ uncompress code into the software interrupt.


# 1.65 09-Jan-2001 thorpej

Once we have a complete frame, schedule a SLIP software interrupt,
and manipulate ipintrq from there. This will allow us to clean up
the use of splimp() in this file later.


# 1.64 09-Jan-2001 thorpej

Make the buffer management in SLIP just a little less evil.


# 1.63 18-Dec-2000 thorpej

ALTQ'ify.


# 1.62 18-Dec-2000 thorpej

Fill in if_dlt.


# 1.61 12-Dec-2000 thorpej

Adapt to bpfattach() changes, and further centralize the bpfattach()
and bpfdetach() calls into link-type subroutines where possible.


# 1.60 02-Nov-2000 itohy

Set the default line discipline to t_linesw, rather than just NULL it.


# 1.59 02-Nov-2000 itohy

Adapt to the new line discipline scheme.


# 1.58 12-Jul-2000 thorpej

NetBSD -> __NetBSD__ in an #ifdef, and nuke sc_bpf; there's one in
the ifnet already.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 1.57 30-Mar-2000 augustss

Kill some more register declarations.


# 1.56 29-Mar-2000 simonb

Don't need to include <sys/conf.h> here.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base kame_141_19991130 comdex-fall-1999-base fvdl-softdep-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.55 27-Mar-1999 dbj

branches: 1.55.8;
fixes to compile if NBPFILTER == 0


# 1.54 25-Mar-1999 tron

Make it possible to set MTU via "ifconfig" at run time. "SLMTU" is now
used to set the initial value.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.53 06-Oct-1998 kleink

branches: 1.53.4;
Use #error instead of causing parse errors; noticed by Heiko.


# 1.52 26-Aug-1998 mrg

use __NetBSD__ not NetBSD


Revision tags: eeh-paddr_t-base
# 1.51 06-Jul-1998 jtk

use #ifdef INET so this compiles again


# 1.50 05-Jul-1998 jonathan

defopt INET, NETATALK.


# 1.49 23-Mar-1998 enami

Add missing comma.


# 1.48 23-Mar-1998 fair

add the ability to run SLIP with CLOCAL set, per PR#3586


# 1.47 01-Mar-1998 fvdl

Merge with Lite2 + local changes


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.46 17-May-1997 christos

Update to ppp-2.3b5


# 1.45 27-Mar-1997 thorpej

Update for the new mbuf code, in a slighly kludgy way. Basically, these
drivers played a somewhat evil trick with clusters, which is now
replaced by a somewhat evil trick with regular malloc'd memory.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.44 13-Oct-1996 christos

backout previous kprintf change


# 1.43 10-Oct-1996 christos

- printf -> kprintf, sprintf -> ksprintf


# 1.42 09-Aug-1996 mrg

use sc_unit instead of pointer arthimetic.


# 1.41 10-Jul-1996 cgd

print difference between pointers with %ld, so that -Wformat works
on the Alpha and for consistency. Also, other minor formatting cleanups.


# 1.40 02-Jun-1996 thorpej

Move a mis-placed line on slattach() so that SLIOCGUNIT works properly.
From Jonathan O'Brien <obrien@phoenix.sfsu.edu>.


Revision tags: netbsd-1-2-base
# 1.39 07-May-1996 thorpej

branches: 1.39.4;
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.


# 1.38 13-Feb-1996 christos

Net prototypes


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.37 12-Aug-1995 mycroft

splnet --> splsoftnet


# 1.36 13-Jun-1995 mycroft

There's no reason to set if_next here.


# 1.35 21-Mar-1995 mycroft

Update to use timer{add,sub}().


# 1.34 08-Mar-1995 cgd

fixed sized types, where appropriate. when casting pointers to
integers to do math on them, cast to long. ioctl commands are
u_longs.


# 1.33 11-Dec-1994 mycroft

timevalsub --> __timersub


# 1.32 30-Oct-1994 cgd

be more careful with types, also pull in headers where necessary.


# 1.31 16-Jul-1994 cgd

use NetBSD (defined in param.h) not __NetBSD__ to allow x-compilation
with native compiler.


# 1.30 15-Jul-1994 cgd

kill bogus external declaration of time


Revision tags: netbsd-1-0-base
# 1.29 29-Jun-1994 cgd

branches: 1.29.2;
New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'


# 1.28 13-May-1994 mycroft

Update to 4.4-Lite networking code, with a few local changes.


# 1.27 08-Mar-1994 cgd

Some stability/safety/extensibility patches. Inspired by Christoph Badura.
Always make sure our buffer is large enough, and restart hung lines.


# 1.26 10-Feb-1994 cgd

mccanne convinced me that slip.h *should* exist. this is what
i "implemented" for 4.4, and the adjustments to the other files to
match.


# 1.25 05-Feb-1994 mycroft

Remove an #ifdef we no longer need.


# 1.24 02-Feb-1994 hpeyerl

Multicast is no longer optional


# 1.23 08-Jan-1994 cgd

quench the grammar flames!


# 1.22 20-Dec-1993 cgd

serious cleanup


# 1.21 19-Dec-1993 cgd

include machine/cpu.h, for machines which define soft interrupt stuff
there. marked XXX; they prolly shouldn't do that...


# 1.20 18-Dec-1993 mycroft

Canonicalize all #includes.


# 1.19 10-Dec-1993 cgd

move slip compression configuration into the interface flags,
and diddle a couple of related things.


# 1.18 06-Dec-1993 hpeyerl

multicast support.
From Chris Maeda, cmaeda@cs.washington.edu
These patches are derived from the IP Multicast patches for BSDI.


# 1.17 09-Nov-1993 glass

T_LINEP member of struct tty becomes t_sc. This replaces the
#define t_sc T_LINEP
that appear in tty_tb.c, if_sl.c, and if_ppp.h


# 1.16 31-Oct-1993 glass

removed slip and ppp specific prototypes from tty.h where they didn't belong.
moved them to tty_conf.c within #if Nwhatever > 0 where they do belong.
made sure that if_sl.c, and if_ppp.c still compile quietly.


# 1.15 02-Oct-1993 mycroft

Call output routine redundantly to possible avoid some hangs due to missed
interrupts.


# 1.14 02-Oct-1993 mycroft

Ignore carrier if not using hardware carrier detect (i.e. CLOCAL is set).


# 1.13 23-Sep-1993 mycroft

Ignore TS_CARR_ON when CLOCAL is set.


Revision tags: magnum-base
# 1.12 09-Aug-1993 deraadt

branches: 1.12.2;
add an additional suser() check.
regular users should not be able to change slip interface characteristics!


# 1.11 01-Aug-1993 mycroft

Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.


Revision tags: netbsd-0-9-patch-001 netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.10 12-Jul-1993 mycroft

Change tty code to use clist interface, but with ring buffer implementation.
Also, fix a couple of bugs in tty.c and pccons.c, and some gross kluginess
in the hp300 stuff.


# 1.9 27-Jun-1993 andrew

ANSIfications - removed all implicit function return types and argument
definitions. Ensured that all files include "systm.h" to gain access to
general prototypes. Casts where necessary.


# 1.8 22-May-1993 cgd

add include of select.h if necessary for protos, or delete if extraneous


# 1.7 18-May-1993 cgd

make kernel select interface be one-stop shopping & clean it all up.


# 1.6 10-May-1993 deraadt

ring buffer now uses rbchar's (shorts) instead of chars.


Revision tags: netbsd-0-8 netbsd-alpha-1
# 1.5 09-Apr-1993 cgd

bump slip MTU back down to 296...


# 1.4 25-Mar-1993 cgd

one line got botched during bpf patch installation


# 1.3 25-Mar-1993 cgd

added BPF support, as provided by David Greenman (davidg@implode.rain.com)


Revision tags: patchkit-0-2-2
# 1.2 21-Mar-1993 cgd

after 0.2.2 "stable" patches applied


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


Revision tags: isaki-audio2-base pgoyette-compat-20190127
# 1.131 24-Jan-2019 knakahara

Add comments about D_MPSAFE to functions called as struct linesw.l_ioctl.


Revision tags: pgoyette-compat-20190118 pgoyette-compat-1226
# 1.130 22-Dec-2018 maxv

Replace: M_MOVE_PKTHDR -> m_move_pkthdr. No functional change, since the
former is a macro to the latter.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422
# 1.129 20-Apr-2018 knakahara

SIOCSIFDSTADDR uses struct ifreq instead of struct ifaddr or struct in_aliasreq.

SIOCSIFDSTADDR is not used by base package commands...

I checked sys/net*/* only.


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.128 13-Apr-2017 maya

branches: 1.128.10;
if MGETHDR fails, don't try to copy to single mbuf and deref null.

reduce ifdefs.


Revision tags: jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 1.127 02-Oct-2016 christos

branches: 1.127.2;
MFREE -> m_free


Revision tags: localcount-20160914
# 1.126 07-Aug-2016 christos

modularize some more drivers and merge the module glue


# 1.125 06-Aug-2016 christos

make strip and slip modular, and cosmetic for ppp.


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.124 10-Jun-2016 ozaki-r

branches: 1.124.2;
Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.123 28-Apr-2016 ozaki-r

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 tags: nick-nhusb-base-20160422
# 1.122 20-Apr-2016 knakahara

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


Revision tags: nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.121 24-Aug-2015 pooka

sprinkle _KERNEL_OPT


# 1.120 20-Aug-2015 uebayasi

Honor pseudo attach decl generated by config(1).


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.119 05-Jun-2014 rmind

branches: 1.119.4;
- 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 tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.118 23-Sep-2011 christos

branches: 1.118.12; 1.118.26;
Change obsolete CBSIZE constant (48), to a power of two constant (64) that
is close enough to match the original assumptions.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base
# 1.117 05-Apr-2010 joerg

Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.116 19-Jan-2010 pooka

branches: 1.116.2; 1.116.4;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase jym-xensuspend-base
# 1.115 07-May-2009 elad

Introduce actions/requests to handle authorization for ppp(4), sl(4),
strip(4), btuart(4) and bcsp(4) network interfaces and devices.

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004955.html


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.114 17-Dec-2008 cegger

branches: 1.114.2;
kill MALLOC and FREE macros.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.113 07-Nov-2008 dyoung

*** 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 tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base
# 1.112 15-Jun-2008 christos

branches: 1.112.2; 1.112.4;
- add if_alloc (ours just mallocs), and if_initname and use them (from FreeBSD)
- kill memsets where M_ZERO can be used.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.111 24-Apr-2008 ad

branches: 1.111.2; 1.111.4; 1.111.6;
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 tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.110 07-Feb-2008 dyoung

branches: 1.110.6; 1.110.8;
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 tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.109 10-Nov-2007 ad

Call ttyflush() with tty_lock held.


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 vmlocking-base
# 1.108 08-Oct-2007 ad

branches: 1.108.2; 1.108.4;
Use the softint API.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base2 yamt-x86pmap-base
# 1.107 01-Sep-2007 dyoung

branches: 1.107.2;
Use ifreq_setaddr(), ifreq_getaddr(), sockaddr_in_init(), and
sockaddr_copy(). Constify. Compare pointers with NULL, not 0.
Don't "test truth" of pointers, but compare with NULL.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.106 14-Jul-2007 ad

branches: 1.106.2; 1.106.6; 1.106.8;
Generic soft interrupts are mandatory.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.105 04-Mar-2007 christos

branches: 1.105.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.104 17-Feb-2007 dyoung

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 tags: post-newlock2-merge newlock2-nbase newlock2-base
# 1.103 04-Jan-2007 elad

branches: 1.103.2;
Consistent usage of KAUTH_GENERIC_ISSUSER.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 netbsd-4-base
# 1.102 16-Nov-2006 christos

__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.101 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.100 23-Jul-2006 ad

branches: 1.100.4; 1.100.6;
Use the LWP cached credentials where sane.


# 1.99 08-Jul-2006 tsutsui

KNF.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.98 07-Jun-2006 kardel

branches: 1.98.2;
merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html


Revision tags: yamt-pdpolicy-base5 simonb-timecounters-base
# 1.97 14-May-2006 elad

branches: 1.97.2;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base
# 1.96 02-Mar-2006 christos

branches: 1.96.2; 1.96.4; 1.96.6;
Provide ppp like statistics instead of grovelling through the kernel
symbols.


Revision tags: yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 thorpej

branches: 1.95.4; 1.95.6;
ANSI function decls and application of static.


# 1.94 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 ktrace-lwp-base
# 1.93 27-Nov-2005 thorpej

Overhaul how TTY line disciplines are handled:
- Replace references to linesw[0] with a ttyldisc_default() function
that returns the default ("termios") line discipline.
- The linesw[] array is gone, replaced by a linked list.
- ttyldisc_add() and ttyldisc_remove() have been replaced by
ttyldisc_attach() and ttyldisc_detach().
- Things that provide line disciplines are now responsible for
registering those disciplines with the system. The linesw
structures are no longer declared in tty_conf.c
- Line disciplines are now refcounted; a lookup causes a reference to
be held. ttyldisc_release() releases the reference. Attempts to
detach an in-use line discipline result in EBUSY.
- Fix function signature lossage in if_sl.c, if_strip.c, and tty_tb.c
that was masked by the old tty_conf.c
- tty_init() is no longer necessary; delete it and its call from main().


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.92 18-Aug-2005 yamt

branches: 1.92.6;
- introduce M_MOVE_PKTHDR and use it where appropriate.
intended to be mostly API compatible with openbsd/freebsd.
- remove a glue #define in netipsec/ipsec_osdep.h.


Revision tags: kent-audio2-base
# 1.91 31-Mar-2005 christos

branches: 1.91.2;
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 tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE 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 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.90 06-Dec-2004 christos

branches: 1.90.4;
Sprinkle #ifdef INET to make a GENERIC kernel compile with INET undefined.


# 1.89 05-Dec-2004 peter

Don't forget to call bpfdetach in the clone destroy function.
While here, add a missing static and change some spaces to tabs.


# 1.88 05-Dec-2004 he

Fix what must have been an omission: missing brace and a leftover
use of `i', which is no longer defined. Fixes build problem for ports
not defining __HAVE_GENERIC_SOFT_INTERRUPTS.


# 1.87 05-Dec-2004 christos

clonify strip and sl.


# 1.86 19-Aug-2004 christos

Factor out the hand-crafting of mbufs from the interface files. Reviewed by
gimpy. XXX: I could have used bpf_mtap2 on some of the new functions, but I
chose not to, because I just wanted to do what amounts to a code move.


# 1.85 21-Apr-2004 itojun

kill sprintf, use snprintf


Revision tags: netbsd-2-0-3-RELEASE 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-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base 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-base
# 1.84 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.83 01-May-2003 itojun

branches: 1.83.2;
bpf_mtap() does not care about M_PKTHDR at the top. M_COPY_PKTHDR has some
consequences, so avoid it. if we need to attach dummy headers, we should
use M_PREPEND instead.


# 1.82 26-Feb-2003 matt

Add MBUFTRACE kernel option.
Do a little mbuf rework while here. Change all uses of MGET*(*, M_WAIT, *)
to m_get*(M_WAIT, *). These are not performance critical and making them
call m_get saves considerable space. Add m_clget analogue of MCLGET and
make corresponding change for M_WAIT uses.
Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE.
Begin to change netstat to use sysctl.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.81 11-Sep-2002 itojun

KNF - return is not a function.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base
# 1.80 17-Mar-2002 atatat

Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.


Revision tags: newlock-base ifpoll-base
# 1.79 14-Jan-2002 kleink

Include <machine/intr.h> unconditionally, instead of only doing so if
__HAVE_GENERIC_SOFT_INTERRUPTS and relying on <sys/param.h> to provide it
otherwise; pointed out by Aymeric Vincent.


# 1.78 12-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.77 15-Jul-2001 martin

branches: 1.77.2;
Fix slight glitch from rev. 1.70: bp is not adjusted for next loop after
outputting some data.
Fix provided by isaki@par.odn.ne.jp in PR kern/13472.


# 1.76 14-Jun-2001 itojun

branches: 1.76.2;
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.


# 1.75 30-May-2001 itojun

fix mbuf leak due to meaningless MGETHDR. from niels provos


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.74 13-Apr-2001 thorpej

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.


# 1.73 31-Mar-2001 enami

Remove unnecessary test of tp->t_linesw against NULL; they are results
of confusion while correcting compilation error after t_line is
replaced with t_linesw.


# 1.72 17-Jan-2001 thorpej

branches: 1.72.2;
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).


# 1.71 15-Jan-2001 thorpej

For SLIP/STRIP/PPP, use generic soft interrupts, if available.


# 1.70 12-Jan-2001 thorpej

After freeing the input buffer, set the pointer to it to NULL.


# 1.69 12-Jan-2001 thorpej

Don't use splimp() to block both net and tty interrupts. Instead,
block both interrupt levels as appropriate.


# 1.68 11-Jan-2001 thorpej

Plug a memory leak.


# 1.67 11-Jan-2001 thorpej

Defer output processing to the software interrupt.


# 1.66 10-Jan-2001 thorpej

Move the VJ uncompress code into the software interrupt.


# 1.65 09-Jan-2001 thorpej

Once we have a complete frame, schedule a SLIP software interrupt,
and manipulate ipintrq from there. This will allow us to clean up
the use of splimp() in this file later.


# 1.64 09-Jan-2001 thorpej

Make the buffer management in SLIP just a little less evil.


# 1.63 18-Dec-2000 thorpej

ALTQ'ify.


# 1.62 18-Dec-2000 thorpej

Fill in if_dlt.


# 1.61 12-Dec-2000 thorpej

Adapt to bpfattach() changes, and further centralize the bpfattach()
and bpfdetach() calls into link-type subroutines where possible.


# 1.60 02-Nov-2000 itohy

Set the default line discipline to t_linesw, rather than just NULL it.


# 1.59 02-Nov-2000 itohy

Adapt to the new line discipline scheme.


# 1.58 12-Jul-2000 thorpej

NetBSD -> __NetBSD__ in an #ifdef, and nuke sc_bpf; there's one in
the ifnet already.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 1.57 30-Mar-2000 augustss

Kill some more register declarations.


# 1.56 29-Mar-2000 simonb

Don't need to include <sys/conf.h> here.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base kame_141_19991130 comdex-fall-1999-base fvdl-softdep-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.55 27-Mar-1999 dbj

branches: 1.55.8;
fixes to compile if NBPFILTER == 0


# 1.54 25-Mar-1999 tron

Make it possible to set MTU via "ifconfig" at run time. "SLMTU" is now
used to set the initial value.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.53 06-Oct-1998 kleink

branches: 1.53.4;
Use #error instead of causing parse errors; noticed by Heiko.


# 1.52 26-Aug-1998 mrg

use __NetBSD__ not NetBSD


Revision tags: eeh-paddr_t-base
# 1.51 06-Jul-1998 jtk

use #ifdef INET so this compiles again


# 1.50 05-Jul-1998 jonathan

defopt INET, NETATALK.


# 1.49 23-Mar-1998 enami

Add missing comma.


# 1.48 23-Mar-1998 fair

add the ability to run SLIP with CLOCAL set, per PR#3586


# 1.47 01-Mar-1998 fvdl

Merge with Lite2 + local changes


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.46 17-May-1997 christos

Update to ppp-2.3b5


# 1.45 27-Mar-1997 thorpej

Update for the new mbuf code, in a slighly kludgy way. Basically, these
drivers played a somewhat evil trick with clusters, which is now
replaced by a somewhat evil trick with regular malloc'd memory.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.44 13-Oct-1996 christos

backout previous kprintf change


# 1.43 10-Oct-1996 christos

- printf -> kprintf, sprintf -> ksprintf


# 1.42 09-Aug-1996 mrg

use sc_unit instead of pointer arthimetic.


# 1.41 10-Jul-1996 cgd

print difference between pointers with %ld, so that -Wformat works
on the Alpha and for consistency. Also, other minor formatting cleanups.


# 1.40 02-Jun-1996 thorpej

Move a mis-placed line on slattach() so that SLIOCGUNIT works properly.
From Jonathan O'Brien <obrien@phoenix.sfsu.edu>.


Revision tags: netbsd-1-2-base
# 1.39 07-May-1996 thorpej

branches: 1.39.4;
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.


# 1.38 13-Feb-1996 christos

Net prototypes


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.37 12-Aug-1995 mycroft

splnet --> splsoftnet


# 1.36 13-Jun-1995 mycroft

There's no reason to set if_next here.


# 1.35 21-Mar-1995 mycroft

Update to use timer{add,sub}().


# 1.34 08-Mar-1995 cgd

fixed sized types, where appropriate. when casting pointers to
integers to do math on them, cast to long. ioctl commands are
u_longs.


# 1.33 11-Dec-1994 mycroft

timevalsub --> __timersub


# 1.32 30-Oct-1994 cgd

be more careful with types, also pull in headers where necessary.


# 1.31 16-Jul-1994 cgd

use NetBSD (defined in param.h) not __NetBSD__ to allow x-compilation
with native compiler.


# 1.30 15-Jul-1994 cgd

kill bogus external declaration of time


Revision tags: netbsd-1-0-base
# 1.29 29-Jun-1994 cgd

branches: 1.29.2;
New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'


# 1.28 13-May-1994 mycroft

Update to 4.4-Lite networking code, with a few local changes.


# 1.27 08-Mar-1994 cgd

Some stability/safety/extensibility patches. Inspired by Christoph Badura.
Always make sure our buffer is large enough, and restart hung lines.


# 1.26 10-Feb-1994 cgd

mccanne convinced me that slip.h *should* exist. this is what
i "implemented" for 4.4, and the adjustments to the other files to
match.


# 1.25 05-Feb-1994 mycroft

Remove an #ifdef we no longer need.


# 1.24 02-Feb-1994 hpeyerl

Multicast is no longer optional


# 1.23 08-Jan-1994 cgd

quench the grammar flames!


# 1.22 20-Dec-1993 cgd

serious cleanup


# 1.21 19-Dec-1993 cgd

include machine/cpu.h, for machines which define soft interrupt stuff
there. marked XXX; they prolly shouldn't do that...


# 1.20 18-Dec-1993 mycroft

Canonicalize all #includes.


# 1.19 10-Dec-1993 cgd

move slip compression configuration into the interface flags,
and diddle a couple of related things.


# 1.18 06-Dec-1993 hpeyerl

multicast support.
From Chris Maeda, cmaeda@cs.washington.edu
These patches are derived from the IP Multicast patches for BSDI.


# 1.17 09-Nov-1993 glass

T_LINEP member of struct tty becomes t_sc. This replaces the
#define t_sc T_LINEP
that appear in tty_tb.c, if_sl.c, and if_ppp.h


# 1.16 31-Oct-1993 glass

removed slip and ppp specific prototypes from tty.h where they didn't belong.
moved them to tty_conf.c within #if Nwhatever > 0 where they do belong.
made sure that if_sl.c, and if_ppp.c still compile quietly.


# 1.15 02-Oct-1993 mycroft

Call output routine redundantly to possible avoid some hangs due to missed
interrupts.


# 1.14 02-Oct-1993 mycroft

Ignore carrier if not using hardware carrier detect (i.e. CLOCAL is set).


# 1.13 23-Sep-1993 mycroft

Ignore TS_CARR_ON when CLOCAL is set.


Revision tags: magnum-base
# 1.12 09-Aug-1993 deraadt

branches: 1.12.2;
add an additional suser() check.
regular users should not be able to change slip interface characteristics!


# 1.11 01-Aug-1993 mycroft

Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.


Revision tags: netbsd-0-9-patch-001 netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.10 12-Jul-1993 mycroft

Change tty code to use clist interface, but with ring buffer implementation.
Also, fix a couple of bugs in tty.c and pccons.c, and some gross kluginess
in the hp300 stuff.


# 1.9 27-Jun-1993 andrew

ANSIfications - removed all implicit function return types and argument
definitions. Ensured that all files include "systm.h" to gain access to
general prototypes. Casts where necessary.


# 1.8 22-May-1993 cgd

add include of select.h if necessary for protos, or delete if extraneous


# 1.7 18-May-1993 cgd

make kernel select interface be one-stop shopping & clean it all up.


# 1.6 10-May-1993 deraadt

ring buffer now uses rbchar's (shorts) instead of chars.


Revision tags: netbsd-0-8 netbsd-alpha-1
# 1.5 09-Apr-1993 cgd

bump slip MTU back down to 296...


# 1.4 25-Mar-1993 cgd

one line got botched during bpf patch installation


# 1.3 25-Mar-1993 cgd

added BPF support, as provided by David Greenman (davidg@implode.rain.com)


Revision tags: patchkit-0-2-2
# 1.2 21-Mar-1993 cgd

after 0.2.2 "stable" patches applied


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.128 13-Apr-2017 maya

if MGETHDR fails, don't try to copy to single mbuf and deref null.

reduce ifdefs.


Revision tags: jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 1.127 02-Oct-2016 christos

branches: 1.127.2;
MFREE -> m_free


Revision tags: localcount-20160914
# 1.126 07-Aug-2016 christos

modularize some more drivers and merge the module glue


# 1.125 06-Aug-2016 christos

make strip and slip modular, and cosmetic for ppp.


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.124 10-Jun-2016 ozaki-r

branches: 1.124.2;
Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.123 28-Apr-2016 ozaki-r

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 tags: nick-nhusb-base-20160422
# 1.122 20-Apr-2016 knakahara

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


Revision tags: nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.121 24-Aug-2015 pooka

sprinkle _KERNEL_OPT


# 1.120 20-Aug-2015 uebayasi

Honor pseudo attach decl generated by config(1).


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.119 05-Jun-2014 rmind

branches: 1.119.4;
- 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 tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.118 23-Sep-2011 christos

branches: 1.118.12; 1.118.26;
Change obsolete CBSIZE constant (48), to a power of two constant (64) that
is close enough to match the original assumptions.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base
# 1.117 05-Apr-2010 joerg

Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.116 19-Jan-2010 pooka

branches: 1.116.2; 1.116.4;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase jym-xensuspend-base
# 1.115 07-May-2009 elad

Introduce actions/requests to handle authorization for ppp(4), sl(4),
strip(4), btuart(4) and bcsp(4) network interfaces and devices.

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004955.html


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.114 17-Dec-2008 cegger

branches: 1.114.2;
kill MALLOC and FREE macros.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.113 07-Nov-2008 dyoung

*** 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 tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base
# 1.112 15-Jun-2008 christos

branches: 1.112.2; 1.112.4;
- add if_alloc (ours just mallocs), and if_initname and use them (from FreeBSD)
- kill memsets where M_ZERO can be used.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.111 24-Apr-2008 ad

branches: 1.111.2; 1.111.4; 1.111.6;
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 tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.110 07-Feb-2008 dyoung

branches: 1.110.6; 1.110.8;
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 tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.109 10-Nov-2007 ad

Call ttyflush() with tty_lock held.


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 vmlocking-base
# 1.108 08-Oct-2007 ad

branches: 1.108.2; 1.108.4;
Use the softint API.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base2 yamt-x86pmap-base
# 1.107 01-Sep-2007 dyoung

branches: 1.107.2;
Use ifreq_setaddr(), ifreq_getaddr(), sockaddr_in_init(), and
sockaddr_copy(). Constify. Compare pointers with NULL, not 0.
Don't "test truth" of pointers, but compare with NULL.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.106 14-Jul-2007 ad

branches: 1.106.2; 1.106.6; 1.106.8;
Generic soft interrupts are mandatory.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.105 04-Mar-2007 christos

branches: 1.105.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.104 17-Feb-2007 dyoung

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 tags: post-newlock2-merge newlock2-nbase newlock2-base
# 1.103 04-Jan-2007 elad

branches: 1.103.2;
Consistent usage of KAUTH_GENERIC_ISSUSER.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 netbsd-4-base
# 1.102 16-Nov-2006 christos

__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.101 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.100 23-Jul-2006 ad

branches: 1.100.4; 1.100.6;
Use the LWP cached credentials where sane.


# 1.99 08-Jul-2006 tsutsui

KNF.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.98 07-Jun-2006 kardel

branches: 1.98.2;
merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html


Revision tags: yamt-pdpolicy-base5 simonb-timecounters-base
# 1.97 14-May-2006 elad

branches: 1.97.2;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base
# 1.96 02-Mar-2006 christos

branches: 1.96.2; 1.96.4; 1.96.6;
Provide ppp like statistics instead of grovelling through the kernel
symbols.


Revision tags: yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 thorpej

branches: 1.95.4; 1.95.6;
ANSI function decls and application of static.


# 1.94 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 ktrace-lwp-base
# 1.93 27-Nov-2005 thorpej

Overhaul how TTY line disciplines are handled:
- Replace references to linesw[0] with a ttyldisc_default() function
that returns the default ("termios") line discipline.
- The linesw[] array is gone, replaced by a linked list.
- ttyldisc_add() and ttyldisc_remove() have been replaced by
ttyldisc_attach() and ttyldisc_detach().
- Things that provide line disciplines are now responsible for
registering those disciplines with the system. The linesw
structures are no longer declared in tty_conf.c
- Line disciplines are now refcounted; a lookup causes a reference to
be held. ttyldisc_release() releases the reference. Attempts to
detach an in-use line discipline result in EBUSY.
- Fix function signature lossage in if_sl.c, if_strip.c, and tty_tb.c
that was masked by the old tty_conf.c
- tty_init() is no longer necessary; delete it and its call from main().


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.92 18-Aug-2005 yamt

branches: 1.92.6;
- introduce M_MOVE_PKTHDR and use it where appropriate.
intended to be mostly API compatible with openbsd/freebsd.
- remove a glue #define in netipsec/ipsec_osdep.h.


Revision tags: kent-audio2-base
# 1.91 31-Mar-2005 christos

branches: 1.91.2;
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 tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE 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 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.90 06-Dec-2004 christos

branches: 1.90.4;
Sprinkle #ifdef INET to make a GENERIC kernel compile with INET undefined.


# 1.89 05-Dec-2004 peter

Don't forget to call bpfdetach in the clone destroy function.
While here, add a missing static and change some spaces to tabs.


# 1.88 05-Dec-2004 he

Fix what must have been an omission: missing brace and a leftover
use of `i', which is no longer defined. Fixes build problem for ports
not defining __HAVE_GENERIC_SOFT_INTERRUPTS.


# 1.87 05-Dec-2004 christos

clonify strip and sl.


# 1.86 19-Aug-2004 christos

Factor out the hand-crafting of mbufs from the interface files. Reviewed by
gimpy. XXX: I could have used bpf_mtap2 on some of the new functions, but I
chose not to, because I just wanted to do what amounts to a code move.


# 1.85 21-Apr-2004 itojun

kill sprintf, use snprintf


Revision tags: netbsd-2-0-3-RELEASE 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-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base 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-base
# 1.84 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.83 01-May-2003 itojun

branches: 1.83.2;
bpf_mtap() does not care about M_PKTHDR at the top. M_COPY_PKTHDR has some
consequences, so avoid it. if we need to attach dummy headers, we should
use M_PREPEND instead.


# 1.82 26-Feb-2003 matt

Add MBUFTRACE kernel option.
Do a little mbuf rework while here. Change all uses of MGET*(*, M_WAIT, *)
to m_get*(M_WAIT, *). These are not performance critical and making them
call m_get saves considerable space. Add m_clget analogue of MCLGET and
make corresponding change for M_WAIT uses.
Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE.
Begin to change netstat to use sysctl.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.81 11-Sep-2002 itojun

KNF - return is not a function.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base
# 1.80 17-Mar-2002 atatat

Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.


Revision tags: newlock-base ifpoll-base
# 1.79 14-Jan-2002 kleink

Include <machine/intr.h> unconditionally, instead of only doing so if
__HAVE_GENERIC_SOFT_INTERRUPTS and relying on <sys/param.h> to provide it
otherwise; pointed out by Aymeric Vincent.


# 1.78 12-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.77 15-Jul-2001 martin

branches: 1.77.2;
Fix slight glitch from rev. 1.70: bp is not adjusted for next loop after
outputting some data.
Fix provided by isaki@par.odn.ne.jp in PR kern/13472.


# 1.76 14-Jun-2001 itojun

branches: 1.76.2;
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.


# 1.75 30-May-2001 itojun

fix mbuf leak due to meaningless MGETHDR. from niels provos


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.74 13-Apr-2001 thorpej

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.


# 1.73 31-Mar-2001 enami

Remove unnecessary test of tp->t_linesw against NULL; they are results
of confusion while correcting compilation error after t_line is
replaced with t_linesw.


# 1.72 17-Jan-2001 thorpej

branches: 1.72.2;
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).


# 1.71 15-Jan-2001 thorpej

For SLIP/STRIP/PPP, use generic soft interrupts, if available.


# 1.70 12-Jan-2001 thorpej

After freeing the input buffer, set the pointer to it to NULL.


# 1.69 12-Jan-2001 thorpej

Don't use splimp() to block both net and tty interrupts. Instead,
block both interrupt levels as appropriate.


# 1.68 11-Jan-2001 thorpej

Plug a memory leak.


# 1.67 11-Jan-2001 thorpej

Defer output processing to the software interrupt.


# 1.66 10-Jan-2001 thorpej

Move the VJ uncompress code into the software interrupt.


# 1.65 09-Jan-2001 thorpej

Once we have a complete frame, schedule a SLIP software interrupt,
and manipulate ipintrq from there. This will allow us to clean up
the use of splimp() in this file later.


# 1.64 09-Jan-2001 thorpej

Make the buffer management in SLIP just a little less evil.


# 1.63 18-Dec-2000 thorpej

ALTQ'ify.


# 1.62 18-Dec-2000 thorpej

Fill in if_dlt.


# 1.61 12-Dec-2000 thorpej

Adapt to bpfattach() changes, and further centralize the bpfattach()
and bpfdetach() calls into link-type subroutines where possible.


# 1.60 02-Nov-2000 itohy

Set the default line discipline to t_linesw, rather than just NULL it.


# 1.59 02-Nov-2000 itohy

Adapt to the new line discipline scheme.


# 1.58 12-Jul-2000 thorpej

NetBSD -> __NetBSD__ in an #ifdef, and nuke sc_bpf; there's one in
the ifnet already.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 1.57 30-Mar-2000 augustss

Kill some more register declarations.


# 1.56 29-Mar-2000 simonb

Don't need to include <sys/conf.h> here.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base kame_141_19991130 comdex-fall-1999-base fvdl-softdep-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.55 27-Mar-1999 dbj

branches: 1.55.8;
fixes to compile if NBPFILTER == 0


# 1.54 25-Mar-1999 tron

Make it possible to set MTU via "ifconfig" at run time. "SLMTU" is now
used to set the initial value.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.53 06-Oct-1998 kleink

branches: 1.53.4;
Use #error instead of causing parse errors; noticed by Heiko.


# 1.52 26-Aug-1998 mrg

use __NetBSD__ not NetBSD


Revision tags: eeh-paddr_t-base
# 1.51 06-Jul-1998 jtk

use #ifdef INET so this compiles again


# 1.50 05-Jul-1998 jonathan

defopt INET, NETATALK.


# 1.49 23-Mar-1998 enami

Add missing comma.


# 1.48 23-Mar-1998 fair

add the ability to run SLIP with CLOCAL set, per PR#3586


# 1.47 01-Mar-1998 fvdl

Merge with Lite2 + local changes


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.46 17-May-1997 christos

Update to ppp-2.3b5


# 1.45 27-Mar-1997 thorpej

Update for the new mbuf code, in a slighly kludgy way. Basically, these
drivers played a somewhat evil trick with clusters, which is now
replaced by a somewhat evil trick with regular malloc'd memory.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.44 13-Oct-1996 christos

backout previous kprintf change


# 1.43 10-Oct-1996 christos

- printf -> kprintf, sprintf -> ksprintf


# 1.42 09-Aug-1996 mrg

use sc_unit instead of pointer arthimetic.


# 1.41 10-Jul-1996 cgd

print difference between pointers with %ld, so that -Wformat works
on the Alpha and for consistency. Also, other minor formatting cleanups.


# 1.40 02-Jun-1996 thorpej

Move a mis-placed line on slattach() so that SLIOCGUNIT works properly.
From Jonathan O'Brien <obrien@phoenix.sfsu.edu>.


Revision tags: netbsd-1-2-base
# 1.39 07-May-1996 thorpej

branches: 1.39.4;
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.


# 1.38 13-Feb-1996 christos

Net prototypes


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.37 12-Aug-1995 mycroft

splnet --> splsoftnet


# 1.36 13-Jun-1995 mycroft

There's no reason to set if_next here.


# 1.35 21-Mar-1995 mycroft

Update to use timer{add,sub}().


# 1.34 08-Mar-1995 cgd

fixed sized types, where appropriate. when casting pointers to
integers to do math on them, cast to long. ioctl commands are
u_longs.


# 1.33 11-Dec-1994 mycroft

timevalsub --> __timersub


# 1.32 30-Oct-1994 cgd

be more careful with types, also pull in headers where necessary.


# 1.31 16-Jul-1994 cgd

use NetBSD (defined in param.h) not __NetBSD__ to allow x-compilation
with native compiler.


# 1.30 15-Jul-1994 cgd

kill bogus external declaration of time


Revision tags: netbsd-1-0-base
# 1.29 29-Jun-1994 cgd

branches: 1.29.2;
New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'


# 1.28 13-May-1994 mycroft

Update to 4.4-Lite networking code, with a few local changes.


# 1.27 08-Mar-1994 cgd

Some stability/safety/extensibility patches. Inspired by Christoph Badura.
Always make sure our buffer is large enough, and restart hung lines.


# 1.26 10-Feb-1994 cgd

mccanne convinced me that slip.h *should* exist. this is what
i "implemented" for 4.4, and the adjustments to the other files to
match.


# 1.25 05-Feb-1994 mycroft

Remove an #ifdef we no longer need.


# 1.24 02-Feb-1994 hpeyerl

Multicast is no longer optional


# 1.23 08-Jan-1994 cgd

quench the grammar flames!


# 1.22 20-Dec-1993 cgd

serious cleanup


# 1.21 19-Dec-1993 cgd

include machine/cpu.h, for machines which define soft interrupt stuff
there. marked XXX; they prolly shouldn't do that...


# 1.20 18-Dec-1993 mycroft

Canonicalize all #includes.


# 1.19 10-Dec-1993 cgd

move slip compression configuration into the interface flags,
and diddle a couple of related things.


# 1.18 06-Dec-1993 hpeyerl

multicast support.
From Chris Maeda, cmaeda@cs.washington.edu
These patches are derived from the IP Multicast patches for BSDI.


# 1.17 09-Nov-1993 glass

T_LINEP member of struct tty becomes t_sc. This replaces the
#define t_sc T_LINEP
that appear in tty_tb.c, if_sl.c, and if_ppp.h


# 1.16 31-Oct-1993 glass

removed slip and ppp specific prototypes from tty.h where they didn't belong.
moved them to tty_conf.c within #if Nwhatever > 0 where they do belong.
made sure that if_sl.c, and if_ppp.c still compile quietly.


# 1.15 02-Oct-1993 mycroft

Call output routine redundantly to possible avoid some hangs due to missed
interrupts.


# 1.14 02-Oct-1993 mycroft

Ignore carrier if not using hardware carrier detect (i.e. CLOCAL is set).


# 1.13 23-Sep-1993 mycroft

Ignore TS_CARR_ON when CLOCAL is set.


Revision tags: magnum-base
# 1.12 09-Aug-1993 deraadt

branches: 1.12.2;
add an additional suser() check.
regular users should not be able to change slip interface characteristics!


# 1.11 01-Aug-1993 mycroft

Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.


Revision tags: netbsd-0-9-patch-001 netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.10 12-Jul-1993 mycroft

Change tty code to use clist interface, but with ring buffer implementation.
Also, fix a couple of bugs in tty.c and pccons.c, and some gross kluginess
in the hp300 stuff.


# 1.9 27-Jun-1993 andrew

ANSIfications - removed all implicit function return types and argument
definitions. Ensured that all files include "systm.h" to gain access to
general prototypes. Casts where necessary.


# 1.8 22-May-1993 cgd

add include of select.h if necessary for protos, or delete if extraneous


# 1.7 18-May-1993 cgd

make kernel select interface be one-stop shopping & clean it all up.


# 1.6 10-May-1993 deraadt

ring buffer now uses rbchar's (shorts) instead of chars.


Revision tags: netbsd-0-8 netbsd-alpha-1
# 1.5 09-Apr-1993 cgd

bump slip MTU back down to 296...


# 1.4 25-Mar-1993 cgd

one line got botched during bpf patch installation


# 1.3 25-Mar-1993 cgd

added BPF support, as provided by David Greenman (davidg@implode.rain.com)


Revision tags: patchkit-0-2-2
# 1.2 21-Mar-1993 cgd

after 0.2.2 "stable" patches applied


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 1.127 02-Oct-2016 christos

MFREE -> m_free


Revision tags: localcount-20160914
# 1.126 07-Aug-2016 christos

modularize some more drivers and merge the module glue


# 1.125 06-Aug-2016 christos

make strip and slip modular, and cosmetic for ppp.


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.124 10-Jun-2016 ozaki-r

branches: 1.124.2;
Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.123 28-Apr-2016 ozaki-r

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 tags: nick-nhusb-base-20160422
# 1.122 20-Apr-2016 knakahara

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


Revision tags: nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.121 24-Aug-2015 pooka

sprinkle _KERNEL_OPT


# 1.120 20-Aug-2015 uebayasi

Honor pseudo attach decl generated by config(1).


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.119 05-Jun-2014 rmind

branches: 1.119.4;
- 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 tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.118 23-Sep-2011 christos

branches: 1.118.12; 1.118.26;
Change obsolete CBSIZE constant (48), to a power of two constant (64) that
is close enough to match the original assumptions.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base
# 1.117 05-Apr-2010 joerg

Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.116 19-Jan-2010 pooka

branches: 1.116.2; 1.116.4;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase jym-xensuspend-base
# 1.115 07-May-2009 elad

Introduce actions/requests to handle authorization for ppp(4), sl(4),
strip(4), btuart(4) and bcsp(4) network interfaces and devices.

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004955.html


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.114 17-Dec-2008 cegger

branches: 1.114.2;
kill MALLOC and FREE macros.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.113 07-Nov-2008 dyoung

*** 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 tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base
# 1.112 15-Jun-2008 christos

branches: 1.112.2; 1.112.4;
- add if_alloc (ours just mallocs), and if_initname and use them (from FreeBSD)
- kill memsets where M_ZERO can be used.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.111 24-Apr-2008 ad

branches: 1.111.2; 1.111.4; 1.111.6;
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 tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.110 07-Feb-2008 dyoung

branches: 1.110.6; 1.110.8;
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 tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.109 10-Nov-2007 ad

Call ttyflush() with tty_lock held.


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 vmlocking-base
# 1.108 08-Oct-2007 ad

branches: 1.108.2; 1.108.4;
Use the softint API.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base2 yamt-x86pmap-base
# 1.107 01-Sep-2007 dyoung

branches: 1.107.2;
Use ifreq_setaddr(), ifreq_getaddr(), sockaddr_in_init(), and
sockaddr_copy(). Constify. Compare pointers with NULL, not 0.
Don't "test truth" of pointers, but compare with NULL.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.106 14-Jul-2007 ad

branches: 1.106.2; 1.106.6; 1.106.8;
Generic soft interrupts are mandatory.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.105 04-Mar-2007 christos

branches: 1.105.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.104 17-Feb-2007 dyoung

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 tags: post-newlock2-merge newlock2-nbase newlock2-base
# 1.103 04-Jan-2007 elad

branches: 1.103.2;
Consistent usage of KAUTH_GENERIC_ISSUSER.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 netbsd-4-base
# 1.102 16-Nov-2006 christos

__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.101 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.100 23-Jul-2006 ad

branches: 1.100.4; 1.100.6;
Use the LWP cached credentials where sane.


# 1.99 08-Jul-2006 tsutsui

KNF.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.98 07-Jun-2006 kardel

branches: 1.98.2;
merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html


Revision tags: yamt-pdpolicy-base5 simonb-timecounters-base
# 1.97 14-May-2006 elad

branches: 1.97.2;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base
# 1.96 02-Mar-2006 christos

branches: 1.96.2; 1.96.4; 1.96.6;
Provide ppp like statistics instead of grovelling through the kernel
symbols.


Revision tags: yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 thorpej

branches: 1.95.4; 1.95.6;
ANSI function decls and application of static.


# 1.94 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 ktrace-lwp-base
# 1.93 27-Nov-2005 thorpej

Overhaul how TTY line disciplines are handled:
- Replace references to linesw[0] with a ttyldisc_default() function
that returns the default ("termios") line discipline.
- The linesw[] array is gone, replaced by a linked list.
- ttyldisc_add() and ttyldisc_remove() have been replaced by
ttyldisc_attach() and ttyldisc_detach().
- Things that provide line disciplines are now responsible for
registering those disciplines with the system. The linesw
structures are no longer declared in tty_conf.c
- Line disciplines are now refcounted; a lookup causes a reference to
be held. ttyldisc_release() releases the reference. Attempts to
detach an in-use line discipline result in EBUSY.
- Fix function signature lossage in if_sl.c, if_strip.c, and tty_tb.c
that was masked by the old tty_conf.c
- tty_init() is no longer necessary; delete it and its call from main().


Revision tags: yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.92 18-Aug-2005 yamt

branches: 1.92.6;
- introduce M_MOVE_PKTHDR and use it where appropriate.
intended to be mostly API compatible with openbsd/freebsd.
- remove a glue #define in netipsec/ipsec_osdep.h.


Revision tags: kent-audio2-base
# 1.91 31-Mar-2005 christos

branches: 1.91.2;
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 tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE 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 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.90 06-Dec-2004 christos

branches: 1.90.4;
Sprinkle #ifdef INET to make a GENERIC kernel compile with INET undefined.


# 1.89 05-Dec-2004 peter

Don't forget to call bpfdetach in the clone destroy function.
While here, add a missing static and change some spaces to tabs.


# 1.88 05-Dec-2004 he

Fix what must have been an omission: missing brace and a leftover
use of `i', which is no longer defined. Fixes build problem for ports
not defining __HAVE_GENERIC_SOFT_INTERRUPTS.


# 1.87 05-Dec-2004 christos

clonify strip and sl.


# 1.86 19-Aug-2004 christos

Factor out the hand-crafting of mbufs from the interface files. Reviewed by
gimpy. XXX: I could have used bpf_mtap2 on some of the new functions, but I
chose not to, because I just wanted to do what amounts to a code move.


# 1.85 21-Apr-2004 itojun

kill sprintf, use snprintf


Revision tags: netbsd-2-0-3-RELEASE 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-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base 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-base
# 1.84 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.83 01-May-2003 itojun

branches: 1.83.2;
bpf_mtap() does not care about M_PKTHDR at the top. M_COPY_PKTHDR has some
consequences, so avoid it. if we need to attach dummy headers, we should
use M_PREPEND instead.


# 1.82 26-Feb-2003 matt

Add MBUFTRACE kernel option.
Do a little mbuf rework while here. Change all uses of MGET*(*, M_WAIT, *)
to m_get*(M_WAIT, *). These are not performance critical and making them
call m_get saves considerable space. Add m_clget analogue of MCLGET and
make corresponding change for M_WAIT uses.
Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE.
Begin to change netstat to use sysctl.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.81 11-Sep-2002 itojun

KNF - return is not a function.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base
# 1.80 17-Mar-2002 atatat

Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.


Revision tags: newlock-base ifpoll-base
# 1.79 14-Jan-2002 kleink

Include <machine/intr.h> unconditionally, instead of only doing so if
__HAVE_GENERIC_SOFT_INTERRUPTS and relying on <sys/param.h> to provide it
otherwise; pointed out by Aymeric Vincent.


# 1.78 12-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.77 15-Jul-2001 martin

branches: 1.77.2;
Fix slight glitch from rev. 1.70: bp is not adjusted for next loop after
outputting some data.
Fix provided by isaki@par.odn.ne.jp in PR kern/13472.


# 1.76 14-Jun-2001 itojun

branches: 1.76.2;
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.


# 1.75 30-May-2001 itojun

fix mbuf leak due to meaningless MGETHDR. from niels provos


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.74 13-Apr-2001 thorpej

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.


# 1.73 31-Mar-2001 enami

Remove unnecessary test of tp->t_linesw against NULL; they are results
of confusion while correcting compilation error after t_line is
replaced with t_linesw.


# 1.72 17-Jan-2001 thorpej

branches: 1.72.2;
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).


# 1.71 15-Jan-2001 thorpej

For SLIP/STRIP/PPP, use generic soft interrupts, if available.


# 1.70 12-Jan-2001 thorpej

After freeing the input buffer, set the pointer to it to NULL.


# 1.69 12-Jan-2001 thorpej

Don't use splimp() to block both net and tty interrupts. Instead,
block both interrupt levels as appropriate.


# 1.68 11-Jan-2001 thorpej

Plug a memory leak.


# 1.67 11-Jan-2001 thorpej

Defer output processing to the software interrupt.


# 1.66 10-Jan-2001 thorpej

Move the VJ uncompress code into the software interrupt.


# 1.65 09-Jan-2001 thorpej

Once we have a complete frame, schedule a SLIP software interrupt,
and manipulate ipintrq from there. This will allow us to clean up
the use of splimp() in this file later.


# 1.64 09-Jan-2001 thorpej

Make the buffer management in SLIP just a little less evil.


# 1.63 18-Dec-2000 thorpej

ALTQ'ify.


# 1.62 18-Dec-2000 thorpej

Fill in if_dlt.


# 1.61 12-Dec-2000 thorpej

Adapt to bpfattach() changes, and further centralize the bpfattach()
and bpfdetach() calls into link-type subroutines where possible.


# 1.60 02-Nov-2000 itohy

Set the default line discipline to t_linesw, rather than just NULL it.


# 1.59 02-Nov-2000 itohy

Adapt to the new line discipline scheme.


# 1.58 12-Jul-2000 thorpej

NetBSD -> __NetBSD__ in an #ifdef, and nuke sc_bpf; there's one in
the ifnet already.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 1.57 30-Mar-2000 augustss

Kill some more register declarations.


# 1.56 29-Mar-2000 simonb

Don't need to include <sys/conf.h> here.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base kame_141_19991130 comdex-fall-1999-base fvdl-softdep-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.55 27-Mar-1999 dbj

branches: 1.55.8;
fixes to compile if NBPFILTER == 0


# 1.54 25-Mar-1999 tron

Make it possible to set MTU via "ifconfig" at run time. "SLMTU" is now
used to set the initial value.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.53 06-Oct-1998 kleink

branches: 1.53.4;
Use #error instead of causing parse errors; noticed by Heiko.


# 1.52 26-Aug-1998 mrg

use __NetBSD__ not NetBSD


Revision tags: eeh-paddr_t-base
# 1.51 06-Jul-1998 jtk

use #ifdef INET so this compiles again


# 1.50 05-Jul-1998 jonathan

defopt INET, NETATALK.


# 1.49 23-Mar-1998 enami

Add missing comma.


# 1.48 23-Mar-1998 fair

add the ability to run SLIP with CLOCAL set, per PR#3586


# 1.47 01-Mar-1998 fvdl

Merge with Lite2 + local changes


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.46 17-May-1997 christos

Update to ppp-2.3b5


# 1.45 27-Mar-1997 thorpej

Update for the new mbuf code, in a slighly kludgy way. Basically, these
drivers played a somewhat evil trick with clusters, which is now
replaced by a somewhat evil trick with regular malloc'd memory.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.44 13-Oct-1996 christos

backout previous kprintf change


# 1.43 10-Oct-1996 christos

- printf -> kprintf, sprintf -> ksprintf


# 1.42 09-Aug-1996 mrg

use sc_unit instead of pointer arthimetic.


# 1.41 10-Jul-1996 cgd

print difference between pointers with %ld, so that -Wformat works
on the Alpha and for consistency. Also, other minor formatting cleanups.


# 1.40 02-Jun-1996 thorpej

Move a mis-placed line on slattach() so that SLIOCGUNIT works properly.
From Jonathan O'Brien <obrien@phoenix.sfsu.edu>.


Revision tags: netbsd-1-2-base
# 1.39 07-May-1996 thorpej

branches: 1.39.4;
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.


# 1.38 13-Feb-1996 christos

Net prototypes


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.37 12-Aug-1995 mycroft

splnet --> splsoftnet


# 1.36 13-Jun-1995 mycroft

There's no reason to set if_next here.


# 1.35 21-Mar-1995 mycroft

Update to use timer{add,sub}().


# 1.34 08-Mar-1995 cgd

fixed sized types, where appropriate. when casting pointers to
integers to do math on them, cast to long. ioctl commands are
u_longs.


# 1.33 11-Dec-1994 mycroft

timevalsub --> __timersub


# 1.32 30-Oct-1994 cgd

be more careful with types, also pull in headers where necessary.


# 1.31 16-Jul-1994 cgd

use NetBSD (defined in param.h) not __NetBSD__ to allow x-compilation
with native compiler.


# 1.30 15-Jul-1994 cgd

kill bogus external declaration of time


Revision tags: netbsd-1-0-base
# 1.29 29-Jun-1994 cgd

branches: 1.29.2;
New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'


# 1.28 13-May-1994 mycroft

Update to 4.4-Lite networking code, with a few local changes.


# 1.27 08-Mar-1994 cgd

Some stability/safety/extensibility patches. Inspired by Christoph Badura.
Always make sure our buffer is large enough, and restart hung lines.


# 1.26 10-Feb-1994 cgd

mccanne convinced me that slip.h *should* exist. this is what
i "implemented" for 4.4, and the adjustments to the other files to
match.


# 1.25 05-Feb-1994 mycroft

Remove an #ifdef we no longer need.


# 1.24 02-Feb-1994 hpeyerl

Multicast is no longer optional


# 1.23 08-Jan-1994 cgd

quench the grammar flames!


# 1.22 20-Dec-1993 cgd

serious cleanup


# 1.21 19-Dec-1993 cgd

include machine/cpu.h, for machines which define soft interrupt stuff
there. marked XXX; they prolly shouldn't do that...


# 1.20 18-Dec-1993 mycroft

Canonicalize all #includes.


# 1.19 10-Dec-1993 cgd

move slip compression configuration into the interface flags,
and diddle a couple of related things.


# 1.18 06-Dec-1993 hpeyerl

multicast support.
From Chris Maeda, cmaeda@cs.washington.edu
These patches are derived from the IP Multicast patches for BSDI.


# 1.17 09-Nov-1993 glass

T_LINEP member of struct tty becomes t_sc. This replaces the
#define t_sc T_LINEP
that appear in tty_tb.c, if_sl.c, and if_ppp.h


# 1.16 31-Oct-1993 glass

removed slip and ppp specific prototypes from tty.h where they didn't belong.
moved them to tty_conf.c within #if Nwhatever > 0 where they do belong.
made sure that if_sl.c, and if_ppp.c still compile quietly.


# 1.15 02-Oct-1993 mycroft

Call output routine redundantly to possible avoid some hangs due to missed
interrupts.


# 1.14 02-Oct-1993 mycroft

Ignore carrier if not using hardware carrier detect (i.e. CLOCAL is set).


# 1.13 23-Sep-1993 mycroft

Ignore TS_CARR_ON when CLOCAL is set.


Revision tags: magnum-base
# 1.12 09-Aug-1993 deraadt

branches: 1.12.2;
add an additional suser() check.
regular users should not be able to change slip interface characteristics!


# 1.11 01-Aug-1993 mycroft

Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.


Revision tags: netbsd-0-9-patch-001 netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.10 12-Jul-1993 mycroft

Change tty code to use clist interface, but with ring buffer implementation.
Also, fix a couple of bugs in tty.c and pccons.c, and some gross kluginess
in the hp300 stuff.


# 1.9 27-Jun-1993 andrew

ANSIfications - removed all implicit function return types and argument
definitions. Ensured that all files include "systm.h" to gain access to
general prototypes. Casts where necessary.


# 1.8 22-May-1993 cgd

add include of select.h if necessary for protos, or delete if extraneous


# 1.7 18-May-1993 cgd

make kernel select interface be one-stop shopping & clean it all up.


# 1.6 10-May-1993 deraadt

ring buffer now uses rbchar's (shorts) instead of chars.


Revision tags: netbsd-0-8 netbsd-alpha-1
# 1.5 09-Apr-1993 cgd

bump slip MTU back down to 296...


# 1.4 25-Mar-1993 cgd

one line got botched during bpf patch installation


# 1.3 25-Mar-1993 cgd

added BPF support, as provided by David Greenman (davidg@implode.rain.com)


Revision tags: patchkit-0-2-2
# 1.2 21-Mar-1993 cgd

after 0.2.2 "stable" patches applied


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision