aboutsummaryrefslogtreecommitdiff
path: root/sys/net
Commit message (Collapse)AuthorAgeFilesLines
* Add the module version to fix the loading with if_bridge.Andrew Thompson2006-08-121-0/+1
| | | | | | | | Reported by: keramida Tested by: keramida Notes: svn path=/head/; revision=161255
* Optionally pad outgoing frames to the minimum of 60 bytes (excl. FCS)Yaroslav Tykhiy2006-08-111-0/+33
| | | | | | | | | | | | | before tagging them. This can help to work around brain-damage in some switches that fail to pad a frame after untagging it if its length drops below the minimum. This option is blessed by IEEE Std 802.1Q (2003 Ed.), paragraph C.4.4.3.b. It's controlled by sysctl net.link.vlan.soft_pad. Idea by: az MFC after: 1 week Notes: svn path=/head/; revision=161210
* Since bpf_allocbufs() uses malloc() with M_WAITOK, don't check returnRobert Watson2006-08-091-16/+9
| | | | | | | | | | values for NULL or return an error state. Assert that all three bpf buffer pointers are NULL before starting. MFC after: 1 week Notes: svn path=/head/; revision=161124
* Add kqueue support to if_tun. Loosely based on if_tap changes.Robert Watson2006-08-081-1/+119
| | | | | | | | | | | | | Two almost identical patches based on the if_tap work were submitted via GNATS; I started out with the patch in 100796 from David Gilbert, but could have easily started with the patch from Vilmos Nebehaj which I found only later. MFC after: 1 week PR: 93976, 100796 Notes: svn path=/head/; revision=161103
* With exception of the if_name() macro, all definitions in net_osdep.hBrooks Davis2006-08-046-344/+1
| | | | | | | | | | | were unused or already in if_var.h so add if_name() to if_var.h and remove net_osdep.h along with all references to it. Longer term we may want to kill off if_name() entierly since all modern BSDs have if_xname variables rendering it unnecessicary. Notes: svn path=/head/; revision=160981
* Should vlan_input() ever be called with ifp pointing to a non-EthernetYaroslav Tykhiy2006-08-031-4/+5
| | | | | | | | | | | | | | | | interface, do not just assign -1 to tag because it breaks the logic of the code to follow. The better way is to handle this case as an unsupported protocol and return unless INVARIANTS is in effect and we can panic. Panic is good there because the scenario can happen only because of a coding error elsewhere. We also should show the interface name in the panic message for easier debugging of the problem, should it ever emerge. Submitted by: qingli (initially) Notes: svn path=/head/; revision=160951
* Back out rev. 1.107 because it introduced as many problemsYaroslav Tykhiy2006-08-031-9/+15
| | | | | | | | | | | | | | | | | as it tried to solve: - it smuggled hidden 802.1q details into otherwise protocol-neutral code; - it put an important code consistency check under DEBUG, which was never defined by anyone but a developer hacking this file for the moment; - lastly, the former bcopy() call had been correct as long as the "dead" code was there. (A new version of the fix for tag of -1 to come in the next commit.) Agreed by: qingli Notes: svn path=/head/; revision=160950
* - Use the new bridgestp callback to once again flush our bridge routes when anAndrew Thompson2006-08-021-2/+38
| | | | | | | | interface is disabled. - Log port changes to syslog, defaulting to off Notes: svn path=/head/; revision=160902
* Tell bridgestp that we are about to free the memory so it can cleanup.Andrew Thompson2006-08-021-0/+3
| | | | Notes: svn path=/head/; revision=160901
* Fix style in the last commit, the variable declaration goes at the top of theAndrew Thompson2006-08-021-1/+2
| | | | | | | function. Notes: svn path=/head/; revision=160900
* Add a callback so we can notify the parent bridge that a port state change hasAndrew Thompson2006-08-022-4/+43
| | | | | | | | occured, we need to do this from a taskqueue to avoid a LOR with the if_bridge mutex. Notes: svn path=/head/; revision=160899
* Be sure to disable the port when removing it from STP.Andrew Thompson2006-08-021-0/+2
| | | | Notes: svn path=/head/; revision=160897
* In vlan_input(), if the network interface does not perform h/w basedQing Li2006-08-011-15/+9
| | | | | | | | | | | | | | | | vlan tag processing, the code will use bcopy() to remove the vlan tag field but the code copies 2 bytes too many, which essentially overwrites the protocol type field. Also, a tag value of -1 is generated for unrecognized interface type, which would cause an invalid memory access in the vlans[] array. In addition, removed a line of dead code and its associated comments. Reviewed by: sam Notes: svn path=/head/; revision=160884
* Add some statistics that are needed to support RFC4188 as part of the SoC2006Andrew Thompson2006-07-314-1/+161
| | | | | | | | | work on a bridge monitoring module for BSNMP. Submitted by: shteryana (SoC 2006) Notes: svn path=/head/; revision=160867
* Remove the dependency of bridgestp.h on if_bridgevar.h by moving a couple ofAndrew Thompson2006-07-274-52/+50
| | | | | | | private structures to if_bridge.c. Notes: svn path=/head/; revision=160769
* Fixing compilation bustage: net/if_bridgevar.h depends on net/bridgestp.h.Tai-hwa Liang2006-07-272-0/+2
| | | | Notes: svn path=/head/; revision=160735
* bridgestp is now a seperate module.Andrew Thompson2006-07-261-0/+1
| | | | Notes: svn path=/head/; revision=160730
* Remove stp variables that are already initialised in bstp_attach().Andrew Thompson2006-07-261-5/+0
| | | | Notes: svn path=/head/; revision=160726
* /tmp/cvsuusTrcAndrew Thompson2006-07-264-723/+953
| | | | Notes: svn path=/head/; revision=160703
* Remove variables that are overridden by ether_ifattach(). This clears up anyAndrew Thompson2006-07-261-3/+0
| | | | | | | confusion especially as *if_output was pointed to a different function. Notes: svn path=/head/; revision=160702
* add support for 802.11 packet injection via bpfSam Leffler2006-07-261-0/+31
| | | | | | | | | Together with: Andrea Bittau <a.bittau@cs.ucl.ac.uk> Reviewed by: arch@ MFC after: 1 month Notes: svn path=/head/; revision=160690
* Rather than calling mircotime() in catchpacket(), make catchpacket()David Malone2006-07-241-6/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | take a timeval indicating when the packet was captured. Move microtime() to the calling functions and grab the timestamp as soon as we know that we're going to call catchpacket at least once. This means that we call microtime() once per matched packet, as opposed to once per matched packet per bpf listener. It also means that we return the same timestamp to all bpf listeners, rather than slightly different ones. It would be more accurate to call microtime() even earlier for all packets, as you have to grab (1+#listener) locks before you can determine if the packet will be logged. You could always grab a timestamp before the locks, but microtime() can be costly, so this didn't seem like a good idea. (I guess most ethernet interfaces will have a bpf listener these days because of dhclient. That means that we could be doing two bpf locks on most packets going through the interface.) PR: 71711 Notes: svn path=/head/; revision=160620
* Change semantics of socket close and detach. Add a new protocol switchRobert Watson2006-07-212-1/+19
| | | | | | | | | | | | | | | | | | | | | | function, pru_close, to notify protocols that the file descriptor or other consumer of a socket is closing the socket. pru_abort is now a notification of close also, and no longer detaches. pru_detach is no longer used to notify of close, and will be called during socket tear-down by sofree() when all references to a socket evaporate after an earlier call to abort or close the socket. This means detach is now an unconditional teardown of a socket, whereas previously sockets could persist after detach of the protocol retained a reference. This faciliates sharing mutexes between layers of the network stack as the mutex is required during the checking and removal of references at the head of sofree(). With this change, pru_detach can now assume that the mutex will no longer be required by the socket layer after completion, whereas before this was not necessarily true. Reviewed by: gnn Notes: svn path=/head/; revision=160549
* Use TAILQ_FOREACH instead of poking around in the guts of the listBrooks Davis2006-07-151-8/+5
| | | | | | | macros. Notes: svn path=/head/; revision=160377
* Drop a pointless cast of ifp->if_softc to (struct tap_softc *).Brooks Davis2006-07-151-1/+1
| | | | Notes: svn path=/head/; revision=160376
* Catch up with the revised network interface cloning which takes an optionalAndrew Thompson2006-07-101-2/+2
| | | | | | | opaque parameter that can specify configuration parameters. Notes: svn path=/head/; revision=160233
* Revise network interface cloning to take an optional opaqueSam Leffler2006-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@ Notes: svn path=/head/; revision=160195
* Adjust rt_(set|get)metrics() to do kernel <-> userland timebase conversion.Oleg Bulyzhin2006-07-061-2/+7
| | | | | | | | | We need it since kernel timebase has changed (time_second -> time_uptime). Approved by: glebius (mentor) Notes: svn path=/head/; revision=160124
* Fix a braino in the last revision, enc_clone_destroy needs return void insteadAndrew Thompson2006-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 Notes: svn path=/head/; revision=160099
* Adjust descriptor locking to tell the kqueue subsystem that our descriptor isChristian S.J. Peron2006-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 Notes: svn path=/head/; revision=160087
* There is a consensus that ifaddr.ifa_addr should never be NULL,Yaroslav Tykhiy2006-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 Notes: svn path=/head/; revision=160038
* Use TAILQ_FOREACH in the __FreeBSD__ case, too.Yaroslav Tykhiy2006-06-291-2/+1
| | | | | | | Funnily enough, rev. 1.15 changed the __Net and __Open cases only. Notes: svn path=/head/; revision=160035
* Use TAILQ_FOREACH.Yaroslav Tykhiy2006-06-291-4/+1
| | | | Notes: svn path=/head/; revision=160034
* Use the nifty TAILQ_FOREACH.Yaroslav Tykhiy2006-06-291-2/+1
| | | | Notes: svn path=/head/; revision=160033
* Detach the interface first, do vlan_unconfig() then.Yaroslav Tykhiy2006-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 Notes: svn path=/head/; revision=160020
* Remove a few unused things.Yaroslav Tykhiy2006-06-291-12/+8
| | | | | | | Fix some style and consistency points. Notes: svn path=/head/; revision=160019
* Reduce unneeded code duplication.Yaroslav Tykhiy2006-06-291-12/+1
| | | | Notes: svn path=/head/; revision=160018
* A small race existed where the lock was dropped between when encif wasAndrew Thompson2006-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] Notes: svn path=/head/; revision=160011
* Simplify ipsec_bpf by using bpf_mtap2().Andrew Thompson2006-06-271-9/+2
| | | | Notes: svn path=/head/; revision=159969
* Add a pseudo interface for packet filtering IPSec connections before or afterAndrew Thompson2006-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 Notes: svn path=/head/; revision=159965
* Fix the VLAN_ARRAY case, mostly regarding improper use of atomic(9)Yaroslav Tykhiy2006-06-211-30/+16
| | | | | | | | in place of conventional rw locking. Alas, atomic(9) can't buy us lockless operation so easily. Notes: svn path=/head/; revision=159838
* Track interface department events and detach vlans fromYaroslav Tykhiy2006-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 Notes: svn path=/head/; revision=159823
* - First initialize ifnet, and then insert it into globalGleb Smirnoff2006-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 Notes: svn path=/head/; revision=159822
* Allow gif interfaces to be added as span ports, the user may want to send aAndrew Thompson2006-06-201-0/+1
| | | | | | | copy of all packets to the other side of the world. Notes: svn path=/head/; revision=159807
* Import interface groups from OpenBSD. This allows to group interfaces inMax Laier2006-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) Notes: svn path=/head/; revision=159781
* Fix spelling mistake in comment.Andrew Thompson2006-06-191-1/+1
| | | | Notes: svn path=/head/; revision=159759
* Since we are doing some bpf(4) clean up, change a couple of function prototypesChristian S.J. Peron2006-06-151-142/+48
| | | | | | | | to be consistent. Also, ANSI'fy function definitions. There is no functional change here. Notes: svn path=/head/; revision=159641
* If bpf(4) has not been compiled into the kernel, initialize the bpf interfaceChristian S.J. Peron2006-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 Notes: svn path=/head/; revision=159595
* Use bit operations to get a locally administered address rather than using aAndrew Thompson2006-06-121-5/+4
| | | | | | | hardcoded OUI code. Notes: svn path=/head/; revision=159555
* Fix KASSERT conditions in if_deregister_com_alloc().Max Khon2006-06-111-2/+2
| | | | Notes: svn path=/head/; revision=159528