Home | History | Annotate | Download | only in net
History log of /src/sys/net/if_arcsubr.c
RevisionDateAuthorComments
 1.87  21-Sep-2025  christos Centralize all the "can't handle af%d\n", messages in one place and provide
more context. Now I get ad-nauseam:
ether_output: wm1: can't handle af18 (link: link#2)
 1.86  05-Jul-2024  rin sys: Drop redundant NULL check before m_freem(9)

m_freem(9) safely has accepted NULL argument at least since 4.2BSD:
https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/sys/uipc_mbuf.c

Compile-tested on amd64/ALL.

Suggested by knakahara@
 1.85  03-Sep-2022  thorpej branches: 1.85.8; 1.85.10;
Garbage-collect the remaining vestiges of netisr.
 1.84  03-Sep-2022  thorpej Convert ARP from a legacy netisr to pktqueue.
 1.83  16-Jun-2021  riastradh if_attach and if_initialize cannot fail, don't test return value

These were originally made failable back in 2017 when if_initialize
allocated a softint in every interface for link state changes, so
that it could fail gracefully instead of panicking:

https://mail-index.NetBSD.org/source-changes/2017/10/23/msg089053.html

However, this spawned many seldom- or never-tested error branches,
which are risky to have around. And that softint in every interface
has since been replaced by a single global workqueue, because link
state changes require thread context but not low latency or high
throughput:

https://mail-index.NetBSD.org/source-changes/2020/02/06/msg113759.html

So there is no longer any reason for if_initialize to fail. (The
subroutine if_stats_init can't fail because percpu_alloc can't fail
either.)

There is a snag: the softint_establish in if_percpuq_create could
fail, potentially leading to bad consequences later on trying to use
the softint. This change doesn't introduce any new bugs because of
the snag -- if_percpuq_attach was already broken. However, the snag
can be better addressed without spawning error branches, either by
using a single softint or making softints less scarce.

(Separate commit will change the signatures of if_attach and
if_initialize to return void, scheduled to ride whatever is the next
convenient kernel bump.)

Patch and testing on amd64 and evbmips64-eb by maya@; commit message
soliloquy, and compile-testing on evbppc/i386/earmv7hf, by me.
 1.82  28-Aug-2020  ozaki-r branches: 1.82.6;
net: introduce IFQ_ENQUEUE_ISR to assemble packet queuing routines (NFCI)
 1.81  29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.80  09-May-2018  maxv branches: 1.80.2; 1.80.8;
Replace
m_copym(m, 0, M_COPYALL, M_DONTWAIT)
by
m_copypacket(m, M_DONTWAIT)
when it is clear that we are copying a packet (that has M_PKTHDR) and not
a raw mbuf chain.
 1.79  26-Apr-2018  maxv m_copy -> m_copym
 1.78  23-Oct-2017  msaitoh branches: 1.78.2;
If if_attach() failed in the attach function, return.
 1.77  14-Feb-2017  ozaki-r branches: 1.77.6;
Do ND in L2_output in the same manner as arpresolve

The benefits of this change are:
- The flow is consistent with IPv4 (and FreeBSD and OpenBSD)
- old: ip6_output => nd6_output (do ND if needed) => L2_output (lookup a stored cache)
- new: ip6_output => L2_output (lookup a cache. Do ND if cache not found)
- We can remove some workarounds in nd6_output
- We can move L2 specific operations to their own place
- The performance slightly improves because one cache lookup is reduced
 1.76  24-Jan-2017  maxv Don't forget to free the mbuf when we decide not to reply to an ARP
request. This obviously is a terrible bug, since it allows a remote sender
to DoS the system with specially-crafted requests sent in a loop.
 1.75  11-Jan-2017  ozaki-r branches: 1.75.2;
Get rid of unnecessary header inclusions
 1.74  03-Oct-2016  ozaki-r Fix race condition on ifqueue used by traditional netisr

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

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

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

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

Reviewed by knakahara@
 1.73  28-Apr-2016  ozaki-r branches: 1.73.2;
Constify remaining rtentry of if_output (fix build)
 1.72  20-Apr-2016  knakahara IFQ_ENQUEUE refactor (3/3) : eliminate pktattr argument from IFQ_ENQUEUE caller
 1.71  07-Apr-2016  christos - tidy up error messages
