Commit Graph

1381 Commits

Author SHA1 Message Date
martin d505b18964 Make sure to include opt_foo.h if a defflag option FOO is used. 2003-06-23 11:00:59 +00:00
itojun b6625c38a4 avoid panic in malloc() under extremely low memory situation.
OpenBSD problem report 2235, 2236, 2640.  fix by Otto Moerbeek.
2003-06-19 06:25:41 +00:00
oki 6873b338d6 Add support in-kernel PPPoE server.
This may work with one PPPoE session.
If you want to use it, #define PPPOE_SERVER in somewhere,
or add options PPPOE_SERVER in kernel config file.

This is experimental code, and good start point for future development.
2003-06-18 08:12:51 +00:00
martin 096ea30c09 Add NETATALK to the list to check if we bail because no ARP is configured. 2003-06-11 10:44:10 +00:00
martin 7f550781cc Fix typpo in #error message. Noted by Pawel Chwalowski in PR 21853. 2003-06-11 10:34:55 +00:00
dyoung 148258d56c Don't call ieee80211_chan2ieee, we don't have it, yet. 2003-05-31 19:37:15 +00:00
kristerw dcfad96372 Make sure splx() is called for all bridge_ioctl() error cases. 2003-05-24 14:22:14 +00:00
itojun 8228c94987 don't call if_free_sadl() until very end of if_detach() logic. many of
routing table manipulation code assumes the presense of AF_LINK sockaddr.
should fix PR 21581
2003-05-23 10:06:17 +00:00
christos 0b736391e8 add COMPAT_ULTRIX where necessary. Thanks gimpy! 2003-05-19 22:17:24 +00:00
itojun abf7c0c6f1 AF_LINK sockaddr has to be attached to ifp->if_addrlist until the end,
as many of the code assumes that TAILQ_FIRST(ifp->if_addrlist) is non-null.
2003-05-16 16:57:09 +00:00
itojun 4008ec1218 use strlcpy 2003-05-16 03:56:49 +00:00
dyoung 045ad0db5e IEEE80211_LOCK and WI_LOCK conceal enormous differences in locking
semantics on FreeBSD and NetBSD, so I am backing them out until
the macro set is enriched.
2003-05-16 01:26:17 +00:00
itojun b4542a20a6 use arc4random 2003-05-14 23:16:44 +00:00
itojun ccc2f25972 no need to compile net_osdep.c. simplify net_osdep.h conditions (remove
bsdi/freebsd/openbsd stuff)
2003-05-14 22:45:02 +00:00
itojun 5ebd8c7eba remove #ifdef __FreeBSD__ (code already diverged enough) 2003-05-14 22:41:40 +00:00
itojun ab4f0285a8 unifdef for readability/clarity. thorpej ok 2003-05-14 15:50:51 +00:00
itojun 346e0198f0 always use PULLDOWN_TEST codepath. 2003-05-14 06:47:33 +00:00
dyoung 541c2cdd2e Sync with FreeBSD. Spelling fix. Make ieee80211_decap a little more
readable. Accomodate both FreeBSD arpcom and NetBSD ethercom with
conditional compilation.
2003-05-13 10:05:05 +00:00
dyoung 15c573fc50 Verify beacon/probe response information elements to prevent buffer
overflows.
2003-05-13 09:53:07 +00:00
dyoung 8c01544ced Pack rates, SSID using helper routines ieee80211_add_{rates,ssid}
instead of reduplicating code. From Sam Leffler/FreeBSD.
2003-05-13 09:47:44 +00:00
dyoung d3f1cc6bf2 Add utility routine ieee80211_get_rate(). 2003-05-13 09:31:56 +00:00
dyoung 1786077eef Begin sync with 802.11 framework in FreeBSD: adopt macros for
locking.
2003-05-13 09:22:31 +00:00
dyoung 9302269223 Define an 802.11 PLCP header and constants.
Define two new status codes for management frames.

Define 802.11 durations of important frame sequences, as will be
needed for ADMtek ADM8211 driver and others.
2003-05-13 05:51:46 +00:00
dyoung 7383a96ca6 Fix two bugs: supported rates elements were assembled incorrectly,
and the 'no recent beacons from %s' message told the wrong BSSID.
2003-05-13 05:43:43 +00:00
grant 6ecb99a75c fix grammatical error in a diagnostic message. 2003-05-06 17:54:27 +00:00
enami 9595f6d722 Initialize mb.m_data. 2003-05-06 09:59:35 +00:00
itojun 860a851ea8 KNF 2003-05-02 03:15:23 +00:00
itojun 5576ac2656 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.
2003-05-01 07:52:58 +00:00
itojun 8c6d963459 don't be too verbose on nd6_storelladdr failure 2003-05-01 07:41:59 +00:00
itojun 8466cf281c consistency; use tokenbroadcastaddr, not ether*. 2003-05-01 02:34:20 +00:00
bjh21 ca2c1040cf Expose IF_NAMESIZE for POSIX and X/Open applications. 2003-04-30 18:50:26 +00:00
bjh21 4be7a2dcf3 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
  can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
  various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
  !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them.  In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-28 23:16:11 +00:00
bjh21 c4987984da Accept standard IEEE 802.3 names for Ethernet medium types.
Suggested by Christos, IIRC.
2003-04-23 23:16:43 +00:00
salo f35804411a depreceated->deprecated 2003-04-17 22:55:29 +00:00
kml 0ad9e0dccc Host AP power saving support. The Host AP notices that the power
saving bit is set in incoming frames from a station, and buffers the
outgoing frames for the station until they are polled for.  This
requires support in the driver to set a bit in the TIM bitmap sent
during 802.11 beacons.

