OpenBSD CVS

CVS log for src/usr.sbin/relayd/pfe.c


[BACK] Up to [local] / src / usr.sbin / relayd

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.90 / (download) - annotate - [select for diffs], Mon Sep 14 11:30:25 2020 UTC (3 years, 8 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, HEAD
Changes since 1.89: +7 -4 lines
Diff to previous 1.89 (colored)

Rewrite the agentx code of relayd. This new framework should allow us
to add new objects easier if so desired and should handle a lot more
corner-cases.

This commit should also fix the following:
- On most (all) tables it omits the *Entry elements, making it not map to
  OPENBSD-RELAYD-MIB.txt.
- sstolen returns the size of the sockaddr_in{,6}, instead of the
  sin{,6}_addr resulting in garbage data to be put in the ip-field.
- relaydSessionPortIn and relaydSessionPortOut are swapped
- relaydSessions only uses relaydSessionIndex, while
  OPENBSD-RELAYD-MIB.txt says it should have 2 indices
- miscellaneous minor things related to the AGENTX-protocol, like wonky
  index handeling and returning NOSUCHINSTANCE where NOSUCHOBJECT
  should be returned, etc.

This commit does remove traps, but it's large enough as is and I intent
on adding it soon(tm). It also deprecates the snmp keyword in favour of
an agentx keyword. The snmp keyword is still available, but will be
removed in the future.

Tweaks and OK denis@ on the relayd parts
Tweaks and OK claudio@ on the agentx parts
"Get it in" deraadt@

Revision 1.89 / (download) - annotate - [select for diffs], Sun May 28 10:39:15 2017 UTC (7 years ago) by benno
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.88: +13 -15 lines
Diff to previous 1.88 (colored)

use __func__ in log messages. fix some whitespace while here.
From Hiltjo Posthuma hiltjo -AT codemadness -DOT- org, thanks!
ok florian, claudio

Revision 1.88 / (download) - annotate - [select for diffs], Tue Jan 24 10:49:14 2017 UTC (7 years, 4 months ago) by benno
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.87: +23 -2 lines
Diff to previous 1.87 (colored)

move the opening of /dev/pf from the parent process to the pfe process
where it is used.
Currently pf is opened on every reload, that will no longer be
possible in the future with pledged programms that do ioctls.
This prepares relayd for that change.

ok deraadt@, meinetwegen reyk@

Revision 1.87 / (download) - annotate - [select for diffs], Fri Sep 2 16:14:09 2016 UTC (7 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.86: +2 -3 lines
Diff to previous 1.86 (colored)

Move snmp options into struct relayd_config and delay start of the
snmp subsystem until the configuration is done.

OK benno@ claudio@

Revision 1.86 / (download) - annotate - [select for diffs], Fri Sep 2 14:45:51 2016 UTC (7 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.85: +13 -11 lines
Diff to previous 1.85 (colored)

Split "struct relayd" into two structs: "struct relayd" and "struct
relayd_config".  This way we can send all the relevant global
configuration to the children, not just the flags and the opts.

With input from and
OK claudio@ benno@

Revision 1.85 / (download) - annotate - [select for diffs], Fri Sep 2 12:12:51 2016 UTC (7 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.84: +5 -5 lines
Diff to previous 1.84 (colored)

As done in httpd, remove ps_ninstances and p_instance.

OK benno@ rzalamena@

Revision 1.84 / (download) - annotate - [select for diffs], Fri Sep 2 11:51:49 2016 UTC (7 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.83: +3 -3 lines
Diff to previous 1.83 (colored)

Terminate relayd using the socket status instead of watching SIGCHLD
or killing child processes. - Based on rzalamena@'s diff for httpd.

OK deraadt@ rzalamena@

Revision 1.83 / (download) - annotate - [select for diffs], Thu Dec 3 16:12:16 2015 UTC (8 years, 6 months ago) by benno
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.82: +3 -1 lines
Diff to previous 1.82 (colored)

quick removal of all host-related entries in the related relayd anchor
if the host fails the SLA check. patch from Brian S. Vangsgaard.
ok reyk@

Revision 1.82 / (download) - annotate - [select for diffs], Wed Dec 2 13:41:27 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.81: +14 -14 lines
Diff to previous 1.81 (colored)

In most cases we don't need all arguments of proc_compose*_imsg(),
so add a shortcut proc_compose*() that skips all of them.  Only use the
full argument list if needed.  The functions with full argument lists can
eventually be replaced with a nicer transaction-based approach later.

OK benno@

Revision 1.81 / (download) - annotate - [select for diffs], Sun Nov 29 01:20:33 2015 UTC (8 years, 6 months ago) by benno
Branch: MAIN
Changes since 1.80: +5 -1 lines
Diff to previous 1.80 (colored)

Use pledge("pf") in pfe.c.
Move getrtable() from pfe to parent process, since its in the way of
pledge.

ok deraadt@, feedback from reyk@ on previous version.

Revision 1.79.2.1 / (download) - annotate - [select for diffs], Sun Sep 20 11:20:16 2015 UTC (8 years, 8 months ago) by benno
Branch: OPENBSD_5_7
Changes since 1.79: +5 -2 lines
Diff to previous 1.79 (colored) next main 1.80 (colored)

maintainance diff for relayd
MFC the following changes

- Missing free(3) in error path (ssl.c,v 1.29)
- fix a memory leak. (pfe.c,v 1.80)
- allocate se_log evbuffer before loging errors with relay_close()
  (relay.c,v 1.192)
- fix a file descriptor leak in http protocol handling
  (relay.c,v 1.193 and relay_http.c,v 1.44)
- Fix obvious problems with relayd config reload
  (ca.c,v 1.13; config.c,v 1.25; parse.y,v 1.204;
  relayd.c,v 1.139; relayd.h,v 1.209)
- http protocol: you cannot append to the previous key-value before
  line three of a request (relay_http.c,v 1.45)
- fix a crash / use after free (relay.c,v 1.194; relay_http.c,v 1.46)
- fix a non safe use of TAILQ_FOREACH with TAILQ_REMOVE
  (relay_http.c,v 1.47)
- Plug a memory leak by simplifying kv_free() (relayd.c,v 1.141)
- Fix memory leak in error case (relay_http.c,v 1.48)
- track the connection state of a session and stops doing double
  opens in certain situations (relay.c,v 1.195; relay_http.c,v 1.49; relayd.h,v 1.210)
- coding style (relay.c,v 1.196; relay_http.c,v 1.50; relayd.h,v 1.212)

ok claudio@, sthen@ and feedback tedu@

Revision 1.80 / (download) - annotate - [select for diffs], Tue Apr 21 01:46:57 2015 UTC (9 years, 1 month ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.79: +5 -2 lines
Diff to previous 1.79 (colored)

fix a memory leak.  ok blambert@

Revision 1.79 / (download) - annotate - [select for diffs], Sun Feb 8 01:39:06 2015 UTC (9 years, 4 months ago) by blambert
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE
Branch point for: OPENBSD_5_7
Changes since 1.78: +4 -3 lines
Diff to previous 1.78 (colored)

move a log_warnx() to a DPRINTF, as it's information intended
for developers, not sysadmins

original diff from yasuoka@

Revision 1.78 / (download) - annotate - [select for diffs], Thu Jan 22 17:42:09 2015 UTC (9 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.77: +6 -12 lines
Diff to previous 1.77 (colored)

Clean up the relayd headers with help of include-what-you-use and some
manual review.  Based on common practice, relayd.h now includes the
necessary headers for itself.

OK benno@

Revision 1.77 / (download) - annotate - [select for diffs], Fri Jan 16 15:06:40 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.76: +1 -2 lines
Diff to previous 1.76 (colored)

Adapt to <limits.h> universe.
ok millert

Revision 1.76 / (download) - annotate - [select for diffs], Wed Nov 19 10:24:40 2014 UTC (9 years, 6 months ago) by blambert
Branch: MAIN
Changes since 1.75: +38 -2 lines
Diff to previous 1.75 (colored)

Support exporting relayd statistics via AgentX/snmpd

This should be equivalent to the statistics available
via the various relaydctl show commands

okay benno@ reyk@

Revision 1.75 / (download) - annotate - [select for diffs], Wed Jul 9 16:42:05 2014 UTC (9 years, 11 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.74: +1 -3 lines
Diff to previous 1.74 (colored)

Replace the protocol directives for HTTP with a new generic filtering
language.  The grammar is inspired by pf and allows to write versatile
last-matching filter rules in protocol sections starting with the
"pass", "block" or "match" keywords.  This work was started almost two
years ago and replaces large parts of relayd(8)'s HTTP and filtering
code.  The initial version reimplements and extends HTTP filtering,
but will be improved to support generic TCP and other protocols later.

With some testing, feedback, and help from benno@ and andre@.

OK benno@

Revision 1.74 / (download) - annotate - [select for diffs], Sun Mar 10 23:32:53 2013 UTC (11 years, 3 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.73: +2 -3 lines
Diff to previous 1.73 (colored)

This diff changes relayd to use the monotonic clock instead of
gettimeofday().  It was also bugging me for some time to have all
these checks of gettimeofday()'s return value: it should not fail.  So
this diff introduces a void getmonotime(struct timeval *tv) that calls
clock_gettime(CLOCK_MONOTONIC, &ts) and converts the output to a
struct timeval that can be used with the existing code and the
timeval-specific timer functions (timerclear, timersub, ...).  It does
not return a status but calls fatal() on error-that-should-not-happen.

ok sthen@ chris@

Revision 1.73 / (download) - annotate - [select for diffs], Wed Oct 3 08:33:31 2012 UTC (11 years, 8 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.72: +20 -23 lines
Diff to previous 1.72 (colored)

Support more than one relay backup table.  Instead of duplicating the
code for main and backup table all over the place, turn the relay
tables into a list attached to the relay.  This improves the code and
allows some other tricks with multiple tables later.

Revision 1.72 / (download) - annotate - [select for diffs], Sat Jan 21 13:40:48 2012 UTC (12 years, 4 months ago) by camield
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.71: +3 -1 lines
Diff to previous 1.71 (colored)

Only start the child processes after all of them reported to have loaded
the config.  Solves a race at startup time where processes can send status
messages about hosts that other processes don't know about yet.
(and have relayd abort with "desynchronized" or "invalid host id")

ok henning pyr deraadt
solves the problem ok from benno todd

Revision 1.71 / (download) - annotate - [select for diffs], Sat Nov 12 19:36:17 2011 UTC (12 years, 6 months ago) by camield
Branch: MAIN
Changes since 1.70: +4 -4 lines
Diff to previous 1.70 (colored)

fix function names in fatalx() messages

ok mikeb

Revision 1.70 / (download) - annotate - [select for diffs], Fri May 20 09:43:53 2011 UTC (13 years ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.69: +37 -46 lines
Diff to previous 1.69 (colored)

Concurrent calls of "relayctl show sessions" could crash relayd.  Fix
the show sessions handler by implementing it in an asynchronous way.

Closes PR 6509
ok pyr@

Revision 1.69 / (download) - annotate - [select for diffs], Thu May 19 08:56:49 2011 UTC (13 years ago) by reyk
Branch: MAIN
Changes since 1.68: +44 -86 lines
Diff to previous 1.68 (colored)

Fix reload support in relayd(8) by reimplementing large parts of the
daemon infrastructure. The previous design made it fairly hard to
reload the complex data structures, especially relays and protocols.
One of the reasons was that the privsep'd relayd processes had two
ways of getting their configuration: 1) from memory after forking from
the parent process and 2) and (partially) via imsgs after reload.  The
new implementation first forks the privsep'd children before the
parents loads the configuration and sends it via imsgs to them; so it
is only like 2) before.  It is based on an approach that I first
implemented for iked(8) and I also fixed many bugs in the code.

Thanks to many testers including dlg@ sthen@ phessler@
ok pyr@ dlg@ sthen@

Revision 1.68 / (download) - annotate - [select for diffs], Mon May 9 12:08:47 2011 UTC (13 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.67: +232 -465 lines
Diff to previous 1.67 (colored)

Reorganize the relayd code to use the proc.c privsep API/commodity
functions that are based on work for iked and smtpd.  This simplifies
the setup of privsep processes and moves some redundant and repeated
code to a single place - which is always good from a quality and
security point of view.  The relayd version of proc.c is different to
the current version in iked because it uses 1:N communications between
processes, eg. a single parent process is talking to many forked relay
children while iked only needs 1:1 communications.

ok sthen@ pyr@

Revision 1.67 / (download) - annotate - [select for diffs], Thu May 5 12:01:43 2011 UTC (13 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.66: +20 -20 lines
Diff to previous 1.66 (colored)

Update all logging and debug functions to use the __func__ macro
instead of static function names.  __func__ is C99 and perfectly fine
to use. It also avoids printing errors; for example if a statement
log_debug("foo:"..) was moved or copied from function foo() to bar()
and the log message was not updated...

Revision 1.66 / (download) - annotate - [select for diffs], Tue Nov 16 15:31:01 2010 UTC (13 years, 6 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.65: +15 -5 lines
Diff to previous 1.65 (colored)

Add support for enable/disable table when using relays instead of redirects.
From Patrik Lundin and Linus Widstromer.

ok reyk@

Revision 1.65 / (download) - annotate - [select for diffs], Sun Aug 1 22:18:35 2010 UTC (13 years, 10 months ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.64: +10 -1 lines
Diff to previous 1.64 (colored)

Allow fallback tables for relays, not just redirections.
Seems reasonable to jsg, ok phessler, no response from reyk or pyr

Revision 1.64 / (download) - annotate - [select for diffs], Fri May 14 11:13:36 2010 UTC (14 years ago) by reyk
Branch: MAIN
Changes since 1.63: +17 -9 lines
Diff to previous 1.63 (colored)

allocate all struct event's on the heap, it looks cleaner, feels better
and follows a suggestion in event.h.  also don't mix signal() and
signal_set()/signal_add().

ok jsg@ gilles@

Revision 1.63 / (download) - annotate - [select for diffs], Mon Aug 17 11:36:01 2009 UTC (14 years, 9 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.62: +25 -2 lines
Diff to previous 1.62 (colored)

also report routers and their host states in relayctl

ok pyr@, jmc@ for man bits

Revision 1.62 / (download) - annotate - [select for diffs], Thu Aug 13 13:51:21 2009 UTC (14 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.61: +10 -1 lines
Diff to previous 1.61 (colored)

add new 'router' functionality to dynamically add or remove routes
based on health check results, using the existing table syntax.  this
allows to maintain multiple (uplink) gateways to implement link
balancing or WAN link failover if no routing protocol or other
keepalive method is available.  works fine with or without
net.inet.ip.multipath enabled.

ok pyr@, jmc@ for manpages

Revision 1.61 / (download) - annotate - [select for diffs], Fri Aug 7 11:21:53 2009 UTC (14 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.60: +2 -2 lines
Diff to previous 1.60 (colored)

rename 'struct session' to 'struct rsession' because it conflicts with
another 'struct session' in sys/sysctl.h.

Revision 1.60 / (download) - annotate - [select for diffs], Fri Jun 5 23:39:51 2009 UTC (15 years ago) by pyr
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.59: +75 -66 lines
Diff to previous 1.59 (colored)

4 handed diff with eric:
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@

Revision 1.59 / (download) - annotate - [select for diffs], Fri Jun 5 00:20:50 2009 UTC (15 years ago) by pyr
Branch: MAIN
Changes since 1.58: +9 -9 lines
Diff to previous 1.58 (colored)

some KNF cleanup following the last sed.

Revision 1.58 / (download) - annotate - [select for diffs], Fri Jun 5 00:04:01 2009 UTC (15 years ago) by pyr
Branch: MAIN
Changes since 1.57: +24 -24 lines
Diff to previous 1.57 (colored)

Make imsg completely async model agnostic by not requiring an
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).

Revision 1.57 / (download) - annotate - [select for diffs], Tue Jun 2 12:24:16 2009 UTC (15 years ago) by reyk
Branch: MAIN
Changes since 1.56: +1 -7 lines
Diff to previous 1.56 (colored)

remove extra imsg_event_add() after EV_WRITE checks - this is not
required because it is called later and there is no return before.

ok gilles@

Revision 1.56 / (download) - annotate - [select for diffs], Tue Jun 2 11:33:06 2009 UTC (15 years ago) by reyk
Branch: MAIN
Changes since 1.55: +17 -19 lines
Diff to previous 1.55 (colored)

Libevent may do an upcall with both EV_READ and EV_WRITE set.
So change the code accordingly to allow that.

Found by claudio@ in ospfd

Revision 1.55 / (download) - annotate - [select for diffs], Fri Apr 17 09:47:06 2009 UTC (15 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.54: +7 -2 lines
Diff to previous 1.54 (colored)

keep the parent relations of hosts after reloading the configuration.

From Camiel Dobbelaar, closes PR 6066

Revision 1.54 / (download) - annotate - [select for diffs], Wed Apr 1 15:05:06 2009 UTC (15 years, 2 months ago) by reyk
Branch: MAIN
Changes since 1.53: +2 -1 lines
Diff to previous 1.53 (colored)

re-initialize tables after reload to handle new and changed tables.

From Pascal Lalonde, closes PR 6112

Revision 1.53 / (download) - annotate - [select for diffs], Fri Dec 5 16:37:55 2008 UTC (15 years, 6 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.52: +2 -1 lines
Diff to previous 1.52 (colored)

change the way relayd reports check results: instead of logging an
arbitrary string in debugging mode, it will store an error code
(HCE_*) for each host.  the error code can be translated to a string
(in log.c) for debugging but it will also be passed to relayctl via
the control socket.

from a user point of view, this will print a human-readable error
message in the "relayctl show hosts" output if a host is down because
the check failed.  the relayctl(8) manpage includes detailed
explanations of the error messages including mitigations for the
most-common problems.

ok jmc@ (manpages)
ok phessler@

Revision 1.52 / (download) - annotate - [select for diffs], Wed Sep 3 13:41:49 2008 UTC (15 years, 9 months ago) by jsg
Branch: MAIN
Changes since 1.51: +2 -1 lines
Diff to previous 1.51 (colored)

Missing breaks.
ok pyr@

Revision 1.51 / (download) - annotate - [select for diffs], Fri Aug 8 08:51:21 2008 UTC (15 years, 10 months ago) by thib
Branch: MAIN
Changes since 1.50: +2 -2 lines
Diff to previous 1.50 (colored)

Check gettimeofday() against -1; Add a missing error check in one place.

OK reyk@

Revision 1.50 / (download) - annotate - [select for diffs], Sat Jul 19 11:38:54 2008 UTC (15 years, 10 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.49: +11 -11 lines
Diff to previous 1.49 (colored)

no need for using a TAILQ queue for the host children list, use a
singly-linked SLIST instead.  the only noticeable change is the
reversed order to notify the children but it does not really matter
here.  also only walk through the children host list if the host
itself is a potential parent.

Revision 1.49 / (download) - annotate - [select for diffs], Sat Jul 19 10:52:32 2008 UTC (15 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.48: +35 -19 lines
Diff to previous 1.48 (colored)

If the new 'parent' keyword is specified for a host in a table,
inherit the state from another host with the specified Id; no
additional check will be for the inheriting host.  This helps in
scenarios with lots of IP aliases that all point to the same service
on the same host (like web hosting with many SSL domains).

discussed with pyr, tested in different setups

Revision 1.48 / (download) - annotate - [select for diffs], Thu Jan 31 09:56:28 2008 UTC (16 years, 4 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.47: +10 -10 lines
Diff to previous 1.47 (colored)

add prefixes to names of structure elements to make it easier to grep
for code, next struct relay.  knf long line fixes will follow later.

ok thib@

Revision 1.47 / (download) - annotate - [select for diffs], Thu Jan 31 09:33:39 2008 UTC (16 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.46: +41 -41 lines
Diff to previous 1.46 (colored)

add prefixes to names of structure elements to make it easier to grep
for code, start with struct relayd.  finally.

ok thib@

Revision 1.46 / (download) - annotate - [select for diffs], Thu Dec 20 20:15:43 2007 UTC (16 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.45: +64 -3 lines
Diff to previous 1.45 (colored)

implement statistics for redirections, like the existing statistics
for relays.  they can be viewed with the new "relayctl show redirects"
command.

(uses the previous change to pf_table.c to get the statistics)

looks good pyr@

Revision 1.45 / (download) - annotate - [select for diffs], Sat Dec 8 20:36:36 2007 UTC (16 years, 6 months ago) by pyr
Branch: MAIN
Changes since 1.44: +92 -92 lines
Diff to previous 1.44 (colored)

Rename everything which reffered to services refer to rdr for internals
(for instance: rename struct service to struct rdr), refer to redirects
otherwise (hoststatectl output).
ok reyk@

Revision 1.44 / (download) - annotate - [select for diffs], Fri Dec 7 17:17:00 2007 UTC (16 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.43: +8 -8 lines
Diff to previous 1.43 (colored)

hoststated gets renamed to relayd.  easier to type, and actually says
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

Revision 1.43 / (download) - annotate - [select for diffs], Sat Nov 24 17:07:28 2007 UTC (16 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.42: +3 -3 lines
Diff to previous 1.42 (colored)

sort includes, adjust to style(9)

Revision 1.42 / (download) - annotate - [select for diffs], Mon Nov 19 15:31:36 2007 UTC (16 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.41: +4 -4 lines
Diff to previous 1.41 (colored)

spacing

Revision 1.41 / (download) - annotate - [select for diffs], Thu Nov 15 17:02:01 2007 UTC (16 years, 6 months ago) by pyr
Branch: MAIN
Changes since 1.40: +7 -2 lines
Diff to previous 1.40 (colored)

Do not insert proto_default inside the dynamically alloced protocol queue.
Handle it as a special case in the one place where it actually matters
instead.

Revision 1.40 / (download) - annotate - [select for diffs], Wed Nov 14 15:25:26 2007 UTC (16 years, 6 months ago) by pyr
Branch: MAIN
Changes since 1.39: +7 -2 lines
Diff to previous 1.39 (colored)

do go through relays when none exist.

Revision 1.39 / (download) - annotate - [select for diffs], Tue Oct 30 21:04:45 2007 UTC (16 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.38: +8 -10 lines
Diff to previous 1.38 (colored)

untangle a mess in the state update logic

Revision 1.38 / (download) - annotate - [select for diffs], Fri Oct 19 14:15:14 2007 UTC (16 years, 7 months ago) by pyr
Branch: MAIN
Changes since 1.37: +2 -2 lines
Diff to previous 1.37 (colored)

Move relays from static TAILQs to allocated ones.
This syncs it with other hoststated entities and will make reload easier.
This is step 1 out of 7 for reload.

Revision 1.37 / (download) - annotate - [select for diffs], Fri Oct 19 12:08:55 2007 UTC (16 years, 7 months ago) by pyr
Branch: MAIN
Changes since 1.36: +2 -2 lines
Diff to previous 1.36 (colored)

Add the ability to schedule an immediate check through hoststatectl.
Especially useful when interval is rather long.
I was supposed to commit this before 4.2.

Revision 1.36 / (download) - annotate - [select for diffs], Fri Sep 28 13:29:56 2007 UTC (16 years, 8 months ago) by pyr
Branch: MAIN
Changes since 1.35: +2 -2 lines
Diff to previous 1.35 (colored)

Correct my mail address.

Revision 1.35 / (download) - annotate - [select for diffs], Thu Sep 27 07:32:50 2007 UTC (16 years, 8 months ago) by pyr
Branch: MAIN
Changes since 1.34: +9 -4 lines
Diff to previous 1.34 (colored)

Do not clear the changed flag to early, which prevented a table
from being used by several services.
``looks fine'' reyk@

Revision 1.34 / (download) - annotate - [select for diffs], Fri Sep 7 08:20:24 2007 UTC (16 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.33: +53 -1 lines
Diff to previous 1.33 (colored)

add an interface to dump running relay sessions to the control socket

Revision 1.33 / (download) - annotate - [select for diffs], Tue Jun 19 13:06:00 2007 UTC (16 years, 11 months ago) by pyr
Branch: MAIN
Changes since 1.32: +2 -7 lines
Diff to previous 1.32 (colored)

don't go through the effort of creating a SIGHUP handler through
libevent just to ignore it, use SIG_IGN instead.
this syncs hoststated with bgpd and (soon) ospfd.

Revision 1.32 / (download) - annotate - [select for diffs], Tue Jun 19 06:29:20 2007 UTC (16 years, 11 months ago) by pyr
Branch: MAIN
Changes since 1.31: +19 -7 lines
Diff to previous 1.31 (colored)

Do not fatal out with ``pipe closed'' when a short read occurs on one
of our socket pairs. Instead disable listening on the pipe, terminate the
event loop, and let the parent process's SIGCHLD handler do a clean
shutdown.

from an ospfd diff by claudio, ok claudio@

Revision 1.31 / (download) - annotate - [select for diffs], Tue Jun 12 15:16:10 2007 UTC (17 years ago) by msf
Branch: MAIN
Changes since 1.30: +21 -20 lines
Diff to previous 1.30 (colored)

put the fd passing from bgpd back in to hoststated's version of imsg,
needed for layer 7 reload support.

ok pyr@

Revision 1.30 / (download) - annotate - [select for diffs], Thu Jun 7 07:19:50 2007 UTC (17 years ago) by pyr
Branch: MAIN
Changes since 1.29: +78 -1 lines
Diff to previous 1.29 (colored)

(finally) Enable reload support for layer 3 configurations.
Hoststated can be reloaded either by sending SIGHUP to the parent process
or by using ``hoststatectl reload''
discussed and ok reyk@

Revision 1.29 / (download) - annotate - [select for diffs], Thu May 31 18:24:02 2007 UTC (17 years ago) by pyr
Branch: MAIN
Changes since 1.28: +4 -7 lines
Diff to previous 1.28 (colored)

simplify pfe_disable_events

Revision 1.28 / (download) - annotate - [select for diffs], Thu May 31 15:49:26 2007 UTC (17 years ago) by pyr
Branch: MAIN
Changes since 1.27: +47 -16 lines
Diff to previous 1.27 (colored)

split pfe's event registration in separate functions (like for hce)

Revision 1.27 / (download) - annotate - [select for diffs], Thu May 31 03:24:05 2007 UTC (17 years ago) by pyr
Branch: MAIN
Changes since 1.26: +4 -4 lines
Diff to previous 1.26 (colored)

allocate table lists and service lists instead of using static structs.
split the code to start the event loop in two functions.
introduce merge_config which will be used later on.

Revision 1.26 / (download) - annotate - [select for diffs], Tue May 29 23:42:15 2007 UTC (17 years ago) by pyr
Branch: MAIN
Changes since 1.25: +2 -1 lines
Diff to previous 1.25 (colored)

when the time comes, let pfe_dispatch_parent be able to service more
than one message.

Revision 1.25 / (download) - annotate - [select for diffs], Tue May 29 23:19:18 2007 UTC (17 years ago) by pyr
Branch: MAIN
Changes since 1.24: +2 -2 lines
Diff to previous 1.24 (colored)

allow the control handling code to send messages back to the parent.
forward IMSG_CTL_RELOAD which ends up not doing anything for now.

Revision 1.24 / (download) - annotate - [select for diffs], Mon May 28 22:11:33 2007 UTC (17 years ago) by pyr
Branch: MAIN
Changes since 1.23: +2 -1 lines
Diff to previous 1.23 (colored)

another small step towards hoststated reloading.
allow purging of parts of the hoststated environment structure.
start using this function now to only keep vital information in
hoststated children processes.

ok reyk@

Revision 1.23 / (download) - annotate - [select for diffs], Sun May 27 20:53:10 2007 UTC (17 years ago) by pyr
Branch: MAIN
Changes since 1.22: +80 -75 lines
Diff to previous 1.22 (colored)

Second step towards hoststated reload:
First split out hosts, tables and services into to structs, one that
contains the runtime fields and one (inside the runtime) that contains
mostly static fields that will be sent over the socket during reload.

Also move the demoted field of tables inside the flags field as its
just a boolean.
ok reyk@

Revision 1.22 / (download) - annotate - [select for diffs], Sat May 26 19:58:49 2007 UTC (17 years ago) by pyr
Branch: MAIN
Changes since 1.21: +6 -5 lines
Diff to previous 1.21 (colored)

first steps for implementing reload:
	* make parse_config allocate the hoststated function by itself
	* make as many sockets as necessary to talk to the relay children
	* add send_all for talking to all children
with advise and ok reyk@

Revision 1.21 / (download) - annotate - [select for diffs], Wed May 9 13:05:42 2007 UTC (17 years, 1 month ago) by pyr
Branch: MAIN
Changes since 1.20: +7 -7 lines
Diff to previous 1.20 (colored)

fix potential NULL deref.
spotted by Ching-Feng Wang <cfw at telepaq.com>.
ok reyk@

Revision 1.20 / (download) - annotate - [select for diffs], Sat Mar 17 22:46:41 2007 UTC (17 years, 2 months ago) by reyk
Branch: MAIN
Changes since 1.19: +10 -5 lines
Diff to previous 1.19 (colored)

fix a bug in the initial setup of the pfe2relay communication sockets
which prevented the pfe to accept statistics updates and natlookups
from any other process then the first one. in other words, this will
show you the total relay statistics off _all_ preforked processes
(hoststatectl show relays) and it will unbreak the natlookup mode with
more than one running relay process.

Revision 1.19 / (download) - annotate - [select for diffs], Wed Mar 7 17:40:32 2007 UTC (17 years, 3 months ago) by reyk
Branch: MAIN
Changes since 1.18: +22 -2 lines
Diff to previous 1.18 (colored)

- fix the hoststatectl host disable/enable commands to work with relay
layer 7 loadbalancing.
- allow to run relays with tables without depending on services
- show hosts and tables assigned to relays in hoststatectl show commands

ok pyr@ deraadt@ with some input from mcbride@

Revision 1.18 / (download) - annotate - [select for diffs], Mon Feb 26 16:10:24 2007 UTC (17 years, 3 months ago) by reyk
Branch: MAIN
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

handle strlcpy return values, make lint happy

Revision 1.17 / (download) - annotate - [select for diffs], Fri Feb 23 00:28:06 2007 UTC (17 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

knf

Revision 1.16 / (download) - annotate - [select for diffs], Thu Feb 22 05:58:06 2007 UTC (17 years, 3 months ago) by reyk
Branch: MAIN
Changes since 1.15: +7 -6 lines
Diff to previous 1.15 (colored)

spacing

Revision 1.15 / (download) - annotate - [select for diffs], Thu Feb 22 03:32:39 2007 UTC (17 years, 3 months ago) by reyk
Branch: MAIN
Changes since 1.14: +149 -10 lines
Diff to previous 1.14 (colored)

Add layer 7 functionality to hoststated used for layer 7
loadbalancing, SSL acceleration, general-purpose TCP relaying, and
transparent proxying.

see hoststated.conf(5) and my upcoming article on undeadly.org for
details.

ok to commit deraadt@ pyr@

Revision 1.14 / (download) - annotate - [select for diffs], Thu Feb 8 13:32:24 2007 UTC (17 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.13: +4 -2 lines
Diff to previous 1.13 (colored)

carefully check some return values and make lint happier.  never pass
any truncated strings (table names/anchors/tags/...) to pf and the
kernel.

ok pyr@

Revision 1.13 / (download) - annotate - [select for diffs], Tue Feb 6 11:21:35 2007 UTC (17 years, 4 months ago) by pyr
Branch: MAIN
Changes since 1.12: +3 -1 lines
Diff to previous 1.12 (colored)

fix a bug when enabling a service that has no backup table.
ok reyk@

Revision 1.12 / (download) - annotate - [select for diffs], Tue Feb 6 08:46:31 2007 UTC (17 years, 4 months ago) by pyr
Branch: MAIN
Changes since 1.11: +1 -3 lines
Diff to previous 1.11 (colored)

remove an unused variable.
ok reyk@

Revision 1.11 / (download) - annotate - [select for diffs], Tue Feb 6 08:45:46 2007 UTC (17 years, 4 months ago) by pyr
Branch: MAIN
Changes since 1.10: +22 -2 lines
Diff to previous 1.10 (colored)

inform hoststatectl monitor of ruleset changes and table syncs.
ok reyk@

Revision 1.10 / (download) - annotate - [select for diffs], Thu Feb 1 20:03:39 2007 UTC (17 years, 4 months ago) by pyr
Branch: MAIN
Changes since 1.9: +8 -1 lines
Diff to previous 1.9 (colored)

add a monitor mode to hoststatectl to continuously report changes in
hoststated.
ok reyk@, "looks nice and clean" niallo@

Revision 1.9 / (download) - annotate - [select for diffs], Mon Jan 29 14:23:31 2007 UTC (17 years, 4 months ago) by pyr
Branch: MAIN
Changes since 1.8: +3 -1 lines
Diff to previous 1.8 (colored)

Add SSL support to hoststated.
with help and OK reyk@
with help and advice by claudio@ and Srebrenko Sehic

Revision 1.8 / (download) - annotate - [select for diffs], Wed Jan 24 10:26:00 2007 UTC (17 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.7: +2 -1 lines
Diff to previous 1.7 (colored)

Similar to ospfd and ripd ignore SIGPIPE in all processes to be able to do
a nice exit in case one of the processes dies. OK pyr@

Revision 1.7 / (download) - annotate - [select for diffs], Tue Jan 9 13:50:11 2007 UTC (17 years, 5 months ago) by pyr
Branch: MAIN
Changes since 1.6: +5 -5 lines
Diff to previous 1.6 (colored)

Finish renaming hostated to hoststated.
Note to testers: the user the daemon changes its id to is now _hoststated,
don't forget to update master.passwd.
ok reyk@

Revision 1.6 / (download) - annotate - [select for diffs], Tue Jan 9 00:45:32 2007 UTC (17 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored)

adapt to rename

Revision 1.5 / (download) - annotate - [select for diffs], Mon Jan 8 20:46:18 2007 UTC (17 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.4: +1 -2 lines
Diff to previous 1.4 (colored)

do NOT use the regexp interface. it is way to complicated, error-prone
and we don't know about all the possible security problems.

change the check send/expect code to use the fnmatch(3) interface
using shell globbing rules instead. this allows simple patterns like
"220 * ESMTP*" or "SSH-[12].??-*".

suggested by deraadt@ and otto@
ok Pierre-Yves Ritschard (pyr at spootnik dot org)

Revision 1.4 / (download) - annotate - [select for diffs], Mon Jan 8 13:37:26 2007 UTC (17 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.3: +2 -1 lines
Diff to previous 1.3 (colored)

add a generic send/expect check using regular expression (see
regex(3)).  this allows to define additional checks for other TCP
protocols.

From Pierre-Yves Ritschard (pyr at spootnik dot org)

Revision 1.3 / (download) - annotate - [select for diffs], Sat Dec 16 18:50:33 2006 UTC (17 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.2: +53 -23 lines
Diff to previous 1.2 (colored)

- allow to use host/service/table names instead of Ids in hostatectl.
- minor change of the "hostatectl show" command output
- increase the max service and tag names (max pf tag name size is 64 now!)

thanks to pyr who found a bug in my initial diff

Revision 1.2 / (download) - annotate - [select for diffs], Sat Dec 16 12:42:14 2006 UTC (17 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.1: +47 -47 lines
Diff to previous 1.1 (colored)

knf, spacing

please note that some editors will replace tabs with multiple spaces
if you cut & paste code from other sections.  please try to keep the
tabs ;).

Revision 1.1 / (download) - annotate - [select for diffs], Sat Dec 16 11:45:07 2006 UTC (17 years, 5 months ago) by reyk
Branch: MAIN

Import hostated, the host status daemon.  This daemon will monitor
remote hosts and dynamically alter pf(4) tables and redirection rules
for active server load balancing.  The daemon has been written by
Pierre-Yves Ritschard (pyr at spootnik.org) and was formerly known as
"slbd".

The daemon is fully functional but it still needs some work and
cleanup so we don't link it to the build yet.  Some TODOs are a
partial rewrite of the check_* routines (use libevent whenever we
can), improvement of the manpages, and general knf and cleanup.

ok deraadt@ claudio@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.