- add a length argument to arpresolve()
- add KASSERT for overflow
 1.70  09-Feb-2016  ozaki-r Fix build
 1.69  13-Oct-2015  roy arpresolve() now returns 0 on success otherwise an error code.
Callers of arpresolve() now pass the error code back to their caller,
masking out EWOULDBLOCK.

This allows applications such as ping(8) to display a suitable error
condition.
 1.68  24-Aug-2015  pooka sprinkle _KERNEL_OPT
 1.67  04-Jun-2015  ozaki-r Pull out route lookups from L2 output routines

Route lookups for routes of RTF_GATEWAY were done in L2 output
routines such as ether_output, but they should be done in L3
i.e., before L2 output routines. This change places the lookups
between L3 output routines (say ip_output) and the L2 output
routines.

The change is based on dyoung's patch submitted in the thread:
https://mail-index.netbsd.org/tech-net/2013/02/01/msg003847.html
You can find out detailed investigations by dyoung about the
issue in there.

Note that the change introduces a workaround for MPLS. ether_output
knew that it needs to fill the ethertype of a frame as MPLS,
based on a tag of an original route (rtentry), but now we don't
pass it to ehter_output. So we have to tell that in another way.
We use mtag to do so for now, which introduces some overhead.
We should fix it somehow in the future.

Discussed on tech-kern and tech-net.
 1.66  05-Jun-2014  rmind branches: 1.66.2; 1.66.4; 1.66.6; 1.66.8;
- 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.
 1.65  15-May-2014  msaitoh Put schednetisr() into splnet()/splx() pair.
This might avoids delay of processing a packet.
 1.64  24-Sep-2012  msaitoh branches: 1.64.2; 1.64.10;
Add missing "\n" in log(9)
 1.63  05-Apr-2010  joerg branches: 1.63.8; 1.63.14; 1.63.18; 1.63.20;
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.
 1.62  19-Jan-2010  pooka branches: 1.62.2; 1.62.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.
 1.61  20-Nov-2009  christos ar_tha() can return NULL; treat this as an error.
 1.60  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.
 1.59  20-Feb-2008  matt branches: 1.59.6; 1.59.10; 1.59.16; 1.59.18; 1.59.20; 1.59.22; 1.59.24;
s/u_\(int[0-9]*_t\)/u\1/g
(change u_int*_t to uint*_t)
 1.58  25-Dec-2007  he Convert to using if_set_sadl() instead of arc_storelladdr(), catching
an overlooked setting of ifnet->if_sadl. This follows up the recent
change to net/if.h.
 1.57  19-Oct-2007  ad branches: 1.57.2; 1.57.4; 1.57.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.56  30-Aug-2007  dyoung branches: 1.56.4;
Use malloc(9) for sockaddrs instead of pool(9), and remove dom_sa_pool
and dom_sa_len members from struct domain. Pools of fixed-size
objects are too rigid for sockaddr_dls, whose size can vary over
a wide range.

Return sockaddr_dl to its "historical" size. Now that I'm using
malloc(9) instead of pool(9) to allocate sockaddr_dl, I can create
a sockaddr_dl of any size in the kernel, so expanding sockaddr_dl
is useless.

Avoid using sizeof(struct sockaddr_dl) in the kernel.

Introduce sockaddr_dl_alloc() for allocating & initializing an
arbitrary sockaddr_dl on the heap.

Add an argument, the sockaddr length, to sockaddr_alloc(),
sockaddr_copy(), and sockaddr_dl_setaddr().

Constify: LLADDR() -> CLLADDR().

Where the kernel overwrites LLADDR(), use sockaddr_dl_setaddr(),
instead. Used properly, sockaddr_dl_setaddr() will not overrun
the end of the sockaddr.
 1.55  19-Feb-2007  dyoung branches: 1.55.4; 1.55.12; 1.55.16; 1.55.18;
Remove unused #define SIN(). From he@.
 1.54  19-Feb-2007  dyoung Fix fallout from if_output constification. Thanks, Havard Eidnes,
for reporting the problem and testing my patch.
 1.53  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.
 1.52  07-Jun-2006  kardel branches: 1.52.12;
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
 1.51  11-Dec-2005  thorpej branches: 1.51.4; 1.51.6; 1.51.8; 1.51.14;
ANSI function decls and application of static.
 1.50  11-Dec-2005  christos merge ktrace-lwp.
 1.49  05-Jun-2005  he branches: 1.49.2;
