1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-03 06:45:37 -08:00
Commit Graph

67 Commits

Author SHA1 Message Date
florian
ac6360cb39 Use getaddrinfo(3) to resolve hostnames / ip addresses.
OK dlg
2024-08-21 10:35:12 +00:00
deraadt
b7041c0781 For open/openat, if the flags parameter does not contain O_CREAT, the
3rd (variadic) mode_t parameter is irrelevant.  Many developers in the past
have passed mode_t (0, 044, 0644, or such), which might lead future people
to copy this broken idiom, and perhaps even believe this parameter has some
meaning or implication or application. Delete them all.
This comes out of a conversation where tb@ noticed that a strange (but
intentional) pledge behaviour is to always knock-out high-bits from
mode_t on a number of system calls as a safety factor, and his bewilderment
that this appeared to be happening against valid modes (at least visually),
but no sorry, they are all irrelevant junk.  They could all be 0xdeafbeef.
ok millert
2021-10-24 21:24:15 +00:00
krw
8552a089f0 Use pw->pw_dir when chroot'ing, not _PATH_VAREMPTY.
Brings various dhcp related daemons into line with
the common idiom.

ok florian@
2019-08-06 11:07:36 +00:00
mpi
44c85a19f1 Consistently spell "IPsec" in comments and debug outputs.
From Raf Czlonka, ok sthen@
2018-03-16 12:31:09 +00:00
reyk
2c3d0355d6 Don't stop logging to stderr when running in foreground with -d.
Pointed out by Kapetanakis Giannis
2017-07-05 11:11:56 +00:00
reyk
b2b4b45f71 constify pc_remote and pc_circuit
OK rzalamena@
2017-04-04 15:50:29 +00:00
rzalamena
f51f0ea748 Move the server struct to header file and make it compatible with IPv6.
ok reyk@
2017-03-16 09:17:20 +00:00
rzalamena
962cae8e7a Improve the interface and addresses discovery code and prepare to
receive IPv6 support.

ok reyk@
2017-03-15 14:31:49 +00:00
rzalamena
c28564c418 Remove some global variables that are not being used.
ok gsoares@, jca@
2017-03-14 09:21:26 +00:00
krw
d8cc3220c5 Eliminate pointless'%m' (a.k.a. hand rolled strerror()) by using fatal() and
log_warn(). Zap a couple of explicit 'syslog()' calls.
2017-02-13 22:49:38 +00:00
krw
4971ba0ea5 Adjust some long lines. 2017-02-13 22:05:35 +00:00
krw
986dbb4c4e Switch from old errwarn.c logging to shiny new log.[ch].
ok benno@
2017-02-13 19:15:39 +00:00
rzalamena
c4c35e14af Add dhcrelay(8) command-line option for replacing Relay Agent Information
on the incoming packets.

Man page tweaks from jmc@
ok reyk@
2016-12-16 18:38:39 +00:00
rzalamena
699fe67197 Unbreak the dhcrelay(8) support to run on enc(4) interfaces.
ok reyk@
2016-12-13 17:40:41 +00:00
rzalamena
2936f4ebb3 Unbreak the insertion of Relay Agent Information on layer 3 mode when
using the default values: use the right address for remote-id.

ok reyk@
2016-12-13 15:28:19 +00:00
rzalamena
12c372e5c3 Filter DHCP reply messages that were not meant for us by looking at the
gateway set. This happens mostly because we are watching a BPF socket.

Suggested by and ok jca@
2016-12-13 09:29:05 +00:00
jmc
bf61b05497 simplify previous; ok reyk 2016-12-13 06:55:32 +00:00
rzalamena
e4b4972171 Implement support for layer 2 relaying and add further Relay Agent
Information (RFC 3046) options. While at there change the naming of the
remote destination parameters: instead of "server" call it "destination".

ok reyk@
2016-12-12 15:41:05 +00:00
rzalamena
fa3d4f89ea Clean up function prototypes: use a single struct to hold all address
information instead of passing multiple different parameters. This also
prepares the dhcrelay code to receive new features, like: IPv6, layer 2
relaying.

ok jca@
2016-12-08 19:18:15 +00:00
rzalamena
a29cd94b79 Simplify get_interfaces function, make it return NULL if we didn't find
the interface and abort dhcrelay with a more friendly message when we
don't have an address configured in the interface.

ok jca@
2016-12-08 09:29:50 +00:00
patrick
b5f87b0636 DHCP requests can be relayed through multiple relays. Currently we
drop requests that have already been relayed.  To allow usage in the
middle of a chain, remove this check and only set giaddr if it has not
been set yet.  This giaddr will be used by the DHCP server to identify
which subnet the client is connected to.

RFC 1542 specifies that we should increase the hop counter every time
we relay a request.  If we receive a request whose hop counter exceeds
the value of 16 we must silently drop it.

ok jca@
2016-12-07 20:03:22 +00:00
patrick
99e009ca8d If the BROADCAST flag is set on a BOOTREPLY, the RFC specifies that
we SHOULD forward the packet not only as L3 broadcast, but also as
L2 broadcast.  Apparently that helps on older machines that can't
handle L2 unicast replies.

