summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd/relay.c
AgeCommit message (Collapse)Author
2008-09-29fix log option with filter rulesReyk Floeter
2008-09-29also log the label if available for the matching rule node (like theReyk Floeter
URL filter category etc.)
2008-09-29spacingReyk Floeter
2008-08-11more goto fail on gettimeofday errorReyk Floeter
2008-08-11better handling of HTTP POSTs or requests with Content-Length.Reyk Floeter
2008-08-11add missing 'break' to read HTTP content correctlyReyk Floeter
2008-08-08add a variable $SERVER_NAME which is "OpenBSD relayd" by default.Reyk Floeter
2008-08-08chunked encoding may include empty lines at random places, do notReyk Floeter
abort the session if we get an empty line except of the expected chunk header.
2008-08-08fix possible memleaks in chunked encoding handlerReyk Floeter
2008-08-08only dump all protocol nodes with DEBUG > 1.Reyk Floeter
2008-08-08Support HTTP responses that neither specify a Content-Length headerReyk Floeter
nor chunked encoding. We don't know the length of the HTTP body in this case, so it only works for single-pass HTTP responses without subsequent HTTP response headers in the stream. You can still enforce the Content-Length header with an "expect" rule. For example, this fixes response handling from undeadly.org (thttpd) if relayd is running as a transparent HTTP proxy.
2008-08-08Check gettimeofday() against -1; Add a missing error check in one place.Thordur I. Bjornsson
OK reyk@
2008-07-22Add dynamic IPv6-to-IPv4 and IPv4-to-IPv6 translation inspired byReyk Floeter
faithd(8) by doing a similar mapping of IPv4/6 addresses with relayd(8) and pf(4) redirections without the need of the faith(4) interface. The trick works in both directions, it can accept IPv6 connections and relay them to IPv4 hosts by extracting the last 4 octets from the IPv6 destination (like faithd(8)), and it can accept IPv4 connections and relay them to IPv6 hosts by prepending the 4 octets of the original IPv4 destination to a configured IPv6 prefix. An access list is not needed because the classification is done in pf.conf(5). It helps to get more faith in relayd. manpage bits ok jmc@ yes, sounds good todd@
2008-07-16relay_connect() may fail, close the session in the bindany callbackReyk Floeter
if it does.
2008-07-16use getsockname() to find out the local address of a connection beforeReyk Floeter
doing a nat lookup. this fixes nat lookups when the relay is listening to a wildcard IPv4/IPv6 address (like 0.0.0.0 or ::).
2008-07-09Use OpenBSD's knuth shuffle algorithm of random values from bind toReyk Floeter
produce the DNS request ids instead of a simple per-request arc4random(). This ensure randomness but also satisfies the non-repeating property we need. ok deraadt@
2008-07-09also set the protocol, either TCP or UDP, in the NAT lookup. thisReyk Floeter
unbreaks NAT lookups with UDP; tested as a transparent DNS relay.
2008-06-11add support for "transparent" forwarding in relays: normally the l7Reyk Floeter
relay will connect to the target host with its own ip address, but this mode will let it use the address of the client that is connecting from the other side. for example, there is no need to add the X-Forwarded-For HTTP headers for internal webservers in this mode anymore since they magically see the remote client ip address in the connection. it also allows to build fully-transparent ssl encapsulation for tcp sessions and many other things... based on an initial idea from dlg@ and pascoe@ (dlg's talk at opencon) using the new BINDANY and divert-reply interfaces from markus@ (since n2k8) ok markus@ pyr@
2008-05-08move the session keys used by dns in a protocol-specific private ptr.Reyk Floeter
2008-05-05Put relay sockets in non blocking mode too. This got forgotten along thePierre-Yves Ritschard
way and didn't show since our read buffers are small. ``put it in'' reyk@
2008-03-21better handling of chunked encoding, further fixes after extensive testingReyk Floeter
2008-03-20handle the case that the Content-Length HTTP header may be 0Reyk Floeter
2008-03-03improve the compare function of addresses respecting the ports; this will fixReyk Floeter
the tree lookups in some cases. From Nigel Taylor ok pyr@ deraadt@
2008-02-13bump copyrightReyk Floeter
2008-02-05Fix a debug printf. After the session members got a se_ prefix this oneThordur I. Bjornsson
was forgotten.
2008-02-04Move some prototypes from relay.c to relayd.h and remove there externsThordur I. Bjornsson
in other places; ok reyk@
2008-02-04Move the declaration of DPRINTF from relay.c too relayd.h so it can beThordur I. Bjornsson
reused; ok reyk@
2008-01-31add prefixes to names of structure elements to make it easier to grepThordur I. Bjornsson
for code, next struct session; ok reyk@;
2008-01-31add prefixes to names of structure elements to make it easier to grepReyk Floeter
for code, next struct relay. knf long line fixes will follow later. ok thib@
2008-01-31add prefixes to names of structure elements to make it easier to grepReyk Floeter
for code, start with struct relayd. finally. ok thib@
2007-12-08Rename everything which reffered to services refer to rdr for internalsPierre-Yves Ritschard
(for instance: rename struct service to struct rdr), refer to redirects otherwise (hoststatectl output). ok reyk@
2007-12-08some changes to the relayd.conf configuration language and grammar.Reyk Floeter
the tables will look more like pf tables, it is easier to re-use tables with different options, "services" will become "redirections" (they refer to rdr pf rules), sync configuration directives of redirect (l3, ex-service) relay (l7) sections (for example "virtual host" will become "listen on"), all target definitions will start with "forward to", etc. pp. (see relay.conf(5) and etc/relayd.conf) discussed with pyr and deraadt ok pyr@
2007-12-07hoststated gets renamed to relayd. easier to type, and actually saysReyk Floeter
what the daemon does - it is a relayer that pays attention to the status of pools of hosts; not a status checkers that happens to do some relaying
2007-11-28bump the current file descriptor resource limit (openfiles-cur) to theReyk Floeter
maximum number of file descriptors for this login class (openfiles-max) of the relay child processes. this will allow 1024 instead of just 128 open file descriptors in the default configuration (class daemon), use the openfiles-max capability and the sysctl kern.maxfiles to adjust the value. ok gilles@ pyr@
2007-11-28typosReyk Floeter
2007-11-26allow to add labels to protocol actions, they will be printed in httpReyk Floeter
error pages and can be used to refer to additional information. ok pyr@
2007-11-24tweak for hostnames without dots (like "localhost")Reyk Floeter
2007-11-24sort includes, adjust to style(9)Reyk Floeter
2007-11-24extend the url lookup algorithm to match the full URL and differentReyk Floeter
possible suffix/prefix combinations by stripping subdomains, path components, and the query args. ok and tested by gilles@
2007-11-24fix goto to jump to the right placeReyk Floeter
2007-11-23re-implement the "mark" action and document it in the manpage:Reyk Floeter
it is possible to attach a mark to a session based on matching an entity (header, url, cookie, ...) and add conditional action for this mark. it works a bit like the tag/tagged keywords in pf, but i decided to pick a different name to avoid confusion. ok pyr@ gilles@
2007-11-22Fix relay roundrobin mode to work correctly when multiple hosts in aReyk Floeter
table are down. Thanks to Preston Norvell at serialssolutions dot com for reporting the problem.
2007-11-22add (new) "url" protocol action, this can be used to match/filter URLReyk Floeter
suffix/prefix expressions like "example.com/index.html?args". a digest mode allows to match against anonymized SHA1/MD5 digests of suffix/prefix expressions.
2007-11-21move HTTP cookie and query lookup code from the into separate functionsReyk Floeter
(the if () else if () block was getting very big).
2007-11-21fix the tree comparison function. it turned out that it could failReyk Floeter
with large trees of protocol actions.
2007-11-21rename the "url" filter action to "query" to use the correct term.Reyk Floeter
please update your hoststated.conf configurations. also add more examples to the manpage. alright pyr@
2007-11-21more work on the "filter" action: close the connection instantly whenReyk Floeter
receiving a filtered entity, fix some remaining issues.
2007-11-20limit the number of displayed lines per node in relay_protodebug().Reyk Floeter
2007-11-20it may be desirable to send a HTTP error page with error code and aReyk Floeter
meaningful message if a HTTP/HTTPS relay closes the connection for some reason. for example, a "403 Forbidden" if the request was rejected by a filter. this will be enabled with the "return error" option and is disabled by default, the standard behaviour is to silently drop the connection; the browser may display an empty page in this case. the look+feel of the HTTP error page can be customized with a CSS style sheet, but we do not intend to allow customization of the error page contents (hoststated is not a webserver!). ok pyr@
2007-11-20another fix to handle "expect" and "filter" actions in the new styleReyk Floeter
correctly. ok pyr@