So far, support for power saving in Host AP mode is only available
for the PRISM2 chipset.
2003-04-08 04:31:23 +00:00
christos e950c1ac8f PR/20844: Iain Hibbert: PPP Compressors cannot be loaded as LKM 2003-03-27 17:50:06 +00:00
bouyer 013798abf2 Make promiscous mode work on vlans: introduce a new link-layer m_flag
M_PROMISC. In ether_input(), flag packets comming from an interface in
promiscous mode which are not for us M_PROMISC instead of droping them.
Drop M_PROMISC packets which are not passed to vlan_input(). M_PROMISC
packets passed to vlan_input() will be looped back to ether_input()
the M_PROMISC flag will be handled appropriately.
Clear M_PROMISC before giving the packet to bridge, as bridge has its own
checks for local MAC addresses.
This also makes bridges on vlan working.
2003-03-25 13:29:39 +00:00
bouyer 4a3c894eef Fix 2 bugs:
- initialise stp when the bridge is turned up, without this stp will keep
  all interfaces disabled in a sequence like:
  brconfig bridge0 add if0 add if1 stp if0 stp if1 up
- s/BRDGSPRI/BRDGSIFPRIO in brconfig.c:cmd_ifpriority()

add a command (ifpathcost) to change the stp path cost of the STP path cost of
an interface. Display the interface path cost with the others STP parameters.
2003-03-19 10:34:33 +00:00
matt e2765c0933 Allow a machine-dependent definition of schednetisr. 2003-03-15 07:51:06 +00:00
dsl 30630417a8 Validate pgid arg to TIOCSPGRP 2003-03-13 10:24:38 +00:00
dsl 53d2320e25 Check that the process/process group id passed to TIOCSPRP is in the session
of the current process.
2003-03-13 10:18:35 +00:00
christos 35f9126434 Fix the fallout from potr malloc changes 2003-03-05 22:56:46 +00:00
aymeric 95d6206a6c ignore multicast PPPoE packets ASAP.
This improves performance a lot on slow machines behind a cable modem.
Protect it with PPPOE_SERVER as a reminder that this will have to be changed
if we add PPPoE server code in the kernel one day.
2003-03-02 10:50:14 +00:00
martin a3248903e4 Backout previous, I'm on crack obviously. 2003-03-01 15:50:15 +00:00
martin b15e7fee31 Initialize sc to NULL, it could be used uninitialized otherwise when
searching for our sc by host unique tag.
2003-03-01 15:24:36 +00:00
aymeric 038e238665 when looking up a Host-Uniq tag, do not consider NULL as a valid
(struct pppoe_softc *). Although we do not generate such tags, other hosts
could and some actually do.
2003-03-01 15:10:13 +00:00
perseant eab869e1c0 Make BRIDGE_IPF an option, and document it. Add it (commented) to GENERIC.
Let brconfig tell whether the bridge is using the ipfilter hook, or not.
2003-02-27 19:22:36 +00:00
matt 70e05a774b Fix tpyo. 2003-02-26 07:47:42 +00:00
matt 65e5548a17 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.
2003-02-26 06:31:08 +00:00
dyoung 595c6d88b2 Add support for Prism monitor mode. From Kevin Lahey
<kml@patheticgeek.net>.

This patch does NOT add monitor mode support for the Lucent radios.

awi(4) was only modified for compatibility with the new mediaopt.
It does NOT support monitor mode.

Tested by Kevin, Daniel Carosone, and I.
2003-02-25 01:57:35 +00:00
simonb ac161ae918 Remove assigned-to but not used variable. 2003-02-23 04:20:06 +00:00
perseant 6b857c229e Add ipf packet-filtering option to if_bridge. The option is controlled at
compile-time by BRIDGE_IPF, and at runtime by brconfig with the {ipf,-ipf}
option on a per-bridge basis.

As a side-effect, add PFIL_HOOKS processing to if_bridge.
2003-02-15 00:46:30 +00:00
martin fd690f8523 PADT is always send with ethertype PPPOE_DISCOVERY, no matter if we
have reached session state or not.

Fixes PR kern/20203 by Shoichi Miyake.
2003-02-04 20:52:23 +00:00
thorpej 882dec6ba3 Test callout_pending(), not callout_active(), and eliminate now-unnecessary
callout_deactivate() calls.
2003-02-03 23:50:59 +00:00
thorpej b193480908 Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant.  Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
2003-02-01 06:23:35 +00:00
tron 0cbe3d790b Use MRU negotiated with remote system as MTU. This fixes PR kern/18850
by Curt Sampson.
2003-01-28 15:36:38 +00:00
jmmv 190a36975b Fix typo: realy -> really. Okay'ed by wiz. 2003-01-22 11:47:05 +00:00
simonb f77e8353aa Remove a break after a goto. 2003-01-19 23:45:33 +00:00
simonb 221db74413 Remove variable that is only assigned too but not referenced. 2003-01-19 23:44:03 +00:00
simonb af85a1483e Fix code in #ifdef WICACHE block to use renamed constants and
struct members.
Remove a break after a return.
2003-01-19 23:17:21 +00:00
simonb 4d6d90e127 Remove variable that is only assigned too but not referenced. 2003-01-19 23:13:46 +00:00
wiz f585195db2 bandwidth, not bandwith. 2003-01-18 12:02:40 +00:00
itojun 40606ab8f2 switch from kame-based m_aux mbuf auxiliary data, to openbsd m_tag
implementation.  it will simplify porting across *bsd (such as kame/altq),
and make us more synchronized.  from Joel Wilsson
2003-01-17 08:11:49 +00:00
jdolecek 384748874a Ethernet multicast entries are malloc'd M_IFMADDR, and thus should
be freed as M_IFMADDR too.
Fix supplied in PR kern/19037 by Sean Boudreau
2003-01-12 12:26:23 +00:00
martin 2e5336f7a8 Fix broken error handling in case M_PREPEND fails.
Noticed by Matthias Scheeler.
2003-01-07 20:02:10 +00:00
wiz 45ad5c9584 successful with only one l. 2003-01-06 12:46:05 +00:00
wiz 617b132aac Spell output with two ts. 2003-01-04 23:43:02 +00:00
kristerw 83b5a18c99 Restore the system priority level in case of errors.
OK:ed by martin.
2002-12-28 21:09:14 +00:00
martin 501da0e586 In do not call pppoe_abort_connect if we fail to send the initial PADI
packet - there is nothing to abort.
In pppoe_abort_connect rearange state handling slightly to avoid calls
to the PPP LCP state machine get into an infinite recursion.

