summaryrefslogtreecommitdiffstats
path: root/sys/netinet/raw_ip.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* revert "Retire kernel support for SO_DONTROUTE" diff, which does bad thingssthen2014-03-281-2/+2
| | | | for localhost connections. discussed with deraadt@
* Retire kernel support for SO_DONTROUTE, since the plan is to alwaysmpi2014-03-271-2/+2
| | | | | | | | 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@
* Switch inpt_queue from CIRCLEQ to TAILQ. Thus ending use of CIRCLEQkrw2013-12-201-2/+2
| | | | | | | in the base. Ports fixes to follow shortly for the two ports (gkrellm and net-snmp) affected. ok zhuk@ millert@
* Remove various external variable declaration from sources files andmpi2013-04-101-4/+2
| | | | | | | move them to the corresponding header with an appropriate comment if necessary. ok guenther@
* Use macros sotoinpcb() and intotcpcb() instead of casts. Use NULLbluhm2013-04-021-2/+2
| | | | | instead of 0 for pointers. No binary change. OK mpi@
* The call to in_pcballoc() in user request attach was handled inbluhm2013-03-311-3/+8
| | | | | | | | three different ways. Use the same code in udp_usrreq() and rip_usrreq() and rip6_usrreq(). This also fixes a pcb and socket leak in udp_usrreq() in case soreserve() fails. Put an splsoftassert() into in_pcballoc() for safety. OK mpi@
* Restrict protocol numbers for raw sockets to the range from 0 to 255.bluhm2013-03-301-1/+5
| | | | OK deraadt@ guenther@
* Add the IP_DIVERTFL socket option on divert(4) sockets to controlbenno2012-10-211-2/+36
| | | | | | which packets (as in direction) of the traffic will be diverted through the divert socket. ok claudio@, henning@
* remove IP_JUMBO, SO_JUMBO, and RTF_JUMBO.dlg2012-03-171-2/+2
| | | | no objection from mcbride@ krw@ markus@ deraadt@
* Fix to be able to bind a raw socket to 0.0.0.0. It had been broken afteryasuoka2011-07-041-6/+5
| | | | | | 1.54. ok claudio@ sosososo henning@
* Bye bye pf_test6(). Only one pf_test function for both IPv4 and v6.claudio2011-07-041-2/+2
| | | | | | 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
* Revert the pf->socket linking diff.oga2011-05-131-16/+1
| | | | | | | | | | | | | | | | | | | | | | | | | at least krw@, pirofti@ and todd@ have been seeing panics (todd and krw with xxxterm not sure about pirofti) involving pool corruption while using this commit. krw and todd confirm that this backout fixes the problem. ok blambert@ krw@, todd@ henning@ and kettenis@ Double link between pf states and sockets. Henning has already implemented half of it. The additional part is: - The pf state lookup for outgoing packets is optimized by using mbuf->inp->state. - For incomming tcp, udp, raw, raw6 packets the socket lookup always is optimized by using mbuf->state->inp. - All protocols establish the link for incomming packets. - All protocols set the inp in the mbuf for outgoing packets. This allows the linkage beginning with the first packet for outgoing connections. - In case of divert states, delete the state when the socket closes. Otherwise new connections could match on old states instead of being diverted to the listen socket. ok henning@
* Make in_broadcast() rdomain aware. Mostly mechanical change.claudio2011-04-281-2/+2
| | | | | | This fixes the problem of binding sockets to broadcast IPs in other rdomains. OK henning@
* Similar to the in_pcb.c change allow raw sockets to be bound to theclaudio2011-04-281-10/+11
| | | | | | local network boradcast. While there kill some leftover AF_IMPLINK checks. OK henning@, sthen@
* Double link between pf states and sockets. Henning has alreadybluhm2011-04-241-1/+16
| | | | | | | | | | | | | | | | implemented half of it. The additional part is: - The pf state lookup for outgoing packets is optimized by using mbuf->inp->state. - For incomming tcp, udp, raw, raw6 packets the socket lookup always is optimized by using mbuf->state->inp. - All protocols establish the link for incomming packets. - All protocols set the inp in the mbuf for outgoing packets. This allows the linkage beginning with the first packet for outgoing connections. - In case of divert states, delete the state when the socket closes. Otherwise new connections could match on old states instead of being diverted to the listen socket. ok henning@
* reintroduce using the RB tree for local address lookups. this isdlg2011-04-191-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | confusing because both addresses and broadcast addresses are put into the tree. there are two types of local address lookup. the first is when the socket layer wants a local address, the second is in ip_input when the kernel is figuring out the packet is for it to process or forward. ip_input considers local addresses and broadcast addresses as local, however, the handling of broadcast addresses is different depending on whether ip_directedbcast is set. if if ip_directbcast is unset then a packet coming in on any interface to any of the systems broadcast addresses is considered local, otherwise the broadcast packet must exist on the interface it was received on. the code also needs to consider classful broadcast addresses so we can continue some legacy applications (eg, netbooting old sparcs that use rarp and bootparam requests to classful broadcast addresses as per PR6382). this diff maintains that support, but restricts it to packets that are broadcast on the link layer (eg, ethernet broadcasted packets), and it only looks up addresses on the local interface. we now only support classful broadcast addresses on local interfaces to avoid weird side effects with packets routed to us. the ip4 socket layer does lookups for local addresses with a wrapper around the global address tree that rejects matches against broadcast addresses. we now no longer support bind sockets to broadcast addresses, no matter what the value of ip_directedbcast is. ok henning@ testing (and possibly ok) claudio@
* Backout the in_iawithaddr() -> ifa_ifwithaddr() change.claudio2011-04-141-2/+3
| | | | | There is a massive issue with broadcast addrs because ifa_ifwithaddr() handles them differently then in_iawithaddr().
* in_iawithaddr -> ifawithaddrhenning2011-04-041-3/+2
| | | | | | the latter is now much faster and the former becomes a wrapper + compat hacks around the latter in a bit. ok dlg sthen and "ah hai" from various in various bars here
* Don't attempt to enqueue mbufs on sockets marked as SS_CANTRCVMORE, asblambert2011-04-031-1/+3
| | | | | | was done earlier for routing sockets. ok claudio@
* Return EACCES when pf_test() blocks a packet in ip_output(). This allowsclaudio2010-09-081-4/+7
| | | | | | | | ip_forward() to know the difference between blocked packets and those that can't be forwarded (EHOSTUNREACH). Only in the latter case an ICMP should be sent. In the other callers of ip_output() change the error back to EHOSTUNREACH since userland may not expect EACCES on a sendto(). OK henning@, markus@
* Fix the naming of interfaces and variables for rdomains and rtablesguenther2010-07-031-4/+5
| | | | | | | | | | | | and make it possible to bind sockets (including listening sockets!) to rtables and not just rdomains. This changes the name of the system calls, socket option, and ioctl. After building with this you should remove the files /usr/share/man/cat2/[gs]etrdomain.0. Since this removes the existing [gs]etrdomain() system calls, the libc major is bumped. Written by claudio@, criticized^Wcritiqued by me
* rtables are stacked on rdomains (it is possible to have multiple routingclaudio2009-11-031-2/+2
| | | | | | | | | | | | | | tables on top of a rdomain) but until now our code was a crazy mix so that it was impossible to correctly use rtables in that case. Additionally pf(4) only knows about rtables and not about rdomains. This is especially bad when tracking (possibly conflicting) states in various domains. This diff fixes all or most of these issues. It adds a lookup function to get the rdomain id based on a rtable id. Makes pf understand rdomains and allows pf to move packets between rdomains (it is similar to NAT). Because pf states now track the rdomain id as well it is necessary to modify the pfsync wire format. So old and new systems will not sync up. A lot of help by dlg@, tested by sthen@, jsg@ and probably more OK dlg@, mpf@, deraadt@
* Initial support for routing domains. This allows to bind interfaces toclaudio2009-06-051-2/+10
| | | | | | | | | alternate routing table and separate them from other interfaces in distinct routing tables. The same network can now be used in any doamin at the same time without causing conflicts. This diff is mostly mechanical and adds the necessary rdomain checks accross net and netinet. L2 and IPv4 are mostly covered still missing pf and IPv6. input and tested by jsg@, phessler@ and reyk@. "put it in" deraadt@
* use the correct idiom for NFOO things which come from "foo.h" filesderaadt2008-10-231-2/+2
| | | | ok dlg
* Include "pf.h" so we get NPF.jsing2008-06-141-1/+3
| | | | ok reyk@
* Deal with the situation when TCP nfs mounts timeout and processesthib2008-05-231-2/+2
| | | | | | | | | | | | | get hung in nfs_reconnect() because they do not have the proper privilages to bind to a socket, by adding a struct proc * argument to sobind() (and the *_usrreq() routines, and finally in{6}_pcbbind) and do the sobind() with proc0 in nfs_connect. OK markus@, blambert@. "go ahead" deraadt@. Fixes an issue reported by bernd@ (Tested by bernd@). Fixes PR5135 too.
* Add SO_BINDANY socket option from BSD/OS.markus2008-05-091-2/+3
| | | | | | | | | The option allows a socket to be bound to addresses which are not local to the machine. In order to receive packets for these addresses SO_BINDANY needs to be combined with matching outgoing pf(4) divert rules, see pf.conf(5). ok beck@
* divert packets to local socket without modifying the ip header;markus2008-05-091-1/+12
| | | | makes transparent proxies much easier; ok beck@, feedback claudio@
* Make the SO_TIMESTAMP sockopt work. When set, this allows the user tockuethe2008-05-021-3/+5
| | | | | | | | | get a timestamp of when the datagram was accepted (by udp(4), for example) rather than having to take a timestamp with gettimeofday(2) when recv(2) returns - possibly several hundreds of microseconds later. May be of use to those interested in precision network timing schemes or QoS for media applications. Tested on alpha, amd64, i386 and sparc64. manpage suggestions from jmc, ok deraadt
* Remove unneeded branch, no need to check if opts is != NULL just set it toclaudio2006-11-251-3/+2
| | | | NULL in any case.
* Make savecontrol functions more generic and use them now for raw IP too.claudio2006-05-291-23/+28
| | | | | Additionally add the IP_RECVIF option which returns the interface a packet was received on. OK markus@ norby@
* Use more queue macros rather than doing it by hand; ok otto@ krw@miod2006-03-051-3/+3
|
* Experimental support for opportunitic use of jumbograms where only some hostsmcbride2005-05-271-2/+2
| | | | | | | | | | | | | | on the local network support them. This adds a new socket option, SO_JUMBO, and a new route flag, RTF_JUMBO. If _both_ the socket option is set and the route for the host has RTF_JUMBO set, ip_output will fragment the packet to the largest possible size for the link, ignoring the card's MTU. The semantics of this feature will be evolving rapidly; talk to us if you intend to use it. ok deraadt@ marius@
* Add kernel support for Protocol Independant Multicast (PIM)mcbride2005-01-141-1/+5
| | | | | | | | Information: http://netweb.usc.edu/pim/ From Pavlin Radoslavov <pavlin@icir.org> ok deraadt@ brad@
* allow ToS to be set on raw ip socketshenning2004-12-081-2/+2
| | | | | From: "Esben Norby (ST/LMD)" <esben.norby@ericsson.com> ok hshoexer markus millert
* use ttl from setsockopt(), similar to bsd/os; ok henning, mcbride, fgschmarkus2004-11-251-2/+2
|
* Multicast routing cleanup from Pavlin Radoslavovmcbride2004-11-241-3/+3
| | | | | | | | | | - sync ip_mroute.c with NetBSD - import some FreeBSD changes to MFC entry handling - set im->im_vif correctly when sending IGMPMSG_WRONGVIF - increment mrtstat.mrts_upcalls correctly - return error from get_sg_cnt() if there is no matching forwarding entry ok henning@ brad@ naddy@
* use CIRCLEQ* for pcb's; ok deraadt, henning, mcbride, with help from canacarmarkus2003-12-211-4/+2
|
* de-register. deraadt okitojun2003-12-101-11/+11
|
* do not flip ip_len/ip_off in netinet stack. deraadt ok.itojun2003-07-091-8/+6
| | | | (please test, especially PF portion)
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-021-6/+2
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* don't use M_WAIT here. we could be in splnet, and caller may not beitojun2003-05-271-2/+4
| | | | xx_usrreq. henning ok
* rip_output: make sure a full ip header is passed for INP_HDRINCL; ok deraadt@markus2003-02-151-1/+5
|
* whitespaceitojun2002-06-091-5/+5
|
* Kill #if __STDC__ used to do K&R vs. ANSI varargs/stdarg; just do thingsmillert2002-03-151-13/+1
| | | | the ANSI way.
* Remove unneeded ip_id convertions.fgsch2001-06-231-3/+2
| | | | | | Instead of using HTONS macro in some places, use htons directly in the struct member and save us a few bytes. Fix comment.
* Cut down on include files.angelos2001-06-081-6/+2
|
* repair copyright notices for NRL & cmetz; cmetzderaadt2001-06-051-14/+38
|
* Lots and lots of changes.angelos2000-09-191-6/+2
|
* disallow AF mismatch on inbound.itojun1999-12-191-1/+5
|