Fix -Wcast-qual warning.
 1.48  17-May-2005  christos Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to
implement, xtoa(), but I think defining the samestring 50 times is a bit
too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it...
 1.47  31-Mar-2005  christos 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
 1.46  26-Feb-2005  perry nuke trailing whitespace
 1.45  25-Mar-2004  is branches: 1.45.8; 1.45.10;
UCB no longer requires the advertising clause.
 1.44  11-Aug-2003  itojun minor knf
 1.43  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.42  02-May-2003  itojun branches: 1.42.2;
KNF
 1.41  19-Jan-2003  simonb Remove variable that is only assigned too but not referenced.
 1.40  11-Sep-2002  itojun KNF - return is not a function.
 1.39  05-Mar-2002  itojun bring in latest ALTQ from kjc. ALTQify some of the drivers.
 1.38  12-Nov-2001  lukem add RCSIDs
 1.37  17-Oct-2001  itojun unifdef OLDIP6OUTPUT
 1.36  14-Jun-2001  itojun branches: 1.36.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.35  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.34  17-Jan-2001  thorpej branches: 1.34.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.33  18-Dec-2000  thorpej Fill in if_dlt.
 1.32  12-Dec-2000  thorpej Adapt to bpfattach() changes, and further centralize the bpfattach()
and bpfdetach() calls into link-type subroutines where possible.
 1.31  12-Apr-2000  itojun revisit in6_ifattach().
- be persistent on initializing interfaces, even if there's manually-
assigned linklocal, multicast/whatever initialization is necessary.
- do not cache mac addr in the kernel. grab mac addr from existing cards
(this is important when you swap ethernet cards back and forth)
now ppp6 works just fine!

call in6_ifattach() on ATM PVC interface to assign link-local, using
hardware MAC address as seed.

(the change is in sync with kame tree).
 1.30  30-Mar-2000  augustss Kill some more register declarations.
 1.29  20-Dec-1999  frueauf Make this compile again:
NEWIP6OUTPUT gets no longer defined, revers logic to use OLDIP6OUTPUT.
 1.28  25-Sep-1999  is branches: 1.28.2; 1.28.8;
Decouple IP mtu for ARCnet devices from interface MTU.
This is important, because for most protocols, link level fragmentation is
used, but with different default effective MTUs. (e.g.: IPv4 default MTU
is 1500 octets, IPv6 default MTU is 9072 octets).
 1.27  19-Sep-1999  is Zeroth version of IPv6 support for ARCnet. Correct MTU handling still needs
to be done.
 1.26  29-Aug-1999  is Move the mtu initialization to arc_storelladdr, so that it will be upped
again when switching link0 on.
XXX This stuff needs to be thought about, especially with the doomming IPv6
support, which uses yet another default mtu.
 1.25  27-Aug-1999  is Don't assume PHDS encoding for DIAGNOSE packets... we have to pass them
raw, if used at all.
 1.24  27-Aug-1999  is Factor out arc_storelladdr(), and use that instead of arc_ifattach() in
the bah_reset() function.
This makes the last change work without deconnecting all the other interfaces
from the interface list.
 1.23  26-Aug-1999  is Only use ifp->if_addrlen after initializing it.\
Problem detected by Andreas Johansson.
 1.22  26-Aug-1999  is Eliminate a function call... we know its exactly one byte here
 1.21  18-May-1999  thorpej Rework layer 2 protocol input routines. Instead of calling e.g. ether_input()
directly, call the function pointer (*if_input)(ifp, m). The input routine
expects the packet header to be at the head of the packet, and will adjust
as necessary. Privatize the layer 2 input and output routines, allowing
*_ifattach() to set them up as appropriate.
 1.20  25-Feb-1999  is branches: 1.20.4;
So... after all, the ATA878.2 copy I had was buggy. The newer revision has
this fixed in the figures (but still not in the text); anyway, the intention
of the ATA is that this is identical to the PHDS specification.
Remove the ...EXC_8782 constant, and change the _EXC_1201 constant to be
a simple ...EXC.
 1.19  16-Jan-1999  is Yet another performance optimization for exceptional length ARCnet packets.
This time in the receive path.
 1.18  16-Jan-1999  is Make the code path for exceptional length packets a bit faster (2 mbuf
operations less) and better readable.
 1.17  05-Jul-1998  jonathan branches: 1.17.6;
