summaryrefslogtreecommitdiffstats
path: root/sys/net
Commit message (Collapse)AuthorAgeFilesLines
* Use TAILQ_FOREACH instead of poking around in the guts of the listbrooks2006-07-151-8/+5
| | | | macros.
* Drop a pointless cast of ifp->if_softc to (struct tap_softc *).brooks2006-07-151-1/+1
|
* Catch up with the revised network interface cloning which takes an optionalthompsa2006-07-101-2/+2
| | | | opaque parameter that can specify configuration parameters.
* Revise network interface cloning to take an optional opaquesam2006-07-0912-35/+73
| | | | | | | | | parameter that can specify configuration parameters: o rev cloner api's to add optional parameter block o add SIOCCREATE2 that accepts parameter data o rev vlan support to use new api (maintain old code) Reviewed by: arch@
* Adjust rt_(set|get)metrics() to do kernel <-> userland timebase conversion.oleg2006-07-061-2/+7
| | | | | | We need it since kernel timebase has changed (time_second -> time_uptime). Approved by: glebius (mentor)
* Fix a braino in the last revision, enc_clone_destroy needs return void insteadthompsa2006-07-041-12/+3
| | | | | | | of int. The clone system will ensure that our first interface is not destroyed so we dont need the extra checking anyway. Tested by: Scott Ullrich
* Adjust descriptor locking to tell the kqueue subsystem that our descriptor iscsjp2006-07-031-3/+1
| | | | | | | | | | | | | | already locked. The reason to do this is to avoid two lock+unlock operations in a row. We need the lock here to serialize access to bd_pid for stats collection purposes. Drop the locks all together on detach, as they will be picked up by knlist_remove. This should fix a failed locking assertion when kqueue is being used with bpf descriptors. Discussed with: jmg
* There is a consensus that ifaddr.ifa_addr should never be NULL,yar2006-06-294-29/+20
| | | | | | | | | | except in places dealing with ifaddr creation or destruction; and in such special places incomplete ifaddrs should never be linked to system-wide data structures. Therefore we can eliminate all the superfluous checks for "ifa->ifa_addr != NULL" and get ready to the system crashing honestly instead of masking possible bugs. Suggested by: glebius, jhb, ru
* Use TAILQ_FOREACH in the __FreeBSD__ case, too.yar2006-06-291-2/+1
| | | | Funnily enough, rev. 1.15 changed the __Net and __Open cases only.
* Use TAILQ_FOREACH.yar2006-06-291-4/+1
|
* Use the nifty TAILQ_FOREACH.yar2006-06-291-2/+1
|
* Detach the interface first, do vlan_unconfig() then.yar2006-06-291-9/+3
| | | | | | | | | | | | | | | Previously, another thread could get a pointer to the interface by scanning the system-wide list and sleep on the global vlan mutex held by vlan_unconfig(). The interface was gone by the time the other thread woke up. In order to be able to call vlan_unconfig() on a detached interface, remove the purely cosmetic bzero'ing of IF_LLADDR from the function because a detached interface has no addresses. Noticed by: a stress-testing script by maxim Reviewed by: glebius
* Remove a few unused things.yar2006-06-291-12/+8
| | | | Fix some style and consistency points.
* Reduce unneeded code duplication.yar2006-06-291-12/+1
|
* A small race existed where the lock was dropped between when encif wasthompsa2006-06-281-24/+20
| | | | | | | | | | | | tested and then set. [1] Reorganise things to eliminate this, we now ensure that enc0 can not be destroyed which as the benefit of no longer needing to lock in ipsec_filter and ipsec_bpf. The cloner will create one interface during the init so we can guarantee that encif will be valid before any SPD entries are added to ipsec. Spotted by: glebius [1]
* Simplify ipsec_bpf by using bpf_mtap2().thompsa2006-06-271-9/+2
|
* Add a pseudo interface for packet filtering IPSec connections before or afterthompsa2006-06-262-0/+324
| | | | | | | | | | | encryption. There are two functions, a bpf tap which has a basic header with the SPI number which our current tcpdump knows how to display, and handoff to pfil(9) for packet filtering. Obtained from: OpenBSD Based on: kern/94829 No objections: arch, net MFC after: 1 month
* Fix the VLAN_ARRAY case, mostly regarding improper use of atomic(9)yar2006-06-211-30/+16
| | | | | in place of conventional rw locking. Alas, atomic(9) can't buy us lockless operation so easily.
* Track interface department events and detach vlans fromyar2006-06-211-8/+76
| | | | | | | | | departing trunk so that we don't get into trouble later by dereferencing a stale pointer to dead trunk's things. Prodded by: oleg Sponsored by: RiNet (Cronyx Plus LLC) MFC after: 1 week
* - First initialize ifnet, and then insert it into globalglebius2006-06-211-14/+16
| | | | | | | | | list. - First remove from global list, then start destroying. PR: kern/97679 Submitted by: Alex Lyashkov <shadow itt.net.ru> Reviewed by: rwatson, brooks
* Allow gif interfaces to be added as span ports, the user may want to send athompsa2006-06-201-0/+1
| | | | copy of all packets to the other side of the world.
* Import interface groups from OpenBSD. This allows to group interfaces inmlaier2006-06-194-0/+321
| | | | | | | | order to - for example - apply firewall rules to a whole group of interfaces. This is required for importing pf from OpenBSD 3.9 Obtained from: OpenBSD (with changes) Discussed on: -net (back in April)
* Fix spelling mistake in comment.thompsa2006-06-191-1/+1
|
* Since we are doing some bpf(4) clean up, change a couple of function prototypescsjp2006-06-151-142/+48
| | | | | to be consistent. Also, ANSI'fy function definitions. There is no functional change here.
* If bpf(4) has not been compiled into the kernel, initialize the bpf interfacecsjp2006-06-142-1/+6
| | | | | | | | pointer to a zeroed, statically allocated bpf_if structure. This way the LIST_EMPTY() macro will always return true. This allows us to remove the additional unconditional memory reference for each packet in the fast path. Discussed with: sam
* Use bit operations to get a locally administered address rather than using athompsa2006-06-121-5/+4
| | | | hardcoded OUI code.
* Fix KASSERT conditions in if_deregister_com_alloc().fjoe2006-06-111-2/+2
|
* Allow bridge and carp to play nicely together by returning the packet if itsthompsa2006-06-081-2/+16
| | | | | | | destined for a carp interface. Obtained from: OpenBSD MFC after: 2 weeks
* Assuming the interface has an address of x.x.x.195, a mask ofqingli2006-06-051-0/+6
| | | | | | | | | | | | | | | | | | | | | 255.255.255.0, and a default route with gateway x.x.x.1. Now if the address mask is changed to something more specific, e.g., 255.255.255.128, then after the mask change the default gateway is no longer reachable. Since the default route is still present in the routing table, when the output code tries to resolve the address of the default gateway in function rt_check(), again, the default route will be returned by rtalloc1(). Because the lock is currently held on the rtentry structure, one more attempt to hold the lock will trigger a crash due to "lock recursed on non-recursive mutex ..." This is a general problem. The fix checks for the above condition so that an existing route entry is not mistaken for a new cloned route. Approriately, an ENETUNREACH error is returned back to the caller Approved by: andre
* Back out previous two commits, this caused some problems in the namespacecsjp2006-06-031-7/+2
| | | | | | | | resulting in some build failures. Instead, to fix the problem of bpf not being present, check the pointer before dereferencing it. This is a temporary bandaid until we can decide on how we want to handle the bpf code not being present. This will be fixed shortly.
* Temporarily include files so that our macro checks do something useful.csjp2006-06-031-0/+3
|
* Make sure we don't try to dereference the the if_bpf pointer when bpf hascsjp2006-06-031-1/+5
| | | | | | not been compiled into the the kernel. Submitted by: benno
* add missed calls to bpf_peers_presentsam2006-06-022-3/+3
|
* Fix the following bpf(4) race condition which can result in a panic:csjp2006-06-0210-102/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (1) bpf peer attaches to interface netif0 (2) Packet is received by netif0 (3) ifp->if_bpf pointer is checked and handed off to bpf (4) bpf peer detaches from netif0 resulting in ifp->if_bpf being initialized to NULL. (5) ifp->if_bpf is dereferenced by bpf machinery (6) Kaboom This race condition likely explains the various different kernel panics reported around sending SIGINT to tcpdump or dhclient processes. But really this race can result in kernel panics anywhere you have frequent bpf attach and detach operations with high packet per second load. Summary of changes: - Remove the bpf interface's "driverp" member - When we attach bpf interfaces, we now set the ifp->if_bpf member to the bpf interface structure. Once this is done, ifp->if_bpf should never be NULL. [1] - Introduce bpf_peers_present function, an inline operation which will do a lockless read bpf peer list associated with the interface. It should be noted that the bpf code will pickup the bpf_interface lock before adding or removing bpf peers. This should serialize the access to the bpf descriptor list, removing the race. - Expose the bpf_if structure in bpf.h so that the bpf_peers_present function can use it. This also removes the struct bpf_if; hack that was there. - Adjust all consumers of the raw if_bpf structure to use bpf_peers_present Now what happens is: (1) Packet is received by netif0 (2) Check to see if bpf descriptor list is empty (3) Pickup the bpf interface lock (4) Hand packet off to process From the attach/detach side: (1) Pickup the bpf interface lock (2) Add/remove from bpf descriptor list Now that we are storing the bpf interface structure with the ifnet, there is is no need to walk the bpf interface list to locate the correct bpf interface. We now simply look up the interface, and initialize the pointer. This has a nice side effect of changing a bpf interface attach operation from O(N) (where N is the number of bpf interfaces), to O(1). [1] From now on, we can no longer check ifp->if_bpf to tell us whether or not we have any bpf peers that might be interested in receiving packets. In collaboration with: sam@ MFC after: 1 month
* Fix gif_output() so that GIF_UNLOCK() is performed only in caseglebius2006-06-021-2/+2
| | | | | | | we have locked the softc. PR: kern/98298 Submitted by: Eugene Grosbein
* raw_disconnect() now disconnects but does not detach the raw pcb. As arwatson2006-06-022-3/+2
| | | | | | | | | | result, raw_uabort() now needs to call raw_detach() directly. As raw_uabort() is never called, and raw_disconnect() is probably not ever actually called in practice, this is likely not a functional change, but improves congruence between protocols, and avoids a NULL raw cb pointer after disconnect, which could result in a panic. MFC after: 1 month
* - Add definition for IFM_10G_CX4.glebius2006-06-021-0/+4
| | | | | | - Put IFM_10G_CX4 and IFM_10G_SR into IFMEDIA_BAUDRATE array. Requested by: Jack Vogel <jfvogel gmail.com>
* Announce all interfaces to devd on attach/detach. This adds a new devctlthompsa2006-06-011-0/+2
| | | | | | | | | | | | | | notification so all interfaces including pseudo are reported. When netif creates the clones at startup devctl_disable has not been turned off yet so the interfaces will not be initialised twice, enforce this by adding an explicit order between rc.d/netif and rc.d/devd. This change allows actions to taken in userland when an interface is cloned and the pseudo interface will be automatically configured if a ifconfig_<int>="" line exists in rc.conf. Reviewed by: brooks No objections on: net
* Revert the (int *) -> (intptr_t *) conversion done as part of rev. 1.59marius2006-05-301-10/+10
| | | | | | | | | | | for IOCTLs where casting data to intptr_t * isn't the right thing to do as _IO() isn't used for them but _IOR(..., int)/_IOW(..., int) are (i.e. for all IOCTLs except VMIO_SIOCSIFFLAGS), fixing tap(4) on big-endian LP64 machines. PR: sparc64/98084 OK'ed by: emax MFC after: 1 week
* Fix -Wundef warnings.ru2006-05-301-7/+7
|
* Avoid unwanted sign extension of indexed byte load in bpf code.dwmalone2006-05-281-2/+2
| | | | | | | PR: 89748 Submitted by: Guy Harris <guy@alum.mit.edu> Obtained from: NetBSD via OpenBSD MFC after: 2 weeks
* Do not call knlist_destroy() in tapclose(). Instead call it when device isemax2006-05-171-4/+3
| | | | | | | | | actually destroyed. Also move call to knlist_init() into tapcreate(). This should fix panic described in kern/95357. PR: kern/95357 No response from: freebsd-current@ MFC after: 3 days
* Fix style(9) nits, whitespace and parentheses.thompsa2006-05-161-61/+52
|
* The current routing code allows insertion of indirect routes that haveqingli2006-05-161-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | gateways which are unreachable except through the default router. For example, assuming there is a default route configured, and inserting a route "route add 64.102.54.0/24 60.80.1.1" is currently allowed even when 60.80.1.1 is only reachable through the default route. However, an error is thrown when this route is utilized, say, "ping 64.102.54.1" will return an error This type of route insertion should be disallowed becasue: 1) Let's say that somehow our code allowed this packet to flow to the default router, and the default router knows the next hop is 60.80.1.1, then the question is why bother inserting this route in the 1st place, just simply use the default route. 2) Since we're not talking about source routing here, the default router could very well choose a different path than using 60.80.1.1 for the next hop, again it defeats the purpose of adding this route. Reviewed by: ru, gnn, bz Approved by: andre
* Recalculate IP checksum after running pfil hooks.dhartmei2006-05-151-2/+17
| | | | | Reviewed by: thompsa Tested by: Adam McDougall <mcdouga9@egr.msu.edu>
* Remove ip6fw. Since ipfw has full functional IPv6 support now and - inmlaier2006-05-121-2/+2
| | | | contrast to ip6fw - is properly lockes, it is time to retire ip6fw.
* Remove various bits of conditional Alpha code and fixup a few comments.jhb2006-05-122-6/+5
|
* Correct test for fragmented packet.hsu2006-05-111-1/+1
|
* Pickup locks for the BPF interface structure. It's quite possible thatcsjp2006-05-071-0/+2
| | | | | | | bpf(4) descriptors can be added and removed on this interface while we are processing stats. MFC after: 2 weeks
* In rtrequest and rtinit check for sa_len != 0 for the givenbz2006-05-041-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | destination. These checks are needed so we do not install a route looking like this: (0) 192.0.2.200 UH tun0 => When removing this route the kernel will start to walk the address space which looks like a hang on 64bit platforms because it'll take ages while on 32bit you should see a panic when kernel debugging options are turned on. The problem is in rtrequest1: if (netmask) { rt_maskedcopy(dst, ndst, netmask); } else bcopy(dst, ndst, dst->sa_len); In both cases the len might be 0 if the application forgot to set it. If so ndst will be all-zero leading to above mentioned strange routes. This is an application error but we must not fail/hang/panic because of this. Looks ok: gnn No objections: net@ (silence) MFC after: 8 weeks
OpenPOWER on IntegriCloud