summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd/relay.c
AgeCommit message (Collapse)Author
2009-08-07rename 'struct session' to 'struct rsession' because it conflicts withReyk Floeter
another 'struct session' in sys/sysctl.h.
2009-06-07Change the way fds passed over a socket are retreived on the receiving side.Eric Faurot
Currently the receiver fetches an imsg via imsg_get() and if he expects an fd, he then calls imsg_get_fd() to fetch the next fd queued on the imsgbuf from which the imsg came. This changes hides the fd queueing mechanism to the API user. When closing an imsg with an fd, the message is flagged so that the receiving end knows it must dequeue the fd in imsg_get() and return it with the imsg structure. This way there is no (less) possible screw up from imsg_get_fd() not being called directly after imsg_get() by the user. The retreived imsg is self-contained. ok pyr@, "I like that" henning@
2009-06-054 handed diff with eric:Pierre-Yves Ritschard
Stop pushing event handling in the imsg framework. Instead, provide a small glue layer on top of both imsg and libevent. This finally clearly separates event handling and imsg construction. Sidetrack bonus: remove the mega-ugly hack of having a dummy imsg_event_add stub in relayctl. This will make bgpd (and thus henning) happy. Next up are smtpd and ospfd. ok eric@
2009-06-05some KNF cleanup following the last sed.Pierre-Yves Ritschard
2009-06-05Make imsg completely async model agnostic by not requiring anPierre-Yves Ritschard
imsg_event_add function to be provided (which ended up being a named callback). Instead provide a wrapper in the daemon and call that everywhere. Previsously discussed with the usual suspects, ok eric@ though not too happy about the function name (imsg_compose_event).
2009-06-02remove extra imsg_event_add() after EV_WRITE checks - this is notReyk Floeter
required because it is called later and there is no return before. ok gilles@
2009-06-02Libevent may do an upcall with both EV_READ and EV_WRITE set.Reyk Floeter
So change the code accordingly to allow that. Found by claudio@ in ospfd
2009-04-24don't truncate http headers when no separator is given between key andPierre-Yves Ritschard
value. ok & ``makes sense'' reyk@
2009-04-02add support to specify a ca file (eg. /etc/ssl/cert.pem) to verify sslReyk Floeter
server certificates when connecting as an SSL client from relays. it works so far, but needs more testing and is currently lacking support for certificate revocation (like CRL or OCSP). the file ssl_privsep.c is extended to implement more code that should be in openssl to allow loading the ca from chroot...
2009-04-01Add support for client-side SSL connections from relays. relayd canReyk Floeter
now sit between two SSL connections (Oitm - OpenBSD-in-the-middle), accept SSL connections and forward to TCP, accept TCP connections and forward to SSL, and do TCP to TCP of course. This was tested by some people a while ago.
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