defopt INET, NETATALK.
 1.16  02-Oct-1997  is Reimplement a test for broadcast addresses advertized, which was left out
when rewriting the ARP system.
 1.15  23-Mar-1997  is branches: 1.15.4;
Fix several bugs related to the new ARP code, and ARCnet ARP support.
Among other, add ARPHRD_ARCNET definition, make sure the hardware type is
set on outgoing ARP packets, make sure we dont send out replies as broadcasts.
 1.14  17-Mar-1997  is Make this compile on port-amiga. Bug report by Bernd Ernesti.
 1.13  16-Mar-1997  is move if_arc.h to sys/net
 1.12  15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.11  13-Oct-1996  christos branches: 1.11.4;
backout previous kprintf change
 1.10  10-Oct-1996  christos - printf -> kprintf, sprintf -> ksprintf
 1.9  02-Sep-1996  is Add IP multicast support as per RFC 1122 section 3.3.7 to ARCnet.
"The mapping of IP Class D addresses to local addresses is
currently specified for the following types of networks:
[...]
o Any network that supports broadcast but not multicast,
addressing: all IP Class D addresses map to the local
broadcast address."
 1.8  07-May-1996  thorpej 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.7  15-Apr-1996  is Don't even check the not-yet-initialized mbuf pointers for being !=
NULL in the error exit code of arc_output(), else we see random data
and try to m_freem() it, panic'ing the machine.
 1.6  24-Dec-1995  mycroft Various cleanup, mostly by me, submitted by Ignatios Souvatzis.
 1.5  12-Jul-1995  cgd branches: 1.5.2;
fix struct member use, as explained in pr 1164. style police
beat the fix into submission.
 1.4  07-Jun-1995  cgd update from Ignatios Souvatzis
 1.3  14-Apr-1995  chopps change args to arc_input also add check on link address which fixes pr#922. from Ignatios Souvatzis <is@beverly.rhein.de>
 1.2  11-Apr-1995  mycroft Remove some explicit references to loif.
 1.1  23-Feb-1995  glass preliminary arcnet support. uses lame but RFC address resolution
 1.5.2.1  15-Apr-1996  is Fix a bug in the HI part of the ARCnet driver, which would cause the
kernel to panic if the IP layer tried to output at the time the
interface was ifconfig'd down.
 1.11.4.4  09-Mar-1997  is netinet/if_ether.h -> netinet/if_inarp.h
 1.11.4.3  11-Feb-1997  is Oops, forgot some usages of ((struct arccom *)ifp)->ac_anaddr
 1.11.4.2  08-Feb-1997  is Extinguish the link level address from struct arccom, too.
XXX Todo: change this in the hardware driver.
 1.11.4.1  07-Feb-1997  is Snapshot of new ARP code.

Our old ARP code was hardwired for 6-byte length medium
addresses, while the protocol is designed for any size.

This snapshot contains a first hack at getting rid of
Ethernet specific data structures. The ep driver is updated
(and tested on the PCI bus), the iy and fpa drivers have been
updated, but not real life tested yet.

If you want to test this with other drivers, you have to update
them first yourself, and probably tag the relevant directories.
Better contact me if you want to do this.
 1.15.4.1  14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.17.6.1  11-Dec-1998  kenh The beginnings of interface detach support. Still some bugs, but mostly
works for me.

This work was originally by Bill Studenmund, and cleaned up by me.
 1.20.4.1  21-Jun-1999  thorpej Sync w/ -current.
 1.28.8.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.28.2.5  21-Apr-2001  bouyer Sync with HEAD
 1.28.2.4  18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.28.2.3  05-Jan-2001  bouyer Sync with HEAD
 1.28.2.2  13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.28.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.34.2.5  17-Sep-2002  nathanw Catch up to -current.
 1.34.2.4  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.34.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.34.2.2  22-Oct-2001  nathanw Catch up to -current.
 1.34.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.36.2.3  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.36.2.2  16-Mar-2002  jdolecek Catch up with -current.
 1.36.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.42.2.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.42.2.5  01-Apr-2005  skrll Sync with HEAD.
 1.42.2.4  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.42.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.42.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.42.2.1  03-Aug-2004  skrll Sync with HEAD
 1.45.10.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.45.8.1  29-Apr-2005  kent sync with -current
 1.49.2.6  27-Feb-2008  yamt sync with head.
 1.49.2.5  21-Jan-2008  yamt sync with head
 1.49.2.4  27-Oct-2007  yamt sync with head.
 1.49.2.3  03-Sep-2007  yamt sync with head.
 1.49.2.2  26-Feb-2007  yamt sync with head.
 1.49.2.1  21-Jun-2006  yamt sync with head.
 1.51.14.1  19-Jun-2006  chap Sync with head.
 1.51.8.1  26-Jun-2006  yamt sync with head.
 1.51.6.1  04-Feb-2006  simonb Adapt for timecounters: mostly use get*time(), use bintime's for timeout