This should fix the symptoms of PR kern/19500, but does not touch the
real cause for the lossage described there.
2002-12-25 11:54:33 +00:00
jdolecek 6973160773 count input/output bytes for tun device
Problem reported and patch provided in PR kern/19554 by Michael van Elst
2002-12-25 08:40:20 +00:00
lukem 0635de35a3 Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more. 2002-11-26 23:30:07 +00:00
christos f5ff34bbc6 si_ -> sel_ 2002-11-26 18:51:18 +00:00
thorpej d6f8cc841d Avoid strict-alias warnings. 2002-11-25 01:55:21 +00:00
scw fc3c6f554f Quell an uninitialised variable warning. 2002-11-24 11:38:51 +00:00
itojun e34d5a243d more pickier packet validation, based on
draft-savola-v6ops-6to4-security-00.txt.  sync w/kame
2002-11-17 19:29:31 +00:00
dyoung 1cfe0913f5 Fix typo: IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK becomes
IEEE80211_FC0_SUBTYPE_CF_ACK_CF_POLL. This is the name the IEEE
802.11 specification indicates.
2002-11-16 06:08:31 +00:00
chs 7d8622764c when there are multiple matches for the requested media, select the first
matching instance rather than the last one.  this restores the behaviour
in the multiple-match case to what it was when all the drivers only allowed
instance 0 (and in particular, makes autonegotiation of the on-board fxp
on my DK440LX board work again by default, which has two PHYs that both
advertise "auto").  as discussed on tech-net.
2002-11-12 16:54:45 +00:00
itojun 50a545a34b remove all entries in rt timer queue on ip_mtudisc change, instead of
destroying the queue.
2002-11-12 02:10:13 +00:00
itojun 96910acf99 add an argument to rt_timer_remove_all(), to specify if we need to call
timeout routine on removal.
2002-11-12 01:37:30 +00:00
itojun c8a8326600 make USE_ENCAPCHECK (in netinet*/*gif.c) to global option, GIF_ENCAPCHECK.
#ifdef out unneeded code when possible.
From: Krister Walfridsson <cato@df.lth.se>
2002-11-11 18:35:27 +00:00
thorpej f5c6a07c43 Fix more signed/unsigned comparison warnings. 2002-11-07 08:00:47 +00:00
thorpej 079b24a323 Make ifm_data unsigned. 2002-11-07 07:53:37 +00:00
thorpej facf465586 Make media and mask unsigned. 2002-11-07 07:42:24 +00:00
kristerw 0ed7608653 Revert previous. Nested comments are evil. 2002-11-02 12:00:03 +00:00
perry 6858187df6 /*CONTCOND*/ while (0)'ed macros 2002-11-02 07:20:42 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
onoe 5a5f1fbe93 Do not start active scan for WI_RID_SCAN_APS request on HostAP, just return
the list of current association clients for WI_RID_READ_APS.
Reset active channel list after active scan.
2002-10-16 11:29:30 +00:00
onoe 4b4897a156 Clear wep key when 'ifconfig -nwkey'.
Change the name for the size of driver private structure:
	ic_bss_privlen -> ic_node_privlen
Add a hook to free node for the driver private structure, though there are
no consumer of the structure in the tree for now.
2002-10-15 08:51:50 +00:00
onoe 74d7ce3980 Use ieee80211_free_node() instead of TAILQ_REMOVE() not to forget
LIST_REMOVE() for ni_hash.  This fixes panic after deassociation due to
inactivity for HostAP.
2002-10-11 01:34:43 +00:00
onoe 5a2d7e0875 Perform as a bridge within the AP for HostAP mode, to allow communication
between a wireless station and another wireless station.
2002-10-04 04:25:05 +00:00
itojun 8b1cd24b78 backout previous two - if you use ppp* interface, kernel panics instantly.
it is apparent that the change was untested, and severety is high.
2002-10-02 02:27:54 +00:00
onoe c4e66a718b In AP mode, transmit deauth to (re)associating station without authenticated. 2002-10-01 09:28:10 +00:00
onoe 8c17118b22 Allow SIOCSIFADDR with AF_LINK and WI_RID_MAC_NODE (wiconfig -m)
to set MAC address.
2002-10-01 03:27:02 +00:00
onoe 9fadcea372 old lucent adhoc-demo mode (adhoc,flag0 or wiconfig -p 3) wasn't handled
correctly.  To avoid massive extra code in each driver, now if_iee80211subr.c
also handles non-standard old lucent adhoc-demo mode.
This also fixes PR 14227.
2002-09-30 15:48:41 +00:00
onoe ed3b52f295 Obtain some functionality from wi_hostap;
use hash for device node list.
	Avoid use weak IV value, increment IV for each packet.
2002-09-30 05:35:28 +00:00
onoe 4c66b63b21 Fix SIOCG80211BSSID to return current BSSID if associated. 2002-09-29 10:17:00 +00:00
provos 0f09ed48a5 remove trailing \n in panic(). approved perry. 2002-09-27 15:35:29 +00:00
itojun 501bf56348 license clarification from the author, via openbsd
>BSD-style license from Serge Vakulenko <vak@cronyx.ru>
2002-09-27 06:20:30 +00:00
onoe 30d884d47c Add support for SIOC[SG]80211BSSID, SIOC[SG]80211CHANNEL.
Change the name of structure ieee80211_bss to ieee80211_node, which is
used for management of stations in hostap mode, and peers in ibss mode.
Split off ic_opmode, ic_phytype from ic_flags.
Preparation to merge 'wi' driver into 80211subr.c.
2002-09-27 05:36:04 +00:00
onoe 23ab1acf02 Change ifmb_baudrate for IFM_IEEE80211_DS5: 5Mbps -> 5.5Mbps 2002-09-27 05:27:20 +00:00
onoe f529393822 Add check suser() for SIOCS80211BSSID, SIOCS80211CHANNEL. 2002-09-27 04:08:40 +00:00
darrenr aa1492743a Fix a case where M_COPY_PKTHDR() wasn't being used prior to calling bpf_mtap 2002-09-26 16:07:03 +00:00
onoe e3261bdc94 initialize pkthdr for dummy mbuf before calling bpf_mtap(). 2002-09-26 13:06:56 +00:00
augustss 7656699497 Remove unused variable so the file compiles again. 2002-09-25 23:24:37 +00:00
thorpej 71404bb533 Don't include <sys/map.h>. 2002-09-25 22:21:01 +00:00
darrenr 4c314b9a9f Keep m_pkthdr.len updated correctly and use it rather than a loop to find
out the total length of the packet.
2002-09-25 16:10:15 +00:00
itojun c40ace5ea0 KNF 2002-09-25 07:24:06 +00:00
itojun 6a3e3549fe backout recent changes, for PR 18392.
bpf_mtap() gets called with not-well-initialized mbuf, so we need to go through
it without touching m->m_pkthdr.len and such.  it's part of our bpf_mtap() API
(at least today).
2002-09-24 03:14:43 +00:00
simonb 4e3613273b Remove breaks after returns, unreachable returns and returns after
returns(!).
2002-09-23 05:51:10 +00:00
simonb f8a2d422d1 uio_resid is a size_t (ie, unsigned), so don't check if it's less than 0. 2002-09-23 04:26:17 +00:00
thorpej cccd4bd402 Fix thinko in the SIOC{G,S}80211CHANNEL and SIOC{G,S}80211BSSID
ioctls.
2002-09-22 01:56:08 +00:00
thorpej 8ad8dd07df Nuke the old SunOS-style ioctl defns. 2002-09-21 17:02:46 +00:00
atatat fe89a76e74 Add a missing semi-colon. 2002-09-19 03:04:32 +00:00
darrenr 0a30063654 For the trivial case where the packet is only in one mbuf, call bpf_tap()
(idea from FreeBSD) - alternative to changing bpf_filter() to be aware of
kernel calling convetion where 0 is passed as the length for mbufs.
2002-09-19 01:16:58 +00:00
darrenr 600f9cb660 If M_PKTHDR is set we can use m_pkthdr.len instead of the for loop. 2002-09-19 00:34:00 +00:00
itojun ce04d2f721 fix comment, sync with kame 2002-09-17 06:32:49 +00:00
itojun cf50f0c768 reject SIOCAIFADDR if embedded address is in private address range. sync w/kame 2002-09-17 05:56:37 +00:00
tron 377e179dcb Use "const" for all input parameters of ethers(3) functions. 2002-09-16 19:25:30 +00:00
thorpej 2d655f566e In bpf_setdlt(), preserve the promiscuous mode setting of the
descriptor.

From David Young <dyoung@ojctech.com>, slight change by me.
2002-09-15 23:44:12 +00:00
thorpej 4c3ae4bbc8 Add new ioctls:
* SIOCS80211CHANNEL, SIOCG80211CHANNEL -- set/get the 802.11 channel.
* SIOCS80211BSSID, SIOCG80211BSSID -- set desired/get current BSSID.

From David Young <dyoung@ojctech.com>.
2002-09-15 23:27:08 +00:00
itojun 0319b78e54 copyright clarification. from openbsd
1.
Paul Mackerras and the Australian National University have worked things
out, and as a result, Paul now owns copyright on all these files, with the
proper terms.

2.
and... we managed to contact "Eric Rosenquist" <eric@rosenquist.com> through
the help of people who found him: first one was nick.stott@cogeco.ca
This now has a better license.  Two authors left to go.
2002-09-13 14:32:11 +00:00
itojun 822449ac65 KNF - return is not a function. 2002-09-11 05:36:26 +00:00
gehenna 77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
onoe 26ebf5f371 Several fixes hostap for awi driver:
- aging ang clear inactivity stations
- DTIM field in beacon/probe response.
- ignore IFF_PROMISC for hostap mode, since 802.11 has 3 address fields,
  so that promisc mode is not required for AP function.
2002-09-03 14:54:00 +00:00
onoe efcfc3e1c8 Add experimental support of Host-AP mode for awi driver.
It works also with WEP enabled.
But aging the associated clients is not implemented yet, so that the number
of clients may increase unlimitedly..
2002-09-02 13:37:35 +00:00
martin 1caaa903fa If the peer did not answer LCP echo requests in-time, but we got user
data through within the last LCP keepalive interval, do not count this
as a keepalive failure.

Addresses parts of kern/17723.
2002-09-01 18:54:12 +00:00
martin adb5933cbb Apply patch from Todd Vierling in PR kern/17665:
remove a test that has been obsoleted by the authentication failure
counter - enter slow retry mode always, not only if we already transfered
data successfully (the test was designed to disable retries when the
initial authentication setting was not correct, the auth failure counter
does this job better).
2002-09-01 18:06:59 +00:00
martin ac83580ea9 Add an option PPPOE_TERM_UNKNOWN_SESSIONS to forcefully disconnect sessions
we don't know anything about with a PADT packet.

Use with care, this is pretty dangerous and will kill all userland PPPoE
implementations. Therefore it is not enabled by default nor added as
a commented out option to GENERIC kernels.

But it is highly usefull if you have a fixed IP, an ISP that does not use
LCP echo requests for link monitoring and you want to recover quickly after
a crash or otherwise ungracefull disconnect.
2002-09-01 17:21:40 +00:00
onoe fd9daca7ea Attach another DLTs for bpf: DLT_IEEE802_11 to capture raw 802.11 frame. 2002-08-28 09:38:08 +00:00
onoe 5d6bb1fbc3 Define new kernel interface bpfattach2() to register another data link
type for the driver, which will be used for 802.11 drivers.
Also add 2 APIs to get a list of available DLTs and use one for them.
	BIOCGDLTLIST (struct bpf_dltlist)
	BIOCSDLT (u_int)
2002-08-28 09:34:57 +00:00
onoe b4c41e0480 Define new DLT: DLT_IEEE802_11, DLT_PRISM_HEADER, and DLT_AIRONET_HEADER
from tcpdump.org
2002-08-28 09:31:20 +00:00
thorpej 83b3b86fd6 Fix a signed/unsigned comparison warning from GCC 3.3. 2002-08-26 01:42:28 +00:00
thorpej f3420f21a5 Fix some signed/unsigned comparison warnings from GCC 3.3. 2002-08-26 01:39:39 +00:00
thorpej 2371f92317 Fix signed/unsigned comparison warnings from GCC 3.3. 2002-08-26 01:36:37 +00:00
tron 56999645f0 Fix typo in a comment. 2002-08-25 19:21:47 +00:00
martin f54ddc3c17 Add a function to lookup bridge members by struct ifnet * and use
it at all call sites that have such a pointer readily available.
This avoids unnecessary strcmp()s in critical paths, and removes
some XXX comments.
2002-08-24 19:00:31 +00:00
onoe 63a1f2ed02 Delete IFM_IEEE80211_IBSS [ibss] and IFM_IEEE80211_IBSSMASTER [ibss-master]
from media options, since IEEE80211_ADHOC [adhoc] is already defined for
IBSS.  Instead, [ibss] is assigned as an alias for IEEE80211_ADHOC.
2002-08-21 03:22:04 +00:00
kristerw 6cf8d48ed9 #if 0 a couple of unused functions. 2002-08-20 03:52:26 +00:00
kristerw 81244d0b17 Make it compile for the __NO_STRICT_ALIGNMENT case. 2002-08-20 03:32:08 +00:00
thorpej c59bd1a572 In ether_output(), don't bother calling memcpy() to plop the ethertype
into the packet: On system with no strict alignment constraints, just
assign the value, and on others, do an inline 2 byte copy.
2002-08-19 18:58:50 +00:00
itojun c00fa8dfd9 avoid swapping endian of ip_len and ip_off on mbuf, to meet with M_LEADINGSPACE
optimization made last year.  should solve PR 17867 and 10195.

IP_HDRINCL behavior of raw ip socket is kept unchanged.  we may want to
provide IP_HDRINCL variant that does not swap endian.
2002-08-14 00:23:27 +00:00
itojun dddc4be003 to be consistent with other sources, use "struct ip *ip", not inp.
(inp is usually used for pointing struct inpcb)
2002-08-12 05:22:57 +00:00
drochner 5f33ace021 rename WI_ ioctl to make it compile again 2002-08-11 12:08:55 +00:00
thorpej 2faddb9f3d * Additional frame control types.
* BEACON and AUTH management packet info.
* Add ioctl for configuring 802.11 auth mode.

From OpenBSD.
2002-08-11 03:39:21 +00:00
thorpej 0eee4f1a69 Add "hostap", "ibss", and "ibss-master" 802.11 media options.
From OpenBSD.
2002-08-10 23:21:58 +00:00
soren f969160bd2 <net/if.h> needs <sys/socket.h> for struct sockaddr.
PR kern/3377 from der Mouse.
2002-08-09 22:43:15 +00:00
itojun cf8807954f backout previous. i was looking at the wrong RFC. 2002-08-06 04:58:57 +00:00
itojun fa5ffb82e4 based on RFC2529, stf(4) should have 1480 as MTU, not 1280.
tron found it, sync w/kame
2002-08-05 23:37:48 +00:00
onoe 248c861292 Fix IBSS for awi driver. 2002-08-05 06:55:05 +00:00
christos d64bbf607d Fix async map handling. Many thanks to Joerg Wunsch for the explanation. 2002-07-30 13:16:35 +00:00
atatat 6675196afb Make tun interfaces perform auto-creation. This means that if a
program opens /dev/tun# and tun# has not been SIOCIFCREATE'd already,
it will be SIOCIFCREATE'd automatically.  FreeBSD's tun interfaces
behave in a somewhat similar fashion.
2002-07-29 16:53:30 +00:00
christos 42f6b6f836 Patches from Frank Kardel:
- length was one off in names and secrets.
- add win 98 kludge but we keep it disabled for now.
- setup the authorization bit early so that we don't end up doing ppp
  negotiations without authorization.
2002-07-28 22:16:47 +00:00
christos 59d3d6c274 Don't throw away the name and the secret lengths. This eliminates all the
strlen() calls, and there was a whole bunch of them.
2002-07-28 19:54:47 +00:00
christos 450091b937 avoid modifying the buffers, by checking for matching lengths first. From
Frank Kardel.
2002-07-28 15:12:29 +00:00
christos ca989d9a38 Use strcmp() instead of memcmp() because if we get passed a 0 length name
and secret, we'll authenticate successfully! While there, rename passwd to
secret so that code looks nicer.
2002-07-27 19:09:07 +00:00
wiz 645df36eff Spell '[Rr]ight' correctly. From Jim Bernard. 2002-07-26 14:11:34 +00:00
tron e5e66e171b Increase interface output error count in case of a failure. 2002-07-23 06:59:51 +00:00
tron 5126e6107d Increase interface output counter for every encapsulated packet sent to IP. 2002-07-23 06:44:53 +00:00
martin 5d9a5f68c8 Use "mono_time" instead of "time" for timeout calculations. 2002-07-13 11:08:03 +00:00
yamt 43b3a8007f don't access freed memory. 2002-07-11 21:37:51 +00:00
yamt c56faa76d8 don't access freed memory. 2002-07-11 21:21:53 +00:00
itojun db705b375f use iana-assigned value for IFT_STF. sync w/kame 2002-07-10 21:01:06 +00:00
itojun c6f53f281c correct tcp header chasing in pp_fastq processing. should fix kern/17491. 2002-07-06 18:33:45 +00:00
itojun fb05cd3dd3 new copyright boilerplate from CMU. from openbsd 2002-07-01 22:09:31 +00:00
onoe b00ef6acdd Fill ar_hrd for AF_ARP. 2002-06-25 03:42:28 +00:00
enami 92912a1744 Actually inject the arp packet into softintr queue. 2002-06-24 12:00:49 +00:00
itojun 0143dfc42f integrate IEEE1394 ARP into generic ARP logic.
XXX there's no check at all in ar_hrd, and we don't set ar_hrd on outgoing.
it seems like a bad thing.
2002-06-24 08:06:20 +00:00
itojun 39cf9ef1f5 g/c last bit of old ipv6 prefix management. 2002-06-23 23:34:08 +00:00
yamt a113bc6fa4 - free buf when unneeded.
- pass a consistent type to free(9).
2002-06-22 17:41:23 +00:00
yamt f6849cb26f fix loop condition.
(don't skip last tag)
2002-06-22 16:56:11 +00:00
itojun f16149934e avoid unneeded call to m_pullup 2002-06-22 11:46:16 +00:00
itojun 9f260b4865 do not require PPPoE control packet to be put into a single mbuf.
reviewed/tested by ymmt
2002-06-22 11:37:48 +00:00
itojun 32e2727406 more style 2002-06-22 05:59:27 +00:00
itojun 98171fbccc style 2002-06-22 05:54:14 +00:00
itojun a028d35cfd more KNF. warn about mbuf misuse (passing pointer outside of mbuf is dangerous) 2002-06-22 05:52:00 +00:00
itojun e94ae067d1 tabify. minor KNF 2002-06-22 05:33:42 +00:00
itojun a10b39ecad reject packets with IPv4 private address range. sync w/kame 2002-06-20 07:43:39 +00:00
itojun 425b0d2350 typo 2002-06-13 05:12:12 +00:00
itojun 00f97b0202 drop too short IPv6 frame 2002-06-13 05:10:34 +00:00
itojun bc880e4114 correect AF_INET6 handling 2002-06-13 05:09:52 +00:00
pooka fef2794715 s/splimp/splnet/ in comment 2002-06-11 11:03:55 +00:00
pooka dc325578c7 fix a few typos in comments 2002-06-11 06:00:57 +00:00
itojun c9faadc40f return EPROTONOSUPPORT if unsupported protocol is specified 2002-06-10 17:40:26 +00:00
itojun 53b229d4cb don't abuse IFF_UP 2002-06-10 17:38:31 +00:00
itojun c0a05a111d raise output errcnt 2002-06-10 17:30:16 +00:00
itojun 2d509e83c4 ENETDOWN if outer ip address is not configured.
plug mbuf leak while here.
2002-06-10 17:12:22 +00:00
itojun ccdab26a23 don't use inner address configured by SIOCSIFADDR/DSTADDR
as outer addresses; now you need to configure outer address by
SIOCS*PHYADDR ("ifconfig tunnel").  as discussed on tech-net
2002-06-10 17:07:51 +00:00
itojun 7864ca478f deprecate IFF_LINK2, !IFF_LINK0 is enough.
no need to manipulate IFF_LINK1 with IFF_LINK0.
remove reference to greconfig(8).
2002-06-09 19:17:43 +00:00
itojun 4c4b38eb0b no need for if_addrlen be 4. From: Martin Husemann <martin@duskware.de> 2002-06-09 17:59:45 +00:00
itojun c284599930 make sure to bzero sockaddr_in 2002-06-09 17:32:54 +00:00
itojun 9c95390f4a style 2002-06-09 17:22:41 +00:00
itojun a8b0c39863 don't forget splx 2002-06-09 17:18:32 +00:00
itojun 04aa2a1c65 avoid code duplicate (route lookup) 2002-06-09 17:17:15 +00:00
itojun 1a5eede494 style 2002-06-09 17:13:31 +00:00
itojun 6f21655564 support SIOCSLIFPHYADDR, SIOCDIFPHYADDR and SIOCGLIFPHYADDR, so that
we can manipulate tunnel endpoint by ifconfig(8).
2002-06-09 17:10:09 +00:00
martin aed31ed511 Change default MTU to 1476 (same value that Cisco uses).
Do not limit the MTU when set by the admin with ifconfig, per discussion
on tech-net.

This fixes PR 16761 from Jasper Wallace.
2002-06-09 09:45:39 +00:00
itojun a636441cdc reject "add" request if if_mtu is different. 2002-06-08 23:17:01 +00:00
itojun f64f00cc3f need to protect if_attachdomain() too 2002-06-08 11:58:50 +00:00
itojun ad2c23cb75 protect dom_ifattach by splnet 2002-06-08 11:54:24 +00:00
wrstuden 9e2b945a7b defparam BPF_BUFSIZE 2002-06-06 23:54:47 +00:00
itojun fc6382d167 no need to set rmx_send/recvpipe. 2002-06-04 22:11:15 +00:00
itojun b1654995d0 add a blank line 2002-06-04 10:00:24 +00:00
itojun 87fc46bce9 improve nd6_setmtu(), to warn too-small MTU on SIOCSIFMTU. sync w/kame 2002-05-30 05:06:28 +00:00
christos ab57e25224 add 2 more CCP defines. 2002-05-29 19:11:05 +00:00
itojun eee0912fd7 don't panic on invalid CONF_ACK from remote (in general, issueing panic
on remote input is bad practice)
2002-05-29 01:38:46 +00:00
itojun ae5a9e211d re-scan all ifnet after domaininit() for if_afdata initialization. 2002-05-27 13:46:45 +00:00
itojun e5aa199677 framework to add af-dependent data structure to struct ifnet.
as discussed at bsd-api-discuss.  sync w/kame
2002-05-27 02:53:49 +00:00
matt 486c7ce727 Add SIOCGIFDATA and SIOCZIFDATA ioctl's to get interface data. (the Z
variant also zeroes the counters after copying them).  In ifunit, add
support for dealing all numeric ifname by treating them as an ifindex
which is used to look up the interface.
2002-05-23 21:34:39 +00:00
itojun d64426f359 use IFT_BRIDGE 2002-05-23 06:19:39 +00:00
itojun 754f309c32 add recently-added IANA values from http://www.iana.org/assignments/smi-numbers 2002-05-23 06:18:44 +00:00
itojun 1d8b891867 sync with KAME.
- make altq_etherclassify() able to handle packets whose ethernet header
  is in a separate mbuf.  closes netbsd PR 16559
