summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_output.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Use rtisivalid(9) to check if the given (cached) route can be used.mpi2015-10-131-3/+3
| | | | | | | | | | | | | | | | | | Note that after calling rtalloc(9) we only check if a route has been returned or not and do not check for its validity. This cannot be improved without a massive refactoring. The kernel currently *do* use !RTF_UP route due to a mismatch between the value of ifp->if_link_state and the IFF_UP|IFF_RUNNING code. I'd explain the RTF_UP flag as follow: . If a cached route entry w/o RTF_UP is passed to ip{6,}_output(), . call rtalloc(9) to see if a better entry is present in the tree. This is enough to support MPATH and route cache invalidation. ok bluhm@
* easy size for free(); ok mpideraadt2015-10-071-2/+4
|
* Always increment rt_use inside rtalloc(9) instead of doing it in somempi2015-09-231-2/+1
| | | | | | specific places. ok claudio@, benno@
* There's no point in abstracting ifp->if_output() as long as pf_test()mpi2015-09-131-3/+3
| | | | | | needs to see lo0 in the output path. ok claudio@
* Get the default loopback interface pointer just after doing a routempi2015-09-131-2/+5
| | | | | | | | | lookup to ensure pf_test() is called with the same interface in the input annd output path for local traffic. Fix a regression reported by Heiko Zimmermann on bugs@, thanks! ok mikeb@, claudio@
* Stop overwriting the rt_ifp pointer of RTF_LOCAL routes with lo0ifp.mpi2015-09-121-7/+4
| | | | | | | | | Use instead the RTF_LOCAL flag to loop local traffic back to the corresponding protocol queue. With this change rt_ifp is now always the same as rt_ifa->ifa_ifp. ok claudio@
* Introduce if_input_local() a function to feed local traffic back tompi2015-09-121-2/+2
| | | | | | | | | | the protocol queues. It basically does what looutput() was doing but having a generic function will allow us to get rid of the loopback hack overwwritting the rt_ifp field of RTF_LOCAL routes. ok mikeb@, dlg@, claudio@
* Fix two cases where it was possible to call if_put with an uninitialized ifpclaudio2015-09-121-3/+3
| | | | Found by jsg@ with clang
* if_put() after if_get for ip_output. This became suddenly super trivial.claudio2015-09-111-2/+6
| | | | OK dlg@
* There is no need to do the route lookups twice just because of IPSec.claudio2015-09-111-114/+50
| | | | | Merge the two blocks into one that is executed before the IPSec tdb lookup. OK mpi@ which had a sent out a similar diff around 3 years ago.
* Revert (again!) the two uses of rtisvalid(9), they break NFS!mpi2015-09-031-17/+11
| | | | Found the hardway by naddy@
* Convert ip{,6}_output() (cached) route entry checks to rtisvalid(9).mpi2015-09-031-11/+17
| | | | | | | | | This introduces a behavior change as we now reject !RTF_UP routes to output packets. This stricter check exposed a bug in the setup of new routes and was the reason for the previous revert. This should be now fixed by r1.229 of sys/net/route.c . ok bluhm@
* Revert the two uses of rtisvalid(9) for the moment, it breaks dhclient(8)mpi2015-09-021-17/+11
| | | | | | | | configured networks on RAMDISK kernels. The problem is that the default route installed by dhclient(8) does not have the RTF_UP flag in this environement and rtisvalid(9) doesn't allow you to use a RTF_DOWN route.
* Convert ip{,6}_output() (cached) route entry checks to rtisvalid(9).mpi2015-09-011-11/+17
| | | | ok bluhm@
* `encif' should only be used under #ifdef NPF.mpi2015-08-311-2/+2
| | | | Reported by jsg@, ok deraadt@
* Kill IP_ROUTETOETHER.mpi2015-07-161-13/+4
| | | | | | | | | This pseudo-option is a hack to support return-rst on bridge(4). It passes Ethernet information via a "struct route" through ip_output(). "struct route" is slowly dying... ok claudio@, benno@
* m_freem() can handle NULL, do not check for this condition beforehands.deraadt2015-07-151-2/+2
| | | | ok stsp mpi
* Get rid of the undocumented & temporary* m_copy() macro added formpi2015-06-301-2/+2
| | | | | | | | compatibility with 4.3BSD in September 1989. *Pick your own definition for "temporary". ok bluhm@, claudio@, dlg@
* Store a unique ID, an interface index, rather than a pointer to thempi2015-06-161-2/+2
| | | | | | | | | | | | | | | receiving interface in the packet header of every mbuf. The interface pointer should now be retrieved when necessary with if_get(). If a NULL pointer is returned by if_get(), the interface has probably been destroy/removed and the mbuf should be freed. Such mechanism will simplify garbage collection of mbufs and limit problems with dangling ifp pointers. Tested by jmatthew@ and krw@, discussed with many. ok mikeb@, bluhm@, dlg@
* Replace a bunch of == 0 with == NULL in pointer tests. Nuke somekrw2015-06-071-11/+11
| | | | | | | annoying trailing, leading and embedded whitespace. No change to .o files. ok deraadt@
* remove PACKET_TAG_IPSEC_PENDING_TDB, it is never set; ok mikeb@markus2015-05-231-18/+3
|
* test mbuf pointers against NULL not 0jsg2015-05-131-6/+6
| | | | ok krw@ miod@
* Stubs and support code for NIC-enabled IPsec bite the dust.mikeb2015-04-171-16/+2
| | | | No objection from reyk@, OK markus, hshoexer
* remove unfinished/unused support for socket-attached ipsec-policiesmarkus2015-04-161-172/+1
| | | | ok mikeb
* Remove support for storing credentials and auth information in the kernel.mikeb2015-04-141-70/+1
| | | | | | | | | This code is largely unfinished and is not used for anything. The change leaves identities as only objects referenced by ipsec_ref structure and their handling requires some changes to support more advanced matching of IPsec connections. No objections from reyk and hshoexer, with and OK markus.
* Remove the "multicast_" prefix from the fields a multicast-only struct.mpi2014-12-171-11/+11
| | | | Prodded by claudio@ and mikeb@
* Use an interface index instead of a pointer for multicast options.mpi2014-12-171-11/+10
| | | | | | | | | | | | Output interface (port) selection for multicast traffic is not done via route lookups. Instead the output ifp is registred when setsockopt(2) is called with the IP{V6,}_MULTICAST_IF option. But since there is no mechanism to invalidate such pointer stored in a pcb when an interface is destroyed/removed, it might lead your kernel to fault. Prevent a fault upon resume reported by frantisek holop, thanks! ok mikeb@, claudio@
* Do not use a "struct route" when a "struct rtentry" is enough.mpi2014-12-081-15/+12
| | | | ok millert@, bluhm@
* Explicitly include <net/if_var.h> instead of pulling it in <net/if.h>.mpi2014-12-051-1/+2
| | | | ok mikeb@, krw@, bluhm@, tedu@
* sizes for simple free cases. sizeof(*) and one case where len is clear.tedu2014-11-201-11/+11
|
* Kill in_iawithaddr() and use ifa_ifwithaddr() directly.mpi2014-11-051-12/+24
| | | | | | | Note that ifa_ifwithaddr() might return a broadcast address, so if you don't want one make sure to filter them out. ok mikeb@
* Rename rtalloc1() into rtalloc(9) and convert its flags to only enablempi2014-11-011-4/+5
| | | | | | functionnality instead of a mix of enable/disable. ok bluhm@, jca@
* Use rtfree() instead of RTFREE(), NULLify some free'd route pointers andmpi2014-10-141-7/+7
| | | | | | kill the macro. ok mikeb@, henning@
* Check if the outgoing route is associated to a broadcast address insteadmpi2014-10-081-3/+3
| | | | | | of doing a lookup on all the addresses of the outgoing interface. ok henning@
* Kill rtalloc() and update rtalloc1() and rtalloc_mpath() to no longermpi2014-09-271-3/+5
| | | | | | rely on "struct route" that should die. ok claudio@
* Fewer <netinet/in_systm.h> !mpi2014-07-221-2/+1
|
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-10/+10
| | | | after discussions with beck deraadt kettenis.
* in_proto_cksum_out: zero the icmp cksum before going on so that we do nothenning2014-07-111-5/+10
| | | | | | | require the caller to do so. lteo needs that for divert soon, and is in line with tcp/udp and the general approach that the rest of the stack should not need to do anything regarding the cksums but setting the "needs it" flag. ok lteo
* ip_output() using varargs always struck me as bizarre, esp since it's onlyhenning2014-04-211-9/+2
| | | | | | ever used to pass on uint32 (for ipsec). stop that madness and just pass the uint32, 0 in all cases but the two that pass the ipsec flowinfo. ok deraadt reyk guenther
* move in_cksum_phdr from in.h (under #ifdef _KERNEL, at least) to ip_output.chenning2014-04-201-1/+26
| | | | | nothing except in_proto_cksum_out() uses it any more, and that's a good thing. was on tech for 3 months, discussed with many
* "struct pkthdr" holds a routing table ID, not a routing domain one.mpi2014-04-141-11/+11
| | | | | | | | | | | | | | Avoid the confusion by using an appropriate name for the variable. Note that since routing domain IDs are a subset of the set of routing table IDs, the following idiom is correct: rtableid = rdomain But to get the routing domain ID corresponding to a given routing table ID, you must call rtable_l2(9). claudio@ likes it, ok mikeb@
* Retire kernel support for SO_DONTROUTE, this time without breakingmpi2014-04-071-36/+4
| | | | | | | | | | | localhost connections. The plan is to always use the routing table for addresses and routes resolutions, so there is no future for an option that wants to bypass it. This option has never been implemented for IPv6 anyway, so let's just remove the IPv4 bits that you weren't aware of. Tested a least by lteo@, guenther@ and chrisz@, ok mikeb@, benno@
* revert "Retire kernel support for SO_DONTROUTE" diff, which does bad thingssthen2014-03-281-4/+36
| | | | for localhost connections. discussed with deraadt@
* Retire kernel support for SO_DONTROUTE, since the plan is to alwaysmpi2014-03-271-36/+4
| | | | | | | | use the routing table there's no future for an option that wants to bypass it. This option has never been implemented for IPv6 anyway, so let's just remove the IPv4 bits that you weren't aware of. Tested by florian@, man pages inputs from jmc@, ok benno@
* since the cksum rewrite the counters for hardware checksummed packetshenning2014-01-231-15/+16
| | | | | | | | | | are are lie, since the software engine emulates hardware offloading and that is later indistinguishable. so kill the hw cksummed counters. introduce software checksummed packet counters instead. tcp/udp handles ip & ipvshit, ip cksum covered, 6 has no ip layer cksum. as before we still have a miscounting bug for inbound with pf on, to be fixed in the next step. found by, prodding & ok naddy
* put the in{,6}_delayed_cksum() and in{,6}_proto_cksum_out() prototypesnaddy2014-01-231-1/+2
| | | | into consistent locations; ok henning@
* Do not clean the multicast records of an interface when it is destroyedmpi2014-01-211-3/+5
| | | | | | | | | | | (unplugged). Even if it makes no sense to keep them around if the interface is no more, we cannot safely remove them since pcb multicast options might keep a pointer to them. Fixes a user after free introduced by the multicast address linking rewrite and reported by Alexey Suslikov, thanks! ok claudio@
* bzero/bcmp -> memset/memcmp. ok matthewtedu2014-01-091-5/+5
|
* Change ip_output()'s non-optional arguments to be standard argumentsmatthew2013-12-171-17/+10
| | | | | | | | | | instead of variable arguments. Allows stricter type checking by the compiler at call sites and also saves a bit of code size on some platforms (e.g., ~200 bytes on amd64). ok mikeb
* ifp must be initialized in ip_setmoptions; from oga via mpi, ok mpimikeb2013-12-041-2/+2
|