summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
Commit message (Collapse)AuthorAgeFilesLines
* Rename m_getm() to m_getm2() and rewrite it to allocate up to page sizedandre2006-11-021-1/+1
| | | | | | | | | | | | | | mbuf clusters. Add a flags parameter to accept M_PKTHDR and M_EOR mbuf chain flags. Provide compatibility macro for m_getm() calling m_getm2() with M_PKTHDR set. Rewrite m_uiotombuf() to use m_getm2() for mbuf allocation and do the uiomove() in a tight loop over the mbuf chain. Add a flags parameter to accept mbuf flags to be passed to m_getm2(). Adjust all callers for the extra parameter. Sponsored by: TCP/IP Optimization Fundraise 2005 MFC after: 3 month
* Check pointer before dereferencing.glebius2006-10-181-1/+2
| | | | | Reported by: Coverity CID: 1556
* Some clenaup of ngs_rcvmsg():glebius2006-10-171-60/+46
| | | | | | | - Inline ship_msg() into ngs_rcvmsg(). - Plug memory leak in case if no control socket present. - Remove malloc() and allocate the sockaddr on stack. - style(9).
* Some cleanup and small changes:glebius2006-10-171-121/+74
| | | | | | | | | | - Use malloc() and free() instead of MALLOC() and FREE() macros. - Do not check malloc results if M_WAITOK was used. - Remove linked list of all netgraph sockets. It isn't needed. - Use ng_findhook() instead of searching the list ourselves. - Use NG_WAITOK in syscalls. - Remove unneeded includes. - style(9)
* Make the sg_len and sg_family members of the sockaddr_ng the same typeglebius2006-10-171-5/+3
| | | | as the corresponding values in sockaddr are.
* Make ng_ID_t fixed size, so that its maximum value is platform independent.glebius2006-10-171-2/+2
| | | | This will be important in future.
* - ng_address_ID() has already freed the message, don't do double free.glebius2006-10-171-6/+2
| | | | | | - Get error from ng_address_ID(). Reported by: Coverity via pjd
* Fix result of some mechanical change that I did some time ago, whenglebius2006-10-131-2/+2
| | | | writing this node.
* Recognize 802.1q frames in Ethernet input and process them.glebius2006-10-111-1/+29
| | | | | PR: kern/101162 Submitted by: CoolDavid (Tseng Guo-Fu) <cooldavid cdpa.nsysu.edu.tw>
* Do not leak hooks in ng_bypass().glebius2006-10-111-0/+3
| | | | Submitted by: Alexander Motin <mav alkar.net>
* Make it buildable.glebius2006-10-111-1/+1
|
* Unbreak a short one.glebius2006-10-111-2/+1
| | | | Submitted by: maxim
* Break long line.glebius2006-10-111-1/+2
|
* Use hash functions with better distribution. Tested on live traffic.glebius2006-10-111-12/+12
| | | | Submitted by: Alexander Motin <mav alkar.net>
* Use bitcount32() from sys/systm.h instead of my own.glebius2006-10-111-17/+4
|
* Don't use data after free.netchild2006-09-301-1/+4
| | | | | | Found by: Coverity Prevent CID: 536 Submitted by: harti (via vs)
* Move ethernet VLAN tags from mtags to its own mbuf packet header fieldandre2006-09-171-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | m_pkthdr.ether_vlan. The presence of the M_VLANTAG flag on the mbuf signifies the presence and validity of its content. Drivers that support hardware VLAN tag stripping fill in the received VLAN tag (containing both vlan and priority information) into the ether_vtag mbuf packet header field: m->m_pkthdr.ether_vtag = vlan_id; /* ntohs()? */ m->m_flags |= M_VLANTAG; to mark the packet m with the specified VLAN tag. On output the driver should check the mbuf for the M_VLANTAG flag to see if a VLAN tag is present and valid: if (m->m_flags & M_VLANTAG) { ... = m->m_pkthdr.ether_vtag; /* htons()? */ ... pass tag to hardware ... } VLAN tags are stored in host byte order. Byte swapping may be necessary. (Note: This driver conversion was mechanic and did not add or remove any byte swapping in the drivers.) Remove zone_mtag_vlan UMA zone and MTAG_VLAN definition. No more tag memory allocation have to be done. Reviewed by: thompsa, yar Sponsored by: TCP/IP Optimization Fundraise 2005
* Fix input byte counting. Now the sum of the ipackets/ibytes countersru2006-09-151-2/+8
| | | | | | | | | of individual interfaces should match the ipackets/ibytes counter of the aggregate (FEC) interface. PR: kern/82189 Submitted by: Stikheev Andrew <sand AT zunet DOT ru> MFC after: 3 days
* Make it possible to set a larger MTU by attempting to set MTUs on allru2006-09-151-1/+19
| | | | | | | | | | | | | | | trunk ports first. If that succeeds, and we're inside our own bounds, so be it. Still not ideal -- adding a port after changing an MTU doesn't change port's MTU, but a step in the right direction. PR: kern/95417 Submitted by: Vladimir Ivanov <wawa AT yandex-team DOT ru> MFC after: 3 days I've slightly edited a patch to make the conditional logic positive and remove (what I think was) a redundant ng_fec_init() call.
* SIOCSIFFLAGS doesn't require an argument in kernel land; instead, flagsru2006-09-151-1/+1
| | | | | | | | | are supposed to be set directly in ifnet already. This change fixes a panic when ng_eiface node is attached to ng_fec node and the latter is shut down (ng_fec sets flags and then calls SIOCSIFFLAGS with a NULL argument). MFC after: 3 days
* s/USBDEVNAME/device_get_nameunit/gemax2006-09-072-110/+105
| | | | s/USBBASEDEVICE/device_t/g
* more usb fallout changesmjacob2006-09-073-75/+86
|
* - Catch up with ongoing rwatson's socket work;emax2006-08-252-184/+68
| | | | | | | | | | - Fix a couple of LORs and panics; - Temporarily remove the code that tries to cleanup sockets that stuck on accepting queues (both complete and incomplete). I'm taking an ostrich approach here until I find a better way to deal with sockets that were disconnected before accepting (i.e. while socket was on complete or incomplete accept queue).
* Fix another fallout from the IF_LLADDR() type change.ru2006-08-241-1/+2
| | | | Spotted by: mwlucas
* Define mtu as u_int16_t not as int. This should fix problem with rfcommemax2006-08-241-1/+2
| | | | | | | | on sparc64. Reported by: Andrew Belashov <bel at orel dot ru> Tested by: Andrew Belashov <bel at orel dot ru> MFC after: 3 days
* Some perfectionizm against last revision.glebius2006-08-101-2/+2
| | | | Submitted by: ru
* Fix ng_pppoe(4) after turning off "autosrc feature" on ng_ether(4).glebius2006-08-092-21/+74
| | | | | | | | | | | | - Store the Ethernet header in node softc. - Initialize header with dst addr and ethertype in node constructor method. - In node connect method send NGM_ETHER_GET_ENADDR message downwards. - If received reply from ng_ether(4) store the src addr in softc. - Add NGM_PPPOE_SETENDADDR message that allows user to override the address with whatever he/she wants.
* - Use log(9) instead of printf(9).glebius2006-08-071-26/+44
| | | | | | | | - Print node ID, where possible. - Prepend log messages with function name, or at least with "ng_pppoe". Reviewed by: julian Tested by: Joao Barros <joao.barros gmail.com>
* Turn off by default "feature" that overwrites MAC addressglebius2006-08-041-1/+0
| | | | | | | | on output frames. Many people were confused with not working CARP, ng_bridge(4) and other subsystems, because ng_ether(4) overwritten source MAC address.
* Remove the dependency of bridgestp.h on if_bridgevar.h by moving a couple ofthompsa2006-07-271-1/+0
| | | | private structures to if_bridge.c.
* Fixing compilation bustage: net/if_bridgevar.h depends on net/bridgestp.h.avatar2006-07-271-0/+1
|
* soreceive_generic(), and sopoll_generic(). Add new functions sosend(),rwatson2006-07-242-9/+7
| | | | | | | | | | | | | | | | soreceive(), and sopoll(), which are wrappers for pru_sosend, pru_soreceive, and pru_sopoll, and are now used univerally by socket consumers rather than either directly invoking the old so*() functions or directly invoking the protocol switch method (about an even split prior to this commit). This completes an architectural change that was begun in 1996 to permit protocols to provide substitute implementations, as now used by UDP. Consumers now uniformly invoke sosend(), soreceive(), and sopoll() to perform these operations on sockets -- in particular, distributed file systems and socket system calls. Architectural head nod: sam, gnn, wollman
* Change semantics of socket close and detach. Add a new protocol switchrwatson2006-07-219-5/+43
| | | | | | | | | | | | | | | | | | | 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
* Replace inb() and outb() with bus_space_read_1() and bus_space_write_1()emax2006-07-052-8/+12
| | | | | Submitted by: marius MFC after: 1 week
* A netgraph node that can do different manipulations withglebius2006-06-272-0/+847
| | | | | | | mbuf_tags(9) on packets. Submitted by: Vadim Goncharov <vadimnuclight tpu.ru> mdoc(7) reviewed by: ru
* Use kern_kldload() and kern_kldunload() to load and unload modules whenjhb2006-06-131-6/+5
| | | | | | | | we intend for the user to be able to unload them later via kldunload(2) instead of calling linker_load_module() and then directly adjusting the ref count on the linker file structure. This makes the resulting consumer code simpler and cleaner and better hides the linker internals making it possible to sanely lock the linker.
* When counting nodes second time, use the same criteria as forglebius2006-06-071-4/+4
| | | | | | | the first time. PR: kern/98529 Submitted by: Michael Heyman
* Use NET_CALLOUT_MPSAFE for netgraph callout initializer.glebius2006-06-062-3/+1
|
* add missed calls to bpf_peers_presentsam2006-06-021-1/+1
|
* Conditionally acquire Giant in netgraph callouts to honor mpsafenet=0.jhb2006-06-021-0/+2
| | | | | Reported by: sekes <gexlie at gmail dot com> MFC after: 1 week
* Replace the array initialization using the gcc-specific formatdds2006-06-021-5/+5
| | | | | | [constant] value with the C99 format [constant] = value
* Add new SIOC_HCI_RAW_NODE_LIST_NAMES ioctl. User-space applications canemax2006-05-173-1/+75
| | | | | | | | | | | | | use this ioctl to obtain the list of HCI nodes. User-space application is expected to preallocate 'ng_btsocket_hci_raw_node_list_names' structure and set limit in 'num_nodes' field. The 'nodes' field should be allocated as well and it should have space for at least 'num_nodes' elements. The SIOC_HCI_RAW_NODE_LIST_NAMES should be issued on bound raw HCI socket. It does not really really matter what HCI name the socket is bound to, as long as it is not empty. MFC after: 1 week
* Remove unneeded check.glebius2006-05-161-4/+0
| | | | Coverity ID: 445
* Do not leak kernel memory in case if userland has been compiledglebius2006-05-161-0/+1
| | | | | | against older NG_VERSION. Coverity ID: 1131
* o Replace disappeared URLs to Cisco docs by new ones, style.maxim2006-04-251-8/+14
| | | | No functional changes.
* o Set to zero engine_type, engine_id and pad (cisco calls itmaxim2006-04-251-0/+3
| | | | | | | | | | sampling_interval) fields in netflow v5 header. We do not use them but some netflow tools show garbage. PR: kern/96296 Submitted by: David Duchscher Approved by: glebius MFC after: 1 week
* Correct assertion in ng_detach().rwatson2006-04-061-1/+1
| | | | | Submitted by: tegge MFC after: 3 months
* Chance protocol switch method pru_detach() so that it returns voidrwatson2006-04-018-47/+21
| | | | | | | | | | | | | | | | | | | | | | | | | rather than an error. Detaches do not "fail", they other occur or the protocol flags SS_PROTOREF to take ownership of the socket. soclose() no longer looks at so_pcb to see if it's NULL, relying entirely on the protocol to decide whether it's time to free the socket or not using SS_PROTOREF. so_pcb is now entirely owned and managed by the protocol code. Likewise, no longer test so_pcb in other socket functions, such as soreceive(), which have no business digging into protocol internals. Protocol detach routines no longer try to free the socket on detach, this is performed in the socket code if the protocol permits it. In rts_detach(), no longer test for rp != NULL in detach, and likewise in other protocols that don't permit a NULL so_pcb, reduce the incidence of testing for it during detach. netinet and netinet6 are not fully updated to this change, which will be in an upcoming commit. In their current state they may leak memory or panic. MFC after: 3 months
* Change protocol switch pru_abort() API so that it returns void ratherrwatson2006-04-017-12/+12
| | | | | | | | | | | | | | than an int, as an error here is not meaningful. Modify soabort() to unconditionally free the socket on the return of pru_abort(), and modify most protocols to no longer conditionally free the socket, since the caller will do this. This commit likely leaves parts of netinet and netinet6 in a situation where they may panic or leak memory, as they have not are not fully updated by this commit. This will be corrected shortly in followup commits to these components. MFC after: 3 months
* Free private data when deleting hook.glebius2006-03-151-0/+2
| | | | | PR: kern/93952 Submitted by: Antoine Brodin <antoine.brodin laposte.net>
OpenPOWER on IntegriCloud