calculations and use "time_second" instead of "time.tv_sec".
 1.51.4.1  09-Sep-2006  rpaulo sync with head
 1.52.12.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.55.18.3  23-Mar-2008  matt sync with HEAD
 1.55.18.2  09-Jan-2008  matt sync with HEAD
 1.55.18.1  06-Nov-2007  matt sync with HEAD
 1.55.16.2  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.55.16.1  03-Sep-2007  jmcneill Sync with HEAD.
 1.55.12.1  03-Sep-2007  skrll Sync with HEAD.
 1.55.4.2  23-Oct-2007  ad Sync with head.
 1.55.4.1  09-Oct-2007  ad Sync with head.
 1.56.4.1  25-Oct-2007  bouyer Sync with HEAD.
 1.57.8.1  02-Jan-2008  bouyer Sync with HEAD
 1.57.4.1  26-Dec-2007  ad Sync with head.
 1.57.2.1  18-Feb-2008  mjf Sync with HEAD.
 1.59.24.1  21-Apr-2010  matt sync to netbsd-5
 1.59.22.1  21-Nov-2009  snj Pull up following revision(s) (requested by christos in ticket #1156):
sys/net/if_arcsubr.c: revision 1.61
sys/net/if_ethersubr.c: revision 1.173
sys/net/if_fddisubr.c: revision 1.78
sys/net/if_tokensubr.c: revision 1.58 via patch
sys/netinet/if_arp.c: revision 1.149
ar_tha() can return NULL; treat this as an error.
 1.59.20.1  21-Nov-2009  snj Pull up following revision(s) (requested by christos in ticket #1156):
sys/net/if_arcsubr.c: revision 1.61
sys/net/if_ethersubr.c: revision 1.173
sys/net/if_fddisubr.c: revision 1.78
sys/net/if_tokensubr.c: revision 1.58 via patch
sys/netinet/if_arp.c: revision 1.149
ar_tha() can return NULL; treat this as an error.
 1.59.18.1  19-Jan-2009  skrll Sync with HEAD.
 1.59.16.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.59.10.3  11-Aug-2010  yamt sync with head.
 1.59.10.2  11-Mar-2010  yamt sync with head
 1.59.10.1  04-May-2009  yamt sync with head.
 1.59.6.1  17-Jan-2009  mjf Sync with HEAD.
 1.62.4.1  30-May-2010  rmind sync with head
 1.62.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.63.20.1  05-Feb-2017  snj Pull up following revision(s) (requested by maxv in ticket #1429):
sys/net/if_arcsubr.c: revision 1.76 via patch
sys/net/if_ecosubr.c: revision 1.50 via patch
sys/net/if_ethersubr.c: revision 1.236 via patch
sys/net/if_fddisubr.c: revision 1.104 via patch
sys/net/if_tokensubr.c: revision 1.80 via patch
Don't forget to free the mbuf when we decide not to reply to an ARP
request. This obviously is a terrible bug, since it allows a remote sender
to DoS the system with specially-crafted requests sent in a loop.
 1.63.18.3  03-Dec-2017  jdolecek update from HEAD
 1.63.18.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.63.18.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.63.14.2  05-Feb-2017  snj Pull up following revision(s) (requested by maxv in ticket #1429):
sys/net/if_arcsubr.c: revision 1.76 via patch
sys/net/if_ecosubr.c: revision 1.50 via patch
sys/net/if_ethersubr.c: revision 1.236 via patch
sys/net/if_fddisubr.c: revision 1.104 via patch
sys/net/if_tokensubr.c: revision 1.80 via patch
Don't forget to free the mbuf when we decide not to reply to an ARP
request. This obviously is a terrible bug, since it allows a remote sender
to DoS the system with specially-crafted requests sent in a loop.
 1.63.14.1  23-Oct-2012  riz branches: 1.63.14.1.2;
Pull up following revision(s) (requested by msaitoh in ticket #616):
sys/netinet/if_atm.c: revision 1.33
sys/net/if_arcsubr.c: revision 1.64
sys/netinet/ip_mroute.c: revision 1.126
Add missing "\n" in log(9)
 1.63.14.1.2.1  05-Feb-2017  snj Pull up following revision(s) (requested by maxv in ticket #1429):
sys/net/if_arcsubr.c: revision 1.76 via patch
sys/net/if_ecosubr.c: revision 1.50 via patch
sys/net/if_ethersubr.c: revision 1.236 via patch
sys/net/if_fddisubr.c: revision 1.104 via patch
sys/net/if_tokensubr.c: revision 1.80 via patch
Don't forget to free the mbuf when we decide not to reply to an ARP
request. This obviously is a terrible bug, since it allows a remote sender
to DoS the system with specially-crafted requests sent in a loop.
 1.63.8.1  30-Oct-2012  yamt sync with head
 1.64.10.1  10-Aug-2014  tls Rebase.
 1.64.2.1  18-May-2014  rmind sync with head
 1.66.8.1  13-Mar-2017  skrll Sync with netbsd-7-1-RELEASE
 1.66.6.1  05-Feb-2017  snj Pull up following revision(s) (requested by maxv in ticket #1355):
sys/net/if_arcsubr.c: revision 1.76 via patch
sys/net/if_ecosubr.c: revision 1.50 via patch
sys/net/if_ethersubr.c: revision 1.236 via patch
sys/net/if_fddisubr.c: revision 1.104 via patch
sys/net/if_tokensubr.c: revision 1.80 via patch
Don't forget to free the mbuf when we decide not to reply to an ARP
request. This obviously is a terrible bug, since it allows a remote sender
to DoS the system with specially-crafted requests sent in a loop.
 1.66.4.9  28-Aug-2017  skrll Sync with HEAD
 1.66.4.8  05-Feb-2017  skrll Sync with HEAD
 1.66.4.7  05-Oct-2016  skrll Sync with HEAD
 1.66.4.6  29-May-2016  skrll Sync with HEAD
 1.66.4.5  22-Apr-2016  skrll Sync with HEAD
 1.66.4.4  19-Mar-2016  skrll Sync with HEAD
 1.66.4.3  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.66.4.2  22-Sep-2015  skrll Sync with HEAD
 1.66.4.1  06-Jun-2015  skrll Sync with HEAD
 1.66.2.1  05-Feb-2017  snj Pull up following revision(s) (requested by maxv in ticket #1355):
sys/net/if_arcsubr.c: revision 1.76 via patch
sys/net/if_ecosubr.c: revision 1.50 via patch
sys/net/if_ethersubr.c: revision 1.236 via patch
sys/net/if_fddisubr.c: revision 1.104 via patch
sys/net/if_tokensubr.c: revision 1.80 via patch
Don't forget to free the mbuf when we decide not to reply to an ARP
request. This obviously is a terrible bug, since it allows a remote sender
to DoS the system with specially-crafted requests sent in a loop.
 1.73.2.2  20-Mar-2017  pgoyette Sync with HEAD
 1.73.2.1  04-Nov-2016  pgoyette Sync with HEAD
 1.75.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.77.6.1  10-Dec-2017  snj Pull up following revision(s) (requested by msaitoh in ticket #427):
sys/arch/amiga/dev/if_bah_zbus.c: 1.17
sys/arch/arm/broadcom/bcm53xx_eth.c: 1.30
sys/arch/powerpc/booke/dev/pq3etsec.c: 1.32
sys/arch/usermode/dev/if_veth.c: 1.9
sys/dev/ic/an.c: 1.66
sys/dev/ic/athn.c: 1.17
sys/dev/ic/atw.c: 1.162
sys/dev/ic/bwi.c: 1.33
sys/dev/ic/dwc_gmac.c: 1.41-1.42
sys/dev/ic/malo.c: 1.10
sys/dev/ic/rt2560.c: 1.31
sys/dev/ic/rt2661.c: 1.36
sys/dev/ic/rt2860.c: 1.29
sys/dev/ic/rtw.c: 1.127
sys/dev/ic/rtwvar.h: 1.46
sys/dev/ic/smc90cx6.c: 1.71
sys/dev/ic/smc90cx6var.h: 1.12
sys/dev/ic/wi.c: 1.244
sys/dev/pci/if_ipw.c: 1.66
sys/dev/pci/if_iwi.c: 1.104
sys/dev/pci/if_iwm.c: 1.76
sys/dev/pci/if_iwn.c: 1.86
sys/dev/pci/if_rtwn.c: 1.13
sys/dev/pci/if_wm.c: 1.541
sys/dev/pci/if_wpi.c: 1.79
sys/dev/pci/ixgbe/ixgbe.c: 1.106
sys/dev/pci/ixgbe/ixv.c: 1.73 via patch
sys/dev/pcmcia/if_malo_pcmcia.c: 1.15
sys/dev/scsipi/if_se.c: 1.95
sys/dev/usb/if_upl.c: 1.60
sys/net/if.c: 1.396
sys/net/if.h: 1.241
sys/net/if_arc.h: 1.23
sys/net/if_arcsubr.c: 1.78
sys/net/if_bridge.c: 1.136-1.137
sys/net/if_etherip.c: 1.39
sys/net/if_faith.c: 1.56
sys/net/if_gif.c: 1.131
sys/net/if_loop.c: 1.96
sys/net/if_mpls.c: 1.30
sys/net/if_pppoe.c: 1.129
sys/net/if_srt.c: 1.27
sys/net/if_stf.c: 1.102
sys/net/if_tap.c: 1.100
sys/net/if_vlan.c: 1.105
sys/netinet/ip_carp.c: 1.91
sys/rump/net/lib/libshmif/if_shmem.c: 1.73-1.74
sys/rump/net/lib/libvirtif/if_virt.c: 1.55-1.56
if_initalize() and if_attach() failed when resource allocation failed
(e.g. allocating softint). Without this change, it panics. It's bad because
resource shortage really occured when a lot of pseudo interface is created.
To avoid this problem, don't panic and change return value of if_initialize()
and if_attach() to int. Caller fanction will be recover from error cleanly by
checking the return value.
Return if bah_attach_subr() failed.
If if_attach() failed in the attach function, return.
- If if_initialize() failed in the attach function, free resources and return.
- Add some missing frees in bridge_clone_destroy().
- KNF
If error occured in bcmeth_ccb_attach(), free resources and return.
If error occured in pq3etsec_attach(), free resources and return.
If error occured in the attach function, free resources and return.
- If if_initialize() failed in athn_attach(), free resources and return.
- Add missing pmf_event_deregister() in athn_detach().
- Free resources correctly on some errors in atw_attach().
- Use apint*() insread of printf() in the attach function.
If if_initialize() failed in the attach function, return.
- If if_initialize() failed in the attach function, free resources and return.
- Add missing dwc_gmac_free_dma_rings() and mutex_destroy() when attach
failed.
- If if_initialize() failed in the attach function, free resources and return.
- ifp is always not NULL in iwi_detach(). Check correctly with ifp->if_softc.
- If if_initialize() failed in the attach function, free resources and return.
- Fix error path in the attach function correctly.
If if_initialize() failed in the attach function, free resources and return.
If if_attach() failed in the attach function, free resources and return.
- If if_initialize() failed in the attach function, free resources and return.
- KNF
- If if_attach() failed in the attach function, free resources and return.
- KNF
Fix compile error.
Fix compile error.
We don't need '&mii', but just 'mii' for mii_detach().
Don't free sc_rthash twice
 1.78.2.2  21-May-2018  pgoyette Sync with HEAD
 1.78.2.1  02-May-2018  pgoyette Synch with HEAD
 1.80.8.1  29-Feb-2020  ad Sync with head.
 1.80.2.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.82.6.1  17-Jun-2021  thorpej Sync w/ HEAD.
 1.85.10.1  02-Aug-2025  perseant Sync with HEAD
 1.85.8.2  16-Nov-2023  thorpej IFQ_CLASSIFY() -> ifq_classify_packet().
 1.85.8.1  15-Nov-2023  thorpej Rename ifq_enqueue() -> if_enqueue(), ifq_enqueue2() -> if_enqueue2().

RSS XML Feed