summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_output.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
|
* Replace INADDR_TO_IFP() by in_iawithaddr() and kill the macro.mpi2013-11-271-5/+11
| | | | ok mikeb@, ports@, henning@
* Don't let in_proto_cksum_out() assume that the ICMP checksum field islteo2013-10-251-9/+6
| | | | | | | | | | | always in the first mbuf of an mbuf chain. Thanks to henning@ and bluhm@ for their work on checksums at b2k13, which allowed this fix to be very straightforward compared to earlier versions. help/feedback bluhm@ henning@ OK henning@ naddy@
* no need to make the icmp cksum "offloading" case special insofar that thehenning2013-10-201-2/+1
| | | | | | cksum needs to be 0'd before, pf does that now (just like in the tcp/udp case) and nothing else uses the icmp "offloading" yet. with & ok bluhm
* make in_proto_cksum_out not rely on the pseudo header checksum to behenning2013-10-191-1/+20
| | | | | | | | | | already there, just compute it - it's dirt cheap. since that happens very late in ip_output, the rest of the stack doesn't have to care about checksums at all any more, if something needs to be checksummed, just set the flag on the pkthdr mbuf to indicate so. stop pre-computing the pseudo header checksum and incrementally updating it in the tcp and udp stacks. ok lteo florian
* Abstract the fact that IPv4 muticast records are linked to thempi2013-10-181-3/+3
| | | | | | | | | interface descriptor throught the first configured address in the global list, this will help reducing the size of future diffs. No object change. ok sthen@
* Change MTU discovery functions to not abuse the global icmpsrc variablempi2013-08-081-5/+2
| | | | | | to pass the destination address of the route to clone. ok markus@, mikeb@
* Make use of IFP_TO_IA() instead of rolling our own copy, no functionalmpi2013-08-081-8/+4
| | | | | | change. ok mikeb@, henning@
* Move bridge_broadcast and subsequently all IPsec SPD lookup code outmikeb2013-07-311-19/+1
| | | | | | | | of the IPL_NET. pf_test should be no longer called under IPL_NET as well. The problem became evident after the related issue was brought up by David Hill <dhill at mindcry ! org>. With input from and OK mpi. Tested by David and me.
* format string fixes: size_t and uint16_tsf2013-07-041-2/+2
| | | | ok bluhm@
* put the cksum diff back, of course with the bug fixed where we couldhenning2013-06-261-3/+3
| | | | | | | | | | | | | | | | | | | | | under some circumstances repair broken checksums on the way. ok ryan naddy mikeb . redo most of the protocol (tcp/udp/...) checksum handling -assume we have hardware checksum offloading. stop mucking with the checksum in most of the stack -stop checksum mucking in pf, just set a "needs checksumming" flag if needed -in all output pathes, very late, if we figure out the outbound interface doesn't have hw cksum offloading, do the cksum in software. this especially makes the bridge path behave like a regular output path -little special casing for bridge still required until the broadcast path loses its disgusting shortcut hacks, but at least it's in one place now and not all over the stack in6_proto_cksum_out mostly written by krw@ started at k2k11 in iceland more than 1.5 years ago - yes it took that long, this stuff is everything but easy. this happens to fix the infamous pf rdr bug that made us turn off proto cksum offloading on almost all interface drivers.
* Replace all ovbcopy with memmove; swap the src and dst arguments tooderaadt2013-06-111-6/+6
| | | | ok otto
* Calculate ICMP checksums with in4_cksum() which lets us get rid of thelteo2013-06-051-7/+4
| | | | | | | | | | | | | clunky m_data/m_len dance needed by in_cksum(). Tested on amd64, hppa, i386, loongson, macppc, sgi, and sparc64. Thanks to blambert@, bluhm@, and henning@ for help and feedback; abieber@ for testing this diff independently on macppc; krw@ for access to his hppa, sgi, and sparc64 test systems at t2k13; nick@ for helping me figure out Ken's hppa so that I can test this diff. :) ok blambert bluhm henning mikeb
* ansify.mpi2013-04-241-35/+9
| | | | | ok mikeb@, haesbaert@ jajaja miod@
* Remove the extern keyword from function declarations, documentmpi2013-04-111-9/+1
| | | | | | | sysctl declarations, move variables and functions used in only one place in their corresponding file. No functional change. No objection from markus@, ok mikeb@
* Remove various external variable declaration from sources files andmpi2013-04-101-3/+1
| | | | | | | move them to the corresponding header with an appropriate comment if necessary. ok guenther@
* Remove read-only ipsec variables and directly use defines instead.mpi2013-04-091-9/+5
| | | | ok mikeb@, markus@
* backout csum diff for the moment, requested by theohenning2012-11-061-3/+3
|
* Make sure that in[6]_proto_cksum_out() is called unconditinally and notclaudio2012-11-051-3/+3
| | | | | inside the NPF block. Fixes checksum issues seen on ramdisk kernels. Initial diff by naddy@, tested and OK by many
* redo most of the protocol (tcp/udp/...) checksum handlinghenning2012-11-011-3/+3
| | | | | | | | | | | | | | | | | | -assume we have hardware checksum offloading. stop mucking with the checksum in most of the stack -stop checksum mucking in pf, just set a "needs checksumming" flag if needed -in all output pathes, very late, if we figure out the outbound interface doesn't have hw cksum offloading, do the cksum in software. this especially makes the bridge path behave like a regular output path -little special casing for bridge still required until the broadcast path loses its disgusting shortcut hacks, but at least it's in one place now and not all over the stack in6_proto_cksum_out mostly written by krw@ started at k2k11 in iceland more than 1.5 years ago - yes it took that long, this stuff is everything but easy. this happens to fix the infamous pf rdr bug that made us turn off proto cksum offloading on almost all interface drivers. ok camield sthen claudio, testing by many, thanks!
* Point an interface directly to its bridgeport configuration, insteadcamield2012-10-051-6/+6
| | | | | | | | | | of to the bridge itself. This is ok, since an interface can only be part of one bridge, and the parent bridge is easy to find from the bridgeport. This way we can get rid of a lot of list walks, improving performance and shortening the code. ok henning stsp sthen reyk
* spltdb() was really just #define'd to be splsoftnet(); replace the formerblambert2012-09-201-6/+6
| | | | | | | | with the latter no change in md5 checksum of generated files ok claudio@ henning@
* add IP_IPSECFLOWINFO option to sendmsg() and recvmsg(), so npppd(4)markus2012-07-161-2/+12
| | | | | | | can use this to select the IPsec tunnel for sending L2TP packets. this fixes Windows (always binding to 1701) and Android clients (negotiating wildcard flows); feedback mpf@ and yasuoka@; ok henning@ and yasuoka@; ok jmc@ for the manpage
* unneccessary casts to unsigned; ok claudioderaadt2012-04-131-5/+5
|
* Bring the rtable sockopt code in line with the setrtable() implementation.claudio2012-04-071-8/+9
| | | | | While there change IP_RTABLE to SO_RTABLE. IP_RTABLE will die soon. With and OK guenther@
* actually store the result of the pmtu-route lookup. otherwise wemarkus2012-03-301-3/+2
| | | | | don't have a MTU to announce in the icmp need fragment packet. this fixes PMTU-discovery for TCP over IPsec; ok mpf@, fries@
* remove IP_JUMBO, SO_JUMBO, and RTF_JUMBO.dlg2012-03-171-9/+1
| | | | no objection from mcbride@ krw@ markus@ deraadt@
* Escape hardware-checksumming if interface is in a bridge, this ishaesbaert2011-12-291-4/+7
| | | | | | | | | | | | | | | | | | already done for UDP/TCP/ICMP. This fixes a problem where checksumming would not be computed if you have a bridge with at least one interface with hardware checksumming and another without. Discussed with sthen@ and henning@, this is somewhat a temporary fix, we should not have these special bridge cases in ip_output, as Henning said, the bridge must behave. But for that to work we need to poke the bridge harder, this problem has been seen by at least two users at: http://marc.info/?l=openbsd-misc&m=132391433319512&w=2 http://marc.info/?l=openbsd-misc&m=132234363030132&w=2 I promised to work on a better diff :-). ok henning@ sthen@ mikeb@
* Kill unused IFCAP_IPSEC and IFCAP_IPCOMP.haesbaert2011-12-021-5/+3
| | | | ok claudio@ henning@ mikeb@
* Bye bye pf_test6(). Only one pf_test function for both IPv4 and v6.claudio2011-07-041-3/+3
| | | | | | The functions were 95% identical anyway. While there use struct pf_addr in struct pf_divert instead of some union which is the same. OK bluhm@ mcbride@ and most probably henning@ as well
* Add IP_RECVRTABLE socket option to be used with a IPPROTO_IPmikeb2011-06-151-1/+9
| | | | | | | | level that allows one to retrieve the original routing domain of UDP datagrams diverted by the pf via "divert-to" with a recvmsg(2). ok claudio
* Do not allow traffic to be sent with a destination address in 0/8;weerd2011-05-281-1/+10
| | | | | | | | this is not allowed according to Stevens and RFCs 5735 and 1122. Suggestion to use ENETUNREACH from claudio. OK phessler@, claudio@
* recognize SO_RTABLE socket option at the SOL_SOCKET level;mikeb2011-05-021-2/+2
| | | | discussed with and ok claudio
* Make in_broadcast() rdomain aware. Mostly mechanical change.claudio2011-04-281-2/+3
| | | | | | This fixes the problem of binding sockets to broadcast IPs in other rdomains. OK henning@
* in_proto_csum_out: if M_ICMP_CSUM_OUT is set, do the icmp checksumhenning2011-04-051-1/+15
| | | | ok dlg fondue-kinda-ok claudio
* mechanic rename M_{TCP|UDP}V4_CSUM_OUT -> M_{TCP|UDP}_CSUM_OUThenning2011-04-051-7/+7
| | | | ok claudio krw
* de-guttenberg our stack a bithenning2011-04-041-31/+23
| | | | | we don't need 7 f***ing copies of the same code to do the protocol checksums (or not, depending on hw capabilities). claudio ok