2002-05-18 22:52:44 +00:00
haya 1ce4bf6bec Bugfix: s/__NetBSD_Version/__NetBSD_Version__/. IPv4 over IEEE 1394
will work with this change.
2002-05-16 09:08:33 +00:00
matt aefe6a5034 Eliminate common. 2002-05-13 23:50:32 +00:00
matt 2d83d27dfa Eliminate more commons. 2002-05-12 20:40:11 +00:00
matt 17b32e3800 Make ppp_softc[] extern and declare in if_ppp.c 2002-05-12 20:38:15 +00:00
tron 953a52bd9e Fix memory leak which occurs after an allocation failure. 2002-05-07 09:14:20 +00:00
martin 75a925b327 "if (debug)" some log messages not signaling real errors but happening
in normal operation.
2002-04-29 16:29:29 +00:00
enami 064142edd8 Use ETHER_HDR_LEN instead of 14. 2002-04-27 02:38:47 +00:00
martin e4998611e9 Fix copyright notice. 2002-04-14 12:24:26 +00:00
martin e9e3eb14ae XXX Explicitly make this fail to compile with a proper warning if we
do not have ARP configured.

This can be caused by configurations including bridge, ppppoe or vlan but
no ethernet interfaces - which does not make sense. We should add a way
to config(8) to issue this kind of warnings.
2002-04-07 07:05:37 +00:00
christos 5c8e181780 We are not guaranteed that we have enough bytes to get a struct ip from our
mbuf. So if we receive a short packet, that looks like gif we would panic.
Reviewed by thorpej, tested by Kimmo Suominen and Andreas Wrede. Thanks for
the help in tracking this down.
2002-03-26 16:05:03 +00:00
jdolecek d1f2e630ca Fix a memory leak in bridge_ioctl_add() when the called for non-ethernet
interface.
Problem noted and fix provided by in kern/16019 by Love.
2002-03-24 16:11:23 +00:00
darrenr 726f1074d8 If someone is poll'ing to write to bpf, assume that it can always be done
and include POLLOUT and POLLWRNORM in the returned events flag set.
Derived from FreeBSD.
2002-03-23 15:55:21 +00:00
atatat 31144d9976 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.
2002-03-17 19:40:26 +00:00
simonb dbafd8c6a6 Make the 'ifnet' variable an extern and declare it in if.c. 2002-03-17 10:21:42 +00:00
itojun 496665ab2c suppress -Wunused if !INET6 2002-03-13 06:43:18 +00:00
fvdl 8a9dc4a551 Fix what looks like a merge error: olen = 0 in z_decompress, not
PPP_HDRLEN, which caused lots of 'ppp_deflate0: exceeded mru (1508 > 1504)'
messages.
2002-03-13 04:04:00 +00:00
fvdl 21275ebab6 Upgrade this generated version to be based on zlib-1.1.4 2002-03-13 03:59:35 +00:00
onoe ca3afc880f fix CRC (ICV) for WEP: ICV is 32bit not 16bit.
(change from htole16 to htole32, so no changes for little endian machine)
2002-03-12 11:07:26 +00:00
thorpej a180cee23b Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map).  Try to deal with this:

