Commit Graph

1964 Commits

Author SHA1 Message Date
yamt
3d7b4bf380 - rtredirect: use sockaddr_cmp directly.
- remove now unused equal.
2009-02-20 10:57:19 +00:00
yamt
a628bc1c00 remove inline from some functions which are not small or critical. 2009-02-20 10:54:57 +00:00
christos
c6c3da7776 PR/40690: Jordan Gordeev: pppoe(4) doesn't work when PPPoE relays are present
Add support for sending the session id tag back.
2009-02-19 15:17:50 +00:00
christos
fab9a9d4d2 mention when this will really break, not 2038 but 2145. 2009-02-14 20:48:46 +00:00
christos
942a145f69 PR/40603: Christoph Badura: unprivileged users can add and delete interface
link addresses. Fixed by centralizing the test as suggested. Will pull up
to 5.0 once submitter tests the fix.
2009-02-12 19:05:36 +00:00
dyoung
dcbf325fdb Cosmetic: break a line, change some spaces to tabs, remove an extra
empty line.
2009-02-05 21:45:36 +00:00
pooka
233a89adc0 Drop splnet() *after* tsleep instead of before. Fixes a race condition
between sleep and wakeup.  (tested on NetBSD 4.0)
2009-02-01 21:25:06 +00:00
yamt
1b3ee850af ppp_get_compressor: take module_lock when trying to load a module. PR/40428 2009-01-19 15:16:34 +00:00
mrg
c30587badd Fix multiple problems:
* A sign extension error creating the bridge ID corrupted the
    priority (always making it the maximum).
    * Do not catch STP packets on an interface for which STP is not
    enabled -- it's a violation of the spec, and causes STP to fail on
    neighboring bridges.
    * An optimization to bstp_input() -- some information is already
    known when we call it.

contributed anonymously.
2009-01-18 10:28:55 +00:00
christos
185469a211 restore binary compatibility on 64 bit systems. 2009-01-13 19:10:52 +00:00
christos
acdd91479e we need route_enqueue not to be static 2009-01-11 04:34:16 +00:00
christos
461a86f9bd merge christos-time_t 2009-01-11 02:45:45 +00:00
bjh21
12052c1959 Make Econet code compile again. 2009-01-07 20:56:40 +00:00
roy
108e90401a When removing routes automatically added, remove the flag from the associated
address.
When changing routes automatically addded, move the flag to the new assoicated
address.
2008-12-21 19:12:43 +00:00
cegger
9b87d582bd kill MALLOC and FREE macros. 2008-12-17 20:51:31 +00:00
christos
9a5d3f2817 replace bitmask_snprintf(9) with snprintb(3) 2008-12-16 22:35:21 +00:00
christos
c8164f5d15 RTAX_GENMASK and RTAX_AUTHOR could cause kernel memory corruption because
info struct members could be pointing to free'd memory. Fix from dyoung.
XXX: Pullup to 5.0
2008-12-12 22:34:58 +00:00
cube
9f95a5d658 Fix handling of ppp compressor modules, from Andrew Doran's input.
- ref count each compressor
 - allow {un,}registration of several modules at once
 - une RUN_ONCE to make sure the mutex is initialised, because
   unfortunately built-in (and bootloader-loaded) modules init functions
   are run before pseudo-devices attach (reported by Nick Hudson).
2008-11-29 23:15:20 +00:00
pooka
c6e7028d1c Make dom_maxrtkey of inet/inet6domain the size of the ip_encap pack
structures.  This is far from optimal, but gets rid of iffy
#ifdef INET in radix.c.  The radix bonsai still needs lots of love
before loading domains dynamically is possible...
2008-11-25 18:28:05 +00:00
cube
c12e613f44 Rework the way PPP compmressors are handled and allow them to be
automatically loaded when needed.
2008-11-25 02:40:36 +00:00
dyoung
a38f380ef4 Update comment for last. 2008-11-20 21:55:15 +00:00
dyoung
67852fcbc2 In the new ifioctl order, tun_ioctl() can call itself through
ifioctl_common().  Since the first tun_ioctl() call already holds
the simplelock, the second tun_ioctl() call will wait forever to
acquire it: deadlock.

