Home | History | Annotate | Download | only in altq
History log of /src/sys/altq/altq_afmap.c
RevisionDateAuthorComments
 1.25  14-Jan-2025  joe refac: remove parens from return statements
 1.24  14-Jan-2025  joe handle duplication: extract address family interface lookup
 1.23  31-Dec-2021  riastradh altq(9): Fix missing IFNET_LOCK around if_ioctl.
 1.22  31-Dec-2021  riastradh sys: Use if_ioctl wrapper function.
 1.21  21-Sep-2021  christos Remove FreeBSD blocks that did not compile anyway, and use l->l_cred
consistently.
 1.20  20-Mar-2014  christos kill sprintf
 1.19  07-Nov-2008  dyoung branches: 1.19.16; 1.19.26; 1.19.30;
*** 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.18  04-Mar-2007  christos branches: 1.18.36; 1.18.40; 1.18.46; 1.18.50;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.17  16-Nov-2006  christos branches: 1.17.4;
__unused removal on arguments; approved by core.
 1.16  20-Oct-2006  elad Kill some KAUTH_GENERIC_ISSUSER.
 1.15  12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.14  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.13  21-Jul-2006  ad branches: 1.13.4; 1.13.6;
- Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.12  15-May-2006  christos kauth fallout
 1.11  14-May-2006  elad integrate kauth.
 1.10  23-Apr-2006  christos Use malloc/free instead of MALLOC/FREE and M_ZERO instead of memset.
 1.9  11-Dec-2005  christos branches: 1.9.4; 1.9.6; 1.9.8; 1.9.10; 1.9.12;
merge ktrace-lwp.
 1.8  26-Feb-2005  perry branches: 1.8.4;
nuke trailing whitespace
 1.7  21-Apr-2004  itojun branches: 1.7.4; 1.7.6;
kill sprintf, use snprintf
 1.6  09-Nov-2003  christos - kill bzero/bcopy
- defopt stats and settings, removing their definitions from the files
- make code compile by eliminating multicharacter constants!?! and rearranging
variable declarations so they are defined before used!?!
- help gcc with uninitialized variables
 1.5  15-Nov-2001  lukem branches: 1.5.16;
don't need <sys/types.h> when including <sys/param.h>
 1.4  12-Nov-2001  lukem add RCSIDs
 1.3  13-Apr-2001  thorpej branches: 1.3.2; 1.3.4;
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.2  14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1  14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1  14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.3  08-Jan-2002  nathanw Catch up to -current.
 1.2.4.2  14-Nov-2001  nathanw Catch up to -current.
 1.2.4.1  21-Jun-2001  nathanw Catch up to -current.
 1.2.2.3  21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2  05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1  14-Dec-2000  bouyer file altq_afmap.c was added on branch thorpej_scsipi on 2001-01-05 17:39:35 +0000
 1.3.4.1  10-Oct-2001  fvdl Convert all remaining devices.
 1.3.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.16.5  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.16.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.16.3  18-Sep-2004  skrll Sync with HEAD.
 1.5.16.2  12-Aug-2004  skrll Adapt to new world order.
 1.5.16.1  03-Aug-2004  skrll Sync with HEAD
 1.7.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.4.1  29-Apr-2005  kent sync with -current
 1.8.4.3  03-Sep-2007  yamt sync with head.
 1.8.4.2  30-Dec-2006  yamt sync with head.
 1.8.4.1  21-Jun-2006  yamt sync with head.
 1.9.12.3  25-Sep-2006  peter sync with head.
 1.9.12.2  09-Jun-2006  peter Merge 2006-05-24 NetBSD-current into the peter-altq branch.
 1.9.12.1  18-Mar-2006  peter Sync with KAME.
 1.9.10.3  11-May-2006  elad sync with head
 1.9.10.2  10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.9.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.9.8.2  11-Aug-2006  yamt sync with head
 1.9.8.1  24-May-2006  yamt sync with head.
 1.9.6.1  01-Jun-2006  kardel Sync with head.
 1.9.4.1  09-Sep-2006  rpaulo sync with head
 1.13.6.2  10-Dec-2006  yamt sync with head.
 1.13.6.1  22-Oct-2006  yamt sync with head
 1.13.4.1  18-Nov-2006  ad Sync with head.
 1.17.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.18.50.1  19-Jan-2009  skrll Sync with HEAD.
 1.18.46.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.18.40.1  04-May-2009  yamt sync with head.
 1.18.36.1  17-Jan-2009  mjf Sync with HEAD.
 1.19.30.1  18-May-2014  rmind sync with head
 1.19.26.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.16.1  22-May-2014  yamt sync with head.

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

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

RSS XML Feed