* Group all information about the backend allocator for a pool in a
  separate structure.  The pool references this structure, rather than
  the individual fields.
* Change the pool_init() API accordingly, and adjust all callers.
* Link all pools using the same backend allocator on a list.
* The backend allocator is responsible for waiting for physical memory
  to become available, but will still fail if it cannot callocate KVA
  space for the pages.  If this happens, carefully drain all pools using
  the same backend allocator, so that some KVA space can be freed.
* Change pool_reclaim() to indicate if it actually succeeded in freeing
  some pages, and use that information to make draining easier and more
  efficient.
* Get rid of PR_URGENT.  There was only one use of it, and it could be
  dealt with by the caller.

From art@openbsd.org.
2002-03-08 20:48:27 +00:00
itojun ac36f7cb2c bring in latest ALTQ from kjc. ALTQify some of the drivers. 2002-03-05 04:12:57 +00:00
martin b94047688f Avoid noise from the kernel if we have pseudo-device pppoe configured
but not used and a userland PPPoE pkg sends/receives PPPoE packets.
2002-03-04 15:15:05 +00:00
martin 493d3dde20 Add support to query the peer for DNS addreses when negotiating IPCP.
Add ioctls to retrieve the results.

While here remove a malloc()/free() of an unused buffer.
2002-03-02 16:23:42 +00:00
thorpej 759f452292 Don't call m_aux_find() to find a VLAN tag unless VLANs are configured
on the interface.
2002-02-28 19:23:03 +00:00
wiz eb16f6854f Typo fix. 2002-02-26 14:54:50 +00:00
martin a7d662b71c Clear M_BCAST and M_MCAST on outgoing mbufs.
Don't copy ttl from the inner packet to the encapsulating packet. Make
the outer ttl sysctl'able. This should close PR 14269 from Jasper Wallace
(change partly from there) and it makes traceroute work over gre tunnels.
2002-02-24 17:22:20 +00:00
martin fe97d3f7c3 Clear M_BCAST and M_MCAST flags on mbufs before passing them down to the
ethernet driver - just in case it would look at them and do the wrong
thing.
2002-02-24 17:11:53 +00:00
christos ba74a6ad5a PR/15703: Sean Boudreau: Case in route_output() where struct rtentry *rt
dereferenced after free.
2002-02-22 17:26:31 +00:00
martin 39764a5363 Use IF_IS_EMPTY and IFQ_IS_EMPTY instead of accessing queue members
directly. Noticed by Thomas Klausner.
2002-02-10 15:17:21 +00:00
martin e8aa4b2c2a Fix typo in comment. 2002-02-10 15:13:43 +00:00
thorpej 654b815d7b Add the Ethertype for 802.3x flow control packets. 2002-02-10 01:28:32 +00:00
atatat 9dd8465963 (1) Make if_index "wrap" at USHRT_MAX instead of going above it so
that other parts of the kernel won't lose gratuitously.  There are
places where it's assumed that it won't grow that large.

