summaryrefslogtreecommitdiffstats
path: root/sys/net
Commit message (Collapse)AuthorAgeFilesLines
* Add more DLT types required by libpcap 0.8.3.bms2004-03-311-0/+52
| | | | Maintain numeric sort order.
* Update system bpf headers for libpcap 0.8.3.bms2004-03-311-1/+58
| | | | Maintain listing of DLT link types in numeric order.
* Add per-softc locking to if_tun:rwatson2004-03-291-6/+66
| | | | | | | | | | | | | | - Add tun_mtx to tun_softc. Annotate what is (and isn't) locked by it. - Lock down tun_flags, tun_pid. - In the output path, cache the value of tun_flags so it's consistent when processing a particular packet rather than re-reading the field. - In general, use unlocked reads for debugging. - Annotate a couple of places where additional unlocked reads may be possible. - Annotate that tun_pid is used as a bug in tunopen(). if_tun is now largely MPSAFE, although questions remain about some of the cdevsw fields and how they are synchronized.
* Lock down if_tun global variables using a new mutex, tunmtx. As withrwatson2004-03-291-11/+31
| | | | | | other pseudo-interfaces, break out tear-down of a softc into a separate tun_destroy() function, and invoke that from the module unloader. Hold tunmtx across manipulations of the global softc list.
* Modify BPF descriptor assertions to assert Giant when a BPF descriptorrwatson2004-03-291-1/+4
| | | | lock is asserted and running non-MPSAFE.
* Lock down global variables in if_gre:rwatson2004-03-222-8/+34
| | | | | | | | | | | | | | - Add gre_mtx to protect global softc list. - Hold gre_mtx over various list operations (insert, delete). - Centralize if_gre interface teardown in gre_destroy(), and call this from modevent unload and gre_clone_destroy(). - Export gre_mtx to ip_gre.c, which walks the gre list to look up gre interfaces during encapsulation. Add a wonking comment on how we need some sort of drain/reference count mechanism to keep gre references alive while in use and simultaneous destroy. This commit does not lockdown softc data, which follows in a future commit.
* Lock down global variables in if_gif:rwatson2004-03-221-9/+50
| | | | | | | | | | | | | | - Add gif_mtx, which protects globals. - Hold gif_mtx around manipulation of gif_softc_list. - Abstract gif destruction code into gif_destroy(), which tears down a softc after it's been removed from the global list by either module unload or clone destroy. - Lock gif_called, even though we know gif_called is broken with reentrant network processing. - Document an event ordering problem in gif_set_tunnel() that will need to be fixed. gif_softc fields not locked down in this commit.
* Move "called", a static function variable used to detect recursiverwatson2004-03-221-4/+11
| | | | | | | processing with gif interfaces, to a global variable named "gif_called". Add an annotation that this approach will not work with a reentrant network stack, and that we should instead use packet tags to detect excessive recursive processing.
* MAC addresses are 8 bits in ARCNET. Adjust bcopy().mdodd2004-03-221-2/+2
|
* - Correct variable name.mdodd2004-03-211-2/+2
| | | | | | - Correct unnecessary use of htons(). Reported by: many.
* Handle AF_ARP.mdodd2004-03-211-0/+27
|
* Correct a bug introduced with the recent clone API chang: when the clonerwatson2004-03-181-0/+1
| | | | | event handler for if_tap fails, make sure to clean up clone state to prevent a clone memory leak.
* sAdd a comment indicating why there continues to be a race condition inrwatson2004-03-181-5/+14
| | | | | | | | | | | | | | | | | | the tap driver, even with Giant over the cdev operation vector, due to a non-atomic test-and-set of the si_drv1 field in the dev_t. This bug exists with Giant under high memory pressure, as malloc() may sleep in tapcreate(), but is less likely to occur. The resolution will probably be to cover si_drv1 using the global tapmtx since no softc is available, but I need to think about this problem more generally across a range of drivers using si_drv1 in combination with SI_CHEAPCLONE to defer expensive allocation to open(). Correct what appears to be a bug in the original if_tap implementation, in which tapopen() will panic if a tap device instance is opened more than once due to an incorrect assertion -- only triggered if INVARIANTS is compiled in (i.e., when built into a kernel). Return EBUSY instead. Expand mtx_lock() coverage using tp->tap_mtx to include tp->ether_addr.
* Remove tun_proc; replace with tun_pid. tun_proc pointer may be stalerwatson2004-03-171-7/+14
| | | | | | | | as the process that opens tun_softc can exit before the file descriptor is closed. Taiwan experience provided by: keichii Crashing breakers provided by: Chia-liang Kao <clkao@clkao.org>
* Add tap_mtx to tap_softc in order to protect per-softc variablesrwatson2004-03-172-2/+44
| | | | | | | (tap_pid, tap_flags). if_tap should now be entirely MPSAFE. Committed from: Bamboo house by ocean in Taiwan Tropical paradise provided by: Chia-liang Kao <clkao@clkao.org>
* Lock down global variables in if_tap (primarily, the tap softc list);rwatson2004-03-151-3/+28
| | | | | | | | | | | | | | | add tapmtx, which protects globale variables. Notes: - The EBUSY check in MOD_UNLOAD may be subject to a race. Moving the event handler unregister inside the mutex grab may prevent that race. - Locking of global variables safely is now possible because tapclones is only modified when the module is loading or unloading, thanks to phk's recent chang to clone_setup(). - softc locking to follow.
* Announce ethernet MAC addresss in ether_ifattach().mdodd2004-03-141-0/+3
|
* Handle AF_ARP in *_output()mdodd2004-03-143-0/+81
| | | | Obtained from: NetBSD
* Compare spppq to NULL instead of using spppq as a boolean.rwatson2004-03-141-2/+2
|
* Constify interactive_ports, as its value is static, and therefore doesn'trwatson2004-03-131-1/+1
| | | | require synchronization.
* Remove stale (unused) unit variables from if_tun and if_tap softc's.rwatson2004-03-132-3/+0
|
* Constify iso88025_broadcastaddr to make it clear no explicitrwatson2004-03-131-3/+3
| | | | synchronization is required.
* Don't allow interfaces to be renamed to the empty string.brooks2004-03-131-2/+4
| | | | | | While I'm here, errors aren't bools. Pointed out by: hmp
* Remove if_withname. It came in with the KAME import, but never gotbrooks2004-03-132-27/+0
| | | | | | | | used. Should someone need its functionality, it's a really expensive implementation of: ifnet_byindex(sdl->sdl_index) Reviewed by: bde, ume
* Add clone_setup() function rather than rely on lazy initialization.phk2004-03-112-0/+2
| | | | Requested by: rwatson
* Fix handling of tap/vmnet flag in relation to cloning and properly enforcephk2004-03-101-10/+8
| | | | | | largest supported unit number for this device driver. Reported by: Kaho Toshikazu <kaho@easy.es.tuat.ac.jp>
* Const-poison ethernet and FDDI broadcast address constants, as theyrwatson2004-03-092-2/+2
| | | | are accessed read-only.
* Introduce stf_mtx to protect global softc list in if_stf. Addrwatson2004-03-091-8/+39
| | | | | | | | | | | | stf_destroy() to handle the common softc destruction path for the two destruction sources: interface cloning destroy, and module unload. NOTE: sc_ro, the cached route for stf conversion, is not synchronized against concurrent access in this change, that will follow in a future change. Reviewed by: pjd
* Introduce faith_mtx to protect the if_faith global softc list.rwatson2004-03-091-7/+27
| | | | | | Push if_faith softc destruction logic into faith_destroy() so that it can be called after softc list removal in both the clone destroy and module unload paths.
* Introduce lo_mtx to protect the global loopback softc list. I'm notrwatson2004-03-091-1/+7
| | | | | | | | really sure why we have a softc list for if_loop, given that it can't be unloaded, but that's an issue to revisit in the future as corrupting the softc list would still cause panics. Reviewed by: benno
* Introduce disc_mtx to protect the global softc list in if_disc.rwatson2004-03-091-8/+29
| | | | | | | | | | | Since there are two destroy paths for if_disc interfaces -- module unload and cloan interface destroy, create a new utility function disc_destroy(), which is callded on a softc after it has been removed from the global softc list; the cloaner and module unload entry paths will both remove it before calling disc_destroy(). Reviewed by: pjd
* Const-poison ip_stf_ttl to make it clear that the variable is notrwatson2004-03-071-1/+1
| | | | modified at run-time.
* Two minor follow-ups on the MT_TAG removal:mlaier2004-03-021-3/+0
| | | | | | | | ifp is now passed explicitly to ether_demux; no need to look it up again. Make mtag a global var in ip_input. Noticed by: rwatson Approved by: bms(mentor)
* Rename dup_sockaddr() to sodupsockaddr() for consistency with otherrwatson2004-03-011-2/+3
| | | | | | | | | | | | functions in kern_socket.c. Rename the "canwait" field to "mflags" and pass M_WAITOK and M_NOWAIT in from the caller context rather than "1" or "0". Correct mflags pass into mac_init_socket() from previous commit to not include M_ZERO. Submitted by: sam
* Define BPFD_LOCK_ASSERT() to assert the BPF descriptor lock.rwatson2004-02-291-0/+1
| | | | | | | | Assert the BPF descriptor lock in the MAC calls referencing live BPF descriptors. Obtained from: TrustedBSD Project Sponsored by: DARPA, McAfee Research
* Grab Giant after MAC processing on outgoing packets being sent viarwatson2004-02-291-1/+3
| | | | | | | | BPF. Grab the BPF descriptor lock before entering MAC since the MAC Framework references BPF descriptor fields, including the BPF descriptor label. Submitted by: sam
* Bring eventhandler callbacks for pf.mlaier2004-02-262-0/+20
| | | | | | | | This enables pf to track dynamic address changes on interfaces (dailup) with the "on (<ifname>)"-syntax. This also brings hooks in anticipation of tracking cloned interfaces, which will be in future versions of pf. Approved by: bms(mentor)
* Tweak existing header and other build infrastructure to be able to buildmlaier2004-02-262-0/+3
| | | | | | | pf/pflog/pfsync as modules. Do not list them in NOTES or modules/Makefile (i.e. do not connect it to any (automatic) builds - yet). Approved by: bms(mentor)
* Re-remove MT_TAGs. The problems with dummynet have been fixed now.mlaier2004-02-252-23/+8
| | | | | Tested by: -current, bms(mentor), me Approved by: bms(mentor), sam
* Don't set d_flags twice. The second setting clobbered D_NOGIANT.bde2004-02-242-4/+2
|
* Device megapatch 4/6:phk2004-02-214-0/+8
| | | | | | | | Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
* Device megapatch 2/6:phk2004-02-214-285/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a couple of functions for pseudodrivers to use for implementing cloning in a manner we will be able to lock down (shortly). Basically what happens is that pseudo drivers get a way to ask for "give me the dev_t with this unit number" or alternatively "give me a dev_t with the lowest guaranteed free unit number" (there is unfortunately a lot of non-POLA in the exact numeric value of this number, just live with it for now) Managing the unit number space this way removes the need to use rman(9) to do so in the drivers this greatly simplifies the code in the drivers because even using rman(9) they still needed to manage their dev_t's anyway. I have taken the if_tun, if_tap, snp and nmdm drivers through the mill, partly because they (ab)used makedev(), but mostly because together they represent three different problems for device-cloning: if_tun and snp is the plain case: just give me a device. if_tap has two kinds of devices, with a flag for device type. nmdm has paired devices (ala pty) can you can clone either of them.
* Device megapatch 1/6:phk2004-02-211-3/+1
| | | | | | | Free approx 86 major numbers with a mostly automatically generated patch. A number of strategic drivers have been left behind by caution, and a few because they still (ab)use their major number.
* Minor beautifications related to style(9) and code consistency.yar2004-02-211-5/+5
| | | | No functional changes.
* Improve the SIOCSIFCAP handler a bit:yar2004-02-211-1/+5
| | | | | | | - allow for ifp->if_ioctl being NULL, as the rest of ifioctl() does; - give the interface driver a chance to report a error to the caller; - don't forget to update ifp->if_lastchange upon successful modification of interface operation parameters.
* Backout MT_TAG removal (i.e. bring back MT_TAGs) for now, as dummynet ismlaier2004-02-182-7/+24
| | | | | | not working properly with the patch in place. Approved by: bms(mentor)
* Random style fixes and a comment update. No functional changes.des2004-02-161-4/+4
|
* Return EACCES rather than ENOBUFS if ipfw blocks a packet on thedwmalone2004-02-151-1/+1
| | | | | | | | | way out at layer 2. PR: 62385 Submitted by: Oleg Bulyzhin <oleg@rinet.ru> Approved by: luigi MFC after: 1 week
* This set of changes eliminates the use of MT_TAG "pseudo mbufs", replacingmlaier2004-02-132-24/+7
| | | | | | | | | | | them mostly with packet tags (one case is handled by using an mbuf flag since the linkage between "caller" and "callee" is direct and there's no need to incur the overhead of a packet tag). This is (mostly) work from: sam Silence from: -arch Approved by: bms(mentor), sam, rwatson
* Initial import of RFC 2385 (TCP-MD5) digest support.bms2004-02-111-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first of two commits; bringing in the kernel support first. This can be enabled by compiling a kernel with options TCP_SIGNATURE and FAST_IPSEC. For the uninitiated, this is a TCP option which provides for a means of authenticating TCP sessions which came into being before IPSEC. It is still relevant today, however, as it is used by many commercial router vendors, particularly with BGP, and as such has become a requirement for interconnect at many major Internet points of presence. Several parts of the TCP and IP headers, including the segment payload, are digested with MD5, including a shared secret. The PF_KEY interface is used to manage the secrets using security associations in the SADB. There is a limitation here in that as there is no way to map a TCP flow per-port back to an SPI without polluting tcpcb or using the SPD; the code to do the latter is unstable at this time. Therefore this code only supports per-host keying granularity. Whilst FAST_IPSEC is mutually exclusive with KAME IPSEC (and thus IPv6), TCP_SIGNATURE applies only to IPv4. For the vast majority of prospective users of this feature, this will not pose any problem. This implementation is output-only; that is, the option is honoured when responding to a host initiating a TCP session, but no effort is made [yet] to authenticate inbound traffic. This is, however, sufficient to interwork with Cisco equipment. Tested with a Cisco 2501 running IOS 12.0(27), and Quagga 0.96.4 with local patches. Patches for tcpdump to validate TCP-MD5 sessions are also available from me upon request. Sponsored by: sentex.net
OpenPOWER on IntegriCloud