summaryrefslogtreecommitdiff
path: root/usr.sbin/dhcrelay
AgeCommit message (Collapse)Author
2023-03-02improve the Nd lines such that the format is consistent for theJason McIntyre
various *d, *conf, *ctl files (where relevant) and simple; also makes "man -k routing" more useful; help from claudio and florian ok claudio florian millert
2022-03-31man pages: add missing commas between subordinate and main clausesChristian Weisgerber
jmc@ dislikes a comma before "then" in a conditional, so leave those untouched. ok jmc@
2021-12-13including sys/cdefs.h manually started as a result of netbsd trying toTheo de Raadt
macro-build a replacement for sccsid, and was done without any concern for namespace damage. Unfortunately this practice started infecting other code as others were unaware they didn't need the file. ok millert guenther
2021-10-24For open/openat, if the flags parameter does not contain O_CREAT, theTheo de Raadt
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-01-17Put the clearing of possible embedded scope in an __KAME__ block.Claudio Jeker
This code does not really need to be optional since for non embedded scope link local addresses this is a NOP. OK jca@
2019-08-06Use pw->pw_dir when chroot'ing, not _PATH_VAREMPTY.Kenneth R Westerback
Brings various dhcp related daemons into line with the common idiom. ok florian@
2018-03-16Consistently spell "IPsec" in comments and debug outputs.Martin Pieuchot
From Raf Czlonka, ok sthen@
2017-07-07Handle carp(4) as HTYPE_ETHER.Reyk Floeter
This fixes "dhcrelay -i carpX" that used to work when dhcrelay didn't care. Reported and tested by Kapetanakis Giannis bilias at edu.physics.uoc.gr
2017-07-05Don't stop logging to stderr when running in foreground with -d.Reyk Floeter
Pointed out by Kapetanakis Giannis
2017-04-19Switch base tools from /dev/bpf0 to /dev/bpf. Now that /dev/bpf has beenMartin Natano
around for two releases, it should be safe to do so. ok bluhm deraadt sthen tb yasuoka
2017-04-05We can enable many -W compiler warnings now.Reyk Floeter
OK rzalamena@
2017-04-05Rework the packet.c code for decoding and assembling DHCP messages.Reyk Floeter
This code suffered from many years of incremental improvements, fix it to: - verify available buffer space in all cases and don't just trust the caller - have an API where you always pass the full buffer length and absolute offset - use consistent types for lengths and buffer offsets (int vs. size_t, ssize_t) - don't just ignore errors, return and fail when something is wrong OK rzalamena@
2017-04-04The unsigned result cannot be -1, turn it into a signed variable.Reyk Floeter
OK rzalamena@
2017-04-04constify pc_remote and pc_circuitReyk Floeter
OK rzalamena@
2017-03-21From a syslog perspective it does not make sense to log fatal andAlexander Bluhm
warn with the same severity. Switch log_warn() to LOG_ERR and keep fatal() at LOG_CRIT. OK reyk@ florian@
2017-03-16Move the server struct to header file and make it compatible with IPv6.Rafael Zalamena
ok reyk@
2017-03-15Improve the interface and addresses discovery code and prepare toRafael Zalamena
receive IPv6 support. ok reyk@
2017-03-14Remove some global variables that are not being used.Rafael Zalamena
ok gsoares@, jca@
2017-02-15Adopt the common verbiage other log.[ch] daemons use to describe '-d'.Kenneth R Westerback
Point out that dhcpd(8) -f is an alias for -d.
2017-02-13Eliminate pointless'%m' (a.k.a. hand rolled strerror()) by using fatal() andKenneth R Westerback
log_warn(). Zap a couple of explicit 'syslog()' calls.
2017-02-13Adjust some long lines.Kenneth R Westerback
2017-02-13Do the strerror() elimination dance with a log_warnx() -> log_warn().Kenneth R Westerback
2017-02-13Banished to the attic.Kenneth R Westerback
2017-02-13Switch from old errwarn.c logging to shiny new log.[ch].Kenneth R Westerback
ok benno@
2016-12-16Add dhcrelay(8) command-line option for replacing Relay Agent InformationRafael Zalamena
on the incoming packets. Man page tweaks from jmc@ ok reyk@
2016-12-13Unbreak the dhcrelay(8) support to run on enc(4) interfaces.Rafael Zalamena
ok reyk@
2016-12-13Unbreak the insertion of Relay Agent Information on layer 3 mode whenRafael Zalamena
using the default values: use the right address for remote-id. ok reyk@
2016-12-13Filter DHCP reply messages that were not meant for us by looking at theRafael Zalamena
gateway set. This happens mostly because we are watching a BPF socket. Suggested by and ok jca@
2016-12-13simplify previous; ok reykJason McIntyre
2016-12-12Implement support for layer 2 relaying and add further Relay AgentRafael Zalamena
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-08Clean up function prototypes: use a single struct to hold all addressRafael Zalamena
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-08Simplify get_interfaces function, make it return NULL if we didn't findRafael Zalamena
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-07DHCP requests can be relayed through multiple relays. Currently wePatrick Wildt
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-07If the BROADCAST flag is set on a BOOTREPLY, the RFC specifies thatPatrick Wildt
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-07pledge(2) dhcrelay with "stdio route". route is needed for interface ioctls.Reyk Floeter
OK rzalamena@
2016-12-07Rename function discover_interfaces into get_interface and change itsRafael Zalamena
prototype to be more useful. ok reyk@
2016-09-26Exit early from rdaemon() is the passed fd is invalid.Jeremie Courreges-Anglas
fd == -1 check suggested by deraadt@, ok florian@
2016-09-15Go in the background later, using rdaemon().Jeremie Courreges-Anglas
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-04Avoid double negations in tests.Jeremie Courreges-Anglas
ok krw@
2016-08-27Pull in <time.h> for one or more of gmtime, strftime, strptime, time,Philip Guenther
timegm, and tzset ok deraadt@
2016-05-28Replace the /dev/bpf* open loop with a plain open("/dev/bpf0", ...).Martin Natano
ok deraadt jca
2016-02-07Eliminate #include inside *.h files and include only needed headers inKenneth R Westerback
each *.c file. Inspired by mention of header silliness by Edgar Pettijohn and mmcc@ on tech@.
2016-02-03be very careful accepting packets via bpf. First check that theKenneth R Westerback
fixed part of the IP header is completely present before using its header length field. Then use the data in the IP header to ensure the entire IP packet is present. Then check that the entire UDP header is present. Then use the data in the UDP header to ensure all the data it thinks is present is actually present. Started when tj@ and a few others noticed ISC "DHCP CVE-2015-8605: UDP payload length not properly checked". ok sthen@ henning@
2016-02-02Variables to count seen packets should be unsigned.Stuart Henderson
From dhcpd/packet.c r1.8 ok jca
2016-02-02Nuke local #define ETHER_HEADER_SIZE and use the identical value'dStuart Henderson
ETHER_HDR_LEN from if_ether.h. From dhcpd packet.c r1.6. ok jca
2016-02-02Remove unused (a.k.a. always passed NULL) parameter 'data' fromStuart Henderson
decode_udp_ip_header() and the useless check of it. Part of original diff from pelikan about udp length errors. From dhcpd: bpf.c r1.9, dhcpd.h r1.46, packet.c r1.5 ok jca
2016-01-13"Check UDP length for short as well as long values" - apply the fix fromStuart Henderson
usr.sbin/dhcpd/packet.c r1.4 to dhcrelay. ok deraadt@
2014-10-25Remove unnecessary netinet/in_systm.h include.Lawrence Teo
ok millert@
2014-07-28merge dhcpd's packet.c revision 1.7:Tobias Stoeckmann
Fix very hard to reach DoS attack vector, which would involve more than 8 billion network packets. Mixture of many many malformed and proper packets could result in a division by zero. ok krw@
2013-07-16use .Mt for email addresses; from Jan Stary <hans at stare dot cz>; ok jmc@Ingo Schwarze