(2) Avoid accidental reuse of occupied slots in the ifindex2ifnet[]
table.
2002-02-09 05:56:34 +00:00
martin 727264d2c9 Avoid any non-error output for normal operations, only print those
messages if the interface is set to debug.
2002-02-01 13:50:00 +00:00
martin 6446e841ec Tweak the slow-but-persistent connection reestablishment timeout, retrying
is not realy expensive - do it once every minute.

Prevent the MTU from being set bigger than what we can handle.
2002-02-01 13:40:16 +00:00
martin 6121a90ba1 Fix copy&pasto: truncate strings copied in at *their* right length, not
some other strings length.

Found by Arne Helme.
2002-01-21 11:37:29 +00:00
jdolecek ec531589ce couple cosmetic style fixes, and drop ^L's 2002-01-18 22:39:12 +00:00
martin 301dca6ef4 Make fields in ioctl parameters that are not allowed to be negative u_ints.
Better range & sanity checking for ioctl arguments (thanks, Jaromir!)
2002-01-15 12:28:08 +00:00
kleink 67dfac7357 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.
2002-01-14 18:19:15 +00:00
kleink c095bf1b6d As discussed with Aymeric, <machine/intr.h> is always required, so don't
make its inclusion conditional.
2002-01-14 16:10:33 +00:00
aymeric 8cae495fc0 Don't include machine/types.h (my fault in previous commit)
Reported by Klaus Klein.
2002-01-14 16:04:44 +00:00