summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
Commit message (Collapse)AuthorAgeFilesLines
* /* -> /*- for license, minor formatting changes, separate for KAMEimp2005-01-0768-91/+91
|
* In certain cases ip_output() can free our route, so checkglebius2004-12-101-1/+2
| | | | | | for its presence before RTFREE(). Noticed by: ru
* style the last changeglebius2004-12-091-2/+2
|
* MFinet4:glebius2004-12-091-3/+10
| | | | | | | - Make route cacheing optional, configurable via IFF_LINK0 flag. - Turn it off by default. Reminded by: suz
* Reviewed by: SUZUKI Shinsuke <suz@kame.net>gnn2004-11-291-17/+34
| | | | | | | | | | Approved by: Robert Watson <rwatson@freebsd.org> Add locking to the IPv6 scoping code. All spl() like calls have also been removed. Cleaning up the handling of ifnet data will happen at a later date.
* support TCP-MD5(IPv4) in KAME-IPSEC, too.suz2004-11-081-0/+6
| | | | MFC after: 3 week
* Initialize struct pr_userreqs in new/sparse style and fill in commonphk2004-11-082-10/+23
| | | | | | default elements in net_init_domain(). This makes it possible to grep these structures and see any bogosities.
* fixed a bug that incorrect IPsec request level may be returned for proto AHsuz2004-10-281-0/+1
| | | | Obtained from: KAME
* Be more careful to only index valid IP protocols and be more verbose withandre2004-10-191-2/+11
| | | | comments.
* Push acquisition of the accept mutex out of sofree() into the callerrwatson2004-10-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (sorele()/sotryfree()): - This permits the caller to acquire the accept mutex before the socket mutex, avoiding sofree() having to drop the socket mutex and re-order, which could lead to races permitting more than one thread to enter sofree() after a socket is ready to be free'd. - This also covers clearing of the so_pcb weak socket reference from the protocol to the socket, preventing races in clearing and evaluation of the reference such that sofree() might be called more than once on the same socket. This appears to close a race I was able to easily trigger by repeatedly opening and resetting TCP connections to a host, in which the tcp_close() code called as a result of the RST raced with the close() of the accepted socket in the user process resulting in simultaneous attempts to de-allocate the same socket. The new locking increases the overhead for operations that may potentially free the socket, so we will want to revise the synchronization strategy here as we normalize the reference counting model for sockets. The use of the accept mutex in freeing of sockets that are not listen sockets is primarily motivated by the potential need to remove the socket from the incomplete connection queue on its parent (listen) socket, so cleaning up the reference model here may allow us to substantially weaken the synchronization requirements. RELENG_5_3 candidate. MFC after: 3 days Reviewed by: dwhite Discussed with: gnn, dwhite, green Reported by: Marc UBM Bocklet <ubm at u-boot-man dot de> Reported by: Vlad <marchenko at gmail dot com>
* fixed too delayed routing cache expiry. (tvtohz() converts a time interval ↵suz2004-10-061-4/+4
| | | | | | to ticks, whereas hzto() converts an absolute time to ticks) Obtained from: KAME
* Prevent reentrancy of the IPv6 routing code (leading to crash withgreen2004-10-031-5/+26
| | | | INVARIANTS on, who knows what with it off).
* Disable MTU feedback in IPv6 if the sender writes data that must be fragmented.dwhite2004-10-021-0/+14
| | | | | | | | | | | Discussed extensively with KAME. The API author's intent isn't clear at this point, so rather than remove the code entirely, #if 0 out and put a big comment in for now. The IPV6_RECVPATHMTU sockopt is available if the application wants to be notified of the path MTU to optimize packet sizes. Thanks to JINMEI Tatuya <jinmei@isl.rdc.toshiba.co.jp> for putting up with my incessant badgering on this issue, and fenner for pointing out the API issue and suggesting solutions.
* Add an additional struct inpcb * argument to pfil(9) in order to enablemlaier2004-09-293-3/+3
| | | | | | | | | | | | | | | | | | | passing along socket information. This is required to work around a LOR with the socket code which results in an easy reproducible hard lockup with debug.mpsafenet=1. This commit does *not* fix the LOR, but enables us to do so later. The missing piece is to turn the filter locking into a leaf lock and will follow in a seperate (later) commit. This will hopefully be MT5'ed in order to fix the problem for RELENG_5 in forseeable future. Suggested by: rwatson A lot of work by: csjp (he'd be even more helpful w/o mentor-reviews ;) Reviewed by: rwatson, csjp Tested by: -pf, -ipfw, LINT, csjp and myself MFC after: 3 days LOR IDs: 14 - 17 (not fixed yet)
* Prefer C99's __func__ over GCC's __FUNCTION__.stefanf2004-09-221-1/+1
|
* Call callout_init() on nd6_slowtimo_ch before setting it going; otherwise,rwatson2004-09-051-0/+1
| | | | | | | the flags field will be improperly initialized resulting in inconsistent operation (sometimes with Giant, sometimes without, et al). RELENG_5 candidate.
* Unlock rather than lock the ripcbinfo lock at the end of rip6_input().rwatson2004-09-021-1/+1
| | | | | | RELENG_5 candidate. Foot provided by: Patrick Guelat <pg at imp dot ch>
* Mark Netgraph TTY, KAME IPSEC, and IPX/SPX as requiring Giant for correctrwatson2004-08-281-0/+2
| | | | | | | operation using NET_NEEDS_GIANT(). This will result in a boot-time restoration of Giant-enabled network operation, or run-time warning on dynamic load (applicable only to the Netgraph component). Additional components will likely need to be marked with this in the future.
* Apply error and success logic consistently to the function netisr_queue() andandre2004-08-272-4/+4
| | | | | | | | | | | | | | | | | | its users. netisr_queue() now returns (0) on success and ERRNO on failure. At the moment ENXIO (netisr queue not functional) and ENOBUFS (netisr queue full) are supported. Previously it would return (1) on success but the return value of IF_HANDOFF() was interpreted wrongly and (0) was actually returned on success. Due to this schednetisr() was never called to kick the scheduling of the isr. However this was masked by other normal packets coming through netisr_dispatch() causing the dequeueing of waiting packets. PR: kern/70988 Found by: MOROHOSHI Akihiko <moro@remus.dti.ne.jp> MFC after: 3 days
* Always compile PFIL_HOOKS into the kernel and remove the associated kernelandre2004-08-274-32/+22
| | | | | | | | | | | compile option. All FreeBSD packet filters now use the PFIL_HOOKS API and thus it becomes a standard part of the network stack. If no hooks are connected the entire packet filter hooks section and related activities are jumped over. This removes any performance impact if no hooks are active. Both OpenBSD and DragonFlyBSD have integrated PFIL_HOOKS permanently as well.
* Remove in6_prefix.[ch] and the contained router renumbering capability.rwatson2004-08-237-1327/+0
| | | | | | | | | | | | The prefix management code currently resides in nd6, leaving only the unused router renumbering capability in the in6_prefix files. Removing it will make it easier for us to provide locking for the remainder of IPv6 by reducing the number of objects requiring synchronized access. This functionality has also been removed from NetBSD and OpenBSD. Submitted by: George Neville-Neil <gnn at neville-neil.com> Discussed with/approved by: suz, keiichi at kame.net, core at kame.net
* When notifying protocol components of an event on an in6pcb, use therwatson2004-08-211-3/+5
| | | | | | | | | | result of the notify() function to decide if we need to unlock the in6pcb or not, rather than always unlocking. Otherwise, we may unlock and already unlocked in6pcb. Reported by: kuriyama, Gordon Bergling <gbergling at 0xfce3.net> Tested by: kuriyama, Gordon Bergling <gbergling at 0xfce3.net> Discussed with: mdodd
* Get rid of the RANDOM_IP_ID option and make it a sysctl. NetBSDdwmalone2004-08-148-46/+1
| | | | | | | | | | | | | | | | | | | | | have already done this, so I have styled the patch on their work: 1) introduce a ip_newid() static inline function that checks the sysctl and then decides if it should return a sequential or random IP ID. 2) named the sysctl net.inet.ip.random_id 3) IPv6 flow IDs and fragment IDs are now always random. Flow IDs and frag IDs are significantly less common in the IPv6 world (ie. rarely generated per-packet), so there should be smaller performance concerns. The sysctl defaults to 0 (sequential IP IDs). Reviewed by: andre, silby, mlaier, ume Based on: NetBSD MFC after: 2 months
* When allocating the IPv6 header to stick in front of raw packet beingrwatson2004-08-121-1/+5
| | | | | | | sent via a raw IPv6 socket, use M_DONTWAIT not M_TRYWAIT, as we're holding the raw pcb mutex. Reported, tested by: kuriyama
* Pass pcbinfo structures to in6_pcbnotify() rather than pcbheadrwatson2004-08-064-8/+19
| | | | | | | | | | structures, allowing in6_pcbnotify() to lock the pcbinfo and each inpcb that it notifies of ICMPv6 events. This prevents inpcb assertions from firing when IPv6 generates and delievers event notifications for inpcbs. Reported by: kuriyama Tested by: kuriyama
* Disallow a particular kind of port theft described by the following scenario:yar2004-07-281-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Alice is too lazy to write a server application in PF-independent manner. Therefore she knocks up the server using PF_INET6 only and allows the IPv6 socket to accept mapped IPv4 as well. An evil hacker known on IRC as cheshire_cat has an account in the same system. He starts a process listening on the same port as used by Alice's server, but in PF_INET. As a consequence, cheshire_cat will distract all IPv4 traffic supposed to go to Alice's server. Such sort of port theft was initially enabled by copying the code that implemented the RFC 2553 semantics on IPv4/6 sockets (see inet6(4)) for the implied case of the same owner for both connections. After this change, the above scenario will be impossible. In the same setting, the user who attempts to start his server last will get EADDRINUSE. Of course, using IPv4 mapped to IPv6 leads to security complications in the first place, but there is no reason to make it even more unsafe. This change doesn't apply to KAME since it affects a FreeBSD-specific part of the code. It doesn't modify the out-of-box behaviour of the TCP/IP stack either as long as mapping IPv4 to IPv6 is off by default. MFC after: 1 month
* Commit a first pass at in6pcb and pcbinfo locking for IPv6,rwatson2004-07-273-35/+160
| | | | | | | | synchronizing IPv6 protocol control blocks and lists. These changes are modeled on the inpcb locking for IPv4, submitted by Jennifer Yang, and committed by Jeffrey Hsu. With these locking changes, IPv6 use of inpcbs is now substantially more MPSAFE, and permits IPv4 inpcb locking assertions to be run in the presence of IPv6 compiled into the kernel.
* Don't consider TCP connections beyond LISTEN stateyar2004-07-271-19/+10
| | | | | | | | | | | | (i.e. with the foreign address being not wildcard) when checking for possible port theft since such connections cannot be stolen. The port theft check is FreeBSD-specific and isn't in the KAME tree. PR: bin/65928 (in the audit trail) Reviewed by: -net, -hackers (silence) Tested by: Nick Leuta <skynick at mail.sc.ru> MFC after: 1 month
* Rename suser_cred()'s PRISON_ROOT flag to SUSER_ALLOWJAIL. This iscperciva2004-07-261-1/+1
| | | | | | | | | | | somewhat clearer, but more importantly allows for a consistent naming scheme for suser_cred flags. The old name is still defined, but will be removed in a few days (unless I hear any complaints...) Discussed with: rwatson, scottl Requested by: jhb
* Do a pass over all modules in the kernel and make them return EOPNOTSUPPphk2004-07-151-0/+1
| | | | | | | | for unknown events. A number of modules return EINVAL in this instance, and I have left those alone for now and instead taught MOD_QUIESCE to accept this as "didn't do anything".
* Link ALTQ to the build and break with ABI for struct ifnet. Please recompilemlaier2004-06-131-0/+6
| | | | | | | | | | | | your (network) modules as well as any userland that might make sense of sizeof(struct ifnet). This does not change the queueing yet. These changes will follow in a seperate commit. Same with the driver changes, which need case by case evaluation. __FreeBSD_version bump will follow. Tested-by: (i386)LINT
* Missed directory in previous commit; need to hold SOCK_LOCK(so)rwatson2004-06-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | before calling sotryfree(). -- Body of earlier bulk commit this belonged with -- Log: Extend coverage of SOCK_LOCK(so) to include so_count, the socket reference count: - Assert SOCK_LOCK(so) macros that directly manipulate so_count: soref(), sorele(). - Assert SOCK_LOCK(so) in macros/functions that rely on the state of so_count: sofree(), sotryfree(). - Acquire SOCK_LOCK(so) before calling these functions or macros in various contexts in the stack, both at the socket and protocol layers. - In some cases, perform soisdisconnected() before sotryfree(), as this could result in frobbing of a non-present socket if sotryfree() actually frees the socket. - Note that sofree()/sotryfree() will release the socket lock even if they don't free the socket. Submitted by: sam Sponsored by: FreeBSD Foundation Obtained from: BSD/OS
* do not check super user privilege in ip6_savecontrol. It isume2004-06-021-20/+5
| | | | | | | meaningless and can even be harmful. Obtained from: KAME MFC after: 3 days
* add missing #include <sys/module.h>phk2004-05-301-0/+1
|
* Fix a bug which I discovered recently while doing IPv6 testing atwpaul2004-05-141-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | Wind River. In the IPv4 output path, one of the tests in ip_output() checks how many slots are actually available in the interface output queue before attempting to send a packet. If, for example, we need to transmit a packet of 32K bytes over an interface with an MTU of 1500, we know it's going to take about 21 fragments to do it. If there's less than 21 slots left in the output queue, there's no point in transmitting anything at all: IP does not do retransmission, so sending only some of the fragments would just be a waste of bandwidth. (In an extreme case, if you're sending a heavy stream of fragmented packets, you might find yourself sending nothing by the first fragment of all your packets.) So if ip_output() notices there's not enough room in the output queue to send the frame, it just dumps the packet and returns ENOBUFS to the app. It turns out ip6_output() lacks this code. Consequently, this caused the netperf UDPIPV6_STREAM test to produce very poor results with large write sizes. This commit adds code to check the remaining space in the output queue and junk fragmented packets if they're too big to be sent, just like with IPv4. (I can't imagine anyone's running an NFS server using UDP over IPv6, but if they are, this will likely make them a lot happier. :)
* fix the change of interface in nd6_storelladdr for multicastluigi2004-04-261-5/+5
| | | | | | addresses too. Reported by: Jun Kuriyama
* This commit does two things:luigi2004-04-251-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. rt_check() cleanup: rt_check() is only necessary for some address families to gain access to the corresponding arp entry, so call it only in/near the *resolve() routines where it is actually used -- at the moment this is arpresolve(), nd6_storelladdr() (the call is embedded here), and atmresolve() (the call is just before atmresolve to reduce the number of changes). This change will make it a lot easier to decouple the arp table from the routing table. There is an extra call to rt_check() in if_iso88025subr.c to determine the routing info length. I have left it alone for the time being. The interface of arpresolve() and nd6_storelladdr() now changes slightly: + the 'rtentry' parameter (really a hint from the upper level layer) is now passed unchanged from *_output(), so it becomes the route to the final destination and not to the gateway. + the routines will return 0 if resolution is possible, non-zero otherwise. + arpresolve() returns EWOULDBLOCK in case the mbuf is being held waiting for an arp reply -- in this case the error code is masked in the caller so the upper layer protocol will not see a failure. 2. arpcom untangling Where possible, use 'struct ifnet' instead of 'struct arpcom' variables, and use the IFP2AC macro to access arpcom fields. This mostly affects the netatalk code. === Detailed changes: === net/if_arcsubr.c rt_check() cleanup, remove a useless variable net/if_atmsubr.c rt_check() cleanup net/if_ethersubr.c rt_check() cleanup, arpcom untangling net/if_fddisubr.c rt_check() cleanup, arpcom untangling net/if_iso88025subr.c rt_check() cleanup netatalk/aarp.c arpcom untangling, remove a block of duplicated code netatalk/at_extern.h arpcom untangling netinet/if_ether.c rt_check() cleanup (change arpresolve) netinet6/nd6.c rt_check() cleanup (change nd6_storelladdr)
* ifp has the same value as rt->rti_ifp so remove the dependencyluigi2004-04-191-2/+2
| | | | on the route entry to locate the necessary information.
* Remove a tail-recursive call in nd6_output.luigi2004-04-191-5/+8
| | | | | | This change is functionally identical to the original code, though I have no idea if that was correct in the first place (see comment in the commit).
* Replace Bcopy/Bzero with 'the real thing' as in the rest of the file.luigi2004-04-182-8/+8
|
* Remove advertising clause from University of California Regent'simp2004-04-0721-84/+0
| | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson
* UDP checksum is mandatory in IPv6 (RFC2460 p.28)suz2004-04-011-2/+4
| | | | Obtained from: KAME
* Reduce 'td' argument to 'cred' (struct ucred) argument in those functions:pjd2004-03-275-19/+22
| | | | | | | | | | | | | | - in_pcbbind(), - in_pcbbind_setup(), - in_pcbconnect(), - in_pcbconnect_setup(), - in6_pcbbind(), - in6_pcbconnect(), - in6_pcbsetport(). "It should simplify/clarify things a great deal." --rwatson Requested by: rwatson Reviewed by: rwatson, ume
* Remove unused argument.pjd2004-03-272-2/+2
| | | | Reviewed by: ume
* Remove unused prototype.pjd2004-03-271-1/+0
| | | | Reviewed by: ume
* Validate IPv6 socket options more carefully to avoid a panic.ume2004-03-261-1/+37
| | | | | PR: kern/61513 Reviewed by: cperciva, nectar
* Move the AH algorithm list from a static local function variable torwatson2004-03-101-37/+38
| | | | | | | | | a static const global variable in ah_core.c. This makes it more clear that this array does not require synchronization, as well as synchronizing the layout to the ESP algorithm list. This is the version of my patch that Itojun committed to the KAME tree. Obtained from: me, via KAME
* move in6_addmulti()/in6_delmulti() into mld6.cume2004-03-042-90/+93
| | | | Obtained from: KAME
* missing splx().ume2004-03-041-1/+3
| | | | | Obtained from: KAME MFC after: 3 days
* - stlye and commentsume2004-03-031-15/+16
| | | | | | | - variable name change (scopeid -> zoneid) - u_short -> u_int16_t, u_char -> u_int8_t Obtained from: KAME
OpenPOWER on IntegriCloud