OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.48 / (download) - annotate - [select for diffs], Fri Jun 28 13:32:50 2019 UTC (4 years, 11 months ago) by deraadt
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, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, HEAD
Changes since 1.47: +2 -2 lines
Diff to previous 1.47 (colored)

When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.

Revision 1.47 / (download) - annotate - [select for diffs], Wed Jul 12 22:57:40 2017 UTC (6 years, 10 months ago) by jca
Branch: MAIN
CVS Tags: 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.46: +8 -7 lines
Diff to previous 1.46 (colored)

Consistently use the variable "ttl" for get/setsockopt

ok benno@ on an earlier version, input from Kapetanakis Giannis

Revision 1.46 / (download) - annotate - [select for diffs], Tue Jul 11 19:41:30 2017 UTC (6 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.45: +40 -13 lines
Diff to previous 1.45 (colored)

Correctly set ttl for IPv4 and IPv6.
Problem noted and fix from Kapetanakis Giannis, thanks!
Input & OK jca.

Revision 1.45 / (download) - annotate - [select for diffs], Sun May 28 10:39:15 2017 UTC (7 years ago) by benno
Branch: MAIN
Changes since 1.44: +3 -3 lines
Diff to previous 1.44 (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.44 / (download) - annotate - [select for diffs], Fri Sep 2 14:45:51 2016 UTC (7 years, 9 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.43: +4 -4 lines
Diff to previous 1.43 (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.43 / (download) - annotate - [select for diffs], Sat Nov 28 09:52:07 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.42: +2 -3 lines
Diff to previous 1.42 (colored)

Use SOCK_NONBLOCK in relayd as well.

OK benno@

Revision 1.42 / (download) - annotate - [select for diffs], Fri Oct 23 12:22:02 2015 UTC (8 years, 7 months ago) by benno
Branch: MAIN
Changes since 1.41: +8 -10 lines
Diff to previous 1.41 (colored)

let the icmp check use getsockopt IP_IPDEFTTL to get the default ttl
instead of using sysctl. makes it possible to pledge hce.

Revision 1.41 / (download) - annotate - [select for diffs], Fri Aug 21 08:45:51 2015 UTC (8 years, 9 months ago) by yasuoka
Branch: MAIN
Changes since 1.40: +5 -2 lines
Diff to previous 1.40 (colored)

Increase the input side socket buffer size for "check icmp" not to
drop the reply messages when "check icmp" is used with many hosts.

ok reyk benno

Revision 1.40 / (download) - annotate - [select for diffs], Thu Jan 22 17:42:09 2015 UTC (9 years, 4 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.39: +3 -5 lines
Diff to previous 1.39 (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.39 / (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.38: +1 -2 lines
Diff to previous 1.38 (colored)

Adapt to <limits.h> universe.
ok millert

Revision 1.38 / (download) - annotate - [select for diffs], Sun Dec 21 00:54:49 2014 UTC (9 years, 5 months ago) by guenther
Branch: MAIN
Changes since 1.37: +1 -2 lines
Diff to previous 1.37 (colored)

Stop pulling in <arpa/inet.h> or <arpa/nameser.h> when unnecessary.
*Do* pull it in when in_{port,addr}_h is needed and <netinet/in.h> isn't.

ok reyk@

Revision 1.37 / (download) - annotate - [select for diffs], Sat Oct 25 03:23:49 2014 UTC (9 years, 7 months ago) by lteo
Branch: MAIN
Changes since 1.36: +1 -2 lines
Diff to previous 1.36 (colored)

Remove unnecessary netinet/in_systm.h include.

ok millert@

Revision 1.36 / (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_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.35: +2 -3 lines
Diff to previous 1.35 (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.35 / (download) - annotate - [select for diffs], Tue Jan 29 15:04:42 2013 UTC (11 years, 4 months ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.34: +2 -2 lines
Diff to previous 1.34 (colored)

use correct function name in fatal error message

Revision 1.34 / (download) - annotate - [select for diffs], Thu Jan 17 20:34:18 2013 UTC (11 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.33: +3 -3 lines
Diff to previous 1.33 (colored)

Remove unnecessary pointer casts.  No binary diff.
OK benno@

Revision 1.31.6.1 / (download) - annotate - [select for diffs], Mon Nov 5 23:10:37 2012 UTC (11 years, 7 months ago) by sthen
Branch: OPENBSD_5_2
Changes since 1.31: +10 -7 lines
Diff to previous 1.31 (colored) next main 1.32 (colored)

MFC reyk's fix for relayd check icmp, ok benno@.
Reported as affecting 5.2 and diff tested by Andrew Klettke, thanks.

Revision 1.33 / (download) - annotate - [select for diffs], Wed Sep 19 09:49:24 2012 UTC (11 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.32: +9 -7 lines
Diff to previous 1.32 (colored)

Copy the host id value to the ICMP echo payload in network byte order and
in a nicer way that silences the compiler.

ok benno@

Revision 1.32 / (download) - annotate - [select for diffs], Wed Sep 19 09:47:00 2012 UTC (11 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.31: +2 -1 lines
Diff to previous 1.31 (colored)

Fix ICMP checks by setting the socklen correctly before calling recvfrom().

ok benno@

Revision 1.31 / (download) - annotate - [select for diffs], Mon May 9 12:08:47 2011 UTC (13 years, 1 month ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Branch point for: OPENBSD_5_2
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (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.30 / (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.29: +4 -4 lines
Diff to previous 1.29 (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.29 / (download) - annotate - [select for diffs], Fri Aug 14 15:31:23 2009 UTC (14 years, 9 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

do not timeout disabled hosts in the icmp checks

Thanks to Sebastian Benoit, closes pr6146

Revision 1.28 / (download) - annotate - [select for diffs], Fri Aug 7 11:32:54 2009 UTC (14 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.27: +14 -6 lines
Diff to previous 1.27 (colored)

get the default ttl via sysctl instead of using IPDEFTTL

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

allow to modify the IP TTL value for host checks.  this can be used to
check if the host is only n hops away and not re-routed over a longer
path.

Revision 1.26 / (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_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.25: +7 -7 lines
Diff to previous 1.25 (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.25 / (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.24: +2 -2 lines
Diff to previous 1.24 (colored)

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

OK reyk@

Revision 1.24 / (download) - annotate - [select for diffs], Sat Jul 19 10:52:32 2008 UTC (15 years, 10 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.23: +3 -2 lines
Diff to previous 1.23 (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.23 / (download) - annotate - [select for diffs], Thu Jan 31 09:33:39 2008 UTC (16 years, 4 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.22: +24 -24 lines
Diff to previous 1.22 (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.22 / (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.21: +7 -7 lines
Diff to previous 1.21 (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.21 / (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.20: +4 -3 lines
Diff to previous 1.20 (colored)

sort includes, adjust to style(9)

Revision 1.20 / (download) - annotate - [select for diffs], Tue Oct 9 05:38:58 2007 UTC (16 years, 8 months ago) by pyr
Branch: MAIN
Changes since 1.19: +4 -3 lines
Diff to previous 1.19 (colored)

Do not notify twice about the same timeout in check_icmp, this previously
corrupted statistics.
Found out by Piotr Sikora < piotr@sikora.nu >.

Revision 1.19 / (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.18: +2 -2 lines
Diff to previous 1.18 (colored)

Correct my mail address.

Revision 1.18 / (download) - annotate - [select for diffs], Mon Jul 16 21:15:36 2007 UTC (16 years, 10 months ago) by pyr
Branch: MAIN
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

typo
also found by Kevin Steves

Revision 1.17 / (download) - annotate - [select for diffs], Mon Jul 16 21:14:58 2007 UTC (16 years, 10 months ago) by pyr
Branch: MAIN
Changes since 1.16: +2 -3 lines
Diff to previous 1.16 (colored)

use fatal and not err, the message would get lost.
found by Kevin Steves <stevesk (at) pobox dot com>

Revision 1.16 / (download) - annotate - [select for diffs], Thu May 31 03:24:05 2007 UTC (17 years ago) by pyr
Branch: MAIN
Changes since 1.15: +4 -4 lines
Diff to previous 1.15 (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.15 / (download) - annotate - [select for diffs], Sun May 27 20:53:10 2007 UTC (17 years ago) by pyr
Branch: MAIN
Changes since 1.14: +17 -14 lines
Diff to previous 1.14 (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.14 / (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.13: +2 -2 lines
Diff to previous 1.13 (colored)

knf

Revision 1.13 / (download) - annotate - [select for diffs], Mon Feb 12 10:39:48 2007 UTC (17 years, 3 months ago) by pyr
Branch: MAIN
Changes since 1.12: +5 -3 lines
Diff to previous 1.12 (colored)

spacing

Revision 1.12 / (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.11: +3 -1 lines
Diff to previous 1.11 (colored)

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

Revision 1.11 / (download) - annotate - [select for diffs], Fri Jan 12 17:12:58 2007 UTC (17 years, 4 months ago) by pyr
Branch: MAIN
Changes since 1.10: +5 -3 lines
Diff to previous 1.10 (colored)

spacing

Revision 1.10 / (download) - annotate - [select for diffs], Thu Jan 11 18:05:08 2007 UTC (17 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.9: +173 -205 lines
Diff to previous 1.9 (colored)

use real async events for checks and improve the non-blocking socket
usage. also modify the check_icmp code to use non-blocking raw sockets
and merge the icmp4 and icmp6 functions. some other minor changes
while i'm here.

as discussed with pyr@ claudio@ deraadt@
ok pyr@

Revision 1.9 / (download) - annotate - [select for diffs], Tue Jan 9 03:32:56 2007 UTC (17 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.8: +14 -18 lines
Diff to previous 1.8 (colored)

use the correct buffer sizes.

(this code needs some more work to implement a better icmp handling,
but this will fix a serious bug for now)

Revision 1.8 / (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.7: +2 -2 lines
Diff to previous 1.7 (colored)

adapt to rename

Revision 1.7 / (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.6: +1 -2 lines
Diff to previous 1.6 (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.6 / (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.5: +2 -1 lines
Diff to previous 1.5 (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.5 / (download) - annotate - [select for diffs], Wed Jan 3 09:45:29 2007 UTC (17 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.4: +5 -5 lines
Diff to previous 1.4 (colored)

spacing

Revision 1.4 / (download) - annotate - [select for diffs], Mon Dec 25 19:05:41 2006 UTC (17 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.3: +7 -13 lines
Diff to previous 1.3 (colored)

fix the conversion from milliseconds to struct timeval, which uses
seconds (tv_sec) and microseconds (tv_usec), but the code assumed
seconds and milliseconds...

Revision 1.3 / (download) - annotate - [select for diffs], Mon Dec 25 18:12:14 2006 UTC (17 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.2: +264 -109 lines
Diff to previous 1.2 (colored)

partial rewrite of the check_* routines to use libevent everywhere
instead of nested select() calls and to handle the non-blocking
sockets properly.

From Pierre-Yves Ritschard (pyr at spootnik dot org)
(with a little help by me)

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

knf, add copyright and license for in_cksum() from ping.c

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.