summaryrefslogtreecommitdiffstats
path: root/sys/netinet/in_var.h
Commit message (Collapse)AuthorAgeFilesLines
* Import rewrite of IPv4 socket multicast layer to support source-specificbms2007-06-121-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and protocol-independent host mode multicast. The code is written to accomodate IPv6, IGMPv3 and MLDv2 with only a little additional work. This change only pertains to FreeBSD's use as a multicast end-station and does not concern multicast routing; for an IGMPv3/MLDv2 router implementation, consider the XORP project. The work is based on Wilbert de Graaf's IGMPv3 code drop for FreeBSD 4.6, which is available at: http://www.kloosterhof.com/wilbert/igmpv3.html Summary * IPv4 multicast socket processing is now moved out of ip_output.c into a new module, in_mcast.c. * The in_mcast.c module implements the IPv4 legacy any-source API in terms of the protocol-independent source-specific API. * Source filters are lazy allocated as the common case does not use them. They are part of per inpcb state and are covered by the inpcb lock. * struct ip_mreqn is now supported to allow applications to specify multicast joins by interface index in the legacy IPv4 any-source API. * In UDP, an incoming multicast datagram only requires that the source port matches the 4-tuple if the socket was already bound by source port. An unbound socket SHOULD be able to receive multicasts sent from an ephemeral source port. * The UDP socket multicast filter mode defaults to exclusive, that is, sources present in the per-socket list will be blocked from delivery. * The RFC 3678 userland functions have been added to libc: setsourcefilter, getsourcefilter, setipv4sourcefilter, getipv4sourcefilter. * Definitions for IGMPv3 are merged but not yet used. * struct sockaddr_storage is now referenced from <netinet/in.h>. It is therefore defined there if not already declared in the same way as for the C99 types. * The RFC 1724 hack (specify 0.0.0.0/8 addresses to IP_MULTICAST_IF which are then interpreted as interface indexes) is now deprecated. * A patch for the Rhyolite.com routed in the FreeBSD base system is available in the -net archives. This only affects individuals running RIPv1 or RIPv2 via point-to-point and/or unnumbered interfaces. * Make IPv6 detach path similar to IPv4's in code flow; functionally same. * Bump __FreeBSD_version to 700048; see UPDATING. This work was financially supported by another FreeBSD committer. Obtained from: p4://bms_netdev Submitted by: Wilbert de Graaf (original work) Reviewed by: rwatson (locking), silence from fenner, net@ (but with encouragement)
* Implement reference counting for ifmultiaddr, in_multi, and in6_multibms2007-03-201-1/+1
| | | | | | | | | | | | | | | | | | | structures. Detect when ifnet instances are detached from the network stack and perform appropriate cleanup to prevent memory leaks. This has been implemented in such a way as to be backwards ABI compatible. Kernel consumers are changed to use if_delmulti_ifma(); in_delmulti() is unable to detect interface removal by design, as it performs searches on structures which are removed with the interface. With this architectural change, the panics FreeBSD users have experienced with carp and pfsync should be resolved. Obtained from: p4 branch bms_netdev Reviewed by: andre Sponsored by: Garance A Drosehn Idea from: NetBSD MFC after: 1 month
* The IPv4 code should clean up multicast group state when an interfacebms2006-09-281-0/+2
| | | | | | | | | | | | goes away. Without this change, it leaks in_multi (and often ether_multi state) if many clonable interfaces are created and destroyed in quick succession. The concept of this fix is borrowed from KAME. Detailed information about this behaviour, as well as test cases, are available in the PR. PR: kern/78227 MFC after: 1 week
* Splelingbms2006-09-251-1/+1
| | | | Submitted by: pjd
* Account for output IP datagrams on the ifaddr where they originated from,bms2006-09-251-3/+14
| | | | | | | | *not* the first ifaddr on the ifp. This is similar to what NetBSD does. PR: kern/72936 Submitted by: alfred Reviewed by: andre
* Return mbuf pointer or NULL from ip_fastforward() as the mbuf pointerandre2006-01-181-1/+1
| | | | | | | | | | | may have changed by m_pullup() during fastforward processing. While this is a bug it is actually never triggered in real world situations and it is not remotely exploitable. Found by: Coverity Prevent(tm) Coverity ID: CID780 Sponsored by: TCP/IP Optimization Fundraise 2005
* Introduce in_multi_mtx, which will protect IPv4-layer multicast addressrwatson2005-08-031-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | lists, as well as accessor macros. For now, this is a recursive mutex due code sequences where IPv4 multicast calls into IGMP calls into ip_output(), which then tests for a multicast forwarding case. For support macros in in_var.h to check multicast address lists, assert that in_multi_mtx is held. Acquire in_multi_mtx around iteration over the IPv4 multicast address lists, such as in ip_input() and ip_output(). Acquire in_multi_mtx when manipulating the IPv4 layer multicast addresses, as well as over the manipulation of ifnet multicast address lists in order to keep the two layers in sync. Lock down accesses to IPv4 multicast addresses in IGMP, or assert the lock when performing IGMP join/leave events. Eliminate spl's associated with IPv4 multicast addresses, portions of IGMP that weren't previously expunged by IGMP locking. Add in_multi_mtx, igmp_mtx, and if_addr_mtx lock order to hard-coded lock order in WITNESS, in that order. Problem reported by: Ed Maste <emaste at phaedrus dot sandvine dot ca> MFC after: 10 days
* Modify network protocol consumers of the ifnet multicast address listsrwatson2005-08-021-0/+2
| | | | | | | to lock if_addr_mtx. Problem reported by: Ed Maste <emaste at phaedrus dot sandvine dot ca> MFC after: 1 week
* /* -> /*- for license, minor formatting changesimp2005-01-071-1/+1
|
* Properly declare the "net.inet" sysctl subtree.andre2004-10-191-0/+1
|
* White space cleanup for netinet before branch:rwatson2004-08-161-1/+1
| | | | | | | | | | | - Trailing tab/space cleanup - Remove spurious spaces between or before tabs This change avoids touching files that Andre likely has in his working set for PFIL hooks changes for IPFW/DUMMYNET. Approved by: re (scottl) Submitted by: Xin LI <delphij@frontfree.net>
* Remove advertising clause from University of California Regent'simp2004-04-071-4/+0
| | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson
* Scrub unused variable zeroin_addr.rwatson2004-03-101-1/+0
|
* Introduce ip_fastforward and remove ip_flow.andre2003-11-141-3/+1
| | | | | | | | | | | | | | | Short description of ip_fastforward: o adds full direct process-to-completion IPv4 forwarding code o handles ip fragmentation incl. hw support (ip_flow did not) o sends icmp needfrag to source if DF is set (ip_flow did not) o supports ipfw and ipfilter (ip_flow did not) o supports divert, ipfw fwd and ipfilter nat (ip_flow did not) o returns anything it can't handle back to normal ip_input Enable with sysctl -w net.inet.ip.fastforwarding=1 Reviewed by: sam (mentor)
* Move from a custom-crafted singly-linked list to the SLIST_* macrosrwatson2003-08-201-1/+1
| | | | | | | | | from queue(3). Improve vertical compactness by using a IGMP_PRINTF() macro rather than #ifdefing IGMP_DEBUG a large number of debugging printfs. Reviewed by: mdodd (SLIST changes)
* Update netisr handling; Each SWI now registers its queue, and all queuejlemon2003-03-041-1/+0
| | | | | | | | | | drain routines are done by swi_net, which allows for better queue control at some future point. Packets may also be directly dispatched to a netisr instead of queued, this may be of interest at some installations, but currently defaults to off. Reviewed by: hsu, silby, jayanth, sam Sponsored by: DARPA, NAI Labs
* Fixed some style bugs in the removal of __P(()). Continuation linesbde2002-03-241-1/+1
| | | | | were not outdented to preserve non-KNF lining up of code with parentheses. Switch to KNF formatting.
* Remove __P.alfred2002-03-191-11/+11
|
* Nuke unused (and incorrect) #define of INADDR_HMASK.jlemon2001-09-291-1/+0
| | | | Spotted by: ru
* Make the INADDR_TO_IFP macro use the IP address hash lookup instead ofjlemon2001-09-291-1/+1
| | | | | | walking the entire list of IP addresses. Pointed out by: bfumerola
* Add a hash table that contains the list of internet addresses, and usejlemon2001-09-291-2/+18
| | | | | this in place of the in_ifaddr list when appropriate. This improves performance on hosts which have a large number of IP aliases.
* KSE Milestone 2julian2001-09-121-1/+1
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Backout damage to the INADDR_TO_IFP() macro in revision 1.7.ru2001-07-171-12/+5
| | | | | | | | | | | | | This macro was supposed to only match local IP addresses of interfaces, and all consumers of this macro assume this as well. (See IP_MULTICAST_IF and IP_ADD_MEMBERSHIP socket options in the ip(4) manpage.) This fixes a major security breach in IPFW-based firewalls where the `me' keyword would match the other end of a P2P link. PR: kern/28567
* In in_ifadown(), differentiate between whether the interface goesru2001-05-111-1/+1
| | | | | | | down or interface address is deleted. Only delete static routes in the latter case. Reported by: Alexander Leidinger <Alexander@leidinger.net>
* Convert if_multiaddrs from LIST to TAILQ so that it can be traversedphk2001-02-061-1/+1
| | | | | | backwards in the three drivers which want to do that. Reviewed by: mikeh
* Use <sys/queue.h> macro API.phk2001-02-041-11/+8
|
* Back out the previous change to the queue(3) interface.jake2000-05-261-4/+4
| | | | | | It was not discussed and should probably not happen. Requested by: msmith and others
* Change the way that the queue(3) structures are declared; don't assume thatjake2000-05-231-4/+4
| | | | | | | | the type argument to *_HEAD and *_ENTRY is a struct. Suggested by: phk Reviewed by: phk Approved by: mdodd
* Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"peter1999-12-291-3/+3
| | | | | | is an application space macro and the applications are supposed to be free to use it as they please (but cannot). This is consistant with the other BSD's who made this change quite some time ago. More commits to come.
* KAME related header files additions and merges.shin1999-11-051-0/+3
| | | | | | | (only those which don't affect c source files so much) Reviewed by: cvs-committers Obtained from: KAME project
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* * Change sysctl from using linker_set to construct its tree using SLISTs.dfr1999-02-161-1/+7
| | | | | | | | | | This makes it possible to change the sysctl tree at runtime. * Change KLD to find and register any sysctl nodes contained in the loaded file and to unregister them when the file is unloaded. Reviewed by: Archie Cobbs <archie@whistle.com>, Peter Wemm <peter@netplex.com.au> (well they looked at it anyway)
* This commit fixes various 64bit portability problems required fordfr1998-06-071-2/+2
| | | | | | | | | | FreeBSD/alpha. The most significant item is to change the command argument to ioctl functions from int to u_long. This change brings us inline with various other BSD versions. Driver writers may like to use (__FreeBSD_version == 300003) to detect this change. The prototype FreeBSD/alpha machdep will follow in a couple of days time.
* Added fast IP forwarding code by Matt Thomas <matt@3am-software.com> viadg1998-05-191-1/+5
| | | | | | | | | | | | NetBSD, ported to FreeBSD by Pierre Beyssac <pb@fasterix.freenix.org> and minorly tweaked by me. This is a standard part of FreeBSD, but must be enabled with: "sysctl -w net.inet.ip.fastforwarding=1" ...and of course forwarding must also be enabled. This should probably be modified to use the zone allocator for speed and space efficiency. The current algorithm also appears to lose if the number of active paths exceeds IPFLOW_MAX (256), in which case it wastes lots of time trying to figure out which cache entry to drop.
* Some staticized variables were still declared to be extern.bde1997-09-071-4/+1
|
* The long-awaited mega-massive-network-code- cleanup. Part I.wollman1997-04-271-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | This commit includes the following changes: 1) Old-style (pr_usrreq()) protocols are no longer supported, the compatibility glue for them is deleted, and the kernel will panic on boot if any are compiled in. 2) Certain protocol entry points are modified to take a process structure, so they they can easily tell whether or not it is possible to sleep, and also to access credentials. 3) SS_PRIV is no more, and with it goes the SO_PRIVSTATE setsockopt() call. Protocols should use the process pointer they are now passed. 4) The PF_LOCAL and PF_ROUTE families have been updated to use the new style, as has the `raw' skeleton family. 5) PF_LOCAL sockets now obey the process's umask when creating a socket in the filesystem. As a result, LINT is now broken. I'm hoping that some enterprising hacker with a bit more time will either make the broken bits work (should be easy for netipx) or dike them out.
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* Convert raw IP from mondo-switch-statement-from-Hell towollman1997-02-181-1/+1
| | | | | | | | | pr_usrreqs. Collapse duplicates with udp_usrreq.c and tcp_usrreq.c (calling the generic routines in uipc_socket2.c and in_pcb.c). Calling sockaddr()_ or peeraddr() on a detached socket now traps, rather than harmlessly returning an error; this should never happen. Allow the raw IP buffer sizes to be controlled via sysctl.
* Provide PRC_IFDOWN and PRC_IFUP support for IP. Now, when an interfacewollman1997-02-131-0/+2
| | | | | | | | is administratively downed, all routes to that interface (including the interface route itself) which are not static will be deleted. When it comes back up, and addresses remaining will have their interface routes re-added. This solves the problem where, for example, an Ethernet interface is downed by traffic continues to flow by way of ARP entries.
* Who had the conical hat? Correct a typo, hidden by a bad cast,wollman1997-01-211-1/+1
| | | | which prevented IP multicast reception from happening.
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Use the new if_multiaddrs list for multicast addresses rather than thewollman1997-01-131-33/+23
| | | | | | | previous hackery involving struct in_ifaddr and arpcom. Get rid of the abominable multi_kludge. Update all network interfaces to use the new machanism. Distressingly few Ethernet drivers program the multicast filter properly (assuming the hardware has one, which it usually does).
* Somehow the removal of ia_next didn't make it in the last time. Hopewollman1996-12-151-2/+1
| | | | | it makes it in this time, and remember not to commit changes next time late on a Friday evening!
* Convert the interface address and IP interface address structureswollman1996-12-131-16/+17
| | | | | | to TAILQs. Fix places which referenced these for no good reason that I can see (the references remain, but were fixed to compile again; they are still questionable).
* IGMPv2 routines rewritten, to be more compact and to fully complyfenner1996-03-141-5/+5
| | | | with the IGMPv2 Internet Draft (including Router Alert IP option)
* Provide a direct entry point for IP input. This actually resultswollman1996-02-051-1/+2
| | | | | in a slight decrease in performance, but will lead to better performance later.
* Fix logic bug (!= should be ==) in recent P2P/multicast kludge.dg1996-01-091-2/+2
| | | | | Reviewed by: Bill Fenner <fenner@parc.xerox.com> Submitted by: Dave Marquardt <marquard@austin.ibm.com>
* Try to make multicast routing work correctly over point-to-pointwollman1996-01-031-1/+8
| | | | | | links (which was broken previously by the support for half-routers). Submitted by: Bill Fenner <fenner@parc.xerox.com>
* Actually call in_rtqdrain()as was originally intended.wollman1995-12-191-1/+2
|
* New style sysctl & staticize alot of stuff.phk1995-11-141-4/+1
|
OpenPOWER on IntegriCloud