Go to file
dyoung de87fe677d *** Summary ***
When a link-layer address changes (e.g., ifconfig ex0 link
02🇩🇪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.
2008-11-07 00:20:01 +00:00
bin PR/11317: Hubert Feyrer: Recognize mismatched parentheses inside old style 2008-11-05 22:04:43 +00:00
common Raise correct interrupt on division errors. 2008-10-27 00:20:22 +00:00
compat Add a horrible kludge to make this build on sparc64, explained in the Makefile. 2008-11-04 15:25:58 +00:00
crypto fixed delsainfo() to avoid a crash when iddst's value is SAINFO_CLIENTADDR 2008-11-06 14:12:28 +00:00
dist Pull in a minor change from file-4.26 that gets cross-compiling from 2008-11-04 13:34:11 +00:00
distrib add Xorg bits 2008-11-06 22:00:38 +00:00
doc ACPICA version 20081031 is out 2008-10-31 18:27:10 +00:00
etc Now that the installation floppies are including tmpfs as well, stop 2008-11-04 14:25:10 +00:00
external Add missing LIBDPLIBS, found by using 'LDFLAGS += -Wl,-z,defs' and sort 2008-11-06 22:28:25 +00:00
games more MKSHARE == no fixes: 2008-10-30 21:37:55 +00:00
gnu pass HOST_CFLAGS when building cross tools 2008-11-04 23:58:40 +00:00
include include <sys/null.h> because _DIAGASSERT(foo == NULL) is too common and some 2008-11-02 14:27:44 +00:00
lib * use advisory file locks to avoid multiple mounts on the same device 2008-11-07 00:18:33 +00:00
libexec pull across the fix from my master bozohttpd cvs tree for PR 38466. 2008-11-06 06:38:43 +00:00
regress Add AWK?=${TOOL_AWK} in regression tests for awk itself. 2008-10-27 20:59:22 +00:00
rescue use nvi instead. thanks to Andreas Wrede 2008-10-29 23:55:28 +00:00
sbin * Instead of silently ignoring extra args, print a usage error. This 2008-11-06 16:01:54 +00:00
share add a couple driver names for Xorg 2008-11-06 22:13:58 +00:00
sys *** Summary *** 2008-11-07 00:20:01 +00:00
tests Don't descend into atf with (${MKATF} == no) 2008-08-16 23:51:51 +00:00
tools include unistd.h where getmode is traditionally declared 2008-11-04 23:31:32 +00:00
usr.bin Change for standards compliance: 2008-11-04 03:14:46 +00:00
usr.sbin ensure mtree_err gets a format string 2008-11-04 23:22:48 +00:00
x11 Use ${TOOL_SED} instead if plain sed in Makefiles. 2008-10-25 22:27:34 +00:00
BUILDING regen for recent change to examples and objdir advice, 2008-09-24 07:38:04 +00:00
Makefile - enable 32-bit library builds on amd64 and sparc64 2008-10-27 22:32:51 +00:00
Makefile.inc
UPDATING Add an entry for the "libc lint problem", mostly taken 2008-09-02 07:34:15 +00:00
build.sh Try harder to guess the correct TOOLDIR. 2008-10-26 23:40:06 +00:00