To fix this, wait to acquire the lock until tuninit().
2008-11-20 21:54:42 +00:00
martin
e6d2ca8863 Pass SIOCAIFADDR to ifioctl_common, fixes PR kern/39900. 2008-11-13 22:22:24 +00:00
ad
0efea177e3 Remove LKMs and switch to the module framework, pass 1.
Proposed on tech-kern@.
2008-11-12 12:35:50 +00:00
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
hans
844d9a4743 call pmf_device_deregister in detach functions. requested by jmcneill. 2008-11-03 00:52:07 +00:00
hans
32ffdb16fe Add NULL pmf handlers. OK by cube. 2008-11-02 14:46:55 +00:00
christos
522f18932f Fold long lines created by the previous commit. No functional change. 2008-10-28 11:41:23 +00:00
dyoung
5cf05f3b26 Stop the "Sleazy use of local variables throughout file", replace
'dst' with 'info.rti_info[RTAX_DST]', et cetera.
2008-10-28 02:03:06 +00:00
christos
e7901a5f9a Fix handling of RTAX_GENMASK. Since this has been removed, userland programs
that set it, ended up causing the kernel to reference random garbage. Ignore
it for compatibility, but add a DIAGNOSTIC message so that userland programs
that set it can be fixed. The only one so far is pppd. Hi dyoung!
2008-10-25 17:34:00 +00:00
dyoung
398adeb7b9 Do not gratuitously cast to void *. 2008-10-24 21:46:09 +00:00
dyoung
beeacc82f5 Fix the device_t/softc split: introduce etherip_softc.sc_dev and
initialize it.  Use sc_dev in etherip_clone_destroy() instead of
casting the softc to struct device *.

Remove gratuitous casts.  Use device_t and cfdata_t throughout.
2008-10-24 21:41:04 +00:00
dyoung
d94f902d6b Do not gratuitously cast to void *. Remove excess parenthesization.
Do not "test truth" of pointers, but compare with NULL.

No functional change intended.
2008-10-24 21:38:18 +00:00
dyoung
71367efb93 Undo a change in my last commit that was not suppsoed to be committed. 2008-10-24 17:14:29 +00:00
dyoung
cf969cfa5a Constify the rt_addrinfo argument to the ifa_rtrequest member
function of struct ifaddr.
2008-10-24 17:07:33 +00:00
scw
edeb3e1fec Reduce the scope of PPPoE session IDs from globally unique to per-interface
unique. Some brands of ADSL modems pick a hard-coded session ID which
would otherwise make it impossible to use two of them in the same system
simultaneously.
2008-10-15 20:08:33 +00:00
pooka
2002727b2c Give maximum level of network softinterrupts a symbolic constant
(which happened to get bumbed from 32 to 33 (AF_MAX) now).
2008-10-14 17:15:20 +00:00
bouyer
88948cf5d2 Make SIOCSIFCAP work again on vlan interfaces: first check that the
capability is enabled on parent, then call ifioctl_common().
2008-10-11 17:19:41 +00:00
pooka
308b8af180 POOL_INIT -> pool_init 2008-10-04 00:09:34 +00:00
pooka
224186c110 Fix pointer size typo - affects only debug output.
Henning Petersen, PR lib/39689
2008-10-03 18:33:06 +00:00
mhitch
70a12d51ab Add support for SerDes controllers; from the OpenBSD driver. Tested on a
Dell Blade server by me, and an HP Blade server by Havard.
2008-09-09 20:12:18 +00:00
gmcgarry
0de5da9678 Replace most gcc-specific __attribute__ uses with BSD-style sys/cdef.h
preprocessor macros.
2008-09-08 23:36:53 +00:00
christos
44c100dd00 - more void * removal
- bcopy -> memcpy
- memmove -> memcpy
- explicitly initialize size to 0 on memory allocation failure.
2008-08-28 19:33:24 +00:00
dyoung
734473836e Do not cast to void * unnecessarily. 2008-08-28 18:43:58 +00:00
rmind
67d6ac0a69 tap_attach/tap_detach: selinit/seldestroy the selinfo structure.
Should fix PR/39237.
2008-08-26 11:06:59 +00:00
martin
b0f7c9ec03 Backout previous/restore initial fix for PR kern/39280.
The later changes were only cosmetic, cause problems in IPv6-only-
connections (reported by Wolfgang Solfrank in private mail), as well
as reintroducing the original bug again.
2008-08-22 12:13:18 +00:00
joerg
216f1c75dc As the scratch memory is only ever copied to or from A and X, make it
unsigned as well.
2008-08-20 13:01:54 +00:00
martin
7c66311782 Simplify auth failure reconnect a bit and make it more similar to the
session establishment timeout handling.
2008-08-19 22:03:05 +00:00
simonb
e50c5ea246 Fix a tyop in a comment and a few #define<tab> nits while here. 2008-08-19 10:41:10 +00:00
martin
e9e3618d99 When upper layer asks us to re-establish a connection, don't do so
synchronously, but insert a (varying) delay. Before we have only been
decoupled from the peer via network latency - now we introduce some
explicit delay. This, at least, creates batter serialized debug output.

However, if we have to reconnect because of an authentication failure,
the peer may have just been unable to access it's radius server. (I have
a setup where this seems to happen every now and then, depending on time
of day.) Backoff reconnect in this cases seriously longer - this is better
than hitting the max-auth-failure limit within a few seconds.
2008-08-18 21:43:49 +00:00