ok jca@
2016-12-07 19:51:48 +00:00
reyk
d3290b0ca7 pledge(2) dhcrelay with "stdio route". route is needed for interface ioctls.
OK rzalamena@
2016-12-07 16:41:17 +00:00
rzalamena
ffc715d7c9 Rename function discover_interfaces into get_interface and change its
prototype to be more useful.

ok reyk@
2016-12-07 13:19:18 +00:00
jca
ec8c174284 Exit early from rdaemon() is the passed fd is invalid.
fd == -1 check suggested by deraadt@, ok florian@
2016-09-26 17:15:19 +00:00
jca
7307f9fa4f Go in the background later, using rdaemon().
rdaemon() works like daemon(3) but requires its caller to pre-open
/dev/null.  This makes it possible to go in the background after
a chroot(2), allowing for more error checking.  The pattern is basically
- open /dev/null
- chroot
- privdrop
- rdaemon

"design" initialy discussed with semarie@ a while ago, ok dlg@
2016-09-15 16:16:03 +00:00
jca
f36a50976a Avoid double negations in tests.
ok krw@
2016-09-04 10:43:52 +00:00
guenther
579e3f2d03 Pull in <time.h> for one or more of gmtime, strftime, strptime, time,
timegm, and tzset

ok deraadt@
2016-08-27 01:26:22 +00:00
krw
f70ef60c9d Eliminate #include inside *.h files and include only needed headers in
each *.c file.

Inspired by mention of header silliness by Edgar Pettijohn and mmcc@
on tech@.
2016-02-07 00:49:28 +00:00
benno
abda2296a7 typo in comment
ok deraadt
2013-03-04 00:29:56 +00:00
dlg
66698dbc29 VMware PXE "ROMs" confuse the DHCP gateway address with the IP
gateway address. This is a problem if your DHCP relay is running
on something that's not your network gateway.

It is purely informational from the relay to the client so we can
safely clear it.

stupid vmware.

ok krw@ beck@
2013-01-15 23:45:03 +00:00
krw
cb1ed761c7 'ingnoring' -> 'ignoring' in a couple of note()'s. 2012-06-22 11:28:36 +00:00
mikeb
13ae2b572f Convert SO_RTABLE's protocol level to the SOL_SOCKET; ok claudio 2011-06-21 17:31:07 +00:00
guenther
8bb39f0859 Fix the naming of interfaces and variables for rdomains and rtables
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
2010-07-03 04:44:50 +00:00
claudio
b0e46094eb Pick up the rdomain from the specified interface and use that rdomain for
relaying the packets to the server. If you need to use cross-domain forwarding
us pf to bounce the packets back and forth.
sure deraadt@
2009-11-03 10:14:09 +00:00
reyk
4be048dca4 Add support for "DHCP-over-IPsec" by implementing RFC 3046 (DHCP Relay
Agent Information Option) and RFC 3456 (DHCP Configuration of IPsec
Tunnel Mode).  This allows to configure various IPsec clients
dynamically via DHCP; dhcrelay needs to listen on enc0 and forward
requests to a DHCP server that supports RFC 3046, like I recently did
for dhcpd(8).

ok krw@
2009-09-03 11:56:49 +00:00
sobrado
c8fc1e41e3 missing new-line character. 2008-07-09 20:08:13 +00:00
sobrado
0b52b90c51 documentation tweaks. 2008-07-09 19:41:56 +00:00
stevesk
9db3f50008 return on ECONNREFUSED so we don't fall through to 'result <
BOOTP_MIN_LEN' and display discarding message.

ok henning@ claudio@
2007-02-09 16:49:47 +00:00
stevesk
32f01720c6 warn() -> warning() to not overload with libc function; this has
previously been done to dhclient and dhcpd
2006-12-18 01:08:58 +00:00
stevesk
2b22138e29 no "\n" needed here; ok henning@ 2006-11-21 14:57:00 +00:00
deraadt
fd395675f8 pretty up print_hw_addr(), and even fix a teeny buffer overflow; ok otto 2005-11-13 20:25:59 +00:00
henning
604345c2f3 -endpwent 2005-05-23 22:54:34 +00:00
djm
3e7173e370 more setres[ug]id; ok deraadt@ 2005-05-02 02:29:26 +00:00
norby
27694b2935 Fixed a typo.
ok henning@ claudio@
2005-01-25 16:55:04 +00:00
claudio
c3d07ec0a3 Use a udp socket to communicate with the dhcp servers. The bpf interface
can't be used to forward the packets. Bpf would relay the packets to wrong
interface. Reports and tests by Hans Kremers and Colin Harford
OK henning@
2004-10-12 16:39:35 +00:00
jaredy
f80fea9b28 -p and -q are no more
ok deraadt
2004-08-15 23:24:14 +00:00
henning
e4a93d041c tzset 2004-05-12 10:41:08 +00:00
deraadt
7877d30c5c remove unused stuff; henning ok 2004-05-04 21:23:10 +00:00
henning
8e161d49a3 fix _dhcp use nonexistant error message here too 2004-04-21 